tape: add 'Restore Key' button

This commit is contained in:
Dietmar Maurer 2021-03-01 11:11:38 +01:00
parent 7507b19cd2
commit 1552d9699c
2 changed files with 40 additions and 0 deletions

View File

@ -1298,6 +1298,11 @@ pub const SUBDIRS: SubdirMap = &sorted!([
&Router::new()
.get(&API_METHOD_READ_LABEL)
),
(
"restore-key",
&Router::new()
.post(&API_METHOD_RESTORE_KEY)
),
(
"rewind",
&Router::new()

View File

@ -29,6 +29,34 @@ Ext.define('PBS.TapeManagement.EncryptionPanel', {
}).show();
},
onRestoreKey: function() {
Ext.create('Proxmox.window.Edit', {
title: gettext('Restore Key'),
isCreate: true,
submitText: gettext('Restore'),
method: 'POST',
url: `/api2/extjs/tape/drive`,
submitUrl: function(url, values) {
let drive = values.drive;
delete values.drive;
return `${url}/${drive}/restore-key`;
},
items: [
{
xtype: 'pbsDriveSelector',
fieldLabel: gettext('Drive'),
name: 'drive',
},
{
xtype: 'textfield',
inputType: 'password',
fieldLabel: gettext('Password'),
name: 'password',
},
],
}).show();
},
reload: function() {
this.getView().getStore().rstore.load();
},
@ -75,6 +103,13 @@ Ext.define('PBS.TapeManagement.EncryptionPanel', {
baseurl: '/api2/extjs/config/tape-encryption-keys',
callback: 'reload',
},
'-',
{
text: gettext('Restore Key'),
xtype: 'proxmoxButton',
handler: 'onRestoreKey',
selModel: false,
},
],
columns: [
{