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:
chouseknecht
2013-05-23 01:07:15 -04:00
parent 3b91d68130
commit bdbfcd4b85
12 changed files with 85 additions and 33 deletions

View File

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

View File

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

View File

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

View File

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

View File

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