Merge pull request #6268 from marshmalien/rmUIScanJobs

Remove UI Scan Jobs Logic from JT Add/Edit
This commit is contained in:
Marliana Lara 2017-06-07 14:40:17 -04:00 committed by GitHub
commit d323a01f5e
5 changed files with 13 additions and 98 deletions

View File

@ -1,7 +1,7 @@
<section class="SystemTrackingContainer Panel" ng-if="noModuleData">
<section class="FactDataError SystemTrackingContainer-main">
<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>
</section>
</section>
@ -57,7 +57,7 @@
The two fact scans were identical for this module.
</p>
<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>
</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"

View File

@ -55,15 +55,12 @@ function(NotificationsList, CompletedJobsList, i18n) {
" 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._("Instead, %s will check playbook " +
" syntax, test environment setup and report problems."), "<code>ansible</code>") + "</p> <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>",
" syntax, test environment setup and report problems."), "<code>ansible</code>") + "</p>",
dataTitle: i18n._('Job Type'),
dataPlacement: 'right',
dataContainer: "body",
subCheckbox: {
variable: 'ask_job_type_on_launch',
ngShow: "!job_type.value || job_type.value !== 'scan'",
text: i18n._('Prompt on launch'),
ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)'
},
@ -90,7 +87,6 @@ function(NotificationsList, CompletedJobsList, i18n) {
subCheckbox: {
variable: 'ask_inventory_on_launch',
ngChange: 'job_template_form.inventory_name.$validate()',
ngShow: "!job_type.value || job_type.value !== 'scan'",
text: i18n._('Prompt on launch')
},
ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)'
@ -100,7 +96,6 @@ function(NotificationsList, CompletedJobsList, i18n) {
labelAction: {
label: i18n._('RESET'),
ngClick: 'resetProjectToDefault()',
'class': "{{!(job_type.value === 'scan' && project_name !== 'Default') ? 'hidden' : ''}}",
},
type: 'lookup',
list: 'ProjectList',
@ -122,7 +117,7 @@ function(NotificationsList, CompletedJobsList, i18n) {
label: i18n._('Playbook'),
type:'select',
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',
awRequiredWhen: {
reqExpression: "playbookrequired",
@ -477,13 +472,13 @@ function(NotificationsList, CompletedJobsList, i18n) {
view_survey: {
ngClick: 'editSurvey()',
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'),
class: 'Form-primaryButton'
},
add_survey: {
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',
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',
@ -493,7 +488,7 @@ function(NotificationsList, CompletedJobsList, i18n) {
edit_survey: {
ngClick: 'editSurvey()',
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'),
class: 'Form-primaryButton'
}

View File

@ -144,13 +144,7 @@
// Update playbook select whenever project value changes
selectPlaybook = function (oldValue, newValue) {
var url;
if($scope.job_type.value === 'scan' && $scope.project_name === "Default"){
$scope.playbook_options = ['Default'];
$scope.playbook = 'Default';
sync_playbook_select2();
Wait('stop');
}
else if (oldValue !== newValue) {
if (oldValue !== newValue) {
if ($scope.project) {
Wait('start');
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() {
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();
};
@ -395,14 +366,9 @@
var fld, data = {};
$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
if($scope.survey_enabled === true &&
$scope.survey_exists!==true){
$scope.survey_exists !== true){
$scope.survey_enabled = false;
}
@ -440,11 +406,7 @@
data.extra_vars = ToJSON($scope.parseType,
$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
// true for this job template if a survey exists
// and it's been enabled. By default,

View File

@ -86,13 +86,7 @@ export default
$scope.playbook_options = [$scope.playbook];
}
if($scope.job_type.value === 'scan' && $scope.project_name === "Default"){
$scope.playbook_options = ['Default'];
$scope.playbook = 'Default';
sync_playbook_select2();
Wait('stop');
}
else if (!Empty(project)) {
if (!Empty(project)) {
url = GetBasePath('projects') + project + '/playbooks/';
Wait('start');
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() {
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();
};
@ -529,12 +500,7 @@ export default
$scope.formSave = function () {
var fld, data = {};
$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
if($scope.survey_enabled === true &&
$scope.survey_exists!==true){
@ -575,11 +541,7 @@ export default
data.extra_vars = ToJSON($scope.parseType,
$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
// true for this job template if a survey exists
// and it's been enabled. By default,

View File

@ -133,10 +133,6 @@ export default
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);
})
.error(function (data, status) {