From fe31f54778a11083c61157ce23f0472450bde731 Mon Sep 17 00:00:00 2001 From: Haokun-Chen Date: Mon, 18 Jun 2018 16:48:41 -0400 Subject: [PATCH] delete empty inputs fields to clear error on credential form --- .../client/features/credentials/add-credentials.controller.js | 3 +++ .../client/features/credentials/edit-credentials.controller.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/awx/ui/client/features/credentials/add-credentials.controller.js b/awx/ui/client/features/credentials/add-credentials.controller.js index d0bb961763..e0b575bf2d 100644 --- a/awx/ui/client/features/credentials/add-credentials.controller.js +++ b/awx/ui/client/features/credentials/add-credentials.controller.js @@ -62,6 +62,9 @@ function AddCredentialsController (models, $state, $scope, strings, componentsSt delete data.inputs[gceFileInputSchema.id]; } + const filteredInputs = _.omit(data.inputs, (value) => value === ''); + data.inputs = filteredInputs; + return credential.request('post', { data }); }; diff --git a/awx/ui/client/features/credentials/edit-credentials.controller.js b/awx/ui/client/features/credentials/edit-credentials.controller.js index 3066034f7b..81b6ebe5fb 100644 --- a/awx/ui/client/features/credentials/edit-credentials.controller.js +++ b/awx/ui/client/features/credentials/edit-credentials.controller.js @@ -113,6 +113,9 @@ function EditCredentialsController (models, $state, $scope, strings, componentsS delete data.inputs[gceFileInputSchema.id]; } + const filteredInputs = _.omit(data.inputs, (value) => value === ''); + data.inputs = filteredInputs; + return credential.request('put', { data }); };