From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 1BAE51FF173 for ; Mon, 25 Nov 2024 12:16:12 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C366210CB0; Mon, 25 Nov 2024 12:16:11 +0100 (CET) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Mon, 25 Nov 2024 12:15:37 +0100 Message-Id: <20241125111537.1504618-7-d.csapak@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241125111537.1504618-1-d.csapak@proxmox.com> References: <20241125111537.1504618-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.016 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup 6/6] ui: sync jobs: add search box X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" 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 --- 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