[pve-devel] [PATCH manager v2 1/4] ui: realm sync edit: improve ux when there is no ldap/ad realm

Dominik Csapak d.csapak at proxmox.com
Tue Jun 13 10:43:58 CEST 2023


by adding an empty text to the dropdown, and disabling the other
possibly invalid fields, so that it's clear why the panel is invalid

as soon as there is an ldap/ad realm, it gets autoselected anyway and
the fields get re-enabled.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes from v1:
* fix eslint warnings
 www/manager6/dc/RealmSyncJob.js | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/www/manager6/dc/RealmSyncJob.js b/www/manager6/dc/RealmSyncJob.js
index 5a903ef7..e12ad858 100644
--- a/www/manager6/dc/RealmSyncJob.js
+++ b/www/manager6/dc/RealmSyncJob.js
@@ -154,6 +154,11 @@ Ext.define('PVE.dc.RealmSyncJobEdit', {
 
 	updateDefaults: function(_field, newValue) {
 	    let me = this;
+
+	    ['scope', 'enable-new', 'schedule'].forEach((reference) => {
+		me.lookup(reference)?.setDisabled(false);
+	    });
+
 	    // only update on create
 	    if (!me.getView().isCreate) {
 		return;
@@ -232,6 +237,9 @@ Ext.define('PVE.dc.RealmSyncJobEdit', {
 			xtype: 'pmxRealmComboBox',
 			storeFilter: rec => rec.data.type === 'ldap' || rec.data.type === 'ad',
 		    },
+		    listConfig: {
+			emptyText: `<div class="x-grid-empty">${gettext('No LDAP/AD Realm found')}</div>`,
+		    },
 		    cbind: {
 			editable: '{isCreate}',
 		    },
@@ -245,6 +253,7 @@ Ext.define('PVE.dc.RealmSyncJobEdit', {
 		{
 		    xtype: 'pveCalendarEvent',
 		    fieldLabel: gettext('Schedule'),
+		    disabled: true,
 		    allowBlank: false,
 		    name: 'schedule',
 		    reference: 'schedule',
@@ -265,6 +274,7 @@ Ext.define('PVE.dc.RealmSyncJobEdit', {
 		    xtype: 'proxmoxKVComboBox',
 		    name: 'scope',
 		    reference: 'scope',
+		    disabled: true,
 		    fieldLabel: gettext('Scope'),
 		    value: '',
 		    emptyText: gettext('No default available'),
@@ -280,6 +290,7 @@ Ext.define('PVE.dc.RealmSyncJobEdit', {
 		    xtype: 'proxmoxKVComboBox',
 		    value: '1',
 		    deleteEmpty: false,
+		    disabled: true,
 		    allowBlank: false,
 		    comboItems: [
 			['1', Proxmox.Utils.yesText],
-- 
2.30.2






More information about the pve-devel mailing list