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
+10
View File
@@ -45,6 +45,11 @@
<input type="text" class="form-control" ng-model="applinksAdd.upstreamUri" name="upstreamUri" id="inputUpstreamUri" autofocus autocomplete="off" required>
</div>
<div class="form-group">
<label class="control-label">Label</label>
<input type="text" class="form-control" ng-model="applinksAdd.label" name="label" id="inputLabel" autocomplete="off" placeholder="Leave empty for autodetection">
</div>
<input class="ng-hide" type="submit" ng-disabled="applinksAddForm.$invalid || applinksAdd.busy"/>
</form>
</div>
@@ -70,6 +75,11 @@
<input type="text" class="form-control" ng-model="applinksEdit.upstreamUri" name="upstreamUri" id="inputUpstreamUri" autofocus autocomplete="off" required>
</div>
<div class="form-group">
<label class="control-label">Label</label>
<input type="text" class="form-control" ng-model="applinksEdit.label" name="label" id="inputLabel" autocomplete="off">
</div>
<input class="ng-hide" type="submit" ng-disabled="applinksEditForm.$invalid || applinksEdit.busyEdit || applinks.busyRemove"/>
</form>
</div>
+17 -3
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();
});