mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 18:40:01 -03:30
Fixes to teams/project/organizations/users/credentials navigation and pathing.
This commit is contained in:
parent
91b534c841
commit
45a4ba7743
@ -134,20 +134,20 @@ angular.module('ansible', [
|
||||
when('/organizations/add', { templateUrl: urlPrefix + 'partials/organizations.html',
|
||||
controller: OrganizationsAdd }).
|
||||
|
||||
when('/organizations/:id', { templateUrl: urlPrefix + 'partials/organizations.html',
|
||||
controller: OrganizationsEdit }).
|
||||
when('/organizations/:organization_id', { templateUrl: urlPrefix + 'partials/organizations.html',
|
||||
controller: OrganizationsEdit }).
|
||||
|
||||
when('/organizations/:id/admins', { templateUrl: urlPrefix + 'partials/organizations.html',
|
||||
when('/organizations/:organization_id/admins', { templateUrl: urlPrefix + 'partials/organizations.html',
|
||||
controller: AdminsList }).
|
||||
|
||||
when('/organizations/:id/users', { templateUrl: urlPrefix + 'partials/users.html',
|
||||
controller: UsersList }).
|
||||
when('/organizations/:organization_id/users', { templateUrl: urlPrefix + 'partials/users.html',
|
||||
controller: UsersList }).
|
||||
|
||||
when('/organizations/:id/users/add', { templateUrl: urlPrefix + 'partials/users.html',
|
||||
controller: UsersAdd }).
|
||||
when('/organizations/:organization_id/users/add', { templateUrl: urlPrefix + 'partials/users.html',
|
||||
controller: UsersAdd }).
|
||||
|
||||
when('/organizations/:organization_id/users/:id', { templateUrl: urlPrefix + 'partials/users.html',
|
||||
controller: UsersEdit }).
|
||||
when('/organizations/:organization_id/users/:user_id', { templateUrl: urlPrefix + 'partials/users.html',
|
||||
controller: UsersEdit }).
|
||||
|
||||
when('/teams', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||
controller: TeamsList }).
|
||||
@ -155,23 +155,29 @@ angular.module('ansible', [
|
||||
when('/teams/add', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||
controller: TeamsAdd }).
|
||||
|
||||
when('/teams/:id', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||
controller: TeamsEdit }).
|
||||
when('/teams/:team_id', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||
controller: TeamsEdit }).
|
||||
|
||||
when('/teams/:id/users', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||
controller: UsersList }).
|
||||
when('/teams/:team_id/users', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||
controller: UsersList }).
|
||||
|
||||
when('/teams/:organization_id/users/:id', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||
controller: UsersEdit }).
|
||||
when('/teams/:team_id/users/:user_id', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||
controller: UsersEdit }).
|
||||
|
||||
when('/teams/:team_id/credentials', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||
controller: CredentialsList }).
|
||||
|
||||
when('/teams/:team_id/credentials/add', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||
controller: CredentialsAdd }).
|
||||
|
||||
when('/teams/:team_id/credentials/:credential_id', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||
controller: CredentialsEdit }).
|
||||
|
||||
when('/credentials', { templateUrl: urlPrefix + 'partials/credentials.html',
|
||||
controller: CredentialsList }).
|
||||
|
||||
when('/credentials/add', { templateUrl: urlPrefix + 'partials/credentials.html',
|
||||
controller: CredentialsAdd }).
|
||||
|
||||
when('/credentials/:id', { templateUrl: urlPrefix + 'partials/credentials.html',
|
||||
controller: CredentialsEdit }).
|
||||
when('/credentials/:credential_id', { templateUrl: urlPrefix + 'partials/credentials.html',
|
||||
controller: CredentialsEdit }).
|
||||
|
||||
when('/users', { templateUrl: urlPrefix + 'partials/users.html',
|
||||
controller: UsersList }).
|
||||
@ -179,8 +185,17 @@ angular.module('ansible', [
|
||||
when('/users/add', { templateUrl: urlPrefix + 'partials/users.html',
|
||||
controller: UsersAdd }).
|
||||
|
||||
when('/users/:id', { templateUrl: urlPrefix + 'partials/users.html',
|
||||
controller: UsersEdit }).
|
||||
when('/users/:user_id', { templateUrl: urlPrefix + 'partials/users.html',
|
||||
controller: UsersEdit }).
|
||||
|
||||
when('/users/:user_id/credentials', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||
controller: CredentialsList }).
|
||||
|
||||
when('/users/:user_id/credentials/add', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||
controller: CredentialsAdd }).
|
||||
|
||||
when('/teams/:user_id/credentials/:credential_id', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||
controller: CredentialsEdit }).
|
||||
|
||||
when('/login', { templateUrl: urlPrefix + 'partials/login-dialog.html', controller: Authenticate }).
|
||||
|
||||
|
||||
@ -12,12 +12,11 @@
|
||||
|
||||
function AdminsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
Alert, AdminList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit,
|
||||
ReturnToCaller)
|
||||
ReturnToCaller,GetBasePath)
|
||||
{
|
||||
var list = AdminList;
|
||||
var defaultUrl = '/api/v1' + '/organizations/' + $routeParams.id + '/users/' ;
|
||||
var defaultUrl = GetBasePath('organizations') + $routeParams.organization_id + '/users/' ;
|
||||
var view = GenerateList;
|
||||
//var paths = $location.path().replace(/^\//,'').split('/');
|
||||
var mode = 'select';
|
||||
var scope = view.inject(AdminList, { mode: mode }); // Inject our view
|
||||
scope.selected = [];
|
||||
@ -29,8 +28,8 @@ function AdminsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
LoadBreadCrumbs();
|
||||
|
||||
scope.finishSelection = function() {
|
||||
Rest.setUrl('/api/v1' + $location.path() + '/'); // We're assuming the path matches the api path.
|
||||
// Will this always be true??
|
||||
var url = GetBasePath('organizations') + $routeParams.organization_id + '/admins/'
|
||||
Rest.setUrl(url);
|
||||
scope.queue = [];
|
||||
|
||||
scope.$on('callFinished', function() {
|
||||
@ -44,13 +43,6 @@ function AdminsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
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) {
|
||||
@ -85,30 +77,28 @@ function AdminsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
}
|
||||
}
|
||||
else {
|
||||
returnToCaller();
|
||||
ReturnToCaller(1);
|
||||
}
|
||||
}
|
||||
|
||||
scope.toggle_admin = function(id) {
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
else {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||
scope[list.iterator + "_" + id + "_class"] = "";
|
||||
//$('input[name="check_' + id + '"]').checked = false;
|
||||
document.getElementById('check_' + id).checked = false;
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||
//$('input[name="check_' + id + '"]').checked = true;
|
||||
document.getElementById('check_' + id).checked = true;
|
||||
if (scope.selected.indexOf(id) == -1) {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AdminsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'AdminList', 'GenerateList',
|
||||
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller' ];
|
||||
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'GetBasePath'];
|
||||
|
||||
|
||||
@ -122,21 +122,19 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Res
|
||||
}
|
||||
|
||||
scope.toggle_credential = function(id) {
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
else {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||
scope[list.iterator + "_" + id + "_class"] = "";
|
||||
//$('input[name="check_' + id + '"]').checked = false;
|
||||
document.getElementById('check_' + id).checked = false;
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||
//$('input[name="check_' + id + '"]').checked = true;
|
||||
document.getElementById('check_' + id).checked = true;
|
||||
if (scope.selected.indexOf(id) == -1) {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -158,35 +156,30 @@ function CredentialsAdd ($scope, $rootScope, $compile, $location, $log, $routePa
|
||||
var form = CredentialForm;
|
||||
var generator = GenerateForm;
|
||||
var scope = generator.inject(form, {mode: 'add', related: false});
|
||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||
var defaultUrl = GetBasePath(base);
|
||||
defaultUrl += (base == 'teams') ? $routeParams.team_id + '/credentials/' : $routeParams.user_id + '/credentials/';
|
||||
generator.reset();
|
||||
LoadBreadCrumbs();
|
||||
|
||||
LookUpInit({
|
||||
scope: scope,
|
||||
form: form,
|
||||
current_item: ($routeParams.user_id) ? $routeParams.user_id : null,
|
||||
list: UserList,
|
||||
field: 'user'
|
||||
});
|
||||
|
||||
LookUpInit({
|
||||
scope: scope,
|
||||
form: form,
|
||||
current_item: ($routeParams.team_id) ? $routeParams.team_id : null,
|
||||
list: TeamList,
|
||||
field: 'team'
|
||||
});
|
||||
|
||||
// Save
|
||||
scope.formSave = function() {
|
||||
Rest.setUrl(defaultUrl);
|
||||
var data = {}
|
||||
for (var fld in form.fields) {
|
||||
data[fld] = scope[fld];
|
||||
}
|
||||
}
|
||||
|
||||
if (base == 'teams') {
|
||||
data['team'] = $routeParams.team_id;
|
||||
}
|
||||
else {
|
||||
data['user'] = $routeParams.user_id;
|
||||
}
|
||||
|
||||
Rest.post(data)
|
||||
.success( function(data, status, headers, config) {
|
||||
ReturnToCaller();
|
||||
ReturnToCaller(1);
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
ProcessErrors(scope, data, status, form,
|
||||
@ -229,8 +222,7 @@ CredentialsAdd.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$lo
|
||||
|
||||
function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, CredentialForm,
|
||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit,
|
||||
RelatedPaginateInit, ReturnToCaller, ClearScope, LookUpInit,
|
||||
UserList, TeamList, Prompt, GetBasePath)
|
||||
RelatedPaginateInit, ReturnToCaller, ClearScope, Prompt, GetBasePath)
|
||||
{
|
||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||
//scope.
|
||||
@ -241,26 +233,13 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
||||
var scope = generator.inject(form, {mode: 'edit', related: true});
|
||||
generator.reset();
|
||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||
var defaultUrl = GetBasePath('credentials');
|
||||
|
||||
var master = {};
|
||||
var id = $routeParams.id;
|
||||
var id = $routeParams.credential_id;
|
||||
var relatedSets = {};
|
||||
|
||||
LookUpInit({
|
||||
scope: scope,
|
||||
form: form,
|
||||
current_item: ($routeParams.user_id) ? $routeParams.user_id : null,
|
||||
list: UserList,
|
||||
field: 'user'
|
||||
});
|
||||
|
||||
LookUpInit({
|
||||
scope: scope,
|
||||
form: form,
|
||||
current_item: ($routeParams.team_id) ? $routeParams.team_id : null,
|
||||
list: TeamList,
|
||||
field: 'team'
|
||||
});
|
||||
|
||||
|
||||
function setAskCheckboxes() {
|
||||
for (var fld in form.fields) {
|
||||
if (form.fields[fld].type == 'password' && form.fields[fld].ask && scope[fld] == 'ASK') {
|
||||
@ -277,7 +256,10 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
||||
}
|
||||
|
||||
// After Credential is loaded, retrieve each related set and any lookups
|
||||
scope.$on('credentialLoaded', function() {
|
||||
if (scope.credentialLoadedRemove) {
|
||||
scope.credentialLoadedRemove();
|
||||
}
|
||||
scope.credentialLoadedRemove = scope.$on('credentialLoaded', function() {
|
||||
for (var set in relatedSets) {
|
||||
scope.search(relatedSets[set].iterator);
|
||||
}
|
||||
@ -287,20 +269,17 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
||||
Rest.setUrl(defaultUrl + ':id/');
|
||||
Rest.get({ params: {id: id} })
|
||||
.success( function(data, status, headers, config) {
|
||||
LoadBreadCrumbs({ path: '/Credentials/' + id, title: data.name });
|
||||
LoadBreadCrumbs({ path: '/credentials/' + id, title: data.name });
|
||||
for (var fld in form.fields) {
|
||||
if (data[fld]) {
|
||||
scope[fld] = data[fld];
|
||||
master[fld] = scope[fld];
|
||||
}
|
||||
if (form.fields[fld].type == 'lookup' && data.summary_fields[form.fields[fld].sourceModel]) {
|
||||
scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] =
|
||||
data.summary_fields[form.fields[fld].sourceModel][form.fields[fld].sourceField];
|
||||
master[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] =
|
||||
scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField];
|
||||
}
|
||||
setAskCheckboxes();
|
||||
}
|
||||
scope.team = data.team;
|
||||
scope.user = data.user;
|
||||
setAskCheckboxes();
|
||||
|
||||
var related = data.related;
|
||||
for (var set in form.related) {
|
||||
if (related[set]) {
|
||||
@ -318,13 +297,18 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
||||
{ hdr: 'Error!', msg: 'Failed to retrieve Credential: ' + $routeParams.id + '. GET status: ' + status });
|
||||
});
|
||||
|
||||
|
||||
// Save changes to the parent
|
||||
scope.formSave = function() {
|
||||
Rest.setUrl(defaultUrl + $routeParams.id + '/');
|
||||
Rest.setUrl(defaultUrl + id + '/');
|
||||
var data = {}
|
||||
for (var fld in form.fields) {
|
||||
data[fld] = scope[fld];
|
||||
}
|
||||
|
||||
data.team = scope.team;
|
||||
data.user = scope.user;
|
||||
|
||||
Rest.put(data)
|
||||
.success( function(data, status, headers, config) {
|
||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||
@ -416,6 +400,5 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
||||
|
||||
CredentialsEdit.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'CredentialForm',
|
||||
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit',
|
||||
'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'LookUpInit', 'UserList', 'TeamList',
|
||||
'Prompt', 'GetBasePath' ];
|
||||
'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'Prompt', 'GetBasePath' ];
|
||||
|
||||
@ -121,21 +121,19 @@ function GroupsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
}
|
||||
|
||||
scope.toggle_group = function(id) {
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
else {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||
scope[list.iterator + "_" + id + "_class"] = "";
|
||||
//$('input[name="check_' + id + '"]').checked = false;
|
||||
document.getElementById('check_' + id).checked = false;
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||
//$('input[name="check_' + id + '"]').checked = true;
|
||||
document.getElementById('check_' + id).checked = true;
|
||||
if (scope.selected.indexOf(id) == -1) {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -120,21 +120,19 @@ function HostsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
}
|
||||
|
||||
scope.toggle_host = function(id) {
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
else {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||
scope[list.iterator + "_" + id + "_class"] = "";
|
||||
//$('input[name="check_' + id + '"]').checked = false;
|
||||
document.getElementById('check_' + id).checked = false;
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||
//$('input[name="check_' + id + '"]').checked = true;
|
||||
document.getElementById('check_' + id).checked = true;
|
||||
if (scope.selected.indexOf(id) == -1) {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -123,21 +123,19 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res
|
||||
}
|
||||
|
||||
scope.toggle_inventory = function(id) {
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
else {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||
scope[list.iterator + "_" + id + "_class"] = "";
|
||||
//$('input[name="check_' + id + '"]').checked = false;
|
||||
document.getElementById('check_' + id).checked = false;
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||
//$('input[name="check_' + id + '"]').checked = true;
|
||||
document.getElementById('check_' + id).checked = true;
|
||||
if (scope.selected.indexOf(id) == -1) {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,21 +117,19 @@ function JobTemplatesList ($scope, $rootScope, $location, $log, $routeParams, Re
|
||||
}
|
||||
|
||||
scope.toggle_job_template = function(id) {
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
else {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||
scope[list.iterator + "_" + id + "_class"] = "";
|
||||
//$('input[name="check_' + id + '"]').checked = false;
|
||||
document.getElementById('check_' + id).checked = false;
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||
//$('input[name="check_' + id + '"]').checked = true;
|
||||
document.getElementById('check_' + id).checked = true;
|
||||
if (scope.selected.indexOf(id) == -1) {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,8 @@
|
||||
'use strict';
|
||||
|
||||
function OrganizationsList ($scope, $rootScope, $location, $log, Rest, Alert, LoadBreadCrumbs, Prompt,
|
||||
GenerateList, OrganizationList, SearchInit, PaginateInit, ClearScope, ProcessErrors)
|
||||
GenerateList, OrganizationList, SearchInit, PaginateInit, ClearScope, ProcessErrors,
|
||||
GetBasePath)
|
||||
{
|
||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||
//scope.
|
||||
@ -21,7 +22,7 @@ function OrganizationsList ($scope, $rootScope, $location, $log, Rest, Alert, Lo
|
||||
var paths = $location.path().replace(/^\//,'').split('/');
|
||||
var mode = (paths[0] == 'organizations') ? 'edit' : 'select'; // if base path 'users', we're here to add/edit users
|
||||
var scope = generate.inject(OrganizationList, { mode: mode }); // Inject our view
|
||||
var defaultUrl = '/api/v1/organizations/';
|
||||
var defaultUrl = GetBasePath('organizations');
|
||||
var iterator = list.iterator;
|
||||
$rootScope.flashMessage = null;
|
||||
|
||||
@ -64,14 +65,33 @@ function OrganizationsList ($scope, $rootScope, $location, $log, Rest, Alert, Lo
|
||||
action: action
|
||||
});
|
||||
}
|
||||
|
||||
scope.toggle_organization = function(id) {
|
||||
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||
scope[list.iterator + "_" + id + "_class"] = "";
|
||||
document.getElementById('check_' + id).checked = false;
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||
document.getElementById('check_' + id).checked = true;
|
||||
if (scope.selected.indexOf(id) == -1) {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OrganizationsList.$inject=[ '$scope', '$rootScope', '$location', '$log', 'Rest', 'Alert', 'LoadBreadCrumbs', 'Prompt',
|
||||
'GenerateList', 'OrganizationList', 'SearchInit', 'PaginateInit', 'ClearScope', 'ProcessErrors'];
|
||||
'GenerateList', 'OrganizationList', 'SearchInit', 'PaginateInit', 'ClearScope', 'ProcessErrors',
|
||||
'GetBasePath' ];
|
||||
|
||||
|
||||
function OrganizationsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, OrganizationForm,
|
||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ClearScope)
|
||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ClearScope, GetBasePath,
|
||||
ReturnToCaller)
|
||||
{
|
||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||
//scope.
|
||||
@ -79,22 +99,23 @@ function OrganizationsAdd ($scope, $rootScope, $compile, $location, $log, $route
|
||||
// Inject dynamic view
|
||||
var form = GenerateForm;
|
||||
var scope = form.inject(OrganizationForm, {mode: 'add', related: false});
|
||||
var defaultUrl = GetBasePath('organizations');
|
||||
form.reset();
|
||||
|
||||
LoadBreadCrumbs();
|
||||
|
||||
// Save
|
||||
scope.formSave = function() {
|
||||
Rest.setUrl('/api/v1/organizations/');
|
||||
Rest.setUrl(defaultUrl);
|
||||
Rest.post({ name: $scope.name,
|
||||
description: $scope.description })
|
||||
.success( function(data, status, headers, config) {
|
||||
$rootScope.flashMessage = "Your changes were successfully saved!";
|
||||
$location.path('/organizations/' + data.id + '/');
|
||||
$rootScope.flashMessage = "New organization successfully created!";
|
||||
$location.path('/organizations/' + data.id);
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
ProcessErrors(scope, data, status, OrganizationForm,
|
||||
{ hdr: 'Error!', msg: 'Failed to add new location. Post returned status: ' + status });
|
||||
{ hdr: 'Error!', msg: 'Failed to add new organization. Post returned status: ' + status });
|
||||
});
|
||||
};
|
||||
|
||||
@ -106,12 +127,13 @@ function OrganizationsAdd ($scope, $rootScope, $compile, $location, $log, $route
|
||||
}
|
||||
|
||||
OrganizationsAdd.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'OrganizationForm',
|
||||
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ClearScope' ];
|
||||
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ClearScope', 'GetBasePath',
|
||||
'ReturnToCaller' ];
|
||||
|
||||
|
||||
function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, OrganizationForm,
|
||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit,
|
||||
RelatedPaginateInit, Prompt, ClearScope)
|
||||
RelatedPaginateInit, Prompt, ClearScope, GetBasePath)
|
||||
{
|
||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||
//scope.
|
||||
@ -122,22 +144,25 @@ function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $rout
|
||||
var scope = GenerateForm.inject(form, {mode: 'edit', related: true});
|
||||
generator.reset();
|
||||
|
||||
var defaultUrl = '/api/v1/organizations/';
|
||||
var defaultUrl = GetBasePath('organizations');
|
||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||
var master = {};
|
||||
var id = $routeParams.id;
|
||||
var id = $routeParams.organization_id;
|
||||
var relatedSets = {};
|
||||
|
||||
// After the Organization is loaded, retrieve each related set
|
||||
scope.$on('organizationLoaded', function() {
|
||||
if (scope.organizationLoadedRemove) {
|
||||
scope.organizationLoadedRemove();
|
||||
}
|
||||
scope.organizationLoadedRemove = scope.$on('organizationLoaded', function() {
|
||||
for (var set in relatedSets) {
|
||||
scope.search(relatedSets[set].iterator);
|
||||
}
|
||||
});
|
||||
|
||||
// Retrieve detail record and prepopulate the form
|
||||
Rest.setUrl(defaultUrl + ':id/');
|
||||
Rest.get({ params: {id: id} })
|
||||
Rest.setUrl(defaultUrl + id + '/');
|
||||
Rest.get()
|
||||
.success( function(data, status, headers, config) {
|
||||
LoadBreadCrumbs({ path: '/organizations/' + id, title: data.name });
|
||||
for (var fld in form.fields) {
|
||||
@ -169,7 +194,7 @@ function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $rout
|
||||
for (var fld in form.fields) {
|
||||
params[fld] = scope[fld];
|
||||
}
|
||||
Rest.setUrl('/api/v1/organizations/' + $routeParams.id + '/');
|
||||
Rest.setUrl(defaultUrl + id + '/');
|
||||
Rest.put(params)
|
||||
.success( function(data, status, headers, config) {
|
||||
master = params;
|
||||
@ -193,13 +218,13 @@ function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $rout
|
||||
// Related set: Add button
|
||||
scope.add = function(set) {
|
||||
$rootScope.flashMessage = null;
|
||||
$location.path('/' + base + '/' + $routeParams.id + '/' + set);
|
||||
$location.path('/' + base + '/' + $routeParams.organization_id + '/' + set);
|
||||
};
|
||||
|
||||
// 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
|
||||
@ -207,7 +232,7 @@ function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $rout
|
||||
$rootScope.flashMessage = null;
|
||||
|
||||
var action = function() {
|
||||
var url = defaultUrl + id + '/' + set + '/';
|
||||
var url = defaultUrl + $routeParams.organization_id + '/' + set + '/';
|
||||
Rest.setUrl(url);
|
||||
Rest.post({ id: itm_id, disassociate: 1 })
|
||||
.success( function(data, status, headers, config) {
|
||||
@ -231,4 +256,4 @@ function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $rout
|
||||
|
||||
OrganizationsEdit.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'OrganizationForm',
|
||||
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit',
|
||||
'RelatedPaginateInit', 'Prompt', 'ClearScope'];
|
||||
'RelatedPaginateInit', 'Prompt', 'ClearScope', 'GetBasePath'];
|
||||
|
||||
@ -117,21 +117,19 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
}
|
||||
|
||||
scope.toggle_project = function(id) {
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
else {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||
scope[list.iterator + "_" + id + "_class"] = "";
|
||||
//$('input[name="check_' + id + '"]').checked = false;
|
||||
document.getElementById('check_' + id).checked = false;
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||
//$('input[name="check_' + id + '"]').checked = true;
|
||||
document.getElementById('check_' + id).checked = true;
|
||||
if (scope.selected.indexOf(id) == -1) {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,6 +24,17 @@ function TeamsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Ale
|
||||
var scope = view.inject(list, { mode: mode }); // Inject our view
|
||||
scope.selected = [];
|
||||
|
||||
// After a refresh, populate the organization name on each row
|
||||
if (scope.PostRefreshRemove) {
|
||||
scope.PostRefreshRemove();
|
||||
}
|
||||
scope.PostRefershRemove = scope.$on('PostRefresh', function() {
|
||||
for( var i=0; i < scope.teams.length; i++) {
|
||||
scope.teams[i].organization_name = scope.teams[i].summary_fields.organization.name;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//SetTeamListeners({ scope: scope, set: 'teams', iterator: list.iterator });
|
||||
SearchInit({ scope: scope, set: 'teams', list: list, url: defaultUrl });
|
||||
PaginateInit({ scope: scope, list: list, url: defaultUrl });
|
||||
@ -131,21 +142,19 @@ function TeamsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Ale
|
||||
}
|
||||
|
||||
scope.toggle_team = function(id) {
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
else {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||
scope[list.iterator + "_" + id + "_class"] = "";
|
||||
//$('input[name="check_' + id + '"]').checked = false;
|
||||
document.getElementById('check_' + id).checked = false;
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||
//$('input[name="check_' + id + '"]').checked = true;
|
||||
document.getElementById('check_' + id).checked = true;
|
||||
if (scope.selected.indexOf(id) == -1) {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -156,8 +165,8 @@ TeamsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams
|
||||
|
||||
|
||||
function TeamsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, TeamForm,
|
||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
|
||||
GenerateList, OrganizationList, SearchInit, PaginateInit, TeamLookUpOrganizationInit)
|
||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
|
||||
GenerateList, OrganizationList, SearchInit, PaginateInit, TeamLookUpOrganizationInit)
|
||||
{
|
||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||
//scope.
|
||||
@ -180,7 +189,7 @@ function TeamsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
||||
}
|
||||
Rest.post(data)
|
||||
.success( function(data, status, headers, config) {
|
||||
ReturnToCaller();
|
||||
$location.path('/teams/' + data.id);
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
ProcessErrors(scope, data, status, form,
|
||||
@ -202,19 +211,21 @@ TeamsAdd.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$
|
||||
|
||||
function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, TeamForm,
|
||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit,
|
||||
RelatedPaginateInit, ReturnToCaller, ClearScope, TeamLookUpOrganizationInit, Prompt)
|
||||
RelatedPaginateInit, ReturnToCaller, ClearScope, TeamLookUpOrganizationInit, Prompt,
|
||||
GetBasePath)
|
||||
{
|
||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||
//scope.
|
||||
|
||||
var defaultUrl='/api/v1/teams/';
|
||||
var defaultUrl=GetBasePath('teams');
|
||||
var generator = GenerateForm;
|
||||
var form = TeamForm;
|
||||
var scope = generator.inject(form, {mode: 'edit', related: true});
|
||||
generator.reset();
|
||||
|
||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||
var master = {};
|
||||
var id = $routeParams.id;
|
||||
var id = $routeParams.team_id;
|
||||
var relatedSets = {};
|
||||
|
||||
TeamLookUpOrganizationInit({ scope: scope });
|
||||
@ -293,13 +304,13 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
||||
// Related set: Add button
|
||||
scope.add = function(set) {
|
||||
$rootScope.flashMessage = null;
|
||||
$location.path('/' + base + '/' + $routeParams.id + '/' + set);
|
||||
$location.path('/' + base + '/' + $routeParams.team_id + '/' + set);
|
||||
};
|
||||
|
||||
// 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
|
||||
@ -307,7 +318,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
||||
$rootScope.flashMessage = null;
|
||||
|
||||
var action = function() {
|
||||
var url = defaultUrl + id + '/' + set + '/';
|
||||
var url = defaultUrl + $routeParams.team_id + '/' + set + '/';
|
||||
Rest.setUrl(url);
|
||||
Rest.post({ id: itm_id, disassociate: 1 })
|
||||
.success( function(data, status, headers, config) {
|
||||
@ -332,6 +343,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
||||
|
||||
TeamsEdit.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'TeamForm',
|
||||
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit',
|
||||
'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'TeamLookUpOrganizationInit', 'Prompt'
|
||||
'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'TeamLookUpOrganizationInit', 'Prompt',
|
||||
'GetBasePath'
|
||||
];
|
||||
|
||||
@ -20,8 +20,8 @@ function UsersList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
var list = UserList;
|
||||
var defaultUrl = '/api/v1/users/';
|
||||
var view = GenerateList;
|
||||
var paths = $location.path().replace(/^\//,'').split('/');
|
||||
var mode = (paths[0] == 'users') ? 'edit' : 'select'; // if base path 'users', we're here to add/edit users
|
||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||
var mode = (base == 'users') ? 'edit' : 'select'; // if base path 'users', we're here to add/edit users
|
||||
var scope = view.inject(UserList, { mode: mode }); // Inject our view
|
||||
scope.selected = [];
|
||||
|
||||
@ -118,21 +118,19 @@ function UsersList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
}
|
||||
|
||||
scope.toggle_user = function(id) {
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
else {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||
scope[list.iterator + "_" + id + "_class"] = "";
|
||||
//$('input[name="check_' + id + '"]').checked = false;
|
||||
document.getElementById('check_' + id).checked = false;
|
||||
if (scope.selected.indexOf(id) > -1) {
|
||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||
//$('input[name="check_' + id + '"]').checked = true;
|
||||
document.getElementById('check_' + id).checked = true;
|
||||
if (scope.selected.indexOf(id) == -1) {
|
||||
scope.selected.push(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -158,7 +156,7 @@ function UsersAdd ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
||||
|
||||
// Save
|
||||
scope.formSave = function() {
|
||||
Rest.setUrl(defaultUrl + $routeParams.id + '/users/');
|
||||
Rest.setUrl(defaultUrl + $routeParams.organization_id + '/users/');
|
||||
var data = {}
|
||||
for (var fld in form.fields) {
|
||||
data[fld] = scope[fld];
|
||||
@ -183,7 +181,7 @@ function UsersAdd ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
||||
scope.clearPWConfirm = function(fld) {
|
||||
// If password value changes, make sure password_confirm must be re-entered
|
||||
scope[fld] = '';
|
||||
scope[form.name][fld].$setValidity('awpassmatch', false);
|
||||
scope[form.name + '_form'][fld].$setValidity('awpassmatch', false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,20 +191,23 @@ UsersAdd.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$
|
||||
|
||||
function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, UserForm,
|
||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit,
|
||||
RelatedPaginateInit, ReturnToCaller, ClearScope)
|
||||
RelatedPaginateInit, ReturnToCaller, ClearScope, GetBasePath)
|
||||
{
|
||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||
//scope.
|
||||
|
||||
var defaultUrl='/api/v1/users/';
|
||||
var defaultUrl=GetBasePath('users');
|
||||
var generator = GenerateForm;
|
||||
var form = UserForm;
|
||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||
var scope = generator.inject(form, {mode: 'edit', related: true});
|
||||
generator.reset();
|
||||
var master = {};
|
||||
var id = $routeParams.id;
|
||||
var id = $routeParams.user_id;
|
||||
var relatedSets = {};
|
||||
|
||||
console.log('here!');
|
||||
|
||||
// After the Organization is loaded, retrieve each related set
|
||||
scope.$on('userLoaded', function() {
|
||||
for (var set in relatedSets) {
|
||||
@ -248,7 +249,7 @@ function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
||||
|
||||
// Save changes to the parent
|
||||
scope.formSave = function() {
|
||||
Rest.setUrl(defaultUrl + $routeParams.id + '/');
|
||||
Rest.setUrl(defaultUrl + id + '/');
|
||||
var data = {}
|
||||
for (var fld in form.fields) {
|
||||
data[fld] = scope[fld];
|
||||
@ -279,9 +280,47 @@ function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
||||
scope[form.name + '_form'][fld].$setValidity('awpassmatch', false);
|
||||
}
|
||||
|
||||
|
||||
// Related set: Add button
|
||||
scope.add = function(set) {
|
||||
$rootScope.flashMessage = null;
|
||||
$location.path('/' + base + '/' + $routeParams.user_id + '/' + set);
|
||||
};
|
||||
|
||||
// Related set: Edit button
|
||||
scope.edit = function(set, id, name) {
|
||||
$rootScope.flashMessage = null;
|
||||
$location.path('/' + set + '/' + id);
|
||||
};
|
||||
|
||||
// Related set: Delete button
|
||||
scope.delete = function(set, itm_id, name, title) {
|
||||
$rootScope.flashMessage = null;
|
||||
|
||||
var action = function() {
|
||||
var url = defaultUrl + $routeParams.user_id + '/' + set + '/';
|
||||
Rest.setUrl(url);
|
||||
Rest.post({ id: itm_id, disassociate: 1 })
|
||||
.success( function(data, status, headers, config) {
|
||||
$('#prompt-modal').modal('hide');
|
||||
scope.search(form.related[set].iterator);
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
$('#prompt-modal').modal('hide');
|
||||
ProcessErrors(scope, data, status, null,
|
||||
{ hdr: 'Error!', msg: 'Call to ' + url + ' failed. POST returned status: ' + status });
|
||||
});
|
||||
};
|
||||
|
||||
Prompt({ hdr: 'Delete',
|
||||
body: 'Are you sure you want to remove ' + name + ' from ' + scope.name + ' ' + title + '?',
|
||||
action: action
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
UsersEdit.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'UserForm',
|
||||
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit',
|
||||
'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope'];
|
||||
'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'GetBasePath'];
|
||||
|
||||
@ -57,7 +57,8 @@ angular.module('CredentialFormDefinition', [])
|
||||
type: 'textarea',
|
||||
addRequired: false,
|
||||
editRequired: false,
|
||||
rows: 10
|
||||
rows: 10,
|
||||
class: 'span10'
|
||||
},
|
||||
"ssh_key_unlock": {
|
||||
label: 'Key Password',
|
||||
@ -100,25 +101,26 @@ angular.module('CredentialFormDefinition', [])
|
||||
editRequired: false,
|
||||
awPassMatch: true,
|
||||
associated: 'sudo_password'
|
||||
},
|
||||
user: {
|
||||
label: 'User',
|
||||
type: 'lookup',
|
||||
sourceModel: 'user',
|
||||
sourceField: 'username',
|
||||
addRequired: false,
|
||||
editRequired: false,
|
||||
ngClick: 'lookUpUser()'
|
||||
},
|
||||
team: {
|
||||
label: 'Team',
|
||||
type: 'lookup',
|
||||
sourceModel: 'team',
|
||||
sourceField: 'name',
|
||||
addRequired: false,
|
||||
editRequired: false,
|
||||
ngClick: 'lookUpTeam()'
|
||||
}
|
||||
// ,
|
||||
// user: {
|
||||
// label: 'User',
|
||||
// type: 'lookup',
|
||||
// sourceModel: 'user',
|
||||
// sourceField: 'username',
|
||||
// addRequired: false,
|
||||
// editRequired: false,
|
||||
// ngClick: 'lookUpUser()'
|
||||
// },
|
||||
// team: {
|
||||
// label: 'Team',
|
||||
// type: 'lookup',
|
||||
// sourceModel: 'team',
|
||||
// sourceField: 'name',
|
||||
// addRequired: false,
|
||||
// editRequired: false,
|
||||
// ngClick: 'lookUpTeam()'
|
||||
// }
|
||||
},
|
||||
|
||||
buttons: { //for now always generates <button> tags
|
||||
|
||||
@ -158,6 +158,13 @@ angular.module('UserFormDefinition', [])
|
||||
iterator: 'credential',
|
||||
open: false,
|
||||
|
||||
actions: {
|
||||
add: {
|
||||
ngClick: "add('credentials')",
|
||||
icon: 'icon-plus'
|
||||
},
|
||||
},
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
key: true,
|
||||
@ -166,7 +173,20 @@ angular.module('UserFormDefinition', [])
|
||||
description: {
|
||||
label: 'Description'
|
||||
}
|
||||
},
|
||||
|
||||
fieldActions: {
|
||||
edit: {
|
||||
ngClick: "edit('credentials', \{\{ credential.id \}\}, '\{\{ credential.name \}\}')",
|
||||
icon: 'icon-edit'
|
||||
},
|
||||
delete: {
|
||||
ngClick: "delete('credentials', \{\{ credential.id \}\}, '\{\{ credential.name \}\}', 'credentials')",
|
||||
icon: 'icon-remove',
|
||||
class: 'btn-danger'
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
@ -14,7 +14,9 @@ angular.module('CredentialsListDefinition', [])
|
||||
iterator: 'credential',
|
||||
selectTitle: 'Add Credentials',
|
||||
editTitle: 'Credentials',
|
||||
selectInstructions: 'Click on a row to select it, and click Finished when done. Use the green <i class=\"icon-plus\"></i> button to create a new row.',
|
||||
selectInstructions: 'Check the Select checkbox next to each credential to be added, and click Finished when done. Use the green <i class=\"icon-plus\"></i> button to create a new user.',
|
||||
editInstructions: 'Add a new credential record from either the Teams tab or the Users tab. Teams and Users each have an associated set of Credentials.',
|
||||
index: true,
|
||||
index: true,
|
||||
|
||||
fields: {
|
||||
@ -44,7 +46,7 @@ angular.module('CredentialsListDefinition', [])
|
||||
icon: 'icon-plus',
|
||||
mode: 'all', // One of: edit, select, all
|
||||
ngClick: 'addCredential()',
|
||||
basePaths: ['credentials'], // base path must be in list, or action not available
|
||||
basePaths: ['teams','users'], // base path must be in list, or action not available
|
||||
class: 'btn-success',
|
||||
awToolTip: 'Create a new credential'
|
||||
}
|
||||
|
||||
@ -141,7 +141,8 @@ angular.module('ListGenerator', ['GeneratorHelpers',])
|
||||
html += "<div class=\"list-actions\">\n";
|
||||
for (action in list.actions) {
|
||||
if (list.actions[action].mode == 'all' || list.actions[action].mode == options.mode) {
|
||||
if ( (list.basePaths == undefined) || (list.basePaths && list.basePaths.indexOf(base) > -1) ) {
|
||||
if ( (list.actions[action].basePaths == undefined) ||
|
||||
(list.actions[action].basePaths && list.actions[action].basePaths.indexOf(base) > -1) ) {
|
||||
html += "<button " + this.attr(list.actions[action], 'ngClick') +
|
||||
"class=\"btn btn-small " + list.actions[action].class + "\" ";
|
||||
html += (list.actions[action].awToolTip) ? this.attr(list.actions[action],'awToolTip') : "";
|
||||
|
||||
@ -204,7 +204,13 @@
|
||||
<script>
|
||||
$('a[data-toggle="tab"]').on('show', function (e) {
|
||||
var url = $(e.target).text();
|
||||
window.location = '#/' + url.toLowerCase().replace(/ /g,'_');
|
||||
var regx = new RegExp('/\#\/' + url.toLowerCase().replace(/ /g,'_') + '/');
|
||||
|
||||
var loc = window.location.toString();
|
||||
if (! regx.test(loc)) {
|
||||
console.log('change! ' + window.location.toString());
|
||||
window.location = '#/' + url.toLowerCase().replace(/ /g,'_');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user