proxmox-backup/www/tape/window/LabelMedia.js
Dominik Csapak 73d471e90f ui: tape: prevent mislabeling tapes in changers
when labeling a tape in a changer, we pre-fill the label field with
the one from the barcode (if it exists). Letting the user change
the label here does not make much sense, since we assume that they are
the same (e.g. for move operations etc.)

So instead simply display the label to protect users from accidentally
changing it. If a user really needs to have a different label than the
suggested one, it's still possible on the cli.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2023-04-24 10:02:20 +02:00

71 lines
1.4 KiB
JavaScript

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'),
url: '/api2/extjs/tape/drive/',
cbindData: function(config) {
let me = this;
return {
driveid: config.driveid,
label: config.label,
};
},
method: 'POST',
showProgress: true,
submitUrl: function(url, values) {
let driveid = encodeURIComponent(values.drive);
delete values.drive;
return `${url}/${driveid}/label-media`;
},
items: [
{
xtype: 'displayfield',
cls: 'pmx-hint',
value: gettext('Make sure that the correct tape is inserted the selected drive and type in the label written on the tape.'),
},
{
xtype: 'pmxDisplayEditField',
fieldLabel: gettext('Drive'),
submitValue: true,
name: 'drive',
editConfig: {
xtype: 'pbsDriveSelector',
},
cbind: {
value: '{driveid}',
editable: '{!driveid}',
},
},
{
fieldLabel: gettext('Label'),
name: 'label-text',
xtype: 'pmxDisplayEditField',
submitValue: true,
allowBlank: false,
cbind: {
value: '{label}',
editable: '{!label}',
},
},
{
xtype: 'pbsMediaPoolSelector',
fieldLabel: gettext('Media Pool'),
name: 'pool',
allowBlank: true,
skipEmptyText: true,
},
],
});