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 30BA26B9B9 for ; Wed, 27 Jan 2021 11:35:04 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6C2AB211CD for ; Wed, 27 Jan 2021 11:34:10 +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 1E4B921020 for ; Wed, 27 Jan 2021 11:34:04 +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 DD68846127 for ; Wed, 27 Jan 2021 11:34:03 +0100 (CET) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Wed, 27 Jan 2021 11:33:55 +0100 Message-Id: <20210127103401.32535-10-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210127103401.32535-1-d.csapak@proxmox.com> References: <20210127103401.32535-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.253 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 09/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: Wed, 27 Jan 2021 10:35:04 -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 | 69 ++++++++++++++++++++++++++++++ www/tape/window/TapeBackup.js | 43 +++++++++++++++++++ 6 files changed, 291 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..f81768a7 --- /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-drive-id]') + .setDisabled(disableSlotField); + }, + }, + }, + { + fieldLabel: gettext('Changer Slot'), + xtype: 'proxmoxintegerfield', + name: 'changer-drive-id', + 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..e30f477d --- /dev/null +++ b/www/tape/window/PoolEdit.js @@ -0,0 +1,69 @@ +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', + skipEmptyText: true, + allowBlank: true, + autoSelect: false, + emptyText: gettext('No Drive'), + cbind: { + deleteEmpty: '{!isCreate}', + }, + }, + { + 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