Commit f6e64492 authored by Dietmar Maurer's avatar Dietmar Maurer

make jslint happy

parent a74f4de9
......@@ -420,6 +420,7 @@ Ext.define('PVE.Utils', { statics: {
},
format_size: function(size) {
/*jslint confusion: true */
if (size < 1024) {
return size;
......@@ -606,6 +607,7 @@ Ext.define('PVE.Utils', { statics: {
},
render_size: function(value, metaData, record, rowIndex, colIndex, store) {
/*jslint confusion: true */
if (!Ext.isNumeric(value)) {
return '';
......
......@@ -16,6 +16,8 @@ Ext.define('PVE.button.Button', {
confirmMsg: false,
initComponent: function() {
/*jslint confusion: true */
var me = this;
if (me.handler) {
......@@ -31,7 +33,7 @@ Ext.define('PVE.button.Button', {
}
if (me.confirmMsg) {
var msg = me.confirmMsg;
msg = me.confirmMsg;
if (Ext.isFunction(me.confirmMsg)) {
msg = me.confirmMsg(rec);
}
......
......@@ -3,10 +3,14 @@ Ext.define('PVE.dc.BackupEdit', {
alias: ['widget.pveDcBackupEdit'],
initComponent : function() {
var me = this;
/*jslint confusion: true */
var me = this;
me.create = !me.jobid;
var url;
var method;
if (me.create) {
url = '/api2/extjs/cluster/backup';
method = 'POST';
......@@ -83,7 +87,6 @@ Ext.define('PVE.dc.BackupEdit', {
},
{
header: 'Status',
dataIndex: 'vmid',
dataIndex: 'uptime',
renderer: function(value) {
if (value) {
......@@ -136,7 +139,7 @@ Ext.define('PVE.dc.BackupEdit', {
fieldLabel: 'Day of week',
multiSelect: true,
value: ['sat'],
allowBlank: false,
allowBlank: false
},
{
xtype: 'timefield',
......@@ -163,12 +166,12 @@ Ext.define('PVE.dc.BackupEdit', {
uncheckedValue: 0
},
{
xtype: 'numberfield',
xtype: 'numberfield',
fieldLabel: 'Max files',
name: 'maxfiles',
minValue: 1,
maxValue: 365,
value: 1,
value: '1',
allowBlank: false
},
{
......@@ -398,7 +401,7 @@ Ext.define('PVE.dc.BackupView', {
viewConfig: {
trackOver: false
},
tbar: [
tbar: [
{
text: 'Add',
handler: function() {
......@@ -433,7 +436,7 @@ Ext.define('PVE.dc.BackupView', {
header: 'Start time',
width: 60,
sortable: true,
dataIndex: 'starttime',
dataIndex: 'starttime'
},
{
header: 'Storage ID',
......
......@@ -22,7 +22,7 @@ Ext.define('PVE.dc.GroupView', {
store.load();
};
var remove_btn = new Ext.Button({
var remove_btn = new Ext.Button({
text: 'Delete',
disabled: true,
handler: function() {
......
......@@ -71,7 +71,7 @@ Ext.define('PVE.dc.UserEdit', {
];
var column2 = [
{
{
xtype: 'textfield',
name: 'firstname',
fieldLabel: 'First Name'
......
......@@ -23,7 +23,7 @@ Ext.define('PVE.dc.UserView', {
store.load();
};
var remove_btn = new Ext.Button({
var remove_btn = new Ext.Button({
text: 'Delete',
disabled: true,
handler: function() {
......@@ -102,7 +102,7 @@ Ext.define('PVE.dc.UserView', {
win.show();
}
},
edit_btn, remove_btn
edit_btn, remove_btn
];
var render_expire = function(date) {
......
......@@ -11,6 +11,7 @@ Ext.define('PVE.form.VMIDSelector', {
validateExists: undefined,
validator: function(value) {
/*jslint confusion: true */
var me = this;
if (!Ext.isDefined(me.validateExists)) {
......
......@@ -109,41 +109,6 @@ Ext.define('PVE.grid.BackupView', {
});
win.show();
win.on('destroy', reload);
return;
var url;
var params = {
vmid: vmid,
force: 1
};
if (vmtype === 'openvz') {
url = '/nodes/' + nodename + '/openvz';
params.ostemplate = volid;
} else if (vmtype === 'qemu') {
url = '/nodes/' + nodename + '/qemu';
params.archive = volid;
} else {
throw 'unknown VM type';
}
PVE.Utils.API2Request({
url: url,
params: params,
method: 'POST',
waitMsgTarget: me,
failure: function(response, opts) {
Ext.Msg.alert('Error', response.htmlStatus);
},
success: function(response, options) {
var upid = response.result.data;
var win = Ext.create('PVE.window.TaskViewer', {
upid: upid
});
win.show();
}
});
}
});
......
......@@ -96,7 +96,7 @@ Ext.define('PVE.grig.LogView', {
return;
}
autoscroll = false;
},
}
}
});
......
......@@ -49,8 +49,7 @@ Ext.define('PVE.node.BCFailCnt', {
itemdblclick: function(v, record) {
var ws = me.up('pveStdWorkspace');
ws.selectById('openvz/' + record.data.id);
},
}
}
});
......
......@@ -10,10 +10,10 @@ Ext.define('PVE.openvz.BeanCounterGrid', {
}
if (record.id.match(/pages$/)) {
return PVE.Utils.format_size(value*4096);
return PVE.Utils.format_size(value*4096);
}
if (record.id.match(/(size|buf)$/)) {
return PVE.Utils.format_size(value);
return PVE.Utils.format_size(value);
}
return value;
......
......@@ -25,7 +25,7 @@ Ext.define('PVE.openvz.Config', {
{
title: 'Summary',
xtype: 'pveOpenVZSummary',
itemId: 'summary',
itemId: 'summary'
},
{
title: 'Ressources',
......
/*jslint confusion: true */
Ext.define('PVE.openvz.CreateWizard', {
extend: 'PVE.window.Wizard',
requires: [
......@@ -125,7 +126,7 @@ Ext.define('PVE.openvz.CreateWizard', {
},
{
xtype: 'pveOpenVZResourceInputPanel',
title: 'Resources',
title: 'Resources'
},
{
xtype: 'inputpanel',
......@@ -200,10 +201,10 @@ Ext.define('PVE.openvz.CreateWizard', {
if (!me.rendered) {
return;
}
var field = me.down('#dns1');
var field = me.down('#dns1');
field.setDisabled(!value);
field.clearInvalid();
var field = me.down('#dns2');
field = me.down('#dns2');
field.setDisabled(!value);
field.clearInvalid();
}
......
/*jslint confusion: true */
Ext.define('PVE.OpenVZ.NetIfEdit', {
extend: 'PVE.window.Edit',
......@@ -116,7 +117,7 @@ Ext.define('PVE.OpenVZ.IPAdd', {
return { ip_address: me.dataCache.ip_address + ' ' + values.ipaddress };
} else {
return { ip_address: values.ipaddress };
};
}
},
initComponent : function() {
......@@ -147,7 +148,7 @@ Ext.define('PVE.OpenVZ.IPAdd', {
Ext.define('PVE.openvz.NetworkView', {
extend: 'Ext.grid.GridPanel',
requires: [
'Ext.grid.*',
'Ext.grid.*'
],
alias: ['widget.pveOpenVZNetworkView'],
......@@ -223,12 +224,12 @@ Ext.define('PVE.openvz.NetworkView', {
initComponent : function() {
var me = this;
nodename = me.pveSelNode.data.node;
var nodename = me.pveSelNode.data.node;
if (!nodename) {
throw "no node name specified";
}
vmid = me.pveSelNode.data.vmid;
var vmid = me.pveSelNode.data.vmid;
if (!vmid) {
throw "no VM ID specified";
}
......@@ -313,7 +314,7 @@ Ext.define('PVE.openvz.NetworkView', {
});
win.on('destroy', me.load, me);
win.show();
}
};
var edit_btn = new Ext.Button({
text: 'Edit',
......@@ -419,7 +420,7 @@ Ext.define('PVE.openvz.NetworkView', {
}
});
me.callParent();
me.callParent();
me.load();
}
......
......@@ -59,7 +59,7 @@ Ext.define('PVE.openvz.Options', {
defaultValue: '0',
renderer: function(value) {
if (value == 0) {
return 'User quotas disabled.'
return 'User quotas disabled.';
}
return value;
},
......
......@@ -39,7 +39,7 @@ Ext.define('PVE.openvz.RessourceView', {
header: 'Processors',
never_delete: true,
editor: 'PVE.openvz.RessourceEdit',
defaultValue: 1,
defaultValue: 1
},
disk: {
header: 'Disk space',
......
......@@ -55,10 +55,11 @@ Ext.define('PVE.openvz.StatusView', {
var render_status = function(value, metaData, record, rowIndex, colIndex, store) {
var failcnt = me.getObjectValue('failcnt', 0);
if (failcnt > 0) {
return value + " (failure count " + failcnt + ")";
return value + " (failure count " + failcnt.toString() + ")";
}
return value;
}
};
var rows = {
name: { header: 'Name', defaultValue: 'no name specified' },
status: { header: 'Status', defaultValue: 'unknown', renderer: render_status },
......
......@@ -80,7 +80,7 @@ Ext.define('PVE.qemu.Migrate', {
layout: 'auto',
border: false,
items: [ me.formPanel ],
buttons: [ submitBtn ],
buttons: [ submitBtn ]
});
me.callParent();
......
......@@ -33,7 +33,7 @@ Ext.define('PVE.qemu.Monitor', {
var el = textbox.getTargetEl();
var dom = Ext.getDom(el);
dom.scrollTop = dom.scrollHeight - dom.clientHeight;
}
};
var refresh = function() {
textbox.update(lines.join('\n'));
......
......@@ -68,7 +68,7 @@ Ext.define('PVE.qemu.Summary', {
text: 'Migrate',
handler: function() {
var win = Ext.create('PVE.qemu.Migrate', {
pveSelNode: me.pveSelNode,
pveSelNode: me.pveSelNode
});
win.show();
}
......
......@@ -7,6 +7,7 @@ Ext.define('PVE.storage.Upload', {
modal: true,
initComponent : function() {
/*jslint confusion: true */
var me = this;
var xhr;
......@@ -24,7 +25,7 @@ Ext.define('PVE.storage.Upload', {
var pbar = Ext.create('Ext.ProgressBar', {
text: 'Ready',
hidden: true
});
});
me.formPanel = Ext.create('Ext.form.Panel', {
method: 'POST',
......@@ -95,8 +96,9 @@ Ext.define('PVE.storage.Upload', {
text: 'Upload',
disabled: true,
handler: function(button) {
var fd;
try {
var fd = new FormData();
fd = new FormData();
} catch (err) {
doStandardSubmit();
return;
......@@ -109,7 +111,7 @@ Ext.define('PVE.storage.Upload', {
fd.append("content", field.getValue());
field.setDisabled(true);
var field = form.findField('filename');
field = form.findField('filename');
var file = field.fileInputEl.dom;
fd.append("filename", file.files[0]);
field.setDisabled(true);
......@@ -123,7 +125,7 @@ Ext.define('PVE.storage.Upload', {
if (xhr.status == 200) {
me.close();
} else {
var msg = "Error " + xhr.status + ": " + Ext.htmlEncode(xhr.statusText);
var msg = "Error " + xhr.status.toString() + ": " + Ext.htmlEncode(xhr.statusText);
Ext.Msg.alert('Upload failed', msg, function(btn) {
me.close();
});
......@@ -132,7 +134,7 @@ Ext.define('PVE.storage.Upload', {
}, false);
xhr.addEventListener("error", function(e) {
var msg = "Error " + e.target.status + " occurred while receiving the document.";
var msg = "Error " + e.target.status.toString() + " occurred while receiving the document.";
Ext.Msg.alert('Upload failed', msg, function(btn) {
me.close();
});
......@@ -155,8 +157,8 @@ Ext.define('PVE.storage.Upload', {
});
Ext.applyIf(me, {
title: 'Upload',
items: me.formPanel,
title: 'Upload',
items: me.formPanel,
buttons: [ abortBtn, submitBtn ],
listeners: {
close: function() {
......@@ -195,7 +197,7 @@ Ext.define('PVE.storage.ContentView', {
groupField: 'content',
proxy: {
type: 'pve',
url: '/api2/json' + baseurl,
url: '/api2/json' + baseurl
},
sorters: {
property: 'volid',
......@@ -213,7 +215,7 @@ Ext.define('PVE.storage.ContentView', {
store.load();
};
Ext.apply(me, {
Ext.apply(me, {
store: store,
selModel: sm,
stateful: false,
......
......@@ -375,7 +375,7 @@ Ext.define('PVE.tree.ResourceTree', {
if (node && node.data.type === record.data.type &&
node.data.node !== record.data.node) {
// defer select (else we get strange errors)
Ext.defer(function() { me.selectExpand(node) }, 100, me);
Ext.defer(function() { me.selectExpand(node); }, 100, me);
}
},
applyState : function(state) {
......
......@@ -97,7 +97,7 @@ Ext.define('PVE.window.Backup', {
layout: 'auto',
border: false,
items: [ me.formPanel ],
buttons: [ submitBtn ],
buttons: [ submitBtn ]
});
me.callParent();
......
......@@ -53,10 +53,6 @@ Ext.define('PVE.window.Restore', {
var form = me.formPanel.getForm();
form.on('validitychange', function(f, valid) {
submitBtn.setDisabled(!valid);
});
var doRestore = function(url, params) {
PVE.Utils.API2Request({
url: url,
......@@ -85,10 +81,11 @@ Ext.define('PVE.window.Restore', {
var params = {
storage: storage,
vmid: me.vmid ? me.vmid : values.vmid,
vmid: me.vmid || values.vmid,
force: me.vmid ? 1 : 0
};
var url;
if (me.vmtype === 'openvz') {
url = '/nodes/' + me.nodename + '/openvz';
params.ostemplate = me.volid;
......@@ -115,6 +112,10 @@ Ext.define('PVE.window.Restore', {
}
});
form.on('validitychange', function(f, valid) {
submitBtn.setDisabled(!valid);
});
var title = (me.vmtype === 'openvz') ? "Restore CT" : "Restore VM";
Ext.apply(me, {
......@@ -124,7 +125,7 @@ Ext.define('PVE.window.Restore', {
layout: 'auto',
border: false,
items: [ me.formPanel ],
buttons: [ submitBtn ],
buttons: [ submitBtn ]
});
me.callParent();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment