use TimeView and TimeEdit from widget toolkit

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Dominik Csapak 2018-01-15 15:17:53 +01:00
parent bf96f60deb
commit 939edd73c9
4 changed files with 2 additions and 99 deletions

View File

@ -120,8 +120,6 @@ JSSRC= \
node/Disks.js \
node/DNSEdit.js \
node/DNSView.js \
node/TimeView.js \
node/TimeEdit.js \
node/StatusView.js \
node/Summary.js \
node/ServiceView.js \

View File

@ -178,7 +178,8 @@ Ext.define('PVE.node.Config', {
title: gettext('Time'),
itemId: 'time',
groups: ['services'],
xtype: 'pveNodeTimeView',
nodename: nodename,
xtype: 'proxmoxNodeTimeView',
iconCls: 'fa fa-clock-o'
});
}

View File

@ -1,39 +0,0 @@
Ext.define('PVE.node.TimeEdit', {
extend: 'PVE.window.Edit',
alias: ['widget.pveNodeTimeEdit'],
initComponent : function() {
var me = this;
var nodename = me.pveSelNode.data.node;
if (!nodename) {
throw "no node name specified";
}
Ext.applyIf(me, {
subject: gettext('Time zone'),
url: "/api2/extjs/nodes/" + nodename + "/time",
fieldDefaults: {
labelWidth: 70
},
width: 400,
items: {
xtype: 'combo',
fieldLabel: gettext('Time zone'),
name: 'timezone',
queryMode: 'local',
store: Ext.create('PVE.data.TimezoneStore'),
valueField: 'zone',
displayField: 'zone',
triggerAction: 'all',
forceSelection: true,
editable: false,
allowBlank: false
}
});
me.callParent();
me.load();
}
});

View File

@ -1,57 +0,0 @@
Ext.define('PVE.node.TimeView', {
extend: 'PVE.grid.ObjectGrid',
alias: ['widget.pveNodeTimeView'],
initComponent : function() {
var me = this;
var nodename = me.pveSelNode.data.node;
if (!nodename) {
throw "no node name specified";
}
var tzoffset = (new Date()).getTimezoneOffset()*60000;
var renderlocaltime = function(value) {
var servertime = new Date((value * 1000) + tzoffset);
return Ext.Date.format(servertime, 'Y-m-d H:i:s');
};
var run_editor = function() {
var win = Ext.create('PVE.node.TimeEdit', {
pveSelNode: me.pveSelNode
});
win.show();
};
Ext.apply(me, {
url: "/api2/json/nodes/" + nodename + "/time",
cwidth1: 150,
interval: 1000,
rows: {
timezone: {
header: gettext('Time zone'),
required: true
},
localtime: {
header: gettext('Server time'),
required: true,
renderer: renderlocaltime
}
},
tbar: [
{
text: gettext("Edit"),
handler: run_editor
}
],
listeners: {
itemdblclick: run_editor
}
});
me.callParent();
me.on('activate', me.rstore.startUpdate);
me.on('destroy', me.rstore.stopUpdate);
}
});