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/4] ui: DataStoreList: add remove button
Date: Tue,  1 Jun 2021 14:13:50 +0200	[thread overview]
Message-ID: <20210601121350.19919-5-d.csapak@proxmox.com> (raw)
In-Reply-To: <20210601121350.19919-1-d.csapak@proxmox.com>

so that a user can remove a datastore from the gui,
though no data is deleted, this has to be done elsewhere (for now)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/Utils.js                   |  1 +
 www/datastore/DataStoreList.js | 39 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/www/Utils.js b/www/Utils.js
index f614d77e..6b378355 100644
--- a/www/Utils.js
+++ b/www/Utils.js
@@ -380,6 +380,7 @@ Ext.define('PBS.Utils', {
 	    backup: (type, id) => PBS.Utils.render_datastore_worker_id(id, gettext('Backup')),
 	    'barcode-label-media': [gettext('Drive'), gettext('Barcode-Label Media')],
 	    'catalog-media': [gettext('Drive'), gettext('Catalog Media')],
+	    'delete-datastore': [gettext('Datastore'), gettext('Remove Datastore')],
 	    dircreate: [gettext('Directory Storage'), gettext('Create')],
 	    dirremove: [gettext('Directory'), gettext('Remove')],
 	    'eject-media': [gettext('Drive'), gettext('Eject Media')],
diff --git a/www/datastore/DataStoreList.js b/www/datastore/DataStoreList.js
index 353709d3..f81b25b7 100644
--- a/www/datastore/DataStoreList.js
+++ b/www/datastore/DataStoreList.js
@@ -113,11 +113,50 @@ Ext.define('PBS.datastore.DataStoreList', {
 
 	me.datastores[data.store] = me.insert(i, {
 	    datastore: data.store,
+	    header: {
+		padding: '6 6 7 9',
+	    },
+	    tools: [
+		{
+		    xtype: 'button',
+		    text: gettext('Remove'),
+		    iconCls: 'fa fa-trash-o',
+		    handler: () => me.removeDatastore(data.store),
+		    padding: 2,
+		},
+	    ],
 	});
 	me.datastores[data.store].setStatus(data);
 	me.datastores[data.store].setTasks(me.tasks[data.store], me.since);
     },
 
+    removeDatastore: function(datastore) {
+	let me = this;
+	Ext.create('Proxmox.window.SafeDestroy', {
+	    url: `/config/datastore/${datastore}`,
+	    item: {
+		id: datastore,
+	    },
+	    note: gettext('Configuration change only, no data will be deleted.'),
+	    autoShow: true,
+	    taskName: 'delete-datastore',
+	    listeners: {
+		destroy: () => {
+		    me.reload();
+		    let navtree = Ext.ComponentQuery.query('navigationtree')[0];
+		    navtree.rstore.load();
+		},
+	    },
+	});
+    },
+
+    reload: function() {
+	let me = this;
+	me.mask();
+	me.usageStore.load();
+	me.taskStore.load();
+    },
+
     initComponent: function() {
 	let me = this;
 	me.items = [
-- 
2.20.1





  parent reply	other threads:[~2021-06-01 12:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01 12:13 [pbs-devel] [PATCH proxmox-backup 0/4] improve datastore removal/creation Dominik Csapak
2021-06-01 12:13 ` [pbs-devel] [PATCH proxmox-backup 1/4] proxmox-backup-proxy: fix leftover references on datastore removal Dominik Csapak
2021-06-01 14:25   ` Thomas Lamprecht
2021-06-01 12:13 ` [pbs-devel] [PATCH proxmox-backup 2/4] api2/confif/datastore: add create datastore api call in a worker Dominik Csapak
2021-06-01 14:33   ` Thomas Lamprecht
2021-06-02  6:34     ` Dietmar Maurer
2021-06-01 12:13 ` [pbs-devel] [PATCH proxmox-backup 3/4] backup/chunk_store: optionally log progress on creation Dominik Csapak
2021-06-01 12:13 ` Dominik Csapak [this message]
2021-06-01 14:37   ` [pbs-devel] [PATCH proxmox-backup 4/4] ui: DataStoreList: add remove button 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=20210601121350.19919-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