From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 18CFD6BF20 for ; Thu, 28 Jan 2021 13:00:37 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6F4DA2D344 for ; Thu, 28 Jan 2021 13:00:05 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 2FD9C2D244 for ; Thu, 28 Jan 2021 12:59:58 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id D887346148 for ; Thu, 28 Jan 2021 12:59:57 +0100 (CET) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Thu, 28 Jan 2021 12:59:46 +0100 Message-Id: <20210128115955.23136-7-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210128115955.23136-1-d.csapak@proxmox.com> References: <20210128115955.23136-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.244 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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 v2 06/15] ui: tape: add Edit Windows 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: , X-List-Received-Date: Thu, 28 Jan 2021 12:00:37 -0000 includes edit windows for * Drives * Changers * Media Pools * Labeling Media * Making new Tape Backups Signed-off-by: Dominik Csapak --- www/Makefile | 5 +++ www/tape/window/ChangerEdit.js | 50 ++++++++++++++++++++++ www/tape/window/DriveEdit.js | 77 ++++++++++++++++++++++++++++++++++ www/tape/window/LabelMedia.js | 47 +++++++++++++++++++++ www/tape/window/PoolEdit.js | 64 ++++++++++++++++++++++++++++ www/tape/window/TapeBackup.js | 43 +++++++++++++++++++ 6 files changed, 286 insertions(+) create mode 100644 www/tape/window/ChangerEdit.js create mode 100644 www/tape/window/DriveEdit.js create mode 100644 www/tape/window/LabelMedia.js create mode 100644 www/tape/window/PoolEdit.js create mode 100644 www/tape/window/TapeBackup.js diff --git a/www/Makefile b/www/Makefile index beea80bf..827633a3 100644 --- a/www/Makefile +++ b/www/Makefile @@ -15,6 +15,11 @@ TAPE_UI_FILES= \ tape/form/PoolSelector.js \ tape/form/RetentionSelector.js \ tape/form/TapeDevicePathSelector.js \ + tape/window/ChangerEdit.js \ + tape/window/DriveEdit.js \ + tape/window/LabelMedia.js \ + tape/window/PoolEdit.js \ + tape/window/TapeBackup.js \ TapeManagement.js endif diff --git a/www/tape/window/ChangerEdit.js b/www/tape/window/ChangerEdit.js new file mode 100644 index 00000000..bb166e50 --- /dev/null +++ b/www/tape/window/ChangerEdit.js @@ -0,0 +1,50 @@ +Ext.define('PBS.TapeManagement.ChangerEditWindow', { + extend: 'Proxmox.window.Edit', + alias: 'widget.pbsChangerEditWindow', + mixins: ['Proxmox.Mixin.CBind'], + + isCreate: true, + isAdd: true, + subject: gettext('Changer'), + cbindData: function(initialConfig) { + let me = this; + + let changerid = initialConfig.changerid; + let baseurl = '/api2/extjs/config/changer'; + + me.isCreate = !changerid; + me.url = changerid ? `${baseurl}/${encodeURIComponent(changerid)}` : baseurl; + me.method = changerid ? 'PUT' : 'POST'; + + return { }; + }, + + items: [ + { + fieldLabel: gettext('Name'), + name: 'name', + xtype: 'pmxDisplayEditField', + renderer: Ext.htmlEncode, + allowBlank: false, + cbind: { + editable: '{isCreate}', + }, + }, + { + fieldLabel: gettext('Path'), + xtype: 'pbsTapeDevicePathSelector', + type: 'changers', + name: 'path', + allowBlank: false, + }, + { + fieldLabel: gettext('Import-Export Slots'), + xtype: 'proxmoxtextfield', + name: 'export-slots', + cbind: { + deleteEmpty: '{!isCreate}', + }, + }, + ], +}); + diff --git a/www/tape/window/DriveEdit.js b/www/tape/window/DriveEdit.js new file mode 100644 index 00000000..5c3c8728 --- /dev/null +++ b/www/tape/window/DriveEdit.js @@ -0,0 +1,77 @@ +Ext.define('PBS.TapeManagement.DriveEditWindow', { + extend: 'Proxmox.window.Edit', + alias: 'widget.pbsDriveEditWindow', + mixins: ['Proxmox.Mixin.CBind'], + + isCreate: true, + isAdd: true, + subject: gettext('Drive'), + cbindData: function(initialConfig) { + let me = this; + + let driveid = initialConfig.driveid; + let baseurl = '/api2/extjs/config/drive'; + + me.isCreate = !driveid; + me.url = driveid ? `${baseurl}/${encodeURIComponent(driveid)}` : baseurl; + me.method = driveid ? 'PUT' : 'POST'; + + return { }; + }, + + items: [ + { + fieldLabel: gettext('Name'), + name: 'name', + xtype: 'pmxDisplayEditField', + renderer: Ext.htmlEncode, + allowBlank: false, + cbind: { + editable: '{isCreate}', + }, + }, + { + fieldLabel: gettext('Changer'), + xtype: 'pbsChangerSelector', + name: 'changer', + skipEmptyText: true, + allowBlank: true, + autoSelect: false, + emptyText: gettext('No Changer'), + cbind: { + deleteEmpty: '{!isCreate}', + }, + listeners: { + change: function(field, value) { + let disableSlotField = !value || value === ''; + console.log(value); + field + .up('window') + .down('field[name=changer-drivenum]') + .setDisabled(disableSlotField); + }, + }, + }, + { + fieldLabel: gettext('Changer Slot'), + xtype: 'proxmoxintegerfield', + name: 'changer-drivenum', + disabled: true, + allowBlank: true, + emptyText: '0', + minValue: 0, + maxValue: 8, + cbind: { + deleteEmpty: '{!isCreate}', + }, + }, + { + fieldLabel: gettext('Path'), + xtype: 'pbsTapeDevicePathSelector', + type: 'drives', + name: 'path', + allowBlank: false, + }, + ], +}); + diff --git a/www/tape/window/LabelMedia.js b/www/tape/window/LabelMedia.js new file mode 100644 index 00000000..ec7fca5d --- /dev/null +++ b/www/tape/window/LabelMedia.js @@ -0,0 +1,47 @@ +Ext.define('PBS.TapeManagement.LabelMediaWindow', { + extend: 'Proxmox.window.Edit', + alias: 'widget.pbsLabelMediaWindow', + mixins: ['Proxmox.Mixin.CBind'], + + isCreate: true, + isAdd: true, + title: gettext('Label Media'), + submitText: gettext('OK'), + + showProgress: true, + + items: [ + { + xtype: 'displayfield', + fieldLabel: gettext('Drive'), + cbind: { + value: '{driveid}', + }, + }, + { + fieldLabel: gettext('Label'), + name: 'label-text', + xtype: 'proxmoxtextfield', + allowBlank: false, + }, + { + xtype: 'pbsMediaPoolSelector', + fieldLabel: gettext('Media Pool'), + name: 'pool', + allowBlank: true, + skipEmptyText: true, + }, + ], + + initComponent: function() { + let me = this; + if (!me.driveid) { + throw "no driveid given"; + } + + let driveid = encodeURIComponent(me.driveid); + me.url = `/api2/extjs/tape/drive/${driveid}/label-media`; + me.callParent(); + }, +}); + diff --git a/www/tape/window/PoolEdit.js b/www/tape/window/PoolEdit.js new file mode 100644 index 00000000..c5148c9d --- /dev/null +++ b/www/tape/window/PoolEdit.js @@ -0,0 +1,64 @@ +Ext.define('PBS.TapeManagement.PoolEditWindow', { + extend: 'Proxmox.window.Edit', + alias: 'widget.pbsPoolEditWindow', + mixins: ['Proxmox.Mixin.CBind'], + + isCreate: true, + isAdd: true, + subject: gettext('Media Pool'), + cbindData: function(initialConfig) { + let me = this; + + let poolid = initialConfig.poolid; + let baseurl = '/api2/extjs/config/media-pool'; + + me.isCreate = !poolid; + me.url = poolid ? `${baseurl}/${encodeURIComponent(poolid)}` : baseurl; + me.method = poolid ? 'PUT' : 'POST'; + + return { }; + }, + + items: [ + { + fieldLabel: gettext('Name'), + name: 'name', + xtype: 'pmxDisplayEditField', + renderer: Ext.htmlEncode, + allowBlank: false, + cbind: { + editable: '{isCreate}', + }, + }, + { + fieldLabel: gettext('Drive'), + xtype: 'pbsDriveSelector', + name: 'drive', + allowBlank: false, + autoSelect: false, + }, + { + fieldLabel: gettext('Allocation'), + xtype: 'pbsAllocationSelector', + name: 'allocation', + skipEmptyText: true, + allowBlank: true, + autoSelect: false, + cbind: { + deleteEmpty: '{!isCreate}', + }, + }, + { + fieldLabel: gettext('Retention'), + xtype: 'pbsRetentionSelector', + name: 'retention', + skipEmptyText: true, + allowBlank: true, + autoSelect: false, + cbind: { + deleteEmpty: '{!isCreate}', + }, + }, + ], +}); + diff --git a/www/tape/window/TapeBackup.js b/www/tape/window/TapeBackup.js new file mode 100644 index 00000000..a3ceacdc --- /dev/null +++ b/www/tape/window/TapeBackup.js @@ -0,0 +1,43 @@ +Ext.define('PBS.TapeManagement.TapeBackupWindow', { + extend: 'Proxmox.window.Edit', + alias: 'pbsTapeBackupWindow', + + subject: gettext('Backup'), + url: '/api2/extjs/tape/backup', + method: 'POST', + showTaskViewer: true, + isCreate: true, + + items: [ + { + xtype: 'pbsDataStoreSelector', + fieldLabel: gettext('Datastore'), + name: 'store', + }, + { + xtype: 'pbsMediaPoolSelector', + fieldLabel: gettext('Media Pool'), + name: 'pool', + }, + { + xtype: 'proxmoxcheckbox', + name: 'export-media-set', + fieldLabel: gettext('Export Media Set'), + listeners: { + change: function(cb, value) { + let me = this; + let eject = me.up('window').down('proxmoxcheckbox[name=eject-media]'); + if (value) { + eject.setValue(false); + } + eject.setDisabled(!!value); + }, + }, + }, + { + xtype: 'proxmoxcheckbox', + name: 'eject-media', + fieldLabel: gettext('Eject Media'), + }, + ], +}); -- 2.20.1