mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 17:37:37 -02:30
Address review comments
This commit is contained in:
@@ -170,7 +170,7 @@ export default ['$scope', 'WorkflowService', 'TemplatesService',
|
|||||||
// This finds the credentials that were selected in the prompt but don't occur
|
// This finds the credentials that were selected in the prompt but don't occur
|
||||||
// in the template defaults
|
// in the template defaults
|
||||||
let credentialsToPost = params.node.promptData.prompts.credentials.value.filter(function (credFromPrompt) {
|
let credentialsToPost = params.node.promptData.prompts.credentials.value.filter(function (credFromPrompt) {
|
||||||
let defaultCreds = params.node.promptData.launchConf.defaults.credentials ? params.node.promptData.launchConf.defaults.credentials : [];
|
let defaultCreds = _.get(params, 'node.promptData.launchConf.defaults.credentials', []);
|
||||||
return !defaultCreds.some(function (defaultCred) {
|
return !defaultCreds.some(function (defaultCred) {
|
||||||
return credFromPrompt.id === defaultCred.id;
|
return credFromPrompt.id === defaultCred.id;
|
||||||
});
|
});
|
||||||
@@ -188,12 +188,14 @@ export default ['$scope', 'WorkflowService', 'TemplatesService',
|
|||||||
|
|
||||||
params.node.isNew = false;
|
params.node.isNew = false;
|
||||||
continueRecursing(data.data.id);
|
continueRecursing(data.data.id);
|
||||||
}, function (error) {
|
}, function ({ data, config, status }) {
|
||||||
ProcessErrors($scope, error.data, error.status, null, {
|
ProcessErrors($scope, data, status, null, {
|
||||||
hdr: 'Error!',
|
hdr: $scope.strings.get('error.HEADER'),
|
||||||
msg: 'Failed to add workflow node. ' +
|
msg: $scope.strings.get('error.CALL', {
|
||||||
'POST returned status: ' +
|
path: `${config.url}`,
|
||||||
error.status
|
action: `${config.method}`,
|
||||||
|
status
|
||||||
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -208,14 +210,14 @@ export default ['$scope', 'WorkflowService', 'TemplatesService',
|
|||||||
|
|
||||||
if (_.get(params, 'node.promptData.launchConf.ask_credential_on_launch')) {
|
if (_.get(params, 'node.promptData.launchConf.ask_credential_on_launch')) {
|
||||||
let credentialsNotInPriorCredentials = params.node.promptData.prompts.credentials.value.filter(function (credFromPrompt) {
|
let credentialsNotInPriorCredentials = params.node.promptData.prompts.credentials.value.filter(function (credFromPrompt) {
|
||||||
let defaultCreds = params.node.promptData.launchConf.defaults.credentials ? params.node.promptData.launchConf.defaults.credentials : [];
|
let defaultCreds = _.get(params, 'node.promptData.launchConf.defaults.credentials', []);
|
||||||
return !defaultCreds.some(function (defaultCred) {
|
return !defaultCreds.some(function (defaultCred) {
|
||||||
return credFromPrompt.id === defaultCred.id;
|
return credFromPrompt.id === defaultCred.id;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
let credentialsToAdd = credentialsNotInPriorCredentials.filter(function (credNotInPrior) {
|
let credentialsToAdd = credentialsNotInPriorCredentials.filter(function (credNotInPrior) {
|
||||||
let previousOverrides = params.node.promptData.prompts.credentials.previousOverrides ? params.node.promptData.prompts.credentials.previousOverrides : [];
|
let previousOverrides = _.get(params, 'node.promptData.prompts.credentials.previousOverrides', []);
|
||||||
return !previousOverrides.some(function (priorCred) {
|
return !previousOverrides.some(function (priorCred) {
|
||||||
return credNotInPrior.id === priorCred.id;
|
return credNotInPrior.id === priorCred.id;
|
||||||
});
|
});
|
||||||
@@ -400,14 +402,9 @@ export default ['$scope', 'WorkflowService', 'TemplatesService',
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$q.all(associatePromises.concat(credentialPromises))
|
return $q.all(associatePromises.concat(credentialPromises))
|
||||||
.then(function () {
|
.then(function () {
|
||||||
$scope.closeDialog();
|
$scope.closeDialog();
|
||||||
}).catch(({
|
|
||||||
data,
|
|
||||||
status
|
|
||||||
}) => {
|
|
||||||
ProcessErrors($scope, data, status, null, {});
|
|
||||||
});
|
});
|
||||||
}).catch(({
|
}).catch(({
|
||||||
data,
|
data,
|
||||||
@@ -855,12 +852,15 @@ export default ['$scope', 'WorkflowService', 'TemplatesService',
|
|||||||
.then(function (data) {
|
.then(function (data) {
|
||||||
$scope.nodeBeingEdited.unifiedJobTemplate = _.clone(data.data.results[0]);
|
$scope.nodeBeingEdited.unifiedJobTemplate = _.clone(data.data.results[0]);
|
||||||
finishConfiguringEdit();
|
finishConfiguringEdit();
|
||||||
}, function (error) {
|
}, function ({ data, status, config }) {
|
||||||
ProcessErrors($scope, error.data, error.status, null, {
|
ProcessErrors($scope, data, status, null, {
|
||||||
hdr: 'Error!',
|
hdr: $scope.strings.get('error.HEADER'),
|
||||||
msg: 'Failed to get unified job template. GET returned ' +
|
msg: $scope.strings.get('error.CALL', {
|
||||||
'status: ' + error.status
|
path: `${config.url}`,
|
||||||
});
|
action: `${config.method}`,
|
||||||
|
status
|
||||||
|
})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
finishConfiguringEdit();
|
finishConfiguringEdit();
|
||||||
@@ -1156,11 +1156,14 @@ export default ['$scope', 'WorkflowService', 'TemplatesService',
|
|||||||
// This is the last page
|
// This is the last page
|
||||||
buildTreeFromNodes();
|
buildTreeFromNodes();
|
||||||
}
|
}
|
||||||
}, function (error) {
|
}, function ({ data, status, config }) {
|
||||||
ProcessErrors($scope, error.data, error.status, null, {
|
ProcessErrors($scope, data, status, null, {
|
||||||
hdr: 'Error!',
|
hdr: $scope.strings.get('error.HEADER'),
|
||||||
msg: 'Failed to get workflow job template nodes. GET returned ' +
|
msg: $scope.strings.get('error.CALL', {
|
||||||
'status: ' + error.status
|
path: `${config.url}`,
|
||||||
|
action: `${config.method}`,
|
||||||
|
status
|
||||||
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user