public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager v2 0/4] improve ui for reaml sync jobs
@ 2023-06-13  8:43 Dominik Csapak
  2023-06-13  8:43 ` [pve-devel] [PATCH manager v2 1/4] ui: realm sync edit: improve ux when there is no ldap/ad realm Dominik Csapak
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Dominik Csapak @ 2023-06-13  8:43 UTC (permalink / raw)
  To: pve-devel

by implementing @thomas suggestions.

The only thing not done for now is a 'run now' button, but for that
we either have to create a new api call, or change the existing
'sync' call to read the job config with an extra parameter
(i'd lean to do the latter)

changes from v1:
* fix eslint warnings
* add new 'run now' button

Dominik Csapak (4):
  ui: realm sync edit: improve ux when there is no ldap/ad realm
  ui: realm sync: change enabled column rendering
  ui: realm: move sync job panel into realm panel
  ui: realm sync: add 'run now' button

 www/manager6/dc/AuthView.js     |  2 +-
 www/manager6/dc/Config.js       | 28 ++++++++++-----
 www/manager6/dc/RealmSyncJob.js | 61 +++++++++++++++++++++++++++++++--
 3 files changed, 79 insertions(+), 12 deletions(-)

-- 
2.30.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH manager v2 1/4] ui: realm sync edit: improve ux when there is no ldap/ad realm
  2023-06-13  8:43 [pve-devel] [PATCH manager v2 0/4] improve ui for reaml sync jobs Dominik Csapak
@ 2023-06-13  8:43 ` Dominik Csapak
  2023-06-14 15:42   ` [pve-devel] applied-series: " Thomas Lamprecht
  2023-06-13  8:43 ` [pve-devel] [PATCH manager v2 2/4] ui: realm sync: change enabled column rendering Dominik Csapak
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Dominik Csapak @ 2023-06-13  8:43 UTC (permalink / raw)
  To: pve-devel

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@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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH manager v2 2/4] ui: realm sync: change enabled column rendering
  2023-06-13  8:43 [pve-devel] [PATCH manager v2 0/4] improve ui for reaml sync jobs Dominik Csapak
  2023-06-13  8:43 ` [pve-devel] [PATCH manager v2 1/4] ui: realm sync edit: improve ux when there is no ldap/ad realm Dominik Csapak
@ 2023-06-13  8:43 ` Dominik Csapak
  2023-06-13  8:44 ` [pve-devel] [PATCH manager v2 3/4] ui: realm: move sync job panel into realm panel Dominik Csapak
  2023-06-13  8:44 ` [pve-devel] [PATCH manager v2 4/4] ui: realm sync: add 'run now' button Dominik Csapak
  3 siblings, 0 replies; 6+ messages in thread
From: Dominik Csapak @ 2023-06-13  8:43 UTC (permalink / raw)
  To: pve-devel

to make it consistent with the repositories ui, since having a checkbox
that is not clickable is confusing

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/dc/RealmSyncJob.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/www/manager6/dc/RealmSyncJob.js b/www/manager6/dc/RealmSyncJob.js
index e12ad858..9541d732 100644
--- a/www/manager6/dc/RealmSyncJob.js
+++ b/www/manager6/dc/RealmSyncJob.js
@@ -49,16 +49,19 @@ Ext.define('PVE.dc.RealmSyncJobView', {
 	},
     },
 
+    viewConfig: {
+	getRowClass: (record, _index) => record.get('enabled') ? '' : 'proxmox-disabled-row',
+    },
+
     columns: [
 	{
 	    header: gettext('Enabled'),
 	    width: 80,
 	    dataIndex: 'enabled',
-	    xtype: 'checkcolumn',
 	    sortable: true,
-	    disabled: true,
-	    disabledCls: 'x-item-enabled',
+	    align: 'center',
 	    stopSelection: false,
+	    renderer: Proxmox.Utils.renderEnabledIcon,
 	},
 	{
 	    text: gettext('Name'),
-- 
2.30.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH manager v2 3/4] ui: realm: move sync job panel into realm panel
  2023-06-13  8:43 [pve-devel] [PATCH manager v2 0/4] improve ui for reaml sync jobs Dominik Csapak
  2023-06-13  8:43 ` [pve-devel] [PATCH manager v2 1/4] ui: realm sync edit: improve ux when there is no ldap/ad realm Dominik Csapak
  2023-06-13  8:43 ` [pve-devel] [PATCH manager v2 2/4] ui: realm sync: change enabled column rendering Dominik Csapak
@ 2023-06-13  8:44 ` Dominik Csapak
  2023-06-13  8:44 ` [pve-devel] [PATCH manager v2 4/4] ui: realm sync: add 'run now' button Dominik Csapak
  3 siblings, 0 replies; 6+ messages in thread
From: Dominik Csapak @ 2023-06-13  8:44 UTC (permalink / raw)
  To: pve-devel

and make it collapsible, so that users can hide it if they're not
interested in it

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes from v1:
* fix eslint warning
 www/manager6/dc/AuthView.js |  2 +-
 www/manager6/dc/Config.js   | 28 ++++++++++++++++++++--------
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/www/manager6/dc/AuthView.js b/www/manager6/dc/AuthView.js
index 60332c3f..229c944b 100644
--- a/www/manager6/dc/AuthView.js
+++ b/www/manager6/dc/AuthView.js
@@ -130,11 +130,11 @@ Ext.define('PVE.dc.AuthView', {
 		},
 	    ],
 	    listeners: {
-		activate: () => me.reload(),
 		itemdblclick: () => me.run_editor(),
 	    },
 	});
 
 	me.callParent();
+	me.reload();
     },
 });
diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js
index 72a9bec1..810a5d04 100644
--- a/www/manager6/dc/Config.js
+++ b/www/manager6/dc/Config.js
@@ -134,18 +134,30 @@ Ext.define('PVE.dc.Config', {
 		itemId: 'roles',
 	    },
 	    {
-		xtype: 'pveAuthView',
 		title: gettext('Realms'),
+		xtype: 'panel',
+		layout: {
+		    type: 'border',
+		},
 		groups: ['permissions'],
 		iconCls: 'fa fa-address-book-o',
 		itemId: 'domains',
-	    },
-	    {
-		xtype: 'pveRealmSyncJobView',
-		title: gettext('Realm Sync'),
-		groups: ['permissions'],
-		iconCls: 'fa fa-refresh',
-		itemId: 'realmsyncjobs',
+		items: [
+		    {
+			xtype: 'pveAuthView',
+			region: 'center',
+			border: false,
+		    },
+		    {
+			xtype: 'pveRealmSyncJobView',
+			title: gettext('Sync Jobs'),
+			region: 'south',
+			collapsible: true,
+			animCollapse: false,
+			border: false,
+			height: '50%',
+		    },
+		],
 	    },
 	    {
 		xtype: 'pveHAStatus',
-- 
2.30.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH manager v2 4/4] ui: realm sync: add 'run now' button
  2023-06-13  8:43 [pve-devel] [PATCH manager v2 0/4] improve ui for reaml sync jobs Dominik Csapak
                   ` (2 preceding siblings ...)
  2023-06-13  8:44 ` [pve-devel] [PATCH manager v2 3/4] ui: realm: move sync job panel into realm panel Dominik Csapak
@ 2023-06-13  8:44 ` Dominik Csapak
  3 siblings, 0 replies; 6+ messages in thread
From: Dominik Csapak @ 2023-06-13  8:44 UTC (permalink / raw)
  To: pve-devel

by simply passing the sync job config to the 'sync' api endpoint, like
we do for vzdump jobs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
new in v2
 www/manager6/dc/RealmSyncJob.js | 41 +++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/www/manager6/dc/RealmSyncJob.js b/www/manager6/dc/RealmSyncJob.js
index 9541d732..bb2e8d2f 100644
--- a/www/manager6/dc/RealmSyncJob.js
+++ b/www/manager6/dc/RealmSyncJob.js
@@ -35,6 +35,41 @@ Ext.define('PVE.dc.RealmSyncJobView', {
 	    });
 	},
 
+	runNow: function() {
+	    let me = this;
+	    let view = me.getView();
+	    let selection = view.getSelection();
+	    if (!selection || selection.length < 1) {
+		return;
+	    }
+
+	    let params = selection[0].data;
+	    let realm = params.realm;
+
+	    let propertiesToDelete = ['comment', 'realm', 'id', 'type', 'schedule', 'last-run', 'next-run', 'enabled'];
+	    for (const prop of propertiesToDelete) {
+		delete params[prop];
+	    }
+
+	    Proxmox.Utils.API2Request({
+		url: `/access/domains/${realm}/sync`,
+		params,
+		waitMsgTarget: view,
+		method: 'POST',
+		success: function(response, options) {
+		    let upid = response.result.data;
+		    let win = Ext.create('Proxmox.window.TaskProgress', {
+			upid: upid,
+			taskDone: () => { me.reload(); },
+		    });
+		    win.show();
+		},
+		failure: function(response, opts) {
+		    Ext.Msg.alert(gettext('Error'), response.htmlStatus);
+		},
+	    });
+	},
+
 	reload: function() {
 	    this.getView().getStore().load();
 	},
@@ -110,6 +145,12 @@ Ext.define('PVE.dc.RealmSyncJobView', {
 	    baseurl: `/api2/extjs/cluster/jobs/realm-sync`,
 	    callback: 'reload',
 	},
+	{
+	    xtype: 'proxmoxButton',
+	    handler: 'runNow',
+	    disabled: true,
+	    text: gettext('Run Now'),
+	},
     ],
 
     listeners: {
-- 
2.30.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] applied-series: [PATCH manager v2 1/4] ui: realm sync edit: improve ux when there is no ldap/ad realm
  2023-06-13  8:43 ` [pve-devel] [PATCH manager v2 1/4] ui: realm sync edit: improve ux when there is no ldap/ad realm Dominik Csapak
@ 2023-06-14 15:42   ` Thomas Lamprecht
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2023-06-14 15:42 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

Am 13/06/2023 um 10:43 schrieb Dominik Csapak:
> 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@proxmox.com>
> ---
> changes from v1:
> * fix eslint warnings
>  www/manager6/dc/RealmSyncJob.js | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
>

applied series with two minor UX follow ups and one small code clean-up
for the run-now API call handlers, thanks!




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-14 15:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-13  8:43 [pve-devel] [PATCH manager v2 0/4] improve ui for reaml sync jobs Dominik Csapak
2023-06-13  8:43 ` [pve-devel] [PATCH manager v2 1/4] ui: realm sync edit: improve ux when there is no ldap/ad realm Dominik Csapak
2023-06-14 15:42   ` [pve-devel] applied-series: " Thomas Lamprecht
2023-06-13  8:43 ` [pve-devel] [PATCH manager v2 2/4] ui: realm sync: change enabled column rendering Dominik Csapak
2023-06-13  8:44 ` [pve-devel] [PATCH manager v2 3/4] ui: realm: move sync job panel into realm panel Dominik Csapak
2023-06-13  8:44 ` [pve-devel] [PATCH manager v2 4/4] ui: realm sync: add 'run now' button Dominik Csapak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal