AC-1006 upgraded all js libraries to latest release. Fixed obvious broken things. Installed bower to make package installation/upgrade easier. Added less to Grunt build.

This commit is contained in:
Chris Houseknecht
2014-02-12 18:24:30 +00:00
committed by Chris Houseknecht
parent d25e712e21
commit e81d02885f
960 changed files with 112155 additions and 35865 deletions
+166 -223
View File
@@ -13,7 +13,7 @@ function CredentialsList($scope, $rootScope, $location, $log, $routeParams, Rest
GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller,
ClearScope, ProcessErrors, GetBasePath, SelectionInit, GetChoices, Wait, Stream) {
ClearScope('htmlTemplate');
ClearScope();
Wait('start');
@@ -21,66 +21,64 @@ function CredentialsList($scope, $rootScope, $location, $log, $routeParams, Rest
defaultUrl = GetBasePath('credentials'),
view = GenerateList,
base = $location.path().replace(/^\//, '').split('/')[0],
mode = (base === 'credentials') ? 'edit' : 'select', // if base path 'credentials', we're here to add/edit
scope = view.inject(list, { mode: mode }),
mode = (base === 'credentials') ? 'edit' : 'select',
url;
view.inject(list, { mode: mode, scope: $scope });
scope.selected = [];
scope.credentialLoading = true;
$scope.selected = [];
$scope.credentialLoading = true;
url = GetBasePath(base) + ( (base === 'users') ? $routeParams.user_id + '/credentials/' : $routeParams.team_id + '/credentials/' );
SelectionInit({
scope: scope,
list: list,
url: url,
returnToCaller: 1
});
if (scope.removePostRefresh) {
scope.removePostRefresh();
if (mode === 'select') {
SelectionInit({ scope: $scope, list: list, url: url, returnToCaller: 1 });
}
scope.removePostRefresh = scope.$on('PostRefresh', function () {
if ($scope.removePostRefresh) {
$scope.removePostRefresh();
}
$scope.removePostRefresh = $scope.$on('PostRefresh', function () {
// Cleanup after a delete
var i, j;
Wait('stop');
$('#prompt-modal').off();
list.fields.kind.searchOptions = scope.credential_kind_options;
list.fields.kind.searchOptions = $scope.credential_kind_options;
// Translate the kind value
for (i = 0; i < scope.credentials.length; i++) {
for (j = 0; j < scope.credential_kind_options.length; j++) {
if (scope.credential_kind_options[j].value === scope.credentials[i].kind) {
scope.credentials[i].kind = scope.credential_kind_options[j].label;
for (i = 0; i < $scope.credentials.length; i++) {
for (j = 0; j < $scope.credential_kind_options.length; j++) {
if ($scope.credential_kind_options[j].value === $scope.credentials[i].kind) {
$scope.credentials[i].kind = $scope.credential_kind_options[j].label;
break;
}
}
}
});
if (scope.removeChoicesReady) {
scope.removeChoicesReady();
if ($scope.removeChoicesReady) {
$scope.removeChoicesReady();
}
scope.removeChoicesReady = scope.$on('choicesReadyCredential', function () {
$scope.removeChoicesReady = $scope.$on('choicesReadyCredential', function () {
SearchInit({
scope: scope,
scope: $scope,
set: 'credentials',
list: list,
url: defaultUrl
});
PaginateInit({
scope: scope,
scope: $scope,
list: list,
url: defaultUrl
});
scope.search(list.iterator);
$scope.search(list.iterator);
});
// Load the list of options for Kind
GetChoices({
scope: scope,
scope: $scope,
url: defaultUrl,
field: 'kind',
variable: 'credential_kind_options',
@@ -90,21 +88,19 @@ function CredentialsList($scope, $rootScope, $location, $log, $routeParams, Rest
LoadBreadCrumbs();
scope.showActivity = function () {
Stream({
scope: scope
});
$scope.showActivity = function () {
Stream({ scope: $scope });
};
scope.addCredential = function () {
$scope.addCredential = function () {
$location.path($location.path() + '/add');
};
scope.editCredential = function (id) {
$scope.editCredential = function (id) {
$location.path($location.path() + '/' + id);
};
scope.deleteCredential = function (id, name) {
$scope.deleteCredential = function (id, name) {
var action = function () {
$('#prompt-modal').on('hidden.bs.modal', function () {
@@ -115,14 +111,11 @@ function CredentialsList($scope, $rootScope, $location, $log, $routeParams, Rest
Rest.setUrl(url);
Rest.destroy()
.success(function () {
scope.search(list.iterator);
$scope.search(list.iterator);
})
.error(function (data, status) {
Wait('stop');
ProcessErrors(scope, data, status, null, {
hdr: 'Error!',
msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status
});
ProcessErrors($scope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status });
});
};
@@ -135,39 +128,37 @@ function CredentialsList($scope, $rootScope, $location, $log, $routeParams, Rest
}
CredentialsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'CredentialList', 'GenerateList',
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
'GetBasePath', 'SelectionInit', 'GetChoices', 'Wait', 'Stream'
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath',
'SelectionInit', 'GetChoices', 'Wait', 'Stream'
];
function CredentialsAdd($scope, $rootScope, $compile, $location, $log, $routeParams, CredentialForm,
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
GenerateList, SearchInit, PaginateInit, LookUpInit, UserList, TeamList, GetBasePath,
GetChoices, Empty, KindChange, OwnerChange, FormSave) {
ClearScope('tree-form');
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
//scope.
function CredentialsAdd($scope, $rootScope, $compile, $location, $log, $routeParams, CredentialForm, GenerateForm, Rest, Alert,
ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, GenerateList, SearchInit, PaginateInit, LookUpInit, UserList, TeamList,
GetBasePath, GetChoices, Empty, KindChange, OwnerChange, FormSave) {
ClearScope();
// Inject dynamic view
var form = CredentialForm,
generator = GenerateForm,
scope = generator.inject(form, { mode: 'add', related: false }),
defaultUrl = GetBasePath('credentials'),
url;
generator.inject(form, { mode: 'add', related: false, scope: $scope });
generator.reset();
LoadBreadCrumbs();
// Load the list of options for Kind
GetChoices({
scope: scope,
scope: $scope,
url: defaultUrl,
field: 'kind',
variable: 'credential_kind_options'
});
LookUpInit({
scope: scope,
scope: $scope,
form: form,
current_item: (!Empty($routeParams.user_id)) ? $routeParams.user_id : null,
list: UserList,
@@ -175,7 +166,7 @@ function CredentialsAdd($scope, $rootScope, $compile, $location, $log, $routePar
});
LookUpInit({
scope: scope,
scope: $scope,
form: form,
current_item: (!Empty($routeParams.team_id)) ? $routeParams.team_id : null,
list: TeamList,
@@ -184,200 +175,172 @@ function CredentialsAdd($scope, $rootScope, $compile, $location, $log, $routePar
if (!Empty($routeParams.user_id)) {
// Get the username based on incoming route
scope.owner = 'user';
scope.user = $routeParams.user_id;
OwnerChange({
scope: scope
});
$scope.owner = 'user';
$scope.user = $routeParams.user_id;
OwnerChange({ scope: $scope });
url = GetBasePath('users') + $routeParams.user_id + '/';
Rest.setUrl(url);
Rest.get()
.success(function (data) {
scope.user_username = data.username;
$scope.user_username = data.username;
})
.error(function (data, status) {
ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve user. GET status: ' + status
});
ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve user. GET status: ' + status });
});
} else if (!Empty($routeParams.team_id)) {
// Get the username based on incoming route
scope.owner = 'team';
scope.team = $routeParams.team_id;
OwnerChange({
scope: scope
});
$scope.owner = 'team';
$scope.team = $routeParams.team_id;
OwnerChange({ scope: $scope });
url = GetBasePath('teams') + $routeParams.team_id + '/';
Rest.setUrl(url);
Rest.get()
.success(function (data) {
scope.team_name = data.name;
$scope.team_name = data.name;
})
.error(function (data, status) {
ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve team. GET status: ' + status
});
ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve team. GET status: ' + status });
});
} else {
// default type of owner to a user
scope.owner = 'user';
OwnerChange({
scope: scope
});
$scope.owner = 'user';
OwnerChange({ scope: $scope });
}
// Handle Kind change
scope.kindChange = function () {
KindChange({
scope: scope,
form: form,
reset: true
});
$scope.kindChange = function () {
KindChange({ scope: $scope, form: form, reset: true });
};
// Save
scope.formSave = function () {
$scope.formSave = function () {
generator.clearApiErrors();
FormSave({
scope: scope,
mode: 'add'
});
FormSave({ scope: $scope, mode: 'add' });
};
// Handle Owner change
scope.ownerChange = function () {
OwnerChange({
scope: scope
});
$scope.ownerChange = function () {
OwnerChange({ scope: $scope });
};
// Reset defaults
scope.formReset = function () {
$scope.formReset = function () {
generator.reset();
//DebugForm({ form: CredentialForm, scope: scope });
};
// Password change
scope.clearPWConfirm = function (fld) {
$scope.clearPWConfirm = function (fld) {
// If password value changes, make sure password_confirm must be re-entered
scope[fld] = '';
scope[form.name + '_form'][fld].$setValidity('awpassmatch', false);
$scope[fld] = '';
$scope[form.name + '_form'][fld].$setValidity('awpassmatch', false);
};
// Respond to 'Ask at runtime?' checkbox
scope.ask = function (fld, associated) {
if (scope[fld + '_ask']) {
scope[fld] = 'ASK';
scope[associated] = '';
scope[form.name + '_form'][associated].$setValidity('awpassmatch', true);
$scope.ask = function (fld, associated) {
if ($scope[fld + '_ask']) {
$scope[fld] = 'ASK';
$scope[associated] = '';
$scope[form.name + '_form'][associated].$setValidity('awpassmatch', true);
} else {
scope[fld] = '';
scope[associated] = '';
scope[form.name + '_form'][associated].$setValidity('awpassmatch', true);
$scope[fld] = '';
$scope[associated] = '';
$scope[form.name + '_form'][associated].$setValidity('awpassmatch', true);
}
};
// Click clear button
scope.clear = function (fld, associated) {
scope[fld] = '';
scope[associated] = '';
scope[form.name + '_form'][associated].$setValidity('awpassmatch', true);
scope[form.name + '_form'].$setDirty();
$scope.clear = function (fld, associated) {
$scope[fld] = '';
$scope[associated] = '';
$scope[form.name + '_form'][associated].$setValidity('awpassmatch', true);
$scope[form.name + '_form'].$setDirty();
};
}
CredentialsAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'CredentialForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'GenerateList',
'SearchInit', 'PaginateInit', 'LookUpInit', 'UserList', 'TeamList', 'GetBasePath', 'GetChoices', 'Empty',
'KindChange', 'OwnerChange', 'FormSave'
'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'GenerateList', 'SearchInit', 'PaginateInit',
'LookUpInit', 'UserList', 'TeamList', 'GetBasePath', 'GetChoices', 'Empty', 'KindChange', 'OwnerChange', 'FormSave'
];
function CredentialsEdit($scope, $rootScope, $compile, $location, $log, $routeParams, CredentialForm,
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit,
RelatedPaginateInit, ReturnToCaller, ClearScope, Prompt, GetBasePath, GetChoices,
KindChange, UserList, TeamList, LookUpInit, Empty, OwnerChange, FormSave, Stream,
Wait
) {
function CredentialsEdit($scope, $rootScope, $compile, $location, $log, $routeParams, CredentialForm, GenerateForm, Rest, Alert,
ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, Prompt, GetBasePath, GetChoices,
KindChange, UserList, TeamList, LookUpInit, Empty, OwnerChange, FormSave, Stream, Wait) {
ClearScope('htmlTemplate');
ClearScope();
var defaultUrl = GetBasePath('credentials'),
generator = GenerateForm,
form = CredentialForm,
scope = generator.inject(form, { mode: 'edit', related: true }),
base = $location.path().replace(/^\//, '').split('/')[0],
master = {},
id = $routeParams.credential_id;
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
generator.reset();
scope.id = id;
$scope.id = id;
function setAskCheckboxes() {
var fld, i;
for (fld in form.fields) {
if (form.fields[fld].type === 'password' && scope[fld] === 'ASK') {
if (form.fields[fld].type === 'password' && $scope[fld] === 'ASK') {
// turn on 'ask' checkbox for password fields with value of 'ASK'
$("#" + fld + "-clear-btn").attr("disabled", "disabled");
scope[fld + '_ask'] = true;
$scope[fld + '_ask'] = true;
} else {
scope[fld + '_ask'] = false;
$scope[fld + '_ask'] = false;
$("#" + fld + "-clear-btn").removeAttr("disabled");
}
master[fld + '_ask'] = scope[fld + '_ask'];
master[fld + '_ask'] = $scope[fld + '_ask'];
}
// Set kind field to the correct option
for (i = 0; i < scope.credential_kind_options.length; i++) {
if (scope.kind === scope.credential_kind_options[i].value) {
scope.kind = scope.credential_kind_options[i];
for (i = 0; i < $scope.credential_kind_options.length; i++) {
if ($scope.kind === $scope.credential_kind_options[i].value) {
$scope.kind = $scope.credential_kind_options[i];
break;
}
}
}
if (scope.removeCredentialLoaded) {
scope.removeCredentialLoaded();
if ($scope.removeCredentialLoaded) {
$scope.removeCredentialLoaded();
}
scope.removeCredentialLoaded = scope.$on('credentialLoaded', function () {
$scope.removeCredentialLoaded = $scope.$on('credentialLoaded', function () {
LookUpInit({
scope: scope,
scope: $scope,
form: form,
current_item: (!Empty($scope.user_id)) ? scope.user_id : null,
current_item: (!Empty($scope.user_id)) ? $scope.user_id : null,
list: UserList,
field: 'user'
});
LookUpInit({
scope: scope,
scope: $scope,
form: form,
current_item: (!Empty($scope.team_id)) ? scope.team_id : null,
current_item: (!Empty($scope.team_id)) ? $scope.team_id : null,
list: TeamList,
field: 'team'
});
setAskCheckboxes();
KindChange({
scope: scope,
scope: $scope,
form: form,
reset: false
});
OwnerChange({
scope: scope
});
OwnerChange({ scope: $scope });
Wait('stop');
});
if (scope.removeChoicesReady) {
scope.removeChoicesReady();
if ($scope.removeChoicesReady) {
$scope.removeChoicesReady();
}
scope.removeChoicesReady = scope.$on('choicesReadyCredential', function () {
$scope.removeChoicesReady = $scope.$on('choicesReadyCredential', function () {
// Retrieve detail record and prepopulate the form
Rest.setUrl(defaultUrl + ':id/');
Rest.get({
params: {
id: id
}
})
Rest.get({ params: { id: id } })
.success(function (data) {
var i, fld;
@@ -389,131 +352,112 @@ function CredentialsEdit($scope, $rootScope, $compile, $location, $log, $routePa
for (fld in form.fields) {
if (data[fld] !== null && data[fld] !== undefined) {
scope[fld] = data[fld];
master[fld] = scope[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] =
$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];
$scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField];
}
}
if (!Empty(scope.user)) {
scope.owner = 'user';
if (!Empty($scope.user)) {
$scope.owner = 'user';
} else {
scope.owner = 'team';
$scope.owner = 'team';
}
master.owner = scope.owner;
master.owner = $scope.owner;
for (i = 0; i < scope.credential_kind_options.length; i++) {
if (scope.credential_kind_options[i].value === data.kind) {
scope.kind = scope.credential_kind_options[i];
for (i = 0; i < $scope.credential_kind_options.length; i++) {
if ($scope.credential_kind_options[i].value === data.kind) {
$scope.kind = $scope.credential_kind_options[i];
break;
}
}
master.kind = scope.kind;
master.kind = $scope.kind;
switch (data.kind) {
case 'aws':
scope.access_key = data.username;
scope.secret_key = data.password;
master.access_key = scope.access_key;
master.secret_key = scope.secret_key;
$scope.access_key = data.username;
$scope.secret_key = data.password;
master.access_key = $scope.access_key;
master.secret_key = $scope.secret_key;
break;
case 'ssh':
scope.ssh_password = data.password;
master.ssh_password = scope.ssh_password;
$scope.ssh_password = data.password;
master.ssh_password = $scope.ssh_password;
break;
case 'rax':
scope.api_key = data.password;
master.api_key = scope.api_key;
$scope.api_key = data.password;
master.api_key = $scope.api_key;
break;
}
scope.$emit('credentialLoaded');
$scope.$emit('credentialLoaded');
})
.error(function (data, status) {
ProcessErrors(scope, data, status, form, {
hdr: 'Error!',
msg: 'Failed to retrieve Credential: ' + $routeParams.id + '. GET status: ' + status
});
ProcessErrors($scope, data, status, form, { hdr: 'Error!',
msg: 'Failed to retrieve Credential: ' + $routeParams.id + '. GET status: ' + status });
});
});
Wait('start');
GetChoices({
scope: scope,
scope: $scope,
url: defaultUrl,
field: 'kind',
variable: 'credential_kind_options',
callback: 'choicesReadyCredential'
});
scope.showActivity = function () {
Stream({
scope: scope
});
$scope.showActivity = function () {
Stream({ scope: $scope });
};
// Save changes to the parent
scope.formSave = function () {
$scope.formSave = function () {
generator.clearApiErrors();
FormSave({
scope: scope,
mode: 'edit'
});
FormSave({ scope: $scope, mode: 'edit' });
};
// Handle Owner change
scope.ownerChange = function () {
OwnerChange({
scope: scope
});
$scope.ownerChange = function () {
OwnerChange({ scope: $scope });
};
// Handle Kind change
scope.kindChange = function () {
KindChange({
scope: scope,
form: form,
reset: true
});
$scope.kindChange = function () {
KindChange({ scope: $scope, form: form, reset: true });
};
// Cancel
scope.formReset = function () {
$scope.formReset = function () {
generator.reset();
for (var fld in master) {
scope[fld] = master[fld];
$scope[fld] = master[fld];
}
setAskCheckboxes();
KindChange({
scope: scope,
form: form,
reset: false
});
OwnerChange({
scope: scope
});
KindChange({ scope: $scope, form: form, reset: false });
OwnerChange({ scope: $scope });
};
// Related set: Add button
scope.add = function (set) {
$scope.add = function (set) {
$rootScope.flashMessage = null;
$location.path('/' + base + '/' + $routeParams.id + '/' + set + '/add');
};
// Related set: Edit button
scope.edit = function (set, id) {
$scope.edit = function (set, id) {
$rootScope.flashMessage = null;
$location.path('/' + base + '/' + $routeParams.id + '/' + set + '/' + id);
};
// Related set: Delete button
scope['delete'] = function (set, itm_id, name, title) {
$scope['delete'] = function (set, itm_id, name, title) {
$rootScope.flashMessage = null;
var action = function () {
@@ -525,12 +469,11 @@ function CredentialsEdit($scope, $rootScope, $compile, $location, $log, $routePa
})
.success(function () {
$('#prompt-modal').modal('hide');
scope.search(form.related[set].iterator);
$scope.search(form.related[set].iterator);
})
.error(function (data, status) {
$('#prompt-modal').modal('hide');
ProcessErrors(scope, data, status, null, {
hdr: 'Error!',
ProcessErrors($scope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + url + ' failed. POST returned status: ' + status
});
});
@@ -538,39 +481,39 @@ function CredentialsEdit($scope, $rootScope, $compile, $location, $log, $routePa
Prompt({
hdr: 'Delete',
body: 'Are you sure you want to remove ' + name + ' from ' + scope.name + ' ' + title + '?',
body: 'Are you sure you want to remove ' + name + ' from ' + $scope.name + ' ' + title + '?',
action: action
});
};
// Password change
scope.clearPWConfirm = function (fld) {
$scope.clearPWConfirm = function (fld) {
// If password value changes, make sure password_confirm must be re-entered
scope[fld] = '';
scope[form.name + '_form'][fld].$setValidity('awpassmatch', false);
$scope[fld] = '';
$scope[form.name + '_form'][fld].$setValidity('awpassmatch', false);
};
// Respond to 'Ask at runtime?' checkbox
scope.ask = function (fld, associated) {
if (scope[fld + '_ask']) {
$scope.ask = function (fld, associated) {
if ($scope[fld + '_ask']) {
$("#" + fld + "-clear-btn").attr("disabled", "disabled");
scope[fld] = 'ASK';
scope[associated] = '';
scope[form.name + '_form'][associated].$setValidity('awpassmatch', true);
$scope[fld] = 'ASK';
$scope[associated] = '';
$scope[form.name + '_form'][associated].$setValidity('awpassmatch', true);
} else {
$("#" + fld + "-clear-btn").removeAttr("disabled");
scope[fld] = '';
scope[associated] = '';
scope[form.name + '_form'][associated].$setValidity('awpassmatch', true);
$scope[fld] = '';
$scope[associated] = '';
$scope[form.name + '_form'][associated].$setValidity('awpassmatch', true);
}
};
scope.clear = function (fld, associated) {
scope[fld] = '';
scope[associated] = '';
scope[form.name + '_form'][associated].$setValidity('awpassmatch', true);
scope[form.name + '_form'].$setDirty();
$scope.clear = function (fld, associated) {
$scope[fld] = '';
$scope[associated] = '';
$scope[form.name + '_form'][associated].$setValidity('awpassmatch', true);
$scope[form.name + '_form'].$setDirty();
};
}