Support setting applink label

This commit is contained in:
Johannes Zellner
2022-07-07 18:53:14 +02:00
parent 85288714ab
commit 7aec21d830
3 changed files with 28 additions and 8 deletions

View File

@@ -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();
});