various app password ui fixes

This commit is contained in:
Girish Ramakrishnan
2020-03-05 20:02:27 -08:00
parent 4d35fde8ba
commit 854281417d
2 changed files with 11 additions and 12 deletions
+9 -10
View File
@@ -396,13 +396,11 @@ angular.module('Application').controller('ProfileController', ['$scope', '$locat
if (error) console.error(error);
$scope.appPassword.passwords = result.appPasswords || [];
$scope.appPassword.identifiers = [
{ id: 'mail', label: 'Email' },
// { id: 'webadmin', label: 'Web Admin'}
];
$scope.appPassword.identifiers = [];
var appsById = {};
$scope.apps.forEach(function (app) {
if (!app.manifest.addons || !app.manifest.addons.ldap) return;
// ignore apps without ldap or with email
if (!app.manifest.addons || !app.manifest.addons.ldap || app.manifest.addons.email || !app.sso) return;
appsById[app.id] = app;
if (app.label) {
@@ -411,17 +409,18 @@ angular.module('Application').controller('ProfileController', ['$scope', '$locat
$scope.appPassword.identifiers.push({ id: app.id, label: app.fqdn });
}
});
$scope.appPassword.identifiers.push({ id: 'mail', label: 'Mail client' });
// setup prettyIdentifier for the UI
// setup label for the table UI
$scope.appPassword.passwords.forEach(function (password) {
if (password.identifier === 'mail') return password.prettyIdentifier = password.identifier;
if (password.identifier === 'mail') return password.label = password.identifier;
var app = appsById[password.identifier];
if (!app) return password.prettyIdentifier = password.identifier + ' (App not found)';
if (!app) return password.label = password.identifier + ' (App not found)';
if (app.label) {
password.prettyIdentifier = app.label + ' (' + app.fqdn + ')';
password.label = app.label + ' (' + app.fqdn + ')';
} else {
password.prettyIdentifier = app.fqdn;
password.label = app.fqdn;
}
});
});