Add initial support to add applinks

This commit is contained in:
Johannes Zellner
2022-07-07 13:32:20 +02:00
parent c8da53fc80
commit c0a4e9e5bd
4 changed files with 134 additions and 34 deletions

View File

@@ -89,6 +89,32 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat
}
};
$scope.applinksAdd = {
error: {},
busy: false,
upstreamUri: '',
show: function () {
$scope.applinksAdd.error = {};
$scope.applinksAdd.busy = false;
$scope.applinksAdd.upstreamUri = '';
$('#applinksAddModal').modal('show');
return false; // prevent propagation and default
},
submit: function () {
if (!$scope.applinksAdd.upstreamUri) return;
Client.addApplink({ upstreamUri: $scope.applinksAdd.upstreamUri }, function (error, result) {
if (error) return console.error('Failed to add applink', error);
$('#applinksAddModal').modal('hide');
});
}
};
$scope.showAppConfigure = function (app, view) {
$location.path('/app/' + app.id + '/' + view);
};
@@ -136,6 +162,13 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat
});
});
// setup all the dialog focus handling
['applinksAddModal'].forEach(function (id) {
$('#' + id).on('shown.bs.modal', function () {
$(this).find("[autofocus]:first").focus();
});
});
$('.collapse').on('shown.bs.collapse', function(){
$(this).parent().find('.fa-angle-right').removeClass('fa-angle-right').addClass('fa-angle-down');
}).on('hidden.bs.collapse', function(){