mirror of
https://github.com/ansible/awx.git
synced 2026-03-19 09:57:33 -02:30
Merge pull request #6268 from marshmalien/rmUIScanJobs
Remove UI Scan Jobs Logic from JT Add/Edit
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<section class="SystemTrackingContainer Panel" ng-if="noModuleData">
|
<section class="SystemTrackingContainer Panel" ng-if="noModuleData">
|
||||||
<section class="FactDataError SystemTrackingContainer-main">
|
<section class="FactDataError SystemTrackingContainer-main">
|
||||||
<p class="FactDataError-note--full">
|
<p class="FactDataError-note--full">
|
||||||
To set up scan jobs, create a <a ui-sref="inventoryJobTemplateAdd({inventory_id: inventory.id})">job template</a> of type 'scan' that targets the "<a ui-sref="inventories.edit({inventory_id: inventory.id})">{{inventory.name}}</a>" inventory.
|
To set up scan jobs, create a <a ui-sref="inventoryJobTemplateAdd({inventory_id: inventory.id})">job template</a> that targets the "<a ui-sref="inventories.edit({inventory_id: inventory.id})">{{inventory.name}}</a>" inventory and check "Store Ansible Facts."
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
The two fact scans were identical for this module.
|
The two fact scans were identical for this module.
|
||||||
</p>
|
</p>
|
||||||
<p class="FactDataError-note" ng-switch-default>
|
<p class="FactDataError-note" ng-switch-default>
|
||||||
We were not able to find any facts collected for this inventory or module. To setup or run scan jobs, edit the "<a link-to="inventoryEdit" model="{ inventory_id: inventory }">{{inventory.name}}</a>" inventory and select "Scan Job Templates."
|
We were not able to find any facts collected for this inventory or module. To setup or run scan jobs, edit the "<a link-to="inventoryEdit" model="{ inventory_id: inventory }">{{inventory.name}}</a>" inventory and check "Store Ansible Facts."
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
<fact-data-table ng-if="!error" left-hostname="leftHostname" right-hostname="rightHostname" left-scan-date="leftScanDate" right-scan-date="rightScanDate" left-data-no-scans="leftDataNoScans" right-data-no-scans="rightDataNoScans" is-nested-display="isNestedDisplay"
|
<fact-data-table ng-if="!error" left-hostname="leftHostname" right-hostname="rightHostname" left-scan-date="leftScanDate" right-scan-date="rightScanDate" left-data-no-scans="leftDataNoScans" right-data-no-scans="rightDataNoScans" is-nested-display="isNestedDisplay"
|
||||||
|
|||||||
@@ -55,15 +55,12 @@ function(NotificationsList, CompletedJobsList, i18n) {
|
|||||||
" on the selected hosts."), "<em>run</em>") + "</p> <p>" +
|
" on the selected hosts."), "<em>run</em>") + "</p> <p>" +
|
||||||
i18n.sprintf(i18n._("Setting the type to %s will not execute the playbook."), "<em>check</em>") + " " +
|
i18n.sprintf(i18n._("Setting the type to %s will not execute the playbook."), "<em>check</em>") + " " +
|
||||||
i18n.sprintf(i18n._("Instead, %s will check playbook " +
|
i18n.sprintf(i18n._("Instead, %s will check playbook " +
|
||||||
" syntax, test environment setup and report problems."), "<code>ansible</code>") + "</p> <p>" +
|
" syntax, test environment setup and report problems."), "<code>ansible</code>") + "</p>",
|
||||||
i18n.sprintf(i18n._("Setting the type to %s will execute the playbook and store any " +
|
|
||||||
" scanned facts for use with Tower's System Tracking feature."), "<em>scan</em>") + "</p>",
|
|
||||||
dataTitle: i18n._('Job Type'),
|
dataTitle: i18n._('Job Type'),
|
||||||
dataPlacement: 'right',
|
dataPlacement: 'right',
|
||||||
dataContainer: "body",
|
dataContainer: "body",
|
||||||
subCheckbox: {
|
subCheckbox: {
|
||||||
variable: 'ask_job_type_on_launch',
|
variable: 'ask_job_type_on_launch',
|
||||||
ngShow: "!job_type.value || job_type.value !== 'scan'",
|
|
||||||
text: i18n._('Prompt on launch'),
|
text: i18n._('Prompt on launch'),
|
||||||
ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)'
|
ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)'
|
||||||
},
|
},
|
||||||
@@ -90,7 +87,6 @@ function(NotificationsList, CompletedJobsList, i18n) {
|
|||||||
subCheckbox: {
|
subCheckbox: {
|
||||||
variable: 'ask_inventory_on_launch',
|
variable: 'ask_inventory_on_launch',
|
||||||
ngChange: 'job_template_form.inventory_name.$validate()',
|
ngChange: 'job_template_form.inventory_name.$validate()',
|
||||||
ngShow: "!job_type.value || job_type.value !== 'scan'",
|
|
||||||
text: i18n._('Prompt on launch')
|
text: i18n._('Prompt on launch')
|
||||||
},
|
},
|
||||||
ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)'
|
ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)'
|
||||||
@@ -100,7 +96,6 @@ function(NotificationsList, CompletedJobsList, i18n) {
|
|||||||
labelAction: {
|
labelAction: {
|
||||||
label: i18n._('RESET'),
|
label: i18n._('RESET'),
|
||||||
ngClick: 'resetProjectToDefault()',
|
ngClick: 'resetProjectToDefault()',
|
||||||
'class': "{{!(job_type.value === 'scan' && project_name !== 'Default') ? 'hidden' : ''}}",
|
|
||||||
},
|
},
|
||||||
type: 'lookup',
|
type: 'lookup',
|
||||||
list: 'ProjectList',
|
list: 'ProjectList',
|
||||||
@@ -122,7 +117,7 @@ function(NotificationsList, CompletedJobsList, i18n) {
|
|||||||
label: i18n._('Playbook'),
|
label: i18n._('Playbook'),
|
||||||
type:'select',
|
type:'select',
|
||||||
ngOptions: 'book for book in playbook_options track by book',
|
ngOptions: 'book for book in playbook_options track by book',
|
||||||
ngDisabled: "(job_type.value === 'scan' && project_name === 'Default') || !(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate) || disablePlaybookBecausePermissionDenied",
|
ngDisabled: "!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate) || disablePlaybookBecausePermissionDenied",
|
||||||
id: 'playbook-select',
|
id: 'playbook-select',
|
||||||
awRequiredWhen: {
|
awRequiredWhen: {
|
||||||
reqExpression: "playbookrequired",
|
reqExpression: "playbookrequired",
|
||||||
@@ -477,13 +472,13 @@ function(NotificationsList, CompletedJobsList, i18n) {
|
|||||||
view_survey: {
|
view_survey: {
|
||||||
ngClick: 'editSurvey()',
|
ngClick: 'editSurvey()',
|
||||||
awFeature: 'surveys',
|
awFeature: 'surveys',
|
||||||
ngShow: '($state.is(\'templates.addJobTemplate\') || $state.is(\'templates.editJobTemplate\')) && job_type.value !== "scan" && survey_exists && !(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)',
|
ngShow: '($state.is(\'templates.addJobTemplate\') || $state.is(\'templates.editJobTemplate\')) && survey_exists && !(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)',
|
||||||
label: i18n._('View Survey'),
|
label: i18n._('View Survey'),
|
||||||
class: 'Form-primaryButton'
|
class: 'Form-primaryButton'
|
||||||
},
|
},
|
||||||
add_survey: {
|
add_survey: {
|
||||||
ngClick: 'addSurvey()',
|
ngClick: 'addSurvey()',
|
||||||
ngShow: '($state.is(\'templates.addJobTemplate\') || $state.is(\'templates.editJobTemplate\')) && job_type.value !== "scan" && !survey_exists && (job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)',
|
ngShow: '($state.is(\'templates.addJobTemplate\') || $state.is(\'templates.editJobTemplate\')) && !survey_exists && (job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)',
|
||||||
awFeature: 'surveys',
|
awFeature: 'surveys',
|
||||||
awToolTip: 'Surveys allow users to be prompted at job launch with a series of questions related to the job. This allows for variables to be defined that affect the playbook run at time of launch.',
|
awToolTip: 'Surveys allow users to be prompted at job launch with a series of questions related to the job. This allows for variables to be defined that affect the playbook run at time of launch.',
|
||||||
dataPlacement: 'top',
|
dataPlacement: 'top',
|
||||||
@@ -493,7 +488,7 @@ function(NotificationsList, CompletedJobsList, i18n) {
|
|||||||
edit_survey: {
|
edit_survey: {
|
||||||
ngClick: 'editSurvey()',
|
ngClick: 'editSurvey()',
|
||||||
awFeature: 'surveys',
|
awFeature: 'surveys',
|
||||||
ngShow: '($state.is(\'templates.addJobTemplate\') || $state.is(\'templates.editJobTemplate\')) && job_type.value !== "scan" && survey_exists && (job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)',
|
ngShow: '($state.is(\'templates.addJobTemplate\') || $state.is(\'templates.editJobTemplate\')) && survey_exists && (job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)',
|
||||||
label: i18n._('Edit Survey'),
|
label: i18n._('Edit Survey'),
|
||||||
class: 'Form-primaryButton'
|
class: 'Form-primaryButton'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,13 +144,7 @@
|
|||||||
// Update playbook select whenever project value changes
|
// Update playbook select whenever project value changes
|
||||||
selectPlaybook = function (oldValue, newValue) {
|
selectPlaybook = function (oldValue, newValue) {
|
||||||
var url;
|
var url;
|
||||||
if($scope.job_type.value === 'scan' && $scope.project_name === "Default"){
|
if (oldValue !== newValue) {
|
||||||
$scope.playbook_options = ['Default'];
|
|
||||||
$scope.playbook = 'Default';
|
|
||||||
sync_playbook_select2();
|
|
||||||
Wait('stop');
|
|
||||||
}
|
|
||||||
else if (oldValue !== newValue) {
|
|
||||||
if ($scope.project) {
|
if ($scope.project) {
|
||||||
Wait('start');
|
Wait('start');
|
||||||
url = GetBasePath('projects') + $scope.project + '/playbooks/';
|
url = GetBasePath('projects') + $scope.project + '/playbooks/';
|
||||||
@@ -173,30 +167,7 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let last_non_scan_project_name = null;
|
|
||||||
let last_non_scan_playbook = "";
|
|
||||||
let last_non_scan_playbook_options = [];
|
|
||||||
$scope.jobTypeChange = function() {
|
$scope.jobTypeChange = function() {
|
||||||
if ($scope.job_type) {
|
|
||||||
if ($scope.job_type.value === 'scan') {
|
|
||||||
if ($scope.project_name !== "Default") {
|
|
||||||
last_non_scan_project_name = $scope.project_name;
|
|
||||||
last_non_scan_playbook = $scope.playbook;
|
|
||||||
last_non_scan_playbook_options = $scope.playbook_options;
|
|
||||||
}
|
|
||||||
// If the job_type is 'scan' then we don't want the user to be
|
|
||||||
// able to prompt for job type or inventory
|
|
||||||
$scope.ask_job_type_on_launch = false;
|
|
||||||
$scope.ask_inventory_on_launch = false;
|
|
||||||
$scope.resetProjectToDefault();
|
|
||||||
}
|
|
||||||
else if ($scope.project_name === "Default") {
|
|
||||||
$scope.project_name = last_non_scan_project_name;
|
|
||||||
$scope.playbook_options = last_non_scan_playbook_options;
|
|
||||||
$scope.playbook = last_non_scan_playbook;
|
|
||||||
$scope.job_template_form.playbook.$setPristine();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sync_playbook_select2();
|
sync_playbook_select2();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -395,14 +366,9 @@
|
|||||||
var fld, data = {};
|
var fld, data = {};
|
||||||
$scope.invalid_survey = false;
|
$scope.invalid_survey = false;
|
||||||
|
|
||||||
// users can't save a survey with a scan job
|
|
||||||
if($scope.job_type.value === "scan" &&
|
|
||||||
$scope.survey_enabled === true){
|
|
||||||
$scope.survey_enabled = false;
|
|
||||||
}
|
|
||||||
// Can't have a survey enabled without a survey
|
// Can't have a survey enabled without a survey
|
||||||
if($scope.survey_enabled === true &&
|
if($scope.survey_enabled === true &&
|
||||||
$scope.survey_exists!==true){
|
$scope.survey_exists !== true){
|
||||||
$scope.survey_enabled = false;
|
$scope.survey_enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,11 +406,7 @@
|
|||||||
|
|
||||||
data.extra_vars = ToJSON($scope.parseType,
|
data.extra_vars = ToJSON($scope.parseType,
|
||||||
$scope.variables, true);
|
$scope.variables, true);
|
||||||
if(data.job_type === 'scan' &&
|
|
||||||
$scope.default_scan === true){
|
|
||||||
data.project = "";
|
|
||||||
data.playbook = "";
|
|
||||||
}
|
|
||||||
// We only want to set the survey_enabled flag to
|
// We only want to set the survey_enabled flag to
|
||||||
// true for this job template if a survey exists
|
// true for this job template if a survey exists
|
||||||
// and it's been enabled. By default,
|
// and it's been enabled. By default,
|
||||||
|
|||||||
@@ -86,13 +86,7 @@ export default
|
|||||||
$scope.playbook_options = [$scope.playbook];
|
$scope.playbook_options = [$scope.playbook];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($scope.job_type.value === 'scan' && $scope.project_name === "Default"){
|
if (!Empty(project)) {
|
||||||
$scope.playbook_options = ['Default'];
|
|
||||||
$scope.playbook = 'Default';
|
|
||||||
sync_playbook_select2();
|
|
||||||
Wait('stop');
|
|
||||||
}
|
|
||||||
else if (!Empty(project)) {
|
|
||||||
url = GetBasePath('projects') + project + '/playbooks/';
|
url = GetBasePath('projects') + project + '/playbooks/';
|
||||||
Wait('start');
|
Wait('start');
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
@@ -132,30 +126,7 @@ export default
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let last_non_scan_project_name = null;
|
|
||||||
let last_non_scan_playbook = "";
|
|
||||||
let last_non_scan_playbook_options = [];
|
|
||||||
$scope.jobTypeChange = function() {
|
$scope.jobTypeChange = function() {
|
||||||
if ($scope.job_type) {
|
|
||||||
if ($scope.job_type.value === 'scan') {
|
|
||||||
if ($scope.project_name !== "Default") {
|
|
||||||
last_non_scan_project_name = $scope.project_name;
|
|
||||||
last_non_scan_playbook = $scope.playbook;
|
|
||||||
last_non_scan_playbook_options = $scope.playbook_options;
|
|
||||||
}
|
|
||||||
// If the job_type is 'scan' then we don't want the user to be
|
|
||||||
// able to prompt for job type or inventory
|
|
||||||
$scope.ask_job_type_on_launch = false;
|
|
||||||
$scope.ask_inventory_on_launch = false;
|
|
||||||
$scope.resetProjectToDefault();
|
|
||||||
}
|
|
||||||
else if ($scope.project_name === "Default") {
|
|
||||||
$scope.project_name = last_non_scan_project_name;
|
|
||||||
$scope.playbook_options = last_non_scan_playbook_options;
|
|
||||||
$scope.playbook = last_non_scan_playbook;
|
|
||||||
$scope.job_template_form.playbook.$setPristine();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sync_playbook_select2();
|
sync_playbook_select2();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -529,12 +500,7 @@ export default
|
|||||||
$scope.formSave = function () {
|
$scope.formSave = function () {
|
||||||
var fld, data = {};
|
var fld, data = {};
|
||||||
$scope.invalid_survey = false;
|
$scope.invalid_survey = false;
|
||||||
|
|
||||||
// users can't save a survey with a scan job
|
|
||||||
if($scope.job_type.value === "scan" &&
|
|
||||||
$scope.survey_enabled === true){
|
|
||||||
$scope.survey_enabled = false;
|
|
||||||
}
|
|
||||||
// Can't have a survey enabled without a survey
|
// Can't have a survey enabled without a survey
|
||||||
if($scope.survey_enabled === true &&
|
if($scope.survey_enabled === true &&
|
||||||
$scope.survey_exists!==true){
|
$scope.survey_exists!==true){
|
||||||
@@ -575,11 +541,7 @@ export default
|
|||||||
|
|
||||||
data.extra_vars = ToJSON($scope.parseType,
|
data.extra_vars = ToJSON($scope.parseType,
|
||||||
$scope.variables, true);
|
$scope.variables, true);
|
||||||
if(data.job_type === 'scan' &&
|
|
||||||
$scope.default_scan === true){
|
|
||||||
data.project = "";
|
|
||||||
data.playbook = "";
|
|
||||||
}
|
|
||||||
// We only want to set the survey_enabled flag to
|
// We only want to set the survey_enabled flag to
|
||||||
// true for this job template if a survey exists
|
// true for this job template if a survey exists
|
||||||
// and it's been enabled. By default,
|
// and it's been enabled. By default,
|
||||||
|
|||||||
@@ -133,10 +133,6 @@ export default
|
|||||||
|
|
||||||
scope.can_edit = data.summary_fields.user_capabilities.edit;
|
scope.can_edit = data.summary_fields.user_capabilities.edit;
|
||||||
|
|
||||||
if (scope.job_type.value === "scan" && (!scope.project || scope.project === "") && (!scope.playbook || scope.playbook === "")) {
|
|
||||||
scope.resetProjectToDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
scope.$emit('jobTemplateLoaded', data.related.cloud_credential, master);
|
scope.$emit('jobTemplateLoaded', data.related.cloud_credential, master);
|
||||||
})
|
})
|
||||||
.error(function (data, status) {
|
.error(function (data, status) {
|
||||||
|
|||||||
Reference in New Issue
Block a user