diff --git a/src/js/client.js b/src/js/client.js index 0df0e607c..2a6dc889d 100644 --- a/src/js/client.js +++ b/src/js/client.js @@ -1868,11 +1868,7 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout }; Client.prototype.addApplink = function (applink, callback) { - var data = { - upstreamUri: applink.upstreamUri - }; - - post('/api/v1/applinks', data, null, function (error, data, status) { + post('/api/v1/applinks', applink, null, function (error, data, status) { if (error) return callback(error); if (status !== 201) return callback(new ClientError(status, data)); diff --git a/src/views/apps.html b/src/views/apps.html index ea5aca1e1..b70981875 100644 --- a/src/views/apps.html +++ b/src/views/apps.html @@ -45,6 +45,11 @@ +
+ + +
+ @@ -70,6 +75,11 @@ +
+ + +
+ diff --git a/src/views/apps.js b/src/views/apps.js index 11b535687..0b3211f63 100644 --- a/src/views/apps.js +++ b/src/views/apps.js @@ -93,11 +93,13 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat error: {}, busy: false, upstreamUri: '', + label: '', show: function () { $scope.applinksAdd.error = {}; $scope.applinksAdd.busy = false; $scope.applinksAdd.upstreamUri = ''; + $scope.applinksAdd.label = ''; $scope.applinksAddForm.$setUntouched(); $scope.applinksAddForm.$setPristine(); @@ -110,7 +112,16 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat submit: function () { if (!$scope.applinksAdd.upstreamUri) return; - Client.addApplink({ upstreamUri: $scope.applinksAdd.upstreamUri }, function (error, result) { + $scope.applinksAdd.busy = true; + + var data = { + upstreamUri: $scope.applinksAdd.upstreamUri, + label: $scope.applinksAdd.label + }; + + Client.addApplink(data, function (error) { + $scope.applinksAdd.busy = false; + if (error) return console.error('Failed to add applink', error); Client.refreshInstalledApps(); @@ -126,6 +137,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat busyRemove: false, id: '', upstreamUri: '', + label: '', show: function (applink) { $scope.applinksEdit.error = {}; @@ -133,6 +145,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat $scope.applinksEdit.busyRemove = false; $scope.applinksEdit.id = applink.id; $scope.applinksEdit.upstreamUri = applink.upstreamUri; + $scope.applinksEdit.label = applink.label; $scope.applinksEditForm.$setUntouched(); $scope.applinksEditForm.$setPristine(); @@ -146,7 +159,8 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat $scope.applinksEdit.busyEdit = true; var data = { - upstreamUri: $scope.applinksEdit.upstreamUri + upstreamUri: $scope.applinksEdit.upstreamUri, + label: $scope.applinksEdit.label }; Client.updateApplink($scope.applinksEdit.id, data, function (error) { @@ -223,7 +237,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat }); // setup all the dialog focus handling - ['applinksAddModal'].forEach(function (id) { + ['applinksAddModal', 'applinksEditModal'].forEach(function (id) { $('#' + id).on('shown.bs.modal', function () { $(this).find("[autofocus]:first").focus(); });