1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 09:51:09 +03:00

Fixed bug where job/workflow templates add forms were fully disabled for users with add access

This commit is contained in:
mabashian 2018-04-05 13:34:16 -04:00
parent 442c209899
commit 78893590d1
2 changed files with 60 additions and 57 deletions

View File

@ -10,14 +10,14 @@
'ProcessErrors', 'GetBasePath', 'md5Setup', 'ParseTypeChange', 'Wait',
'Empty', 'ToJSON', 'CallbackHelpInit', 'GetChoices', '$state', 'availableLabels',
'CreateSelect2', '$q', 'i18n', 'Inventory', 'Project', 'InstanceGroupsService',
'MultiCredentialService', 'ConfigData',
'MultiCredentialService', 'ConfigData', 'resolvedModels',
function(
$filter, $scope,
$stateParams, JobTemplateForm, GenerateForm, Rest, Alert,
ProcessErrors, GetBasePath, md5Setup, ParseTypeChange, Wait,
Empty, ToJSON, CallbackHelpInit, GetChoices,
$state, availableLabels, CreateSelect2, $q, i18n, Inventory, Project, InstanceGroupsService,
MultiCredentialService, ConfigData
MultiCredentialService, ConfigData, resolvedModels
) {
// Inject dynamic view
@ -28,8 +28,10 @@
selectPlaybook, checkSCMStatus,
callback;
init();
function init(){
const jobTemplate = resolvedModels[0];
$scope.canAddJobTemplate = jobTemplate.options('actions.POST');
// apply form definition's default field values
GenerateForm.applyDefaults(form, $scope);
@ -58,7 +60,6 @@
selectedCredentials: []
};
});
}
callback = function() {
// Make sure the form controller knows there was a change

View File

@ -8,15 +8,20 @@ export default [
'$scope', 'WorkflowForm', 'GenerateForm', 'Alert', 'ProcessErrors',
'Wait', '$state', 'CreateSelect2', 'TemplatesService',
'ToJSON', 'ParseTypeChange', '$q', 'Rest', 'GetBasePath', 'availableLabels', 'i18n',
'resolvedModels',
function($scope, WorkflowForm, GenerateForm, Alert, ProcessErrors,
Wait, $state, CreateSelect2, TemplatesService, ToJSON,
ParseTypeChange, $q, Rest, GetBasePath, availableLabels, i18n) {
ParseTypeChange, $q, Rest, GetBasePath, availableLabels, i18n,
resolvedModels) {
// Inject dynamic view
let form = WorkflowForm(),
generator = GenerateForm;
function init() {
const workflowTemplate = resolvedModels[1];
$scope.canAddWorkflowJobTemplate = workflowTemplate.options('actions.POST');
$scope.canEditOrg = true;
$scope.parseType = 'yaml';
$scope.can_edit = true;
@ -44,7 +49,6 @@ export default [
$scope.workflowEditorTooltip = i18n._("Please save before defining the workflow graph.");
$scope.surveyTooltip = i18n._('Please save before adding a survey to this workflow.');
}
$scope.formSave = function () {
let fld, data = {};
@ -167,7 +171,5 @@ export default [
$scope.formCancel = function () {
$state.transitionTo('templates');
};
init();
}
];