From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 4/4] ui: tape/ChangerStatus: add 'is labeled' column for tapes
Date: Thu, 4 Feb 2021 13:56:32 +0100 [thread overview]
Message-ID: <20210204125632.16787-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20210204125632.16787-1-d.csapak@proxmox.com>
so that a user can see if a tape in a library is not yet labeled
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/tape/ChangerStatus.js | 34 ++++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/www/tape/ChangerStatus.js b/www/tape/ChangerStatus.js
index f7e1b1f4..97294b72 100644
--- a/www/tape/ChangerStatus.js
+++ b/www/tape/ChangerStatus.js
@@ -377,19 +377,31 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
try {
Proxmox.Utils.setErrorMask(view, true);
Proxmox.Utils.setErrorMask(me.lookup('content'));
- let status = await PBS.Async.api2({
+ let status_fut = PBS.Async.api2({
url: `/api2/extjs/tape/changer/${encodeURIComponent(changer)}/status`,
});
- let drives = await PBS.Async.api2({
+ let drives_fut = PBS.Async.api2({
url: `/api2/extjs/tape/drive?changer=${encodeURIComponent(changer)}`,
});
+ let tapes_fut = PBS.Async.api2({
+ url: '/api2/extjs/tape/media/list',
+ });
+
+ let [status, drives, tapes_list] = await Promise.all([status_fut, drives_fut, tapes_fut]);
+
let data = {
slot: [],
'import-export': [],
drive: [],
};
+ let tapes = {};
+
+ for (const tape of tapes_list.result.data) {
+ tapes[tape['label-text']] = true;
+ }
+
let drive_entries = {};
for (const entry of drives.result.data) {
@@ -403,6 +415,8 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
entry = Ext.applyIf(entry, drive_entries[entry['entry-id']]);
}
+ entry['is-labeled'] = !!tapes[entry['label-text']];
+
data[type].push(entry);
}
@@ -520,6 +534,22 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
flex: 1,
renderer: (value) => value || '',
},
+ {
+ text: gettext('Labeled'),
+ dataIndex: 'is-labeled',
+ width: 80,
+ renderer: function(value, mD, record) {
+ if (!record.data['label-text']) {
+ return "";
+ }
+
+ if (record.data['label-text'].startsWith("CLN")) {
+ return "";
+ }
+
+ return Proxmox.Utils.format_boolean(value);
+ },
+ },
{
text: gettext('Actions'),
xtype: 'actioncolumn',
--
2.20.1
next prev parent reply other threads:[~2021-02-04 12:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-04 12:56 [pbs-devel] [PATCH proxmox-backup 1/4] ui: tape: add EncryptionPanel to add/remove encryption keys Dominik Csapak
2021-02-04 12:56 ` [pbs-devel] [PATCH proxmox-backup 2/4] ui: tape/PoolEdit: add selector for " Dominik Csapak
2021-02-04 12:56 ` [pbs-devel] [PATCH proxmox-backup 3/4] ui: tape/PoolConfig: add flex to columns Dominik Csapak
2021-02-04 12:56 ` Dominik Csapak [this message]
2021-02-04 16:43 ` [pbs-devel] applied: [PATCH proxmox-backup 1/4] ui: tape: add EncryptionPanel to add/remove encryption keys Dietmar Maurer
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=20210204125632.16787-4-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