2020-05-26 10:23:25 +00:00
|
|
|
Ext.define('pmx-remotes', {
|
|
|
|
extend: 'Ext.data.Model',
|
2020-11-05 11:12:25 +00:00
|
|
|
fields: ['name', 'host', 'port', 'auth-id', 'fingerprint', 'comment',
|
2020-09-29 14:18:59 +00:00
|
|
|
{
|
|
|
|
name: 'server',
|
|
|
|
calculate: function(data) {
|
2020-10-01 07:57:56 +00:00
|
|
|
let txt = data.host || "localhost";
|
2020-09-29 14:18:59 +00:00
|
|
|
let port = data.port || "8007";
|
2020-10-01 07:57:56 +00:00
|
|
|
if (port.toString() !== "8007") {
|
|
|
|
if (Proxmox.Utils.IP6_match.test(txt)) {
|
|
|
|
txt = `[${txt}]`;
|
|
|
|
}
|
|
|
|
txt += `:${port}`;
|
2020-09-30 11:23:39 +00:00
|
|
|
}
|
2020-10-01 07:57:56 +00:00
|
|
|
return txt;
|
2020-10-01 11:03:14 +00:00
|
|
|
},
|
|
|
|
},
|
2020-09-29 14:18:59 +00:00
|
|
|
],
|
2020-05-26 10:23:25 +00:00
|
|
|
idProperty: 'name',
|
|
|
|
proxy: {
|
|
|
|
type: 'proxmox',
|
|
|
|
url: '/api2/json/config/remote',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
Ext.define('PBS.config.RemoteView', {
|
|
|
|
extend: 'Ext.grid.GridPanel',
|
|
|
|
alias: 'widget.pbsRemoteView',
|
|
|
|
|
|
|
|
stateful: true,
|
|
|
|
stateId: 'grid-remotes',
|
|
|
|
|
|
|
|
title: gettext('Remotes'),
|
|
|
|
|
2020-11-10 08:23:22 +00:00
|
|
|
tools: [PBS.Utils.get_help_tool("backup-remote")],
|
|
|
|
|
2020-05-26 10:23:25 +00:00
|
|
|
controller: {
|
|
|
|
xclass: 'Ext.app.ViewController',
|
|
|
|
|
|
|
|
addRemote: function() {
|
|
|
|
let me = this;
|
|
|
|
Ext.create('PBS.window.RemoteEdit', {
|
|
|
|
listeners: {
|
|
|
|
destroy: function() {
|
|
|
|
me.reload();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}).show();
|
|
|
|
},
|
|
|
|
|
|
|
|
editRemote: function() {
|
|
|
|
let me = this;
|
|
|
|
let view = me.getView();
|
|
|
|
let selection = view.getSelection();
|
|
|
|
if (selection.length < 1) return;
|
|
|
|
|
|
|
|
Ext.create('PBS.window.RemoteEdit', {
|
|
|
|
name: selection[0].data.name,
|
|
|
|
listeners: {
|
|
|
|
destroy: function() {
|
|
|
|
me.reload();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}).show();
|
|
|
|
},
|
|
|
|
|
|
|
|
reload: function() { this.getView().getStore().rstore.load(); },
|
|
|
|
|
|
|
|
init: function(view) {
|
|
|
|
Proxmox.Utils.monStoreErrors(view, view.getStore().rstore);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
listeners: {
|
|
|
|
activate: 'reload',
|
|
|
|
itemdblclick: 'editRemote',
|
|
|
|
},
|
|
|
|
|
|
|
|
store: {
|
|
|
|
type: 'diff',
|
|
|
|
autoDestroy: true,
|
|
|
|
autoDestroyRstore: true,
|
|
|
|
sorters: 'name',
|
|
|
|
rstore: {
|
|
|
|
type: 'update',
|
|
|
|
storeid: 'pmx-remotes',
|
|
|
|
model: 'pmx-remotes',
|
|
|
|
autoStart: true,
|
|
|
|
interval: 5000,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
tbar: [
|
|
|
|
{
|
|
|
|
xtype: 'proxmoxButton',
|
|
|
|
text: gettext('Add'),
|
|
|
|
handler: 'addRemote',
|
|
|
|
selModel: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'proxmoxButton',
|
|
|
|
text: gettext('Edit'),
|
|
|
|
handler: 'editRemote',
|
|
|
|
disabled: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'proxmoxStdRemoveButton',
|
2020-05-28 15:29:54 +00:00
|
|
|
baseurl: '/config/remote',
|
2020-05-26 10:23:25 +00:00
|
|
|
callback: 'reload',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
|
|
|
|
viewConfig: {
|
|
|
|
trackOver: false,
|
|
|
|
},
|
|
|
|
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
header: gettext('Remote'),
|
|
|
|
width: 200,
|
|
|
|
sortable: true,
|
|
|
|
renderer: Ext.String.htmlEncode,
|
|
|
|
dataIndex: 'name',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
header: gettext('Host'),
|
|
|
|
width: 200,
|
|
|
|
sortable: true,
|
2020-09-29 14:18:59 +00:00
|
|
|
dataIndex: 'server',
|
2020-05-26 10:23:25 +00:00
|
|
|
},
|
|
|
|
{
|
2020-11-05 11:12:25 +00:00
|
|
|
header: gettext('Auth ID'),
|
2020-05-29 04:46:56 +00:00
|
|
|
width: 200,
|
2020-05-26 10:23:25 +00:00
|
|
|
sortable: true,
|
|
|
|
renderer: Ext.String.htmlEncode,
|
2020-11-05 11:12:25 +00:00
|
|
|
dataIndex: 'auth-id',
|
2020-05-26 10:23:25 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
header: gettext('Fingerprint'),
|
|
|
|
sortable: false,
|
|
|
|
renderer: Ext.String.htmlEncode,
|
|
|
|
dataIndex: 'fingerprint',
|
2020-05-29 04:46:56 +00:00
|
|
|
width: 200,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
header: gettext('Comment'),
|
|
|
|
sortable: false,
|
|
|
|
renderer: Ext.String.htmlEncode,
|
|
|
|
dataIndex: 'comment',
|
2020-05-26 10:23:25 +00:00
|
|
|
flex: 1,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|