mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 03:31:10 -03:30
Latest UI changes. Related-set key fields now link to the edit/detail page. Job detail page disables correctly. Fixed jobs related set on Job Templates detail page.
This commit is contained in:
@@ -306,4 +306,3 @@
|
||||
}
|
||||
|
||||
/* End Jobs Page */
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Res
|
||||
var list = CredentialList;
|
||||
var defaultUrl = GetBasePath('credentials');
|
||||
var view = GenerateList;
|
||||
var paths = $location.path().replace(/^\//,'').split('/');
|
||||
var mode = (paths[0] == 'credentials') ? 'edit' : 'select'; // if base path 'credentials', we're here to add/edit
|
||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||
var mode = (base == 'credentials') ? 'edit' : 'select'; // if base path 'credentials', we're here to add/edit
|
||||
var scope = view.inject(CredentialList, { mode: mode }); // Inject our view
|
||||
scope.selected = [];
|
||||
|
||||
@@ -62,8 +62,9 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Res
|
||||
}
|
||||
|
||||
scope.finishSelection = function() {
|
||||
Rest.setUrl(GetBasePath('base') + $location.path() + '/'); // We're assuming the path matches the api path.
|
||||
// Will this always be true??
|
||||
var url = GetBasePath(base);
|
||||
url += (base == 'users') ? $routeParams.user_id + '/credentials/' : $routeParams.team_id + '/credentials/';
|
||||
Rest.setUrl(url);
|
||||
scope.queue = [];
|
||||
|
||||
scope.$on('callFinished', function() {
|
||||
@@ -77,13 +78,6 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Res
|
||||
for (var i=0; i < scope.queue.length; i++) {
|
||||
if (scope.queue[i].result == 'error') {
|
||||
errors++;
|
||||
// there is no way to know which user raised the error. no data comes
|
||||
// back from the api call.
|
||||
// $('td.username-column').each(function(index) {
|
||||
// if ($(this).text() == scope.queue[i].username) {
|
||||
// $(this).addClass("error");
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
||||
if (errors > 0) {
|
||||
|
||||
@@ -24,7 +24,22 @@ function GroupsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
|
||||
var scope = view.inject(GroupList, { mode: 'select' }); // Inject our view
|
||||
scope.selected = [];
|
||||
|
||||
|
||||
if (scope.PostRefreshRemove) {
|
||||
scope.PostRefreshRemove();
|
||||
}
|
||||
scope.PostRefresRemove = scope.$on('PostRefresh', function() {
|
||||
if ($routeParams.group_id) {
|
||||
// Remove the current group from the list of available groups, thus
|
||||
// preventing a group from being added to itself
|
||||
for (var i=0; i < scope.groups.length; i++) {
|
||||
if (scope.groups[i].id == $routeParams.group_id) {
|
||||
scope.groups.splice(i,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SearchInit({ scope: scope, set: 'groups', list: list, url: defaultUrl });
|
||||
PaginateInit({ scope: scope, list: list, url: defaultUrl });
|
||||
scope.search(list.iterator);
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
|
||||
function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, InventoryList,
|
||||
GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller,
|
||||
ClearScope, ProcessErrors)
|
||||
ClearScope, ProcessErrors, GetBasePath)
|
||||
{
|
||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||
//scope.
|
||||
var list = InventoryList;
|
||||
var defaultUrl = '/api/v1/inventories/';
|
||||
var defaultUrl = GetBasePath('inventory');
|
||||
var view = GenerateList;
|
||||
var paths = $location.path().replace(/^\//,'').split('/');
|
||||
var mode = (paths[0] == 'inventories') ? 'edit' : 'select'; // if base path 'users', we're here to add/edit users
|
||||
@@ -141,7 +141,8 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res
|
||||
}
|
||||
|
||||
InventoriesList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'InventoryList', 'GenerateList',
|
||||
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors' ];
|
||||
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
|
||||
'GetBasePath' ];
|
||||
|
||||
|
||||
function InventoriesAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, InventoryForm,
|
||||
|
||||
@@ -512,7 +512,7 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route
|
||||
// Related set: Edit button
|
||||
scope.edit = function(set, id, name) {
|
||||
$rootScope.flashMessage = null;
|
||||
$location.path('/' + base + '/' + $routeParams.id + '/' + set + '/' + id);
|
||||
$location.path('/' + set + '/' + id);
|
||||
};
|
||||
|
||||
// Related set: Delete button
|
||||
|
||||
@@ -219,6 +219,12 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
||||
scope[fld] = data[fld];
|
||||
}
|
||||
}
|
||||
|
||||
if (data.status != 'new') {
|
||||
$('input[type="text"], textarea').attr('readonly','readonly');
|
||||
$('select').prop('disabled', 'disabled');
|
||||
$('.lookup-btn').prop('disabled', 'disabled');
|
||||
}
|
||||
|
||||
scope.url = data.url;
|
||||
var related = data.related;
|
||||
|
||||
@@ -13,6 +13,7 @@ angular.module('JobTemplateFormDefinition', [])
|
||||
addTitle: 'Create Job Templates', //Legend in add mode
|
||||
editTitle: '{{ name }}', //Legend in edit mode
|
||||
name: 'job_templates',
|
||||
twoColumns: true,
|
||||
well: true,
|
||||
|
||||
fields: {
|
||||
@@ -20,13 +21,15 @@ angular.module('JobTemplateFormDefinition', [])
|
||||
label: 'Name',
|
||||
type: 'text',
|
||||
addRequired: true,
|
||||
editRequired: true
|
||||
editRequired: true,
|
||||
column: 1
|
||||
},
|
||||
description: {
|
||||
label: 'Description',
|
||||
type: 'text',
|
||||
addRequired: false,
|
||||
editRequired: false
|
||||
editRequired: false,
|
||||
column: 1
|
||||
},
|
||||
job_type: {
|
||||
label: 'Job Type',
|
||||
@@ -34,7 +37,8 @@ angular.module('JobTemplateFormDefinition', [])
|
||||
ngOptions: 'type.label for type in job_type_options',
|
||||
default: 'run',
|
||||
addRequired: true,
|
||||
editRequired: true
|
||||
editRequired: true,
|
||||
column: 1
|
||||
},
|
||||
inventory: {
|
||||
label: 'Inventory',
|
||||
@@ -43,7 +47,8 @@ angular.module('JobTemplateFormDefinition', [])
|
||||
sourceField: 'name',
|
||||
addRequired: true,
|
||||
editRequired: true,
|
||||
ngClick: 'lookUpInventory()'
|
||||
ngClick: 'lookUpInventory()',
|
||||
column: 1
|
||||
},
|
||||
project: {
|
||||
label: 'Project',
|
||||
@@ -53,6 +58,7 @@ angular.module('JobTemplateFormDefinition', [])
|
||||
addRequired: true,
|
||||
editRequired: true,
|
||||
ngClick: 'lookUpProject()',
|
||||
column: 1
|
||||
},
|
||||
playbook: {
|
||||
label: 'Playbook',
|
||||
@@ -60,7 +66,8 @@ angular.module('JobTemplateFormDefinition', [])
|
||||
ngOptions: 'book for book in playbook_options',
|
||||
id: 'playbook-select',
|
||||
addRequired: true,
|
||||
editRequired: true
|
||||
editRequired: true,
|
||||
column: 1
|
||||
},
|
||||
credential: {
|
||||
label: 'Credential',
|
||||
@@ -69,7 +76,8 @@ angular.module('JobTemplateFormDefinition', [])
|
||||
sourceField: 'name',
|
||||
ngClick: 'lookUpCredential()',
|
||||
addRequired: false,
|
||||
editRequired: false
|
||||
editRequired: false,
|
||||
column: 1
|
||||
},
|
||||
forks: {
|
||||
label: 'Forks',
|
||||
@@ -79,13 +87,15 @@ angular.module('JobTemplateFormDefinition', [])
|
||||
max: 100,
|
||||
default: 0,
|
||||
addRequired: false,
|
||||
editRequired: false
|
||||
editRequired: false,
|
||||
column: 2
|
||||
},
|
||||
limit: {
|
||||
label: 'Limit',
|
||||
type: 'text',
|
||||
addRequired: false,
|
||||
editRequired: false
|
||||
editRequired: false,
|
||||
column: 2
|
||||
},
|
||||
verbosity: {
|
||||
label: 'Verbosity',
|
||||
@@ -95,15 +105,17 @@ angular.module('JobTemplateFormDefinition', [])
|
||||
min: 0,
|
||||
max: 3,
|
||||
addRequired: false,
|
||||
editRequired: false
|
||||
editRequired: false,
|
||||
column: 2
|
||||
},
|
||||
extra_vars: {
|
||||
label: 'Extra Variables',
|
||||
type: 'textarea',
|
||||
rows: 6,
|
||||
class: 'span4',
|
||||
class: 'span12',
|
||||
addRequired: false,
|
||||
editRequired: false
|
||||
editRequired: false,
|
||||
column: 2
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ angular.module('JobFormDefinition', [])
|
||||
name: 'jobs',
|
||||
well: true,
|
||||
twoColumns: true,
|
||||
allowReadonly: true,
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
@@ -113,7 +112,7 @@ angular.module('JobFormDefinition', [])
|
||||
label: 'Extra Variables',
|
||||
type: 'textarea',
|
||||
rows: 6,
|
||||
class: 'span5',
|
||||
class: 'span12',
|
||||
addRequired: false,
|
||||
editRequired: false,
|
||||
column: 2
|
||||
|
||||
@@ -93,6 +93,7 @@ angular.module('OrganizationFormDefinition', [])
|
||||
title: 'Administrators',
|
||||
iterator: 'admin', // Singular form of name (e.g. thing)
|
||||
open: false, // Open accordion on load?
|
||||
base: '/users',
|
||||
actions: { // Actions displayed top right of list
|
||||
add: {
|
||||
ngClick: "add('admins')",
|
||||
|
||||
@@ -89,6 +89,7 @@ angular.module('UserFormDefinition', [])
|
||||
title: 'Admin of Organizations',
|
||||
iterator: 'adminof', // Singular form of name (e.g. thing)
|
||||
open: false, // Open accordion on load?
|
||||
base: '/organizations',
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
|
||||
@@ -34,6 +34,8 @@ angular.module('RelatedSearchHelper', ['RestServices', 'Utilities','RefreshRelat
|
||||
}
|
||||
scope[form.related[set].iterator + 'SearchType'] = 'contains';
|
||||
scope[form.related[set].iterator + 'SearchTypeLabel'] = 'Contains';
|
||||
scope[form.related[set].iterator + 'SelectShow'] = false;
|
||||
scope[form.related[set].iterator + 'HideSearchType'] = false;
|
||||
}
|
||||
|
||||
// Functions to handle search widget changes
|
||||
|
||||
@@ -365,7 +365,7 @@ angular.module('FormGenerator', ['GeneratorHelpers'])
|
||||
html += "<label class=\"control-label\" for=\"" + fld + '">' + field.label + '</label>' + "\n";
|
||||
html += "<div class=\"controls\">\n";
|
||||
html += "<div class=\"input-prepend\">\n";
|
||||
html += "<button class=\"btn\" " + this.attr(field,'ngClick') + "><i class=\"icon-search\"></i></button>\n";
|
||||
html += "<button class=\"lookup-btn btn\" " + this.attr(field,'ngClick') + "><i class=\"icon-search\"></i></button>\n";
|
||||
html += "<input class=\"input-medium\" type=\"text\" ";
|
||||
html += "ng-model=\"" + field.sourceModel + '_' + field.sourceField + "\" ";
|
||||
html += "name=\"" + field.sourceModel + '_' + field.sourceField + "\" ";
|
||||
@@ -470,6 +470,7 @@ angular.module('FormGenerator', ['GeneratorHelpers'])
|
||||
//buttons
|
||||
if (!this.modal) {
|
||||
if (this.has('buttons')) {
|
||||
html += (this.form.twoColumns) ? "<hr />" : "";
|
||||
html += "<div class=\"control-group\">\n";
|
||||
html += "<div class=\"controls buttons\">\n";
|
||||
}
|
||||
@@ -477,7 +478,8 @@ angular.module('FormGenerator', ['GeneratorHelpers'])
|
||||
var button = this.form.buttons[btn];
|
||||
//button
|
||||
html += "<button ";
|
||||
html += "class=\"btn btn-small";
|
||||
html += "class=\"btn";
|
||||
html += (this.form.twoColumns) ? "" : " btn-small";
|
||||
html += (button.class) ? " " + button.class : "";
|
||||
html += "\" ";
|
||||
if (button.ngClick) {
|
||||
@@ -641,9 +643,29 @@ angular.module('FormGenerator', ['GeneratorHelpers'])
|
||||
html += "<td>{{ $index + (" + form.related[itm].iterator + "Page * " +
|
||||
form.related[itm].iterator + "PageSize) + 1 }}.</td>\n";
|
||||
var cnt = 1;
|
||||
var rfield;
|
||||
var base = (form.related[itm].base) ? form.related[itm].base : itm;
|
||||
base = base.replace(/^\//,'');
|
||||
for (var fld in form.related[itm].fields) {
|
||||
cnt++;
|
||||
html += "<td>{{ " + form.related[itm].iterator + "." + fld + " }}</td>\n";
|
||||
rfield = form.related[itm].fields[fld];
|
||||
html += "<td>";
|
||||
if ((rfield.key || rfield.link || rfield.linkTo || rfield.ngClick )) {
|
||||
if (rfield.linkTo) {
|
||||
html += "<a href=\"#" + rfield.linkTo + "\">";
|
||||
}
|
||||
else if (rfield.ngClick) {
|
||||
html += "<a href=\"\"" + this.attr(rfield, 'ngClick') + "\">";
|
||||
}
|
||||
else {
|
||||
html += "<a href=\"#/" + base + "/{{" + form.related[itm].iterator + ".id }}\">";
|
||||
}
|
||||
}
|
||||
html += "{{ " + form.related[itm].iterator + "." + fld + " }}";
|
||||
if ((rfield.key || rfield.link || rfield.linkTo || rfield.ngClick )) {
|
||||
html += "</a>";
|
||||
}
|
||||
html += "</td>\n";
|
||||
}
|
||||
|
||||
// Row level actions
|
||||
|
||||
Reference in New Issue
Block a user