From 59aeec5705c90efa140b380fceaa8eca445d426b Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Thu, 10 Nov 2016 11:14:08 -0500 Subject: [PATCH] Small fixes based on PR review feedback --- awx/ui/client/legacy-styles/lists.less | 1 - awx/ui/client/src/app.js | 1 - awx/ui/client/src/forms.js | 2 - awx/ui/client/src/forms/Jobs.js | 118 ------------------ awx/ui/client/src/forms/WorkflowMaker.js | 18 +-- awx/ui/client/src/forms/Workflows.js | 6 - awx/ui/client/src/helpers/teams.js | 61 --------- awx/ui/client/src/i18n.js | 9 +- .../add-workflow/workflow-add.controller.js | 20 +-- .../copy/job-templates-copy.controller.js | 5 +- 10 files changed, 22 insertions(+), 219 deletions(-) delete mode 100644 awx/ui/client/src/forms/Jobs.js diff --git a/awx/ui/client/legacy-styles/lists.less b/awx/ui/client/legacy-styles/lists.less index 3081725e69..ee69342e0f 100644 --- a/awx/ui/client/legacy-styles/lists.less +++ b/awx/ui/client/legacy-styles/lists.less @@ -379,7 +379,6 @@ table, tbody { height: 0; vertical-align: middle; border-top: 4px dashed; - border-top: 4px solid\9; border-right: 4px solid transparent; border-left: 4px solid transparent; } diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index 0019ddf172..e6ae0e891f 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -162,7 +162,6 @@ var tower = angular.module('Tower', [ 'ProjectsHelper', 'CompletedJobsDefinition', 'AllJobsDefinition', - 'JobFormDefinition', 'JobSummaryDefinition', 'ParseHelper', 'ChildrenHelper', diff --git a/awx/ui/client/src/forms.js b/awx/ui/client/src/forms.js index dca21972f2..db46a6d0d8 100644 --- a/awx/ui/client/src/forms.js +++ b/awx/ui/client/src/forms.js @@ -16,7 +16,6 @@ import JobEventData from "./forms/JobEventData"; import JobSummary from "./forms/JobSummary"; import JobTemplates from "./forms/JobTemplates"; import JobVarsPrompt from "./forms/JobVarsPrompt"; -import Jobs from "./forms/Jobs"; import LogViewerOptions from "./forms/LogViewerOptions"; import LogViewerStatus from "./forms/LogViewerStatus"; import Organizations from "./forms/Organizations"; @@ -41,7 +40,6 @@ export JobSummary, JobTemplates, JobVarsPrompt, - Jobs, LogViewerOptions, LogViewerStatus, Organizations, diff --git a/awx/ui/client/src/forms/Jobs.js b/awx/ui/client/src/forms/Jobs.js deleted file mode 100644 index dda37e158b..0000000000 --- a/awx/ui/client/src/forms/Jobs.js +++ /dev/null @@ -1,118 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - /** - * @ngdoc function - * @name forms.function:Jobs - * @description This form is for adding/editing a Job -*/ - -// @issue PLEASE KILL ME I NEED TO DIE - -export default - angular.module('JobFormDefinition', []) - .value('JobForm', { - - addTitle: 'Create Job', - editTitle: '{{ id }} - {{ name }}', - name: 'jobs', - stateTree: 'jobs', - well: true, - base: 'jobs', - tabs: true, - - navigationLinks: { - details: { - href: "/#/jobs/{{ job_id }}", - label: 'Status', - icon: 'icon-zoom-in', - active: true, - ngShow: "job_id !== null" - }, - events: { - href: "/#/jobs/{{ job_id }}/job_events", - label: 'Events', - icon: 'icon-list-ul' - }, - hosts: { - href: "/#/jobs/{{ job_id }}/job_host_summaries", - label: 'Host Summary', - icon: 'icon-laptop' - } - }, - - fields: { - status: { - type: 'custom', - control: "  {{ job_explanation }}", - readonly: true - }, - result_stdout: { - label: 'Standard Out', - type: 'textarea', - readonly: true, - xtraWide: true, - rows: "{{ stdout_rows }}", - "class": 'nowrap mono-space allowresize', - ngShow: "result_stdout != ''" - }, - result_traceback: { - label: 'Traceback', - type: 'textarea', - xtraWide: true, - readonly: true, - rows: "{{ traceback_rows }}", - "class": 'nowrap mono-space allowresize', - ngShow: "result_traceback != ''" - }, - type: { - label: 'Job Type', - type: 'text', - readonly: true - }, - launch_type: { - label: 'Launch Type', - type: 'text', - readonly: true - }, - created: { - label: 'Created On', - type: 'text', - readonly: true - }, - modified: { - label: 'Last Updated', - type: 'text', - readonly: true - } - }, - - actions: { - refresh: { - dataPlacement: 'top', - icon: "icon-refresh", - iconSize: 'large', - mode: 'all', - //ngShow: "job_status == 'pending' || job_status == 'waiting' || job_status == 'running'", - 'class': 'btn-xs btn-primary', - awToolTip: "Refresh the page", - ngClick: "refresh()" - } - }, - - related: { - job_template: { - type: 'collection', - title: 'Job Tempate', - iterator: 'job', - index: false, - open: false, - - fields: { } - } - } - - }); diff --git a/awx/ui/client/src/forms/WorkflowMaker.js b/awx/ui/client/src/forms/WorkflowMaker.js index d7cf84ade9..56e5c42dd7 100644 --- a/awx/ui/client/src/forms/WorkflowMaker.js +++ b/awx/ui/client/src/forms/WorkflowMaker.js @@ -56,7 +56,6 @@ export default sourceField: 'name', ngClick: 'lookUpCredential()', requiredErrorMsg: "Please select a Credential.", - column: 1, class: 'Form-formGroup--fullWidth', awPopOver: "

Select the credential you want the job to use when accessing the remote hosts. Choose the credential containing " + " the username and SSH key or password that Ansible will need to log into the remote hosts.

", @@ -65,7 +64,7 @@ export default dataContainer: "body", ngShow: "selectedTemplate.ask_credential_on_launch", awRequiredWhen: { - reqExpression: 'selectedTemplate.ask_credential_on_launch' + reqExpression: 'selectedTemplate && selectedTemplate.ask_credential_on_launch' } }, inventory: { @@ -77,7 +76,6 @@ export default basePath: 'organization', ngClick: 'lookUpInventory()', requiredErrorMsg: "Please select an Inventory.", - column: 1, class: 'Form-formGroup--fullWidth', awPopOver: "

Select the inventory containing the hosts you want this job to manage.

", dataTitle: 'Inventory', @@ -85,7 +83,7 @@ export default dataContainer: "body", ngShow: "selectedTemplate.ask_inventory_on_launch", awRequiredWhen: { - reqExpression: 'selectedTemplate.ask_inventory_on_launch' + reqExpression: 'selectedTemplate && selectedTemplate.ask_inventory_on_launch' } }, job_type: { @@ -93,7 +91,6 @@ export default type: 'select', ngOptions: 'type.label for type in job_type_options track by type.value', "default": 0, - column: 1, class: 'Form-formGroup--fullWidth', awPopOver: "

When this template is submitted as a job, setting the type to run will execute the playbook, running tasks " + " on the selected hosts.

Setting the type to check will not execute the playbook. Instead, ansible will check playbook " + @@ -104,15 +101,12 @@ export default dataContainer: "body", ngShow: "selectedTemplate.ask_job_type_on_launch", awRequiredWhen: { - reqExpression: 'selectedTemplate.ask_job_type_on_launch' + reqExpression: 'selectedTemplate && selectedTemplate.ask_job_type_on_launch' } }, limit: { label: 'Limit', type: 'text', - addRequired: false, - editRequired: false, - column: 1, class: 'Form-formGroup--fullWidth', awPopOver: "

Provide a host pattern to further constrain the list of hosts that will be managed or affected by the playbook. " + "Multiple patterns can be separated by ; : or ,

For more information and examples see " + @@ -126,10 +120,7 @@ export default label: 'Job Tags', type: 'textarea', rows: 5, - addRequired: false, - editRequired: false, 'elementClass': 'Form-textInput', - column: 2, class: 'Form-formGroup--fullWidth', awPopOver: "

Provide a comma separated list of tags.

\n" + "

Tags are useful when you have a large playbook, and you want to run a specific part of a play or task.

" + @@ -143,10 +134,7 @@ export default label: 'Skip Tags', type: 'textarea', rows: 5, - addRequired: false, - editRequired: false, 'elementClass': 'Form-textInput', - column: 2, class: 'Form-formGroup--fullWidth', awPopOver: "

Provide a comma separated list of tags.

\n" + "

Skip tags are useful when you have a large playbook, and you want to skip specific parts of a play or task.

" + diff --git a/awx/ui/client/src/forms/Workflows.js b/awx/ui/client/src/forms/Workflows.js index 442c651d7a..8f5ecb9bdc 100644 --- a/awx/ui/client/src/forms/Workflows.js +++ b/awx/ui/client/src/forms/Workflows.js @@ -36,8 +36,6 @@ export default description: { label: 'Description', type: 'text', - addRequired: false, - editRequired: false, column: 1 }, organization: { @@ -58,8 +56,6 @@ export default class: 'Form-formGroup--fullWidth', ngOptions: 'label.label for label in labelOptions track by label.value', multiSelect: true, - addRequired: false, - editRequired: false, dataTitle: 'Labels', dataPlacement: 'right', awPopOver: "

Optional labels that describe this job template, such as 'dev' or 'test'. Labels can be used to group and filter job templates and completed jobs in the Tower display.

", @@ -70,8 +66,6 @@ export default type: 'textarea', class: 'Form-textAreaLabel Form-formGroup--fullWidth', rows: 6, - addRequired: false, - editRequired: false, "default": "---", column: 2, awPopOver: "

Pass extra command line variables to the playbook. This is the -e or --extra-vars command line parameter " + diff --git a/awx/ui/client/src/helpers/teams.js b/awx/ui/client/src/helpers/teams.js index d729a8996e..b89d2a1283 100644 --- a/awx/ui/client/src/helpers/teams.js +++ b/awx/ui/client/src/helpers/teams.js @@ -73,65 +73,4 @@ export default }); }; } - ]) - - .factory('TeamLookUpOrganizationInit', ['Alert', 'Rest', 'OrganizationList', 'generateList', - function (Alert, Rest, OrganizationList, GenerateList) { - return function (params) { - - var scope = params.scope; - - // Show pop-up to select organization - scope.lookUpOrganization = function () { - var list = OrganizationList, - listGenerator = GenerateList, - listScope = listGenerator.inject(list, { mode: 'lookup', hdr: 'Select Organization' }); - - listScope.selectAction = function () { - var i, found = false; - for (i = 0; i < listScope[list.name].length; i++) { - if (listScope[list.iterator + "_" + listScope[list.name][i].id + "_class"] === "success") { - found = true; - scope.organization = listScope[list.name][i].id; - scope.organization_name = listScope[list.name][i].name; - scope.team_form.$setDirty(); - listGenerator.hide(); - } - } - if (found === false) { - Alert('No Selection', 'Click on a row to select an Organization before clicking the Select button.'); - } - }; - - listScope.toggle_organization = function (id) { - // when user clicks a row, remove 'success' class from all rows except clicked-on row - if (listScope[list.name]) { - for (var i = 0; i < listScope[list.name].length; i++) { - listScope[list.iterator + "_" + listScope[list.name][i].id + "_class"] = ""; - } - } - if (id !== null && id !== undefined) { - listScope[list.iterator + "_" + id + "_class"] = "success"; - } - }; - - // @issue: OLD SEARCH - // SearchInit({ - // scope: listScope, - // set: list.name, - // list: list, - // url: defaultUrl - // }); - // PaginateInit({ - // scope: listScope, - // list: list, - // url: defaultUrl, - // mode: 'lookup' - // }); - // scope.search(list.iterator); - - listScope.toggle_organization(scope.organization); - }; - }; - } ]); diff --git a/awx/ui/client/src/i18n.js b/awx/ui/client/src/i18n.js index 78f2150153..0b64a40222 100644 --- a/awx/ui/client/src/i18n.js +++ b/awx/ui/client/src/i18n.js @@ -1,3 +1,5 @@ +/* jshint ignore:start */ + function isString(arg) { return typeof arg === 'string'; } @@ -45,8 +47,8 @@ export function format(f) { var args = arguments; var len = args.length; var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') {return '%';} - if (i >= len) {return x;} + if (x === '%%') return '%'; + if (i >= len) return x; switch (x) { case '%s': return String(args[i++]); case '%d': return Number(args[i++]); @@ -57,7 +59,6 @@ export function format(f) { } catch (_) { return '[Circular]'; } - break; default: return x; } @@ -79,7 +80,7 @@ export default return function() { var langInfo = $window.navigator.language || $window.navigator.userLanguage; - //var langUrl = langInfo.replace('-', '_'); + var langUrl = langInfo.replace('-', '_'); //gettextCatalog.debug = true; gettextCatalog.setCurrentLanguage(langInfo); // TODO: the line below is commented out temporarily until diff --git a/awx/ui/client/src/job-templates/add-workflow/workflow-add.controller.js b/awx/ui/client/src/job-templates/add-workflow/workflow-add.controller.js index 17a26c9a4f..fd51a4adc1 100644 --- a/awx/ui/client/src/job-templates/add-workflow/workflow-add.controller.js +++ b/awx/ui/client/src/job-templates/add-workflow/workflow-add.controller.js @@ -80,14 +80,18 @@ $scope.variables, true); // The idea here is that we want to find the new option elements that also have a label that exists in the dom - $("#workflow_job_template_labels > option").filter("[data-select2-tag=true]").each(function(optionIndex, option) { - $("#workflow_job_template_labels").siblings(".select2").first().find(".select2-selection__choice").each(function(labelIndex, label) { - if($(option).text() === $(label).attr('title')) { - // Mark that the option has a label present so that we can filter by that down below - $(option).attr('data-label-is-present', true); - } - }); - }); + $("#workflow_job_template_labels > option") + .filter("[data-select2-tag=true]") + .each(function(optionIndex, option) { + $("#workflow_job_template_labels") + .siblings(".select2").first().find(".select2-selection__choice") + .each(function(labelIndex, label) { + if($(option).text() === $(label).attr('title')) { + // Mark that the option has a label present so that we can filter by that down below + $(option).attr('data-label-is-present', true); + } + }); + }); $scope.newLabels = $("#workflow_job_template_labels > option") .filter("[data-select2-tag=true]") diff --git a/awx/ui/client/src/job-templates/copy/job-templates-copy.controller.js b/awx/ui/client/src/job-templates/copy/job-templates-copy.controller.js index 089c7b6628..c82f412bc5 100644 --- a/awx/ui/client/src/job-templates/copy/job-templates-copy.controller.js +++ b/awx/ui/client/src/job-templates/copy/job-templates-copy.controller.js @@ -22,9 +22,8 @@ if(res.type && res.type === 'job_template') { $state.go('templates.editJobTemplate', {id: res.id}, {reload: true}); } - else if(res.type && res.type === 'workflow') { - // TODO: direct the user to the edit state for workflows - } + // Workflow edit to be implemented post 3.1 but we'll need to handle the + // state transition for that here }); }) .error(function(res, status){