public inbox for pbs-devel@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 6/6] ui: sync jobs: add search box
Date: Mon, 25 Nov 2024 12:15:37 +0100	[thread overview]
Message-ID: <20241125111537.1504618-7-d.csapak@proxmox.com> (raw)
In-Reply-To: <20241125111537.1504618-1-d.csapak@proxmox.com>

filter by (remote) store, remote, id, owner, direction.
Local store is only included on the globabl view not the datastore
specific one.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/config/SyncView.js | 62 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/www/config/SyncView.js b/www/config/SyncView.js
index 3471100b6..ca1f7ecd6 100644
--- a/www/config/SyncView.js
+++ b/www/config/SyncView.js
@@ -31,6 +31,40 @@ Ext.define('PBS.config.SyncJobView', {
     controller: {
 	xclass: 'Ext.app.ViewController',
 
+	search: function(tf, value) {
+	    let me = this;
+	    let view = me.getView();
+	    let store = view.getStore();
+	    if (!value && value !== 0) {
+		store.clearFilter();
+		tf.triggers.clear.setVisible(false);
+		return;
+	    }
+	    tf.triggers.clear.setVisible(true);
+	    if (value.length < 2) return;
+
+	    store.clearFilter();
+
+	    let fieldsToSearch = ['direction', 'id', 'remote', 'remote-store', 'owner'];
+	    if (!view.datastore) {
+		fieldsToSearch.push('store');
+	    }
+	    value = value.toLowerCase();
+
+
+	    store.addFilter(function(rec) {
+		let found = false;
+		for (const field of fieldsToSearch) {
+		    let recValue = rec.data[field] ?? '';
+		    if (recValue.toString().toLowerCase().indexOf(value) !== -1) {
+			found = true;
+			break;
+		    }
+		}
+		return found;
+	    });
+	},
+
 	addPullSyncJob: function() {
 	    this.addSyncJob('pull');
 	},
@@ -197,6 +231,34 @@ Ext.define('PBS.config.SyncJobView', {
 	    handler: 'runSyncJob',
 	    disabled: true,
 	},
+	'->',
+	{
+	    xtype: 'tbtext',
+	    html: gettext('Search'),
+	},
+	{
+	    xtype: 'textfield',
+	    reference: 'searchbox',
+	    emptyText: gettext('(remote) store, remote, id, owner, direction'),
+	    minWidth: 300,
+	    triggers: {
+		clear: {
+		    cls: 'pmx-clear-trigger',
+		    weight: -1,
+		    hidden: true,
+		    handler: function() {
+			this.triggers.clear.setVisible(false);
+			this.setValue('');
+		    },
+		},
+	    },
+	    listeners: {
+		change: {
+		    fn: 'search',
+		    buffer: 500,
+		},
+	    },
+	},
     ],
 
     viewConfig: {
-- 
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 ` [pbs-devel] [PATCH proxmox-backup 4/6] ui: sync jobs: revert to single list for pull/push jobs Dominik Csapak
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 ` Dominik Csapak [this message]
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-7-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 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