Skip to content

Commit

Permalink
Upgrade AngularJS to 1.8.0 (#322)
Browse files Browse the repository at this point in the history
* Roll AngularJS forward to 1.7.9, update return signature for all uses of .then()

* Roll AngularJS forward to 1.8.0
  • Loading branch information
bodom0015 authored Aug 5, 2020
1 parent 35cd723 commit 2977159
Show file tree
Hide file tree
Showing 17 changed files with 4,526 additions and 4,789 deletions.
4 changes: 2 additions & 2 deletions dashboard/DashboardModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ angular.module('ndslabs', [ 'navbar', 'footer', 'ndslabs-services', 'ndslabs-fil

// Every so often, check that our token is still valid
var checkToken = function() {
NdsLabsApi.getCheck_token().then(function() { $log.debug('Token is still valid.'); }, function() {
NdsLabsApi.getCheckToken().then(function() { $log.debug('Token is still valid.'); }, function() {
$log.error('Token expired, redirecting to login.');
terminateSession();
});
Expand All @@ -150,7 +150,7 @@ angular.module('ndslabs', [ 'navbar', 'footer', 'ndslabs-services', 'ndslabs-fil
if (token) {
authInfo.get().token = token;
authInfo.get().namespace = $cookies.get('namespace', CookieOptions);
NdsLabsApi.getRefresh_token().then(function() {
NdsLabsApi.getRefreshToken().then(function() {
$log.debug('Token refreshed: ' + authInfo.get().token);
Loading.set(ServerData.populateAll(authInfo.get().namespace));

Expand Down
3 changes: 2 additions & 1 deletion dashboard/catalog/CatalogController.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ angular
});

// Install this app to etcd
return NdsLabsApi.postStacks({ 'stack': app }).then(function(stack, xhr) {
return NdsLabsApi.postStacks({ 'stack': app }).then(function(response) {
var stack = response.data;
$log.debug("successfully posted to /projects/" + projectId + "/stacks!");

Analytics.trackEvent('application', 'add', spec.key, 1, true);
Expand Down
2 changes: 1 addition & 1 deletion dashboard/catalog/addOrEdit/AddOrEditSpecController.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ angular
});

var method = $scope.editingSpec ? 'putServicesByServiceId' : 'postServices';
return NdsLabsApi[method]({ service: spec, serviceId: spec.key }).then(function(data) {
return NdsLabsApi[method]({ service: spec, serviceId: spec.key }).then(function(response) {
// TODO: Only populate changed spec?
Specs.populate().then(function() {
$location.path('/store');
Expand Down
10 changes: 5 additions & 5 deletions dashboard/dashboard/DashboardController.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ angular
// Then send the "start" command to the API server
return NdsLabsApi.getStartByStackId({
'stackId': stack.id
}).then(function(data, xhr) {
}).then(function(response) {
$log.debug('successfully started ' + stack.name);
Analytics.trackEvent('application', 'launch', stack.key, 1, true);
}, function(headers) {
Expand Down Expand Up @@ -132,7 +132,7 @@ angular
// Then send the "stop" command to the API server
return NdsLabsApi.getStopByStackId({
'stackId': stack.id
}).then(function(data, xhr) {
}).then(function(response) {
$log.debug('successfully stopped ' + stack.name);
Analytics.trackEvent('application', 'shutdown', stack.key, 1, true);
}, function(headers) {
Expand All @@ -157,7 +157,7 @@ angular
return NdsLabsApi.putStacksByStackId({
'stack': stack,
'stackId': stack.id
}).then(function(data, xhr) {
}).then(function(response) {
$log.debug('successfully removed service ' + svc.service + ' from stack ' + stack.name);
}, function(headers) {
$log.error('failed to remove service ' + svc.service + ' from stack ' + stack.name);
Expand Down Expand Up @@ -222,7 +222,7 @@ angular
return NdsLabsApi.putStacksByStackId({
'stack': stk,
'stackId': stack.id
}).then(function(data, xhr) {
}).then(function(response) {
$log.debug('successfully set secure == ' + secure + ' on stack id ' + stk.id);
stack.secure = stk.secure;
}, function(headers) {
Expand Down Expand Up @@ -256,7 +256,7 @@ angular
// Delete the stack
return NdsLabsApi.deleteStacksByStackId({
'stackId': stack.id
}).then(function(data, xhr) {
}).then(function(response) {
$log.debug('successfully deleted stack: ' + stack.name);
Analytics.trackEvent('application', 'delete', stack.key, 1, true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ angular
});

// Now populate the default values of each property
NdsLabsApi.getConfigs({ 'services': [ service.service ] }).then(function(data, headers) {
NdsLabsApi.getConfigs({ 'services': [ service.service ] }).then(function(response) {
var data = response.data;
angular.forEach(data[service.service], function(cfg) {
var config = _.find($scope.configs, [ 'name', cfg.name ]);
config.defaultValue = cfg.value;
Expand Down
4 changes: 2 additions & 2 deletions dashboard/dashboard/modals/logViewer/LogViewerController.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ angular
($scope.refreshLog = function() {
NdsLabsApi.getLogsByStackServiceId({
'stackServiceId': service.id
}).then(function(data, xhr) {
}).then(function(response) {
$log.debug('successfully grabbed logs for serviceId ' + service.id);
$scope.serviceLog = data;
$scope.serviceLog = response.data;
//$scope.gotoAnchor('bottom');
}, function(headers) {
$log.error('error grabbing logs for service ' + service.id);
Expand Down
4 changes: 2 additions & 2 deletions landing/LandingModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ angular
// TODO: Move this logic to the LoginModule
if ($scope.user && $scope.token) {
$scope.verified = null;
NdsLabsApi.putRegisterVerify({ verify: { u: $scope.user, t: $scope.token } }).then(function(data) {
console.debug(data);
NdsLabsApi.putRegisterVerify({ verify: { u: $scope.user, t: $scope.token } }).then(function(response) {
console.debug(response.data);
$scope.verified = true;
}, function(response) {
$log.error("Failed to verify user " + $scope.user + ":" + $scope.token);
Expand Down
5 changes: 3 additions & 2 deletions landing/help/HelpController.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ angular

$scope.productName = ProductName;

NdsLabsApi.getContact().then(function(contact) {
NdsLabsApi.getContact().then(function(response) {
var contact = response.data;
$scope.support = contact;

$scope.links = [
Expand Down Expand Up @@ -66,7 +67,7 @@ angular
}

$scope.status = "sending";
return NdsLabsApi.postSupport({ support: $scope.request }).then(function(data) {
return NdsLabsApi.postSupport({ support: $scope.request }).then(function(response) {
$scope.resetForm();
$scope.forms.supportForm.messageField.$pristine = true;
$scope.status = "sent";
Expand Down
4 changes: 2 additions & 2 deletions landing/swagger/SwaggerController.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ angular
$scope.productName = ProductName;
$scope.swaggerSpec = '';

$http.get(url).then(function(data) {
$http.get(url).then(function(response) {
$log.debug("Successfully pulled swagger spec");
$scope.swaggerSpec = data.data;
$scope.swaggerSpec = response.data.data;
}, function(response) {
$log.error("Failed to retrieve swagger spec");
});
Expand Down
6 changes: 3 additions & 3 deletions login/static/LoginController.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ angular
"username": $scope.settings.namespace,
"password": $scope.settings.password
}
}).then(function(data, xhr) {
}).then(function(response) {
$scope.errorMessage = '';

// TODO: cauth server should set this for us, but doesn't seem to be working
// FIXME: parameterize domain or connect to cauth endpoint
$cookies.put('namespace', $scope.settings.namespace, CookieOptions);
$cookies.put('token', data.token, CookieOptions);
$cookies.put('token', response.data.token, CookieOptions);

$log.debug("Logged in!");
//getProject();
Expand Down Expand Up @@ -103,7 +103,7 @@ angular
$log.debug("Logging out!");

// TODO: DELETE /authenticate to delete a token in the backend?
//NdsLabsApi.deleteAuthenticate().then(function(data, xhr) {
//NdsLabsApi.deleteAuthenticate().then(function(response) {
$scope.errorMessage = '';
$scope.progressMessage = '';
$log.debug("Logging out!");
Expand Down
10 changes: 5 additions & 5 deletions login/static/reset/ResetPasswordController.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ angular
return;
}

NdsLabsApi.postReset({ userId: $scope.password.accountId }).then(function(data) {
console.debug(data);
NdsLabsApi.postReset({ userId: $scope.password.accountId }).then(function(response) {
console.debug(response.data);
$scope.resetSendSuccessful = true;
}, function(response) {
$log.error("Failed to send password reset link");
Expand All @@ -68,10 +68,10 @@ angular
}

// TODO: What is the correct API call here?
NdsLabsApi.putChange_password({ password: {
NdsLabsApi.putChangePassword({ password: {
password: $scope.password.password,
}}).then(function(data) {
console.debug(data);
}}).then(function(response) {
console.debug(response.data);
$scope.resetSuccessful = true;
$scope.resetForms();
}, function(response) {
Expand Down
2 changes: 1 addition & 1 deletion login/static/signUp/SignUpController.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ angular
account.nexturl = $routeParams.rd;
}

return NdsLabsApi.postRegister({ 'account': account }).then(function(data, xhr) {
return NdsLabsApi.postRegister({ 'account': account }).then(function(response) {
$scope.errorMessage = '';
$scope.showVerify = true;
}, function(response) {
Expand Down
Loading

0 comments on commit 2977159

Please sign in to comment.