Small fixes based on PR review feedback

This commit is contained in:
Michael Abashian 2016-11-10 11:14:08 -05:00
parent 5a940ff06a
commit 59aeec5705
10 changed files with 22 additions and 219 deletions

View File

@ -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;
}

View File

@ -162,7 +162,6 @@ var tower = angular.module('Tower', [
'ProjectsHelper',
'CompletedJobsDefinition',
'AllJobsDefinition',
'JobFormDefinition',
'JobSummaryDefinition',
'ParseHelper',
'ChildrenHelper',

View File

@ -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,

View File

@ -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: "<i class=\"fa icon-job-{{ status }}\"></i> &nbsp;{{ 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: { }
}
}
});

View File

@ -56,7 +56,6 @@ export default
sourceField: 'name',
ngClick: 'lookUpCredential()',
requiredErrorMsg: "Please select a Credential.",
column: 1,
class: 'Form-formGroup--fullWidth',
awPopOver: "<p>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.</p>",
@ -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: "<p>Select the inventory containing the hosts you want this job to manage.</p>",
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: "<p>When this template is submitted as a job, setting the type to <em>run</em> will execute the playbook, running tasks " +
" on the selected hosts.</p> <p>Setting the type to <em>check</em> will not execute the playbook. Instead, <code>ansible</code> 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: "<p>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 &#59; &#58; or &#44;</p><p>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: "<p>Provide a comma separated list of tags.</p>\n" +
"<p>Tags are useful when you have a large playbook, and you want to run a specific part of a play or task.</p>" +
@ -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: "<p>Provide a comma separated list of tags.</p>\n" +
"<p>Skip tags are useful when you have a large playbook, and you want to skip specific parts of a play or task.</p>" +

View File

@ -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: "<p>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.</p>",
@ -70,8 +66,6 @@ export default
type: 'textarea',
class: 'Form-textAreaLabel Form-formGroup--fullWidth',
rows: 6,
addRequired: false,
editRequired: false,
"default": "---",
column: 2,
awPopOver: "<p>Pass extra command line variables to the playbook. This is the <code>-e</code> or <code>--extra-vars</code> command line parameter " +

View File

@ -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);
};
};
}
]);

View File

@ -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

View File

@ -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]")

View File

@ -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){