mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 09:27:36 -02:30
Fix field enablement on workflow form
This commit is contained in:
@@ -42,14 +42,14 @@ export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) {
|
|||||||
label: i18n._('Name'),
|
label: i18n._('Name'),
|
||||||
type: 'text',
|
type: 'text',
|
||||||
required: true,
|
required: true,
|
||||||
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)',
|
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddOrEdit)',
|
||||||
column: 1
|
column: 1
|
||||||
},
|
},
|
||||||
description: {
|
description: {
|
||||||
label: i18n._('Description'),
|
label: i18n._('Description'),
|
||||||
type: 'text',
|
type: 'text',
|
||||||
column: 1,
|
column: 1,
|
||||||
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)'
|
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddOrEdit)'
|
||||||
},
|
},
|
||||||
organization: {
|
organization: {
|
||||||
label: i18n._('Organization'),
|
label: i18n._('Organization'),
|
||||||
@@ -65,8 +65,8 @@ export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) {
|
|||||||
reqExpression: '!current_user.is_superuser'
|
reqExpression: '!current_user.is_superuser'
|
||||||
},
|
},
|
||||||
column: 1,
|
column: 1,
|
||||||
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate) || !canEditOrg',
|
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddOrEdit) || !canEditOrg',
|
||||||
awLookupWhen: '(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate) && canEditOrg'
|
awLookupWhen: '(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddOrEdit) && canEditOrg'
|
||||||
},
|
},
|
||||||
inventory: {
|
inventory: {
|
||||||
label: i18n._('Inventory'),
|
label: i18n._('Inventory'),
|
||||||
@@ -87,7 +87,7 @@ export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) {
|
|||||||
ngChange: 'workflow_job_template_form.inventory_name.$validate()',
|
ngChange: 'workflow_job_template_form.inventory_name.$validate()',
|
||||||
text: i18n._('Prompt on launch')
|
text: i18n._('Prompt on launch')
|
||||||
},
|
},
|
||||||
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate) || !canEditInventory',
|
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddOrEdit) || !canEditInventory',
|
||||||
},
|
},
|
||||||
labels: {
|
labels: {
|
||||||
label: i18n._('Labels'),
|
label: i18n._('Labels'),
|
||||||
@@ -102,7 +102,7 @@ export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) {
|
|||||||
ngShow: 'workflow_job_template_labels_isValid !== true',
|
ngShow: 'workflow_job_template_labels_isValid !== true',
|
||||||
text: i18n._('Max 512 characters per label.'),
|
text: i18n._('Max 512 characters per label.'),
|
||||||
},
|
},
|
||||||
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)'
|
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddOrEdit)'
|
||||||
},
|
},
|
||||||
variables: {
|
variables: {
|
||||||
label: i18n._('Extra Variables'),
|
label: i18n._('Extra Variables'),
|
||||||
@@ -119,7 +119,7 @@ export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) {
|
|||||||
variable: 'ask_variables_on_launch',
|
variable: 'ask_variables_on_launch',
|
||||||
text: i18n._('Prompt on launch')
|
text: i18n._('Prompt on launch')
|
||||||
},
|
},
|
||||||
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)' // TODO: get working
|
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddOrEdit)' // TODO: get working
|
||||||
},
|
},
|
||||||
checkbox_group: {
|
checkbox_group: {
|
||||||
label: i18n._('Options'),
|
label: i18n._('Options'),
|
||||||
@@ -133,7 +133,7 @@ export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) {
|
|||||||
dataPlacement: 'right',
|
dataPlacement: 'right',
|
||||||
dataTitle: i18n._('Enable Concurrent Jobs'),
|
dataTitle: i18n._('Enable Concurrent Jobs'),
|
||||||
dataContainer: "body",
|
dataContainer: "body",
|
||||||
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)'
|
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddOrEdit)'
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -142,22 +142,22 @@ export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) {
|
|||||||
launch: {
|
launch: {
|
||||||
component: 'at-launch-template',
|
component: 'at-launch-template',
|
||||||
templateObj: 'workflow_job_template_obj',
|
templateObj: 'workflow_job_template_obj',
|
||||||
ngShow: '(workflow_job_template_obj.summary_fields.user_capabilities.start || canAddWorkflowJobTemplate)',
|
ngShow: '(workflow_job_template_obj.summary_fields.user_capabilities.start || canAddOrEdit)',
|
||||||
ngDisabled: 'disableLaunch || workflow_job_template_form.$dirty',
|
ngDisabled: 'disableLaunch || workflow_job_template_form.$dirty',
|
||||||
showTextButton: 'true'
|
showTextButton: 'true'
|
||||||
},
|
},
|
||||||
cancel: {
|
cancel: {
|
||||||
ngClick: 'formCancel()',
|
ngClick: 'formCancel()',
|
||||||
ngShow: '(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)'
|
ngShow: '(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddOrEdit)'
|
||||||
},
|
},
|
||||||
close: {
|
close: {
|
||||||
ngClick: 'formCancel()',
|
ngClick: 'formCancel()',
|
||||||
ngShow: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)'
|
ngShow: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddOrEdit)'
|
||||||
},
|
},
|
||||||
save: {
|
save: {
|
||||||
ngClick: 'formSave()', //$scope.function to call on click, optional
|
ngClick: 'formSave()', //$scope.function to call on click, optional
|
||||||
ngDisabled: "workflow_job_template_form.$invalid || can_edit!==true", //Disable when $pristine or $invalid, optional and when can_edit = false, for permission reasons
|
ngDisabled: "workflow_job_template_form.$invalid || can_edit!==true", //Disable when $pristine or $invalid, optional and when can_edit = false, for permission reasons
|
||||||
ngShow: '(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)'
|
ngShow: '(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddOrEdit)'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) {
|
|||||||
awToolTip: i18n._('Add a permission'),
|
awToolTip: i18n._('Add a permission'),
|
||||||
actionClass: 'at-Button--add',
|
actionClass: 'at-Button--add',
|
||||||
actionId: 'button-add',
|
actionId: 'button-add',
|
||||||
ngShow: '(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)'
|
ngShow: '(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddOrEdit)'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -226,7 +226,7 @@ export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) {
|
|||||||
relatedButtons: {
|
relatedButtons: {
|
||||||
view_survey: {
|
view_survey: {
|
||||||
ngClick: 'editSurvey()',
|
ngClick: 'editSurvey()',
|
||||||
ngShow: '($state.is(\'templates.addWorkflowJobTemplate\') || $state.is(\'templates.editWorkflowJobTemplate\') || $state.is(\'templates.editWorkflowJobTemplate.workflowMaker\')) && survey_exists && !(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)',
|
ngShow: '($state.is(\'templates.addWorkflowJobTemplate\') || $state.is(\'templates.editWorkflowJobTemplate\') || $state.is(\'templates.editWorkflowJobTemplate.workflowMaker\')) && survey_exists && !(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddOrEdit)',
|
||||||
label: i18n._('View Survey'),
|
label: i18n._('View Survey'),
|
||||||
class: 'Form-primaryButton'
|
class: 'Form-primaryButton'
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export default [
|
|||||||
|
|
||||||
const workflowTemplate = resolvedModels[1];
|
const workflowTemplate = resolvedModels[1];
|
||||||
|
|
||||||
$scope.canAddOrEdit = workflowTemplate.options('actions.POST');
|
$scope.canAddOrEdit = workflowTemplate.options('actions.POST') ? true : false;
|
||||||
|
|
||||||
$scope.canEditOrg = true;
|
$scope.canEditOrg = true;
|
||||||
$scope.canEditInventory = true;
|
$scope.canEditInventory = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user