mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 19:51:08 -03:30
Fixes to teams/project/organizations/users/credentials navigation and pathing.
This commit is contained in:
@@ -134,20 +134,20 @@ angular.module('ansible', [
|
|||||||
when('/organizations/add', { templateUrl: urlPrefix + 'partials/organizations.html',
|
when('/organizations/add', { templateUrl: urlPrefix + 'partials/organizations.html',
|
||||||
controller: OrganizationsAdd }).
|
controller: OrganizationsAdd }).
|
||||||
|
|
||||||
when('/organizations/:id', { templateUrl: urlPrefix + 'partials/organizations.html',
|
when('/organizations/:organization_id', { templateUrl: urlPrefix + 'partials/organizations.html',
|
||||||
controller: OrganizationsEdit }).
|
controller: OrganizationsEdit }).
|
||||||
|
|
||||||
when('/organizations/:id/admins', { templateUrl: urlPrefix + 'partials/organizations.html',
|
when('/organizations/:organization_id/admins', { templateUrl: urlPrefix + 'partials/organizations.html',
|
||||||
controller: AdminsList }).
|
controller: AdminsList }).
|
||||||
|
|
||||||
when('/organizations/:id/users', { templateUrl: urlPrefix + 'partials/users.html',
|
when('/organizations/:organization_id/users', { templateUrl: urlPrefix + 'partials/users.html',
|
||||||
controller: UsersList }).
|
controller: UsersList }).
|
||||||
|
|
||||||
when('/organizations/:id/users/add', { templateUrl: urlPrefix + 'partials/users.html',
|
when('/organizations/:organization_id/users/add', { templateUrl: urlPrefix + 'partials/users.html',
|
||||||
controller: UsersAdd }).
|
controller: UsersAdd }).
|
||||||
|
|
||||||
when('/organizations/:organization_id/users/:id', { templateUrl: urlPrefix + 'partials/users.html',
|
when('/organizations/:organization_id/users/:user_id', { templateUrl: urlPrefix + 'partials/users.html',
|
||||||
controller: UsersEdit }).
|
controller: UsersEdit }).
|
||||||
|
|
||||||
when('/teams', { templateUrl: urlPrefix + 'partials/teams.html',
|
when('/teams', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||||
controller: TeamsList }).
|
controller: TeamsList }).
|
||||||
@@ -155,23 +155,29 @@ angular.module('ansible', [
|
|||||||
when('/teams/add', { templateUrl: urlPrefix + 'partials/teams.html',
|
when('/teams/add', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||||
controller: TeamsAdd }).
|
controller: TeamsAdd }).
|
||||||
|
|
||||||
when('/teams/:id', { templateUrl: urlPrefix + 'partials/teams.html',
|
when('/teams/:team_id', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||||
controller: TeamsEdit }).
|
controller: TeamsEdit }).
|
||||||
|
|
||||||
when('/teams/:id/users', { templateUrl: urlPrefix + 'partials/teams.html',
|
when('/teams/:team_id/users', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||||
controller: UsersList }).
|
controller: UsersList }).
|
||||||
|
|
||||||
when('/teams/:organization_id/users/:id', { templateUrl: urlPrefix + 'partials/teams.html',
|
when('/teams/:team_id/users/:user_id', { templateUrl: urlPrefix + 'partials/teams.html',
|
||||||
controller: UsersEdit }).
|
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',
|
when('/credentials', { templateUrl: urlPrefix + 'partials/credentials.html',
|
||||||
controller: CredentialsList }).
|
controller: CredentialsList }).
|
||||||
|
|
||||||
when('/credentials/add', { templateUrl: urlPrefix + 'partials/credentials.html',
|
when('/credentials/:credential_id', { templateUrl: urlPrefix + 'partials/credentials.html',
|
||||||
controller: CredentialsAdd }).
|
controller: CredentialsEdit }).
|
||||||
|
|
||||||
when('/credentials/:id', { templateUrl: urlPrefix + 'partials/credentials.html',
|
|
||||||
controller: CredentialsEdit }).
|
|
||||||
|
|
||||||
when('/users', { templateUrl: urlPrefix + 'partials/users.html',
|
when('/users', { templateUrl: urlPrefix + 'partials/users.html',
|
||||||
controller: UsersList }).
|
controller: UsersList }).
|
||||||
@@ -179,8 +185,17 @@ angular.module('ansible', [
|
|||||||
when('/users/add', { templateUrl: urlPrefix + 'partials/users.html',
|
when('/users/add', { templateUrl: urlPrefix + 'partials/users.html',
|
||||||
controller: UsersAdd }).
|
controller: UsersAdd }).
|
||||||
|
|
||||||
when('/users/:id', { templateUrl: urlPrefix + 'partials/users.html',
|
when('/users/:user_id', { templateUrl: urlPrefix + 'partials/users.html',
|
||||||
controller: UsersEdit }).
|
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 }).
|
when('/login', { templateUrl: urlPrefix + 'partials/login-dialog.html', controller: Authenticate }).
|
||||||
|
|
||||||
|
|||||||
@@ -12,12 +12,11 @@
|
|||||||
|
|
||||||
function AdminsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
function AdminsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||||
Alert, AdminList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit,
|
Alert, AdminList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit,
|
||||||
ReturnToCaller)
|
ReturnToCaller,GetBasePath)
|
||||||
{
|
{
|
||||||
var list = AdminList;
|
var list = AdminList;
|
||||||
var defaultUrl = '/api/v1' + '/organizations/' + $routeParams.id + '/users/' ;
|
var defaultUrl = GetBasePath('organizations') + $routeParams.organization_id + '/users/' ;
|
||||||
var view = GenerateList;
|
var view = GenerateList;
|
||||||
//var paths = $location.path().replace(/^\//,'').split('/');
|
|
||||||
var mode = 'select';
|
var mode = 'select';
|
||||||
var scope = view.inject(AdminList, { mode: mode }); // Inject our view
|
var scope = view.inject(AdminList, { mode: mode }); // Inject our view
|
||||||
scope.selected = [];
|
scope.selected = [];
|
||||||
@@ -29,8 +28,8 @@ function AdminsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
LoadBreadCrumbs();
|
LoadBreadCrumbs();
|
||||||
|
|
||||||
scope.finishSelection = function() {
|
scope.finishSelection = function() {
|
||||||
Rest.setUrl('/api/v1' + $location.path() + '/'); // We're assuming the path matches the api path.
|
var url = GetBasePath('organizations') + $routeParams.organization_id + '/admins/'
|
||||||
// Will this always be true??
|
Rest.setUrl(url);
|
||||||
scope.queue = [];
|
scope.queue = [];
|
||||||
|
|
||||||
scope.$on('callFinished', function() {
|
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++) {
|
for (var i=0; i < scope.queue.length; i++) {
|
||||||
if (scope.queue[i].result == 'error') {
|
if (scope.queue[i].result == 'error') {
|
||||||
errors++;
|
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) {
|
if (errors > 0) {
|
||||||
@@ -85,30 +77,28 @@ function AdminsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
returnToCaller();
|
ReturnToCaller(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.toggle_admin = function(id) {
|
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") {
|
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||||
scope[list.iterator + "_" + id + "_class"] = "";
|
scope[list.iterator + "_" + id + "_class"] = "";
|
||||||
//$('input[name="check_' + id + '"]').checked = false;
|
|
||||||
document.getElementById('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 {
|
else {
|
||||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||||
//$('input[name="check_' + id + '"]').checked = true;
|
|
||||||
document.getElementById('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',
|
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) {
|
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") {
|
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||||
scope[list.iterator + "_" + id + "_class"] = "";
|
scope[list.iterator + "_" + id + "_class"] = "";
|
||||||
//$('input[name="check_' + id + '"]').checked = false;
|
|
||||||
document.getElementById('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 {
|
else {
|
||||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||||
//$('input[name="check_' + id + '"]').checked = true;
|
|
||||||
document.getElementById('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 form = CredentialForm;
|
||||||
var generator = GenerateForm;
|
var generator = GenerateForm;
|
||||||
var scope = generator.inject(form, {mode: 'add', related: false});
|
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();
|
generator.reset();
|
||||||
LoadBreadCrumbs();
|
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
|
// Save
|
||||||
scope.formSave = function() {
|
scope.formSave = function() {
|
||||||
Rest.setUrl(defaultUrl);
|
Rest.setUrl(defaultUrl);
|
||||||
var data = {}
|
var data = {}
|
||||||
for (var fld in form.fields) {
|
for (var fld in form.fields) {
|
||||||
data[fld] = scope[fld];
|
data[fld] = scope[fld];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (base == 'teams') {
|
||||||
|
data['team'] = $routeParams.team_id;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
data['user'] = $routeParams.user_id;
|
||||||
|
}
|
||||||
|
|
||||||
Rest.post(data)
|
Rest.post(data)
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
ReturnToCaller();
|
ReturnToCaller(1);
|
||||||
})
|
})
|
||||||
.error( function(data, status, headers, config) {
|
.error( function(data, status, headers, config) {
|
||||||
ProcessErrors(scope, data, status, form,
|
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,
|
function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, CredentialForm,
|
||||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit,
|
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit,
|
||||||
RelatedPaginateInit, ReturnToCaller, ClearScope, LookUpInit,
|
RelatedPaginateInit, ReturnToCaller, ClearScope, Prompt, GetBasePath)
|
||||||
UserList, TeamList, Prompt, GetBasePath)
|
|
||||||
{
|
{
|
||||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
//scope.
|
//scope.
|
||||||
@@ -241,26 +233,13 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
var scope = generator.inject(form, {mode: 'edit', related: true});
|
var scope = generator.inject(form, {mode: 'edit', related: true});
|
||||||
generator.reset();
|
generator.reset();
|
||||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||||
|
var defaultUrl = GetBasePath('credentials');
|
||||||
|
|
||||||
var master = {};
|
var master = {};
|
||||||
var id = $routeParams.id;
|
var id = $routeParams.credential_id;
|
||||||
var relatedSets = {};
|
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() {
|
function setAskCheckboxes() {
|
||||||
for (var fld in form.fields) {
|
for (var fld in form.fields) {
|
||||||
if (form.fields[fld].type == 'password' && form.fields[fld].ask && scope[fld] == 'ASK') {
|
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
|
// 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) {
|
for (var set in relatedSets) {
|
||||||
scope.search(relatedSets[set].iterator);
|
scope.search(relatedSets[set].iterator);
|
||||||
}
|
}
|
||||||
@@ -287,20 +269,17 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
Rest.setUrl(defaultUrl + ':id/');
|
Rest.setUrl(defaultUrl + ':id/');
|
||||||
Rest.get({ params: {id: id} })
|
Rest.get({ params: {id: id} })
|
||||||
.success( function(data, status, headers, config) {
|
.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) {
|
for (var fld in form.fields) {
|
||||||
if (data[fld]) {
|
if (data[fld]) {
|
||||||
scope[fld] = data[fld];
|
scope[fld] = data[fld];
|
||||||
master[fld] = scope[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;
|
var related = data.related;
|
||||||
for (var set in form.related) {
|
for (var set in form.related) {
|
||||||
if (related[set]) {
|
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 });
|
{ hdr: 'Error!', msg: 'Failed to retrieve Credential: ' + $routeParams.id + '. GET status: ' + status });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Save changes to the parent
|
// Save changes to the parent
|
||||||
scope.formSave = function() {
|
scope.formSave = function() {
|
||||||
Rest.setUrl(defaultUrl + $routeParams.id + '/');
|
Rest.setUrl(defaultUrl + id + '/');
|
||||||
var data = {}
|
var data = {}
|
||||||
for (var fld in form.fields) {
|
for (var fld in form.fields) {
|
||||||
data[fld] = scope[fld];
|
data[fld] = scope[fld];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data.team = scope.team;
|
||||||
|
data.user = scope.user;
|
||||||
|
|
||||||
Rest.put(data)
|
Rest.put(data)
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
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',
|
CredentialsEdit.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'CredentialForm',
|
||||||
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit',
|
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit',
|
||||||
'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'LookUpInit', 'UserList', 'TeamList',
|
'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'Prompt', 'GetBasePath' ];
|
||||||
'Prompt', 'GetBasePath' ];
|
|
||||||
|
|
||||||
@@ -121,21 +121,19 @@ function GroupsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
}
|
}
|
||||||
|
|
||||||
scope.toggle_group = function(id) {
|
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") {
|
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||||
scope[list.iterator + "_" + id + "_class"] = "";
|
scope[list.iterator + "_" + id + "_class"] = "";
|
||||||
//$('input[name="check_' + id + '"]').checked = false;
|
|
||||||
document.getElementById('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 {
|
else {
|
||||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||||
//$('input[name="check_' + id + '"]').checked = true;
|
|
||||||
document.getElementById('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) {
|
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") {
|
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||||
scope[list.iterator + "_" + id + "_class"] = "";
|
scope[list.iterator + "_" + id + "_class"] = "";
|
||||||
//$('input[name="check_' + id + '"]').checked = false;
|
|
||||||
document.getElementById('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 {
|
else {
|
||||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||||
//$('input[name="check_' + id + '"]').checked = true;
|
|
||||||
document.getElementById('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) {
|
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") {
|
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||||
scope[list.iterator + "_" + id + "_class"] = "";
|
scope[list.iterator + "_" + id + "_class"] = "";
|
||||||
//$('input[name="check_' + id + '"]').checked = false;
|
|
||||||
document.getElementById('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 {
|
else {
|
||||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||||
//$('input[name="check_' + id + '"]').checked = true;
|
|
||||||
document.getElementById('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) {
|
scope.toggle_job_template = function(id) {
|
||||||
if (scope.selected.indexOf(id) > -1) {
|
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||||
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"] = "";
|
scope[list.iterator + "_" + id + "_class"] = "";
|
||||||
//$('input[name="check_' + id + '"]').checked = false;
|
|
||||||
document.getElementById('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 {
|
else {
|
||||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||||
//$('input[name="check_' + id + '"]').checked = true;
|
|
||||||
document.getElementById('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';
|
'use strict';
|
||||||
|
|
||||||
function OrganizationsList ($scope, $rootScope, $location, $log, Rest, Alert, LoadBreadCrumbs, Prompt,
|
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
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
//scope.
|
//scope.
|
||||||
@@ -21,7 +22,7 @@ function OrganizationsList ($scope, $rootScope, $location, $log, Rest, Alert, Lo
|
|||||||
var paths = $location.path().replace(/^\//,'').split('/');
|
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 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 scope = generate.inject(OrganizationList, { mode: mode }); // Inject our view
|
||||||
var defaultUrl = '/api/v1/organizations/';
|
var defaultUrl = GetBasePath('organizations');
|
||||||
var iterator = list.iterator;
|
var iterator = list.iterator;
|
||||||
$rootScope.flashMessage = null;
|
$rootScope.flashMessage = null;
|
||||||
|
|
||||||
@@ -64,14 +65,33 @@ function OrganizationsList ($scope, $rootScope, $location, $log, Rest, Alert, Lo
|
|||||||
action: action
|
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',
|
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,
|
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
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
//scope.
|
//scope.
|
||||||
@@ -79,22 +99,23 @@ function OrganizationsAdd ($scope, $rootScope, $compile, $location, $log, $route
|
|||||||
// Inject dynamic view
|
// Inject dynamic view
|
||||||
var form = GenerateForm;
|
var form = GenerateForm;
|
||||||
var scope = form.inject(OrganizationForm, {mode: 'add', related: false});
|
var scope = form.inject(OrganizationForm, {mode: 'add', related: false});
|
||||||
|
var defaultUrl = GetBasePath('organizations');
|
||||||
form.reset();
|
form.reset();
|
||||||
|
|
||||||
LoadBreadCrumbs();
|
LoadBreadCrumbs();
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
scope.formSave = function() {
|
scope.formSave = function() {
|
||||||
Rest.setUrl('/api/v1/organizations/');
|
Rest.setUrl(defaultUrl);
|
||||||
Rest.post({ name: $scope.name,
|
Rest.post({ name: $scope.name,
|
||||||
description: $scope.description })
|
description: $scope.description })
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
$rootScope.flashMessage = "Your changes were successfully saved!";
|
$rootScope.flashMessage = "New organization successfully created!";
|
||||||
$location.path('/organizations/' + data.id + '/');
|
$location.path('/organizations/' + data.id);
|
||||||
})
|
})
|
||||||
.error( function(data, status, headers, config) {
|
.error( function(data, status, headers, config) {
|
||||||
ProcessErrors(scope, data, status, OrganizationForm,
|
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',
|
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,
|
function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, OrganizationForm,
|
||||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit,
|
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
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
//scope.
|
//scope.
|
||||||
@@ -122,22 +144,25 @@ function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $rout
|
|||||||
var scope = GenerateForm.inject(form, {mode: 'edit', related: true});
|
var scope = GenerateForm.inject(form, {mode: 'edit', related: true});
|
||||||
generator.reset();
|
generator.reset();
|
||||||
|
|
||||||
var defaultUrl = '/api/v1/organizations/';
|
var defaultUrl = GetBasePath('organizations');
|
||||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||||
var master = {};
|
var master = {};
|
||||||
var id = $routeParams.id;
|
var id = $routeParams.organization_id;
|
||||||
var relatedSets = {};
|
var relatedSets = {};
|
||||||
|
|
||||||
// After the Organization is loaded, retrieve each related set
|
// 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) {
|
for (var set in relatedSets) {
|
||||||
scope.search(relatedSets[set].iterator);
|
scope.search(relatedSets[set].iterator);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Retrieve detail record and prepopulate the form
|
// Retrieve detail record and prepopulate the form
|
||||||
Rest.setUrl(defaultUrl + ':id/');
|
Rest.setUrl(defaultUrl + id + '/');
|
||||||
Rest.get({ params: {id: id} })
|
Rest.get()
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
LoadBreadCrumbs({ path: '/organizations/' + id, title: data.name });
|
LoadBreadCrumbs({ path: '/organizations/' + id, title: data.name });
|
||||||
for (var fld in form.fields) {
|
for (var fld in form.fields) {
|
||||||
@@ -169,7 +194,7 @@ function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $rout
|
|||||||
for (var fld in form.fields) {
|
for (var fld in form.fields) {
|
||||||
params[fld] = scope[fld];
|
params[fld] = scope[fld];
|
||||||
}
|
}
|
||||||
Rest.setUrl('/api/v1/organizations/' + $routeParams.id + '/');
|
Rest.setUrl(defaultUrl + id + '/');
|
||||||
Rest.put(params)
|
Rest.put(params)
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
master = params;
|
master = params;
|
||||||
@@ -193,13 +218,13 @@ function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $rout
|
|||||||
// Related set: Add button
|
// Related set: Add button
|
||||||
scope.add = function(set) {
|
scope.add = function(set) {
|
||||||
$rootScope.flashMessage = null;
|
$rootScope.flashMessage = null;
|
||||||
$location.path('/' + base + '/' + $routeParams.id + '/' + set);
|
$location.path('/' + base + '/' + $routeParams.organization_id + '/' + set);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Related set: Edit button
|
// Related set: Edit button
|
||||||
scope.edit = function(set, id, name) {
|
scope.edit = function(set, id, name) {
|
||||||
$rootScope.flashMessage = null;
|
$rootScope.flashMessage = null;
|
||||||
$location.path('/' + base + '/' + $routeParams.id + '/' + set + '/' + id);
|
$location.path('/' + set + '/' + id);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Related set: Delete button
|
// Related set: Delete button
|
||||||
@@ -207,7 +232,7 @@ function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $rout
|
|||||||
$rootScope.flashMessage = null;
|
$rootScope.flashMessage = null;
|
||||||
|
|
||||||
var action = function() {
|
var action = function() {
|
||||||
var url = defaultUrl + id + '/' + set + '/';
|
var url = defaultUrl + $routeParams.organization_id + '/' + set + '/';
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.post({ id: itm_id, disassociate: 1 })
|
Rest.post({ id: itm_id, disassociate: 1 })
|
||||||
.success( function(data, status, headers, config) {
|
.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',
|
OrganizationsEdit.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'OrganizationForm',
|
||||||
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit',
|
'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) {
|
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") {
|
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||||
scope[list.iterator + "_" + id + "_class"] = "";
|
scope[list.iterator + "_" + id + "_class"] = "";
|
||||||
//$('input[name="check_' + id + '"]').checked = false;
|
|
||||||
document.getElementById('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 {
|
else {
|
||||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||||
//$('input[name="check_' + id + '"]').checked = true;
|
|
||||||
document.getElementById('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
|
var scope = view.inject(list, { mode: mode }); // Inject our view
|
||||||
scope.selected = [];
|
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 });
|
//SetTeamListeners({ scope: scope, set: 'teams', iterator: list.iterator });
|
||||||
SearchInit({ scope: scope, set: 'teams', list: list, url: defaultUrl });
|
SearchInit({ scope: scope, set: 'teams', list: list, url: defaultUrl });
|
||||||
PaginateInit({ scope: scope, 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) {
|
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") {
|
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||||
scope[list.iterator + "_" + id + "_class"] = "";
|
scope[list.iterator + "_" + id + "_class"] = "";
|
||||||
//$('input[name="check_' + id + '"]').checked = false;
|
|
||||||
document.getElementById('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 {
|
else {
|
||||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||||
//$('input[name="check_' + id + '"]').checked = true;
|
|
||||||
document.getElementById('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,
|
function TeamsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, TeamForm,
|
||||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
|
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
|
||||||
GenerateList, OrganizationList, SearchInit, PaginateInit, TeamLookUpOrganizationInit)
|
GenerateList, OrganizationList, SearchInit, PaginateInit, TeamLookUpOrganizationInit)
|
||||||
{
|
{
|
||||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
//scope.
|
//scope.
|
||||||
@@ -180,7 +189,7 @@ function TeamsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
|||||||
}
|
}
|
||||||
Rest.post(data)
|
Rest.post(data)
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
ReturnToCaller();
|
$location.path('/teams/' + data.id);
|
||||||
})
|
})
|
||||||
.error( function(data, status, headers, config) {
|
.error( function(data, status, headers, config) {
|
||||||
ProcessErrors(scope, data, status, form,
|
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,
|
function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, TeamForm,
|
||||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit,
|
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
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
//scope.
|
//scope.
|
||||||
|
|
||||||
var defaultUrl='/api/v1/teams/';
|
var defaultUrl=GetBasePath('teams');
|
||||||
var generator = GenerateForm;
|
var generator = GenerateForm;
|
||||||
var form = TeamForm;
|
var form = TeamForm;
|
||||||
var scope = generator.inject(form, {mode: 'edit', related: true});
|
var scope = generator.inject(form, {mode: 'edit', related: true});
|
||||||
generator.reset();
|
generator.reset();
|
||||||
|
|
||||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||||
var master = {};
|
var master = {};
|
||||||
var id = $routeParams.id;
|
var id = $routeParams.team_id;
|
||||||
var relatedSets = {};
|
var relatedSets = {};
|
||||||
|
|
||||||
TeamLookUpOrganizationInit({ scope: scope });
|
TeamLookUpOrganizationInit({ scope: scope });
|
||||||
@@ -293,13 +304,13 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
|||||||
// Related set: Add button
|
// Related set: Add button
|
||||||
scope.add = function(set) {
|
scope.add = function(set) {
|
||||||
$rootScope.flashMessage = null;
|
$rootScope.flashMessage = null;
|
||||||
$location.path('/' + base + '/' + $routeParams.id + '/' + set);
|
$location.path('/' + base + '/' + $routeParams.team_id + '/' + set);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Related set: Edit button
|
// Related set: Edit button
|
||||||
scope.edit = function(set, id, name) {
|
scope.edit = function(set, id, name) {
|
||||||
$rootScope.flashMessage = null;
|
$rootScope.flashMessage = null;
|
||||||
$location.path('/' + base + '/' + $routeParams.id + '/' + set + '/' + id);
|
$location.path('/' + set + '/' + id);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Related set: Delete button
|
// Related set: Delete button
|
||||||
@@ -307,7 +318,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
|||||||
$rootScope.flashMessage = null;
|
$rootScope.flashMessage = null;
|
||||||
|
|
||||||
var action = function() {
|
var action = function() {
|
||||||
var url = defaultUrl + id + '/' + set + '/';
|
var url = defaultUrl + $routeParams.team_id + '/' + set + '/';
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.post({ id: itm_id, disassociate: 1 })
|
Rest.post({ id: itm_id, disassociate: 1 })
|
||||||
.success( function(data, status, headers, config) {
|
.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',
|
TeamsEdit.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'TeamForm',
|
||||||
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit',
|
'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 list = UserList;
|
||||||
var defaultUrl = '/api/v1/users/';
|
var defaultUrl = '/api/v1/users/';
|
||||||
var view = GenerateList;
|
var view = GenerateList;
|
||||||
var paths = $location.path().replace(/^\//,'').split('/');
|
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||||
var mode = (paths[0] == 'users') ? 'edit' : 'select'; // if base path 'users', we're here to add/edit users
|
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
|
var scope = view.inject(UserList, { mode: mode }); // Inject our view
|
||||||
scope.selected = [];
|
scope.selected = [];
|
||||||
|
|
||||||
@@ -118,21 +118,19 @@ function UsersList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
}
|
}
|
||||||
|
|
||||||
scope.toggle_user = function(id) {
|
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") {
|
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
||||||
scope[list.iterator + "_" + id + "_class"] = "";
|
scope[list.iterator + "_" + id + "_class"] = "";
|
||||||
//$('input[name="check_' + id + '"]').checked = false;
|
|
||||||
document.getElementById('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 {
|
else {
|
||||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
scope[list.iterator + "_" + id + "_class"] = "success";
|
||||||
//$('input[name="check_' + id + '"]').checked = true;
|
|
||||||
document.getElementById('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
|
// Save
|
||||||
scope.formSave = function() {
|
scope.formSave = function() {
|
||||||
Rest.setUrl(defaultUrl + $routeParams.id + '/users/');
|
Rest.setUrl(defaultUrl + $routeParams.organization_id + '/users/');
|
||||||
var data = {}
|
var data = {}
|
||||||
for (var fld in form.fields) {
|
for (var fld in form.fields) {
|
||||||
data[fld] = scope[fld];
|
data[fld] = scope[fld];
|
||||||
@@ -183,7 +181,7 @@ function UsersAdd ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
|||||||
scope.clearPWConfirm = function(fld) {
|
scope.clearPWConfirm = function(fld) {
|
||||||
// If password value changes, make sure password_confirm must be re-entered
|
// If password value changes, make sure password_confirm must be re-entered
|
||||||
scope[fld] = '';
|
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,
|
function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, UserForm,
|
||||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit,
|
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
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
//scope.
|
//scope.
|
||||||
|
|
||||||
var defaultUrl='/api/v1/users/';
|
var defaultUrl=GetBasePath('users');
|
||||||
var generator = GenerateForm;
|
var generator = GenerateForm;
|
||||||
var form = UserForm;
|
var form = UserForm;
|
||||||
|
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||||
var scope = generator.inject(form, {mode: 'edit', related: true});
|
var scope = generator.inject(form, {mode: 'edit', related: true});
|
||||||
generator.reset();
|
generator.reset();
|
||||||
var master = {};
|
var master = {};
|
||||||
var id = $routeParams.id;
|
var id = $routeParams.user_id;
|
||||||
var relatedSets = {};
|
var relatedSets = {};
|
||||||
|
|
||||||
|
console.log('here!');
|
||||||
|
|
||||||
// After the Organization is loaded, retrieve each related set
|
// After the Organization is loaded, retrieve each related set
|
||||||
scope.$on('userLoaded', function() {
|
scope.$on('userLoaded', function() {
|
||||||
for (var set in relatedSets) {
|
for (var set in relatedSets) {
|
||||||
@@ -248,7 +249,7 @@ function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
|||||||
|
|
||||||
// Save changes to the parent
|
// Save changes to the parent
|
||||||
scope.formSave = function() {
|
scope.formSave = function() {
|
||||||
Rest.setUrl(defaultUrl + $routeParams.id + '/');
|
Rest.setUrl(defaultUrl + id + '/');
|
||||||
var data = {}
|
var data = {}
|
||||||
for (var fld in form.fields) {
|
for (var fld in form.fields) {
|
||||||
data[fld] = scope[fld];
|
data[fld] = scope[fld];
|
||||||
@@ -279,9 +280,47 @@ function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
|||||||
scope[form.name + '_form'][fld].$setValidity('awpassmatch', false);
|
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',
|
UsersEdit.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'UserForm',
|
||||||
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit',
|
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit',
|
||||||
'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope'];
|
'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'GetBasePath'];
|
||||||
|
|
||||||
@@ -57,7 +57,8 @@ angular.module('CredentialFormDefinition', [])
|
|||||||
type: 'textarea',
|
type: 'textarea',
|
||||||
addRequired: false,
|
addRequired: false,
|
||||||
editRequired: false,
|
editRequired: false,
|
||||||
rows: 10
|
rows: 10,
|
||||||
|
class: 'span10'
|
||||||
},
|
},
|
||||||
"ssh_key_unlock": {
|
"ssh_key_unlock": {
|
||||||
label: 'Key Password',
|
label: 'Key Password',
|
||||||
@@ -100,25 +101,26 @@ angular.module('CredentialFormDefinition', [])
|
|||||||
editRequired: false,
|
editRequired: false,
|
||||||
awPassMatch: true,
|
awPassMatch: true,
|
||||||
associated: 'sudo_password'
|
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
|
buttons: { //for now always generates <button> tags
|
||||||
|
|||||||
@@ -158,6 +158,13 @@ angular.module('UserFormDefinition', [])
|
|||||||
iterator: 'credential',
|
iterator: 'credential',
|
||||||
open: false,
|
open: false,
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
add: {
|
||||||
|
ngClick: "add('credentials')",
|
||||||
|
icon: 'icon-plus'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
fields: {
|
fields: {
|
||||||
name: {
|
name: {
|
||||||
key: true,
|
key: true,
|
||||||
@@ -166,7 +173,20 @@ angular.module('UserFormDefinition', [])
|
|||||||
description: {
|
description: {
|
||||||
label: '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',
|
iterator: 'credential',
|
||||||
selectTitle: 'Add Credentials',
|
selectTitle: 'Add Credentials',
|
||||||
editTitle: '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,
|
index: true,
|
||||||
|
|
||||||
fields: {
|
fields: {
|
||||||
@@ -44,7 +46,7 @@ angular.module('CredentialsListDefinition', [])
|
|||||||
icon: 'icon-plus',
|
icon: 'icon-plus',
|
||||||
mode: 'all', // One of: edit, select, all
|
mode: 'all', // One of: edit, select, all
|
||||||
ngClick: 'addCredential()',
|
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',
|
class: 'btn-success',
|
||||||
awToolTip: 'Create a new credential'
|
awToolTip: 'Create a new credential'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,7 +141,8 @@ angular.module('ListGenerator', ['GeneratorHelpers',])
|
|||||||
html += "<div class=\"list-actions\">\n";
|
html += "<div class=\"list-actions\">\n";
|
||||||
for (action in list.actions) {
|
for (action in list.actions) {
|
||||||
if (list.actions[action].mode == 'all' || list.actions[action].mode == options.mode) {
|
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') +
|
html += "<button " + this.attr(list.actions[action], 'ngClick') +
|
||||||
"class=\"btn btn-small " + list.actions[action].class + "\" ";
|
"class=\"btn btn-small " + list.actions[action].class + "\" ";
|
||||||
html += (list.actions[action].awToolTip) ? this.attr(list.actions[action],'awToolTip') : "";
|
html += (list.actions[action].awToolTip) ? this.attr(list.actions[action],'awToolTip') : "";
|
||||||
|
|||||||
@@ -204,7 +204,13 @@
|
|||||||
<script>
|
<script>
|
||||||
$('a[data-toggle="tab"]').on('show', function (e) {
|
$('a[data-toggle="tab"]').on('show', function (e) {
|
||||||
var url = $(e.target).text();
|
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>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user