title: gettext('Guest Agent Network Information'),
height: 300,
layout: {
- type: 'fit'
+ type: 'fit',
},
modal: true,
items: [
{
xtype: 'grid',
+ store: {},
emptyText: gettext('No network information'),
+ viewConfig: {
+ enableTextSelection: true,
+ },
columns: [
{
dataIndex: 'name',
text: gettext('Name'),
- flex: 3
+ flex: 3,
},
{
dataIndex: 'hardware-address',
text: gettext('MAC address'),
- width: 140
+ width: 140,
},
{
dataIndex: 'ip-addresses',
val.forEach(function(ip) {
var addr = ip['ip-address'];
var pref = ip.prefix;
- if (addr && pref) {
+ if (addr && pref) {
ips.push(addr + '/' + pref);
}
});
return ips.join('<br>');
- }
- }
- ]
- }
- ]
+ },
+ },
+ ],
+ },
+ ],
});
Ext.define('PVE.qemu.AgentIPView', {
layout: {
type: 'hbox',
- align: 'top'
+ align: 'top',
},
nics: [],
items: [
{
xtype: 'box',
- html: '<i class="fa fa-exchange"></i> IPs'
+ html: '<i class="fa fa-exchange"></i> IPs',
},
{
xtype: 'container',
layout: {
type: 'vbox',
align: 'right',
- pack: 'end'
+ pack: 'end',
},
items: [
{
flex: 1,
itemId: 'ipBox',
style: {
- 'text-align': 'right'
- }
+ 'text-align': 'right',
+ },
},
{
xtype: 'button',
hidden: true,
ui: 'default-toolbar',
handler: function(btn) {
- var me = this.up('pveAgentIPView');
+ let view = this.up('pveAgentIPView');
var win = Ext.create('PVE.window.IPInfo');
- win.down('grid').getStore().setData(me.nics);
+ win.down('grid').getStore().setData(view.nics);
win.show();
},
- text: gettext('More')
- }
- ]
- }
+ text: gettext('More'),
+ },
+ ],
+ },
],
getDefaultIps: function(nics) {
var ips = [];
nics.forEach(function(nic) {
if (nic['hardware-address'] &&
- nic['hardware-address'] != '00:00:00:00:00:00') {
-
+ nic['hardware-address'] !== '00:00:00:00:00:00' &&
+ nic['hardware-address'] !== '0:0:0:0:0:0') {
var nic_ips = nic['ip-addresses'] || [];
nic_ips.forEach(function(ip) {
var p = ip['ip-address'];
startIPStore: function(store, records, success) {
var me = this;
- var agentRec = store.getById('agent');
- /*jslint confusion: true*/
- /* value is number and string */
- me.agent = (agentRec && agentRec.data.value === 1);
- me.running = (store.getById('status').data.value === 'running');
- /*jslint confusion: false*/
+ let agentRec = store.getById('agent');
+ let state = store.getById('status');
+
+ me.agent = agentRec && agentRec.data.value === 1;
+ me.running = state && state.data.value === 'running';
var caps = Ext.state.Manager.get('GuiCap');
text = ips.join('<br>');
}
} else if (me.nics && me.nics.error) {
- var msg = gettext('Cannot get info from Guest Agent<br>Error: {0}');
text = Ext.String.format(text, me.nics.error.desc);
}
} else if (me.agent) {
method: 'POST',
proxy: {
type: 'proxmox',
- url: '/api2/json/nodes/' + nodename + '/qemu/' + vmid + '/agent/network-get-interfaces'
- }
+ url: '/api2/json/nodes/' + nodename + '/qemu/' + vmid + '/agent/network-get-interfaces',
+ },
});
me.callParent();
me.updateStatus(!success);
});
- me.on('destroy', me.ipStore.stopUpdate);
+ me.on('destroy', me.ipStore.stopUpdate, me.ipStore);
// if we already have info about the vm, use it immediately
if (me.rstore.getCount()) {
// check if the guest agent is there on every statusstore load
me.mon(me.rstore, 'load', me.startIPStore, me);
- }
+ },
});