all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 4/6] ui: sync jobs: revert to single list for pull/push jobs
Date: Mon, 25 Nov 2024 12:15:35 +0100	[thread overview]
Message-ID: <20241125111537.1504618-5-d.csapak@proxmox.com> (raw)
In-Reply-To: <20241125111537.1504618-1-d.csapak@proxmox.com>

but add a separate column for the direction so one still sees the
separate jobs.

change the 'local owner/user' to a single column, but add a tooltip in
the header to explain when it does what.

This makes the 'SyncJobsPullPushView' unnecessary, so delete it.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
not really sure about the tooltip helptext for the owner/user, but did
not come up with something better for now...

 www/Makefile                   |  1 -
 www/config/SyncPullPushView.js | 61 -----------------------------
 www/config/SyncView.js         | 70 +++++++++++++++++++++++-----------
 www/datastore/DataStoreList.js |  2 +-
 www/datastore/Panel.js         |  2 +-
 5 files changed, 50 insertions(+), 86 deletions(-)
 delete mode 100644 www/config/SyncPullPushView.js

diff --git a/www/Makefile b/www/Makefile
index d35e81283..609a0ba67 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -61,7 +61,6 @@ JSSRC=							\
 	config/TrafficControlView.js			\
 	config/ACLView.js				\
 	config/SyncView.js				\
-	config/SyncPullPushView.js			\
 	config/VerifyView.js				\
 	config/PruneView.js				\
 	config/GCView.js				\
diff --git a/www/config/SyncPullPushView.js b/www/config/SyncPullPushView.js
deleted file mode 100644
index 3460bc662..000000000
--- a/www/config/SyncPullPushView.js
+++ /dev/null
@@ -1,61 +0,0 @@
-Ext.define('PBS.config.SyncPullPush', {
-    extend: 'Ext.panel.Panel',
-    alias: 'widget.pbsSyncJobPullPushView',
-    title: gettext('Sync Jobs'),
-
-    mixins: ['Proxmox.Mixin.CBind'],
-
-    layout: {
-	type: 'vbox',
-	align: 'stretch',
-	multi: true,
-	bodyPadding: 5,
-    },
-    defaults: {
-	collapsible: false,
-	margin: 5,
-    },
-    scrollable: true,
-    items: [
-	{
-	    xtype: 'pbsSyncJobView',
-	    itemId: 'syncJobsPull',
-	    syncDirection: 'pull',
-	    cbind: {
-		datastore: '{datastore}',
-	    },
-	    minHeight: 125, // shows at least one line of content
-	},
-	{
-	    xtype: 'splitter',
-	    performCollapse: false,
-	},
-	{
-	    xtype: 'pbsSyncJobView',
-	    itemId: 'syncJobsPush',
-	    syncDirection: 'push',
-	    cbind: {
-		datastore: '{datastore}',
-	    },
-	    flex: 1,
-	    minHeight: 125, // shows at least one line of content
-	},
-    ],
-    initComponent: function() {
-	let me = this;
-
-	let subPanelIds = me.items.map(el => el.itemId).filter(id => !!id);
-
-	me.callParent();
-
-	for (const itemId of subPanelIds) {
-	    let component = me.getComponent(itemId);
-	    component.relayEvents(me, ['activate', 'deactivate', 'destroy']);
-	}
-    },
-
-    cbindData: function(initialConfig) {
-        let me = this;
-        me.datastore = initialConfig.datastore ? initialConfig.datastore : undefined;
-    },
-});
diff --git a/www/config/SyncView.js b/www/config/SyncView.js
index c8b2181c4..7f68bf7cc 100644
--- a/www/config/SyncView.js
+++ b/www/config/SyncView.js
@@ -26,26 +26,25 @@ Ext.define('PBS.config.SyncJobView', {
     stateful: true,
     stateId: 'grid-sync-jobs-v1',
 
-    title: gettext('Sync Jobs - Pull Direction'),
-    ownerHeader: gettext('Owner'),
-
-    cbindData: function(initialConfig) {
-	let me = this;
-	if (me.syncDirection === 'push') {
-	    me.title = gettext('Sync Jobs - Push Direction');
-	    me.ownerHeader = gettext('Local User');
-	}
-    },
+    title: gettext('Sync Jobs'),
 
     controller: {
 	xclass: 'Ext.app.ViewController',
 
-	addSyncJob: function() {
+	addPullSyncJob: function() {
+	    this.addSyncJob('pull');
+	},
+
+	addPushSyncJob: function() {
+	    this.addSyncJob('push');
+	},
+
+	addSyncJob: function(syncDirection) {
 	    let me = this;
 	    let view = me.getView();
             Ext.create('PBS.window.SyncJobEdit', {
 		datastore: view.datastore,
-		syncDirection: view.syncDirection,
+		syncDirection,
 		listeners: {
 		    destroy: function() {
 			me.reload();
@@ -63,7 +62,7 @@ Ext.define('PBS.config.SyncJobView', {
             Ext.create('PBS.window.SyncJobEdit', {
 		datastore: view.datastore,
                 id: selection[0].data.id,
-		syncDirection: view.syncDirection,
+		syncDirection: selection[0].data.direction,
 		listeners: {
 		    destroy: function() {
 			me.reload();
@@ -125,9 +124,7 @@ Ext.define('PBS.config.SyncJobView', {
 	    if (view.datastore !== undefined) {
 		params.store = view.datastore;
 	    }
-	    if (view.syncDirection !== undefined) {
-		params["sync-direction"] = view.syncDirection;
-	    }
+	    params['sync-direction'] = 'all';
 	    view.getStore().rstore.getProxy().setExtraParams(params);
 	    Proxmox.Utils.monStoreErrors(view, view.getStore().rstore);
 	},
@@ -158,10 +155,21 @@ Ext.define('PBS.config.SyncJobView', {
 
     tbar: [
 	{
-	    xtype: 'proxmoxButton',
 	    text: gettext('Add'),
-	    handler: 'addSyncJob',
-	    selModel: false,
+	    menu: [
+		{
+		    text: gettext('Add Pull Sync Job'),
+		    iconCls: "fa fa-fw fa-download",
+		    handler: 'addPullSyncJob',
+		    selModel: false,
+		},
+		{
+		    text: gettext('Add Push Sync Job'),
+		    iconCls: "fa fa-fw fa-upload",
+		    handler: 'addPushSyncJob',
+		    selModel: false,
+		},
+	    ],
 	},
 	{
 	    xtype: 'proxmoxButton',
@@ -205,6 +213,23 @@ Ext.define('PBS.config.SyncJobView', {
 	    flex: 1,
 	    sortable: true,
 	},
+	{
+	    header: gettext('Direction'),
+	    dataIndex: 'direction',
+	    renderer: function(value) {
+		let iconCls, text;
+		if (value === 'pull') {
+		    iconCls = 'download';
+		    text = gettext('Pull');
+		} else {
+		    iconCls = 'upload';
+		    text = gettext('Push');
+		}
+		return `<i class="fa fa-fw fa-${iconCls}"></i> ${text}`;
+	    },
+	    width: 100,
+	    sortable: true,
+	},
 	{
 	    header: gettext('Local Store'),
 	    dataIndex: 'store',
@@ -245,9 +270,10 @@ Ext.define('PBS.config.SyncJobView', {
 	    sortable: true,
 	},
 	{
-	    cbind: {
-		header: '{ownerHeader}',
-	    },
+	    header: `${gettext('Local Owner/User')} <i class="fa fa-question-circle" data-qtip="
+	    ${gettext("Pull: The local owner.")}<br>
+	    ${gettext("Push: The local user used for access control.")}
+	    "></i>`,
 	    dataIndex: 'owner',
 	    renderer: 'render_optional_owner',
 	    flex: 2,
diff --git a/www/datastore/DataStoreList.js b/www/datastore/DataStoreList.js
index 22ef18540..fc68cfc10 100644
--- a/www/datastore/DataStoreList.js
+++ b/www/datastore/DataStoreList.js
@@ -239,7 +239,7 @@ Ext.define('PBS.datastore.DataStores', {
 	{
 	    iconCls: 'fa fa-refresh',
 	    itemId: 'syncjobs',
-	    xtype: 'pbsSyncJobPullPushView',
+	    xtype: 'pbsSyncJobView',
 	},
 	{
 	    iconCls: 'fa fa-check-circle',
diff --git a/www/datastore/Panel.js b/www/datastore/Panel.js
index e1da7cfac..ad9fc10fe 100644
--- a/www/datastore/Panel.js
+++ b/www/datastore/Panel.js
@@ -68,7 +68,7 @@ Ext.define('PBS.DataStorePanel', {
 	{
 	    iconCls: 'fa fa-refresh',
 	    itemId: 'syncjobs',
-	    xtype: 'pbsSyncJobPullPushView',
+	    xtype: 'pbsSyncJobView',
 	    cbind: {
 		datastore: '{datastore}',
 	    },
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


  parent reply	other threads:[~2024-11-25 11:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-25 11:15 [pbs-devel] [PATCH proxmox-backup 0/6] sync job ui improvements Dominik Csapak
2024-11-25 11:15 ` [pbs-devel] [PATCH proxmox-backup 1/6] api: admin: sync: add direction to sync job status Dominik Csapak
2024-11-25 11:15 ` [pbs-devel] [PATCH proxmox-backup 2/6] api: admin: sync: add optional 'all' sync type for listing Dominik Csapak
2024-11-25 11:15 ` [pbs-devel] [PATCH proxmox-backup 3/6] cli: manager: sync: add 'sync-direction' parameter to list Dominik Csapak
2024-11-25 11:15 ` Dominik Csapak [this message]
2024-11-25 11:15 ` [pbs-devel] [PATCH proxmox-backup 5/6] ui: sync jobs: change default sorting to 'store' -> 'direction' -> 'id' Dominik Csapak
2024-11-25 11:15 ` [pbs-devel] [PATCH proxmox-backup 6/6] ui: sync jobs: add search box Dominik Csapak
2024-11-25 11:30 ` [pbs-devel] [PATCH proxmox-backup 0/6] sync job ui improvements Christian Ebner
2024-11-26 15:03 ` [pbs-devel] applied-series: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241125111537.1504618-5-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal