Better upstreamUri error feedback

This commit is contained in:
Johannes Zellner
2022-10-06 19:50:47 +02:00
parent 458e02c0a0
commit 2f8bf0e825
2 changed files with 14 additions and 0 deletions
+7
View File
@@ -178,6 +178,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat
submit: function () {
$scope.applinksEdit.busyEdit = true;
$scope.applinksEdit.error = {};
var accessRestriction = null;
if ($scope.applinksEdit.accessRestrictionOption === 'groups') {
@@ -204,6 +205,12 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat
Client.updateApplink($scope.applinksEdit.id, data, function (error) {
$scope.applinksEdit.busyEdit = false;
if (error && error.statusCode === 400 && error.message.includes('upstreamUri')) {
$scope.applinksEdit.error.upstreamUri = error.message;
$scope.applinksEditForm.$setUntouched();
$scope.applinksEditForm.$setPristine();
return;
}
if (error) return console.error('Failed to update applink', error);
Client.refreshInstalledApps();
+7
View File
@@ -637,6 +637,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$tran
if (!$scope.applinksAdd.upstreamUri) return;
$scope.applinksAdd.busy = true;
$scope.applinksAdd.error = {};
var accessRestriction = null;
if ($scope.applinksAdd.accessRestrictionOption === 'groups') {
@@ -655,6 +656,12 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$tran
Client.addApplink(data, function (error) {
$scope.applinksAdd.busy = false;
if (error && error.statusCode === 400 && error.message.includes('upstreamUri')) {
$scope.applinksAdd.error.upstreamUri = error.message;
$scope.applinksAddForm.$setUntouched();
$scope.applinksAddForm.$setPristine();
return;
}
if (error) return console.error('Failed to add applink', error);
// wait for dialog to be fully closed to avoid modal behavior breakage when moving to a different view already