]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/Utils.js
3 console
.log("Starting Proxmox VE Manager");
5 Ext
.Ajax
.defaultHeaders
= {
6 'Accept': 'application/json',
9 Ext
.define('PVE.Utils', {
12 // this singleton contains miscellaneous utilities
14 toolkit
: undefined, // (extjs|touch), set inside Toolkit.js
16 bus_match
: /^(ide|sata|virtio|scsi)(\d+)$/,
30 'c': gettext('Community'),
31 'b': gettext('Basic'),
32 's': gettext('Standard'),
33 'p': gettext('Premium'),
36 noSubKeyHtml
: 'You do not have a valid subscription for this server. Please visit '
37 +'<a target="_blank" href="https://www.proxmox.com/products/proxmox-ve/subscription-service-plans">'
38 +'www.proxmox.com</a> to get a list of available options.',
42 { desc
: '5.x - 2.6 Kernel', val
: 'l26' },
43 { desc
: '2.4 Kernel', val
: 'l24' },
45 'Microsoft Windows': [
46 { desc
: '10/2016/2019', val
: 'win10' },
47 { desc
: '8.x/2012/2012r2', val
: 'win8' },
48 { desc
: '7/2008r2', val
: 'win7' },
49 { desc
: 'Vista/2008', val
: 'w2k8' },
50 { desc
: 'XP/2003', val
: 'wxp' },
51 { desc
: '2000', val
: 'w2k' },
54 { desc
: '-', val
: 'solaris' },
57 { desc
: '-', val
: 'other' },
61 is_windows: function(ostype
) {
62 for (let entry
of PVE
.Utils
.kvm_ostypes
['Microsoft Windows']) {
63 if (entry
.val
=== ostype
) {
70 get_health_icon: function(state
, circle
) {
71 if (circle
=== undefined) {
75 if (state
=== undefined) {
79 var icon
= 'faded fa-question';
82 icon
= 'good fa-check';
85 icon
= 'warning fa-upload';
88 icon
= 'warning fa-refresh';
91 icon
= 'warning fa-exclamation';
94 icon
= 'critical fa-times';
106 parse_ceph_version: function(service
) {
107 if (service
.ceph_version_short
) {
108 return service
.ceph_version_short
;
111 if (service
.ceph_version
) {
112 var match
= service
.ceph_version
.match(/version (\d+(\.\d+)*)/);
121 compare_ceph_versions: function(a
, b
) {
129 if (Ext
.isArray(a
)) {
130 avers
= a
.slice(); // copy array
132 avers
= a
.toString().split('.');
135 if (Ext
.isArray(b
)) {
136 bvers
= b
.slice(); // copy array
138 bvers
= b
.toString().split('.');
142 let av
= avers
.shift();
143 let bv
= bvers
.shift();
145 if (av
=== undefined && bv
=== undefined) {
147 } else if (av
=== undefined) {
149 } else if (bv
=== undefined) {
152 let diff
= parseInt(av
, 10) - parseInt(bv
, 10);
153 if (diff
!== 0) return diff
;
154 // else we need to look at the next parts
159 get_ceph_icon_html: function(health
, fw
) {
160 var state
= PVE
.Utils
.map_ceph_health
[health
];
161 var cls
= PVE
.Utils
.get_health_icon(state
);
165 return "<i class='fa " + cls
+ "'></i> ";
170 'HEALTH_UPGRADE': 'upgrade',
172 'HEALTH_WARN': 'warning',
173 'HEALTH_ERR': 'critical',
176 render_sdn_pending: function(rec
, value
, key
, index
) {
177 if (rec
.data
.state
=== undefined || rec
.data
.state
=== null) {
181 if (rec
.data
.state
=== 'deleted') {
182 if (value
=== undefined) {
185 return '<div style="text-decoration: line-through;">'+ value
+'</div>';
187 } else if (rec
.data
.pending
[key
] !== undefined && rec
.data
.pending
[key
] !== null) {
188 if (rec
.data
.pending
[key
] === 'deleted') {
191 return rec
.data
.pending
[key
];
197 render_sdn_pending_state: function(rec
, value
) {
198 if (value
=== undefined || value
=== null) {
202 let icon
= `<i class="fa fa-fw fa-refresh warning"></i>`;
204 if (value
=== 'deleted') {
205 return '<span>' + icon
+ value
+ '</span>';
208 let tip
= gettext('Pending Changes') + ': <br>';
210 for (const [key
, keyvalue
] of Object
.entries(rec
.data
.pending
)) {
211 if ((rec
.data
[key
] !== undefined && rec
.data
.pending
[key
] !== rec
.data
[key
]) ||
212 rec
.data
[key
] === undefined
214 tip
+= `${key}: ${keyvalue} <br>`;
217 return '<span data-qtip="' + tip
+ '">'+ icon
+ value
+ '</span>';
220 render_ceph_health: function(healthObj
) {
222 iconCls
: PVE
.Utils
.get_health_icon(),
226 if (!healthObj
|| !healthObj
.status
) {
230 var health
= PVE
.Utils
.map_ceph_health
[healthObj
.status
];
232 state
.iconCls
= PVE
.Utils
.get_health_icon(health
, true);
233 state
.text
= healthObj
.status
;
238 render_zfs_health: function(value
) {
239 if (typeof value
=== 'undefined') {
242 var iconCls
= 'question-circle';
246 iconCls
= 'check-circle good';
250 iconCls
= 'exclamation-circle warning';
255 iconCls
= 'times-circle critical';
260 return '<i class="fa fa-' + iconCls
+ '"></i> ' + value
;
263 render_pbs_fingerprint
: fp
=> fp
.substring(0, 23),
265 render_backup_encryption: function(v
, meta
, record
) {
267 return gettext('No');
271 if (v
.match(/^[a-fA-F0-9]{2}:/)) { // fingerprint
272 tip
= `Key fingerprint ${PVE.Utils.render_pbs_fingerprint(v)}`;
274 let icon
= `<i class="fa fa-fw fa-lock good"></i>`;
275 return `<span data-qtip="${tip}">${icon} ${gettext('Encrypted')}</span>`;
278 render_backup_verification: function(v
, meta
, record
) {
279 let i
= (cls
, txt
) => `<i class="fa fa-fw fa-${cls}"></i> ${txt}`;
280 if (v
=== undefined || v
=== null) {
281 return i('question-circle-o warning', gettext('None'));
284 let txt
= gettext('Failed');
285 let iconCls
= 'times critical';
286 if (v
.state
=== 'ok') {
288 iconCls
= 'check good';
289 let now
= Date
.now() / 1000;
290 let task
= Proxmox
.Utils
.parse_task_upid(v
.upid
);
291 let verify_time
= Proxmox
.Utils
.render_timestamp(task
.starttime
);
292 tip
= `Last verify task started on ${verify_time}`;
293 if (now
- v
.starttime
> 30 * 24 * 60 * 60) {
294 tip
= `Last verify task over 30 days ago: ${verify_time}`;
295 iconCls
= 'check warning';
298 return `<span data-qtip="${tip}"> ${i(iconCls, txt)} </span>`;
301 render_backup_status: function(value
, meta
, record
) {
302 if (typeof value
=== 'undefined') {
306 let iconCls
= 'check-circle good';
307 let text
= gettext('Yes');
309 if (!PVE
.Parser
.parseBoolean(value
.toString())) {
310 iconCls
= 'times-circle critical';
312 text
= gettext('No');
314 let reason
= record
.get('reason');
315 if (typeof reason
!== 'undefined') {
316 if (reason
in PVE
.Utils
.backup_reasons_table
) {
317 reason
= PVE
.Utils
.backup_reasons_table
[record
.get('reason')];
319 text
= `${text} - ${reason}`;
323 return `<i class="fa fa-${iconCls}"></i> ${text}`;
326 render_backup_days_of_week: function(val
) {
327 var dows
= ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
330 val
.split(',').forEach(function(day
) {
332 var dow
= (dows
.indexOf(day
)+6)%7;
334 if (selected
.length
=== 0 || selected
[selected
.length
-1] === 0) {
337 selected
[selected
.length
-1]++;
350 selected
.forEach(function(item
) {
353 days
.push(Ext
.Date
.dayNames
[cur
+1] + '-' + Ext
.Date
.dayNames
[(cur
+item
)%7]);
355 } else if (item
=== 2) {
356 days
.push(Ext
.Date
.dayNames
[cur
+1]);
357 days
.push(Ext
.Date
.dayNames
[(cur
+2)%7]);
359 } else if (item
=== 1) {
360 days
.push(Ext
.Date
.dayNames
[(cur
+1)%7]);
363 return days
.join(', ');
366 render_backup_selection: function(value
, metaData
, record
) {
367 let allExceptText
= gettext('All except {0}');
368 let allText
= '-- ' + gettext('All') + ' --';
369 if (record
.data
.all
) {
370 if (record
.data
.exclude
) {
371 return Ext
.String
.format(allExceptText
, record
.data
.exclude
);
375 if (record
.data
.vmid
) {
376 return record
.data
.vmid
;
379 if (record
.data
.pool
) {
380 return "Pool '"+ record
.data
.pool
+ "'";
386 backup_reasons_table
: {
387 'backup=yes': gettext('Enabled'),
388 'backup=no': gettext('Disabled'),
389 'enabled': gettext('Enabled'),
390 'disabled': gettext('Disabled'),
391 'not a volume': gettext('Not a volume'),
392 'efidisk but no OMVF BIOS': gettext('EFI Disk without OMVF BIOS'),
395 get_kvm_osinfo: function(value
) {
396 var info
= { base
: 'Other' }; // default
398 Ext
.each(Object
.keys(PVE
.Utils
.kvm_ostypes
), function(k
) {
399 Ext
.each(PVE
.Utils
.kvm_ostypes
[k
], function(e
) {
400 if (e
.val
=== value
) {
401 info
= { desc
: e
.desc
, base
: k
};
409 render_kvm_ostype: function(value
) {
410 var osinfo
= PVE
.Utils
.get_kvm_osinfo(value
);
411 if (osinfo
.desc
&& osinfo
.desc
!== '-') {
412 return osinfo
.base
+ ' ' + osinfo
.desc
;
418 render_hotplug_features: function(value
) {
421 if (!value
|| value
=== '0') {
422 return gettext('Disabled');
426 value
= 'disk,network,usb';
429 Ext
.each(value
.split(','), function(el
) {
431 fa
.push(gettext('Disk'));
432 } else if (el
=== 'network') {
433 fa
.push(gettext('Network'));
434 } else if (el
=== 'usb') {
436 } else if (el
=== 'memory') {
437 fa
.push(gettext('Memory'));
438 } else if (el
=== 'cpu') {
439 fa
.push(gettext('CPU'));
445 return fa
.join(', ');
448 render_localtime: function(value
) {
449 if (value
=== '__default__') {
450 return Proxmox
.Utils
.defaultText
+ ' (' + gettext('Enabled for Windows') + ')';
452 return Proxmox
.Utils
.format_boolean(value
);
455 render_qga_features: function(config
) {
457 return Proxmox
.Utils
.defaultText
+ ' (' + Proxmox
.Utils
.disabledText
+ ')';
459 let qga
= PVE
.Parser
.parsePropertyString(config
, 'enabled');
460 if (!PVE
.Parser
.parseBoolean(qga
.enabled
)) {
461 return Proxmox
.Utils
.disabledText
;
465 let agentstring
= Proxmox
.Utils
.enabledText
;
467 for (const [key
, value
] of Object
.entries(qga
)) {
468 let displayText
= Proxmox
.Utils
.disabledText
;
469 if (key
=== 'type') {
474 displayText
= map
[value
] || Proxmox
.Utils
.unknownText
;
475 } else if (PVE
.Parser
.parseBoolean(value
)) {
476 displayText
= Proxmox
.Utils
.enabledText
;
478 agentstring
+= `, ${key}: ${displayText}`;
484 render_qemu_machine: function(value
) {
485 return value
|| Proxmox
.Utils
.defaultText
+ ' (i440fx)';
488 render_qemu_bios: function(value
) {
490 return Proxmox
.Utils
.defaultText
+ ' (SeaBIOS)';
491 } else if (value
=== 'seabios') {
493 } else if (value
=== 'ovmf') {
494 return "OVMF (UEFI)";
500 render_dc_ha_opts: function(value
) {
502 return Proxmox
.Utils
.defaultText
;
504 return PVE
.Parser
.printPropertyString(value
);
507 render_as_property_string: function(value
) {
508 return !value
? Proxmox
.Utils
.defaultText
509 : PVE
.Parser
.printPropertyString(value
);
512 render_scsihw: function(value
) {
514 return Proxmox
.Utils
.defaultText
+ ' (LSI 53C895A)';
515 } else if (value
=== 'lsi') {
516 return 'LSI 53C895A';
517 } else if (value
=== 'lsi53c810') {
519 } else if (value
=== 'megasas') {
520 return 'MegaRAID SAS 8708EM2';
521 } else if (value
=== 'virtio-scsi-pci') {
522 return 'VirtIO SCSI';
523 } else if (value
=== 'virtio-scsi-single') {
524 return 'VirtIO SCSI single';
525 } else if (value
=== 'pvscsi') {
526 return 'VMware PVSCSI';
532 render_spice_enhancements: function(values
) {
533 let props
= PVE
.Parser
.parsePropertyString(values
);
534 if (Ext
.Object
.isEmpty(props
)) {
535 return Proxmox
.Utils
.noneText
;
539 if (PVE
.Parser
.parseBoolean(props
.foldersharing
)) {
540 output
.push('Folder Sharing: ' + gettext('Enabled'));
542 if (props
.videostreaming
=== 'all' || props
.videostreaming
=== 'filter') {
543 output
.push('Video Streaming: ' + props
.videostreaming
);
545 return output
.join(', ');
548 // fixme: auto-generate this
549 // for now, please keep in sync with PVE::Tools::kvmkeymaps
554 'de-ch': 'German (Swiss)',
555 'en-gb': 'English (UK)',
556 'en-us': 'English (USA)',
560 //fo: 'Faroe Islands',
562 'fr-be': 'French (Belgium)',
563 'fr-ca': 'French (Canada)',
564 'fr-ch': 'French (Swiss)',
574 //'nl-be': 'Dutch (Belgium)',
578 'pt-br': 'Portuguese (Brazil)',
587 std
: gettext('Standard VGA'),
588 vmware
: gettext('VMware compatible'),
590 qxl2
: 'SPICE dual monitor',
591 qxl3
: 'SPICE three monitors',
592 qxl4
: 'SPICE four monitors',
593 serial0
: gettext('Serial terminal') + ' 0',
594 serial1
: gettext('Serial terminal') + ' 1',
595 serial2
: gettext('Serial terminal') + ' 2',
596 serial3
: gettext('Serial terminal') + ' 3',
597 virtio
: 'VirtIO-GPU',
598 none
: Proxmox
.Utils
.noneText
,
601 render_kvm_language: function(value
) {
602 if (!value
|| value
=== '__default__') {
603 return Proxmox
.Utils
.defaultText
;
605 var text
= PVE
.Utils
.kvm_keymaps
[value
];
607 return text
+ ' (' + value
+ ')';
612 kvm_keymap_array: function() {
613 var data
= [['__default__', PVE
.Utils
.render_kvm_language('')]];
614 Ext
.Object
.each(PVE
.Utils
.kvm_keymaps
, function(key
, value
) {
615 data
.push([key
, PVE
.Utils
.render_kvm_language(value
)]);
622 '__default__': Proxmox
.Utils
.defaultText
+ ' (xterm.js)',
623 'vv': 'SPICE (remote-viewer)',
624 'html5': 'HTML5 (noVNC)',
625 'xtermjs': 'xterm.js',
628 render_console_viewer: function(value
) {
629 value
= value
|| '__default__';
630 if (PVE
.Utils
.console_map
[value
]) {
631 return PVE
.Utils
.console_map
[value
];
636 console_viewer_array: function() {
637 return Ext
.Array
.map(Object
.keys(PVE
.Utils
.console_map
), function(v
) {
638 return [v
, PVE
.Utils
.render_console_viewer(v
)];
642 render_kvm_vga_driver: function(value
) {
644 return Proxmox
.Utils
.defaultText
;
646 var vga
= PVE
.Parser
.parsePropertyString(value
, 'type');
647 var text
= PVE
.Utils
.kvm_vga_drivers
[vga
.type
];
649 text
= Proxmox
.Utils
.defaultText
;
652 return text
+ ' (' + value
+ ')';
657 kvm_vga_driver_array: function() {
658 var data
= [['__default__', PVE
.Utils
.render_kvm_vga_driver('')]];
659 Ext
.Object
.each(PVE
.Utils
.kvm_vga_drivers
, function(key
, value
) {
660 data
.push([key
, PVE
.Utils
.render_kvm_vga_driver(value
)]);
666 render_kvm_startup: function(value
) {
667 var startup
= PVE
.Parser
.parseStartup(value
);
670 if (startup
.order
=== undefined) {
673 res
+= startup
.order
;
675 if (startup
.up
!== undefined) {
676 res
+= ',up=' + startup
.up
;
678 if (startup
.down
!== undefined) {
679 res
+= ',down=' + startup
.down
;
685 extractFormActionError: function(action
) {
687 switch (action
.failureType
) {
688 case Ext
.form
.action
.Action
.CLIENT_INVALID
:
689 msg
= gettext('Form fields may not be submitted with invalid values');
691 case Ext
.form
.action
.Action
.CONNECT_FAILURE
:
692 msg
= gettext('Connection error');
693 var resp
= action
.response
;
694 if (resp
.status
&& resp
.statusText
) {
695 msg
+= " " + resp
.status
+ ": " + resp
.statusText
;
698 case Ext
.form
.action
.Action
.LOAD_FAILURE
:
699 case Ext
.form
.action
.Action
.SERVER_INVALID
:
700 msg
= Proxmox
.Utils
.extractRequestError(action
.result
, true);
707 'images': gettext('Disk image'),
708 'backup': gettext('VZDump backup file'),
709 'vztmpl': gettext('Container template'),
710 'iso': gettext('ISO image'),
711 'rootdir': gettext('Container'),
712 'snippets': gettext('Snippets'),
715 volume_is_qemu_backup: function(volid
, format
) {
716 return format
=== 'pbs-vm' || volid
.match(':backup/vzdump-qemu-');
719 volume_is_lxc_backup: function(volid
, format
) {
720 return format
=== 'pbs-ct' || volid
.match(':backup/vzdump-(lxc|openvz)-');
725 name
: gettext('Active Directory Server'),
726 ipanel
: 'pveAuthADPanel',
727 syncipanel
: 'pveAuthLDAPSyncPanel',
733 name
: gettext('LDAP Server'),
734 ipanel
: 'pveAuthLDAPPanel',
735 syncipanel
: 'pveAuthLDAPSyncPanel',
741 name
: gettext('OpenID Connect Server'),
742 ipanel
: 'pveAuthOpenIDPanel',
746 iconCls
: 'pmx-itype-icon-openid-logo',
750 ipanel
: 'pveAuthBasePanel',
756 name
: 'Proxmox VE authentication server',
757 ipanel
: 'pveAuthBasePanel',
766 name
: Proxmox
.Utils
.directoryText
,
767 ipanel
: 'DirInputPanel',
773 ipanel
: 'LVMInputPanel',
779 ipanel
: 'LvmThinInputPanel',
785 ipanel
: 'BTRFSInputPanel',
791 ipanel
: 'NFSInputPanel',
797 ipanel
: 'CIFSInputPanel',
803 ipanel
: 'GlusterFsInputPanel',
809 ipanel
: 'IScsiInputPanel',
815 ipanel
: 'CephFSInputPanel',
820 name
: 'CephFS (PVE)',
821 ipanel
: 'CephFSInputPanel',
828 ipanel
: 'RBDInputPanel',
834 ipanel
: 'RBDInputPanel',
840 name
: 'ZFS over iSCSI',
841 ipanel
: 'ZFSInputPanel',
847 ipanel
: 'ZFSPoolInputPanel',
852 name
: 'Proxmox Backup Server',
853 ipanel
: 'PBSInputPanel',
878 ipanel
: 'SimpleInputPanel',
883 ipanel
: 'VlanInputPanel',
888 ipanel
: 'QinQInputPanel',
893 ipanel
: 'VxlanInputPanel',
898 ipanel
: 'EvpnInputPanel',
903 sdncontrollerSchema
: {
910 ipanel
: 'EvpnInputPanel',
911 faIcon
: 'crosshairs',
915 ipanel
: 'BgpInputPanel',
916 faIcon
: 'crosshairs',
927 ipanel
: 'PVEIpamInputPanel',
933 ipanel
: 'NetboxInputPanel',
938 ipanel
: 'PhpIpamInputPanel',
950 ipanel
: 'PowerdnsInputPanel',
955 format_sdnvnet_type: function(value
, md
, record
) {
956 var schema
= PVE
.Utils
.sdnvnetSchema
[value
];
960 return Proxmox
.Utils
.unknownText
;
963 format_sdnzone_type: function(value
, md
, record
) {
964 var schema
= PVE
.Utils
.sdnzoneSchema
[value
];
968 return Proxmox
.Utils
.unknownText
;
971 format_sdncontroller_type: function(value
, md
, record
) {
972 var schema
= PVE
.Utils
.sdncontrollerSchema
[value
];
976 return Proxmox
.Utils
.unknownText
;
979 format_sdnipam_type: function(value
, md
, record
) {
980 var schema
= PVE
.Utils
.sdnipamSchema
[value
];
984 return Proxmox
.Utils
.unknownText
;
987 format_sdndns_type: function(value
, md
, record
) {
988 var schema
= PVE
.Utils
.sdndnsSchema
[value
];
992 return Proxmox
.Utils
.unknownText
;
995 format_storage_type: function(value
, md
, record
) {
996 if (value
=== 'rbd') {
997 value
= !record
|| record
.get('monhost') ? 'rbd' : 'pveceph';
998 } else if (value
=== 'cephfs') {
999 value
= !record
|| record
.get('monhost') ? 'cephfs' : 'pvecephfs';
1002 var schema
= PVE
.Utils
.storageSchema
[value
];
1006 return Proxmox
.Utils
.unknownText
;
1009 format_ha: function(value
) {
1010 var text
= Proxmox
.Utils
.noneText
;
1012 if (value
.managed
) {
1013 text
= value
.state
|| Proxmox
.Utils
.noneText
;
1015 text
+= ', ' + Proxmox
.Utils
.groupText
+ ': ';
1016 text
+= value
.group
|| Proxmox
.Utils
.noneText
;
1022 format_content_types: function(value
) {
1023 return value
.split(',').sort().map(function(ct
) {
1024 return PVE
.Utils
.contentTypes
[ct
] || ct
;
1028 render_storage_content: function(value
, metaData
, record
) {
1029 var data
= record
.data
;
1030 if (Ext
.isNumber(data
.channel
) &&
1031 Ext
.isNumber(data
.id
) &&
1032 Ext
.isNumber(data
.lun
)) {
1034 Ext
.String
.leftPad(data
.channel
, 2, '0') +
1035 " ID " + data
.id
+ " LUN " + data
.lun
;
1037 return data
.volid
.replace(/^.*?:(.*?\/)?/, '');
1040 render_serverity: function(value
) {
1041 return PVE
.Utils
.log_severity_hash
[value
] || value
;
1044 calculate_hostcpu: function(data
) {
1045 if (!(data
.uptime
&& Ext
.isNumeric(data
.cpu
))) {
1049 if (data
.type
!== 'qemu' && data
.type
!== 'lxc') {
1053 var index
= PVE
.data
.ResourceStore
.findExact('id', 'node/' + data
.node
);
1054 var node
= PVE
.data
.ResourceStore
.getAt(index
);
1055 if (!Ext
.isDefined(node
) || node
=== null) {
1058 var maxcpu
= node
.data
.maxcpu
|| 1;
1060 if (!Ext
.isNumeric(maxcpu
) && (maxcpu
>= 1)) {
1064 return (data
.cpu
/maxcpu
) * data
.maxcpu
;
1067 render_hostcpu: function(value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1068 if (!(record
.data
.uptime
&& Ext
.isNumeric(record
.data
.cpu
))) {
1072 if (record
.data
.type
!== 'qemu' && record
.data
.type
!== 'lxc') {
1076 var index
= PVE
.data
.ResourceStore
.findExact('id', 'node/' + record
.data
.node
);
1077 var node
= PVE
.data
.ResourceStore
.getAt(index
);
1078 if (!Ext
.isDefined(node
) || node
=== null) {
1081 var maxcpu
= node
.data
.maxcpu
|| 1;
1083 if (!Ext
.isNumeric(maxcpu
) && (maxcpu
>= 1)) {
1087 var per
= (record
.data
.cpu
/maxcpu
) * record
.data
.maxcpu
* 100;
1089 return per
.toFixed(1) + '% of ' + maxcpu
.toString() + (maxcpu
> 1 ? 'CPUs' : 'CPU');
1092 render_bandwidth: function(value
) {
1093 if (!Ext
.isNumeric(value
)) {
1097 return Proxmox
.Utils
.format_size(value
) + '/s';
1100 render_timestamp_human_readable: function(value
) {
1101 return Ext
.Date
.format(new Date(value
* 1000), 'l d F Y H:i:s');
1104 calculate_mem_usage: function(data
) {
1105 if (!Ext
.isNumeric(data
.mem
) ||
1106 data
.maxmem
=== 0 ||
1111 return data
.mem
/ data
.maxmem
;
1114 calculate_hostmem_usage: function(data
) {
1115 if (data
.type
!== 'qemu' && data
.type
!== 'lxc') {
1119 var index
= PVE
.data
.ResourceStore
.findExact('id', 'node/' + data
.node
);
1120 var node
= PVE
.data
.ResourceStore
.getAt(index
);
1122 if (!Ext
.isDefined(node
) || node
=== null) {
1125 var maxmem
= node
.data
.maxmem
|| 0;
1127 if (!Ext
.isNumeric(data
.mem
) ||
1133 return data
.mem
/ maxmem
;
1136 render_mem_usage_percent: function(value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1137 if (!Ext
.isNumeric(value
) || value
=== -1) {
1141 // we got no percentage but bytes
1143 var maxmem
= record
.data
.maxmem
;
1144 if (!record
.data
.uptime
||
1146 !Ext
.isNumeric(mem
)) {
1150 return (mem
*100/maxmem
).toFixed(1) + " %";
1152 return (value
*100).toFixed(1) + " %";
1155 render_hostmem_usage_percent: function(value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1156 if (!Ext
.isNumeric(record
.data
.mem
) || value
=== -1) {
1160 if (record
.data
.type
!== 'qemu' && record
.data
.type
!== 'lxc') {
1164 var index
= PVE
.data
.ResourceStore
.findExact('id', 'node/' + record
.data
.node
);
1165 var node
= PVE
.data
.ResourceStore
.getAt(index
);
1166 var maxmem
= node
.data
.maxmem
|| 0;
1168 if (record
.data
.mem
> 1) {
1169 // we got no percentage but bytes
1170 var mem
= record
.data
.mem
;
1171 if (!record
.data
.uptime
||
1173 !Ext
.isNumeric(mem
)) {
1177 return ((mem
*100)/maxmem
).toFixed(1) + " %";
1179 return (value
*100).toFixed(1) + " %";
1182 render_mem_usage: function(value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1184 var maxmem
= record
.data
.maxmem
;
1186 if (!record
.data
.uptime
) {
1190 if (!(Ext
.isNumeric(mem
) && maxmem
)) {
1194 return Proxmox
.Utils
.render_size(value
);
1197 calculate_disk_usage: function(data
) {
1198 if (!Ext
.isNumeric(data
.disk
) ||
1199 ((data
.type
=== 'qemu' || data
.type
=== 'lxc') && data
.uptime
=== 0) ||
1205 return data
.disk
/ data
.maxdisk
;
1208 render_disk_usage_percent: function(value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1209 if (!Ext
.isNumeric(value
) || value
=== -1) {
1213 return (value
* 100).toFixed(1) + " %";
1216 render_disk_usage: function(value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1218 var maxdisk
= record
.data
.maxdisk
;
1219 var type
= record
.data
.type
;
1221 if (!Ext
.isNumeric(disk
) ||
1223 ((type
=== 'qemu' || type
=== 'lxc') && record
.data
.uptime
=== 0)
1228 return Proxmox
.Utils
.render_size(value
);
1231 get_object_icon_class: function(type
, record
) {
1235 if (type
=== 'type') {
1237 objType
= record
.groupbyid
;
1238 } else if (record
.template
) {
1240 objType
= 'template';
1244 status
= record
.status
+ ' ha-' + record
.hastate
;
1248 status
+= ' locked lock-' + record
.lock
;
1251 var defaults
= PVE
.tree
.ResourceTree
.typeDefaults
[objType
];
1252 if (defaults
&& defaults
.iconCls
) {
1253 var retVal
= defaults
.iconCls
+ ' ' + status
;
1260 render_resource_type: function(value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1261 var cls
= PVE
.Utils
.get_object_icon_class(value
, record
.data
);
1263 var fa
= '<i class="fa-fw x-grid-icon-custom ' + cls
+ '"></i> ';
1267 render_support_level: function(value
, metaData
, record
) {
1268 return PVE
.Utils
.support_level_hash
[value
] || '-';
1271 render_upid: function(value
, metaData
, record
) {
1272 var type
= record
.data
.type
;
1273 var id
= record
.data
.id
;
1275 return Proxmox
.Utils
.format_task_description(type
, id
);
1278 render_optional_url: function(value
) {
1279 if (value
&& value
.match(/^https?:\/\//)) {
1280 return '<a target="_blank" href="' + value
+ '">' + value
+ '</a>';
1285 render_san: function(value
) {
1287 if (Ext
.isArray(value
)) {
1288 value
.forEach(function(val
) {
1289 if (!Ext
.isNumber(val
)) {
1293 return names
.join('<br>');
1298 render_full_name: function(firstname
, metaData
, record
) {
1299 var first
= firstname
|| '';
1300 var last
= record
.data
.lastname
|| '';
1301 return Ext
.htmlEncode(first
+ " " + last
);
1304 render_u2f_error: function(error
) {
1306 '1': gettext('Other Error'),
1307 '2': gettext('Bad Request'),
1308 '3': gettext('Configuration Unsupported'),
1309 '4': gettext('Device Ineligible'),
1310 '5': gettext('Timeout'),
1312 return "U2F Error: " + ErrorNames
[error
] || Proxmox
.Utils
.unknownText
;
1315 windowHostname: function() {
1316 return window
.location
.hostname
.replace(Proxmox
.Utils
.IP6_bracket_match
,
1317 function(m
, addr
, offset
, original
) { return addr
; });
1320 openDefaultConsoleWindow: function(consoles
, consoleType
, vmid
, nodename
, vmname
, cmd
) {
1321 var dv
= PVE
.Utils
.defaultViewer(consoles
, consoleType
);
1322 PVE
.Utils
.openConsoleWindow(dv
, consoleType
, vmid
, nodename
, vmname
, cmd
);
1325 openConsoleWindow: function(viewer
, consoleType
, vmid
, nodename
, vmname
, cmd
) {
1326 if (vmid
=== undefined && (consoleType
=== 'kvm' || consoleType
=== 'lxc')) {
1327 throw "missing vmid";
1330 throw "no nodename specified";
1333 if (viewer
=== 'html5') {
1334 PVE
.Utils
.openVNCViewer(consoleType
, vmid
, nodename
, vmname
, cmd
);
1335 } else if (viewer
=== 'xtermjs') {
1336 Proxmox
.Utils
.openXtermJsViewer(consoleType
, vmid
, nodename
, vmname
, cmd
);
1337 } else if (viewer
=== 'vv') {
1338 let url
= '/nodes/' + nodename
+ '/spiceshell';
1340 proxy
: PVE
.Utils
.windowHostname(),
1342 if (consoleType
=== 'kvm') {
1343 url
= '/nodes/' + nodename
+ '/qemu/' + vmid
.toString() + '/spiceproxy';
1344 } else if (consoleType
=== 'lxc') {
1345 url
= '/nodes/' + nodename
+ '/lxc/' + vmid
.toString() + '/spiceproxy';
1346 } else if (consoleType
=== 'upgrade') {
1347 params
.cmd
= 'upgrade';
1348 } else if (consoleType
=== 'cmd') {
1350 } else if (consoleType
!== 'shell') {
1351 throw `unknown spice viewer type '${consoleType}'`;
1353 PVE
.Utils
.openSpiceViewer(url
, params
);
1355 throw `unknown viewer type '${viewer}'`;
1359 defaultViewer: function(consoles
, type
) {
1360 var allowSpice
, allowXtermjs
;
1362 if (consoles
=== true) {
1364 allowXtermjs
= true;
1365 } else if (typeof consoles
=== 'object') {
1366 allowSpice
= consoles
.spice
;
1367 allowXtermjs
= !!consoles
.xtermjs
;
1369 let dv
= PVE
.VersionInfo
.console
|| (type
=== 'kvm' ? 'vv' : 'xtermjs');
1370 if (dv
=== 'vv' && !allowSpice
) {
1371 dv
= allowXtermjs
? 'xtermjs' : 'html5';
1372 } else if (dv
=== 'xtermjs' && !allowXtermjs
) {
1373 dv
= allowSpice
? 'vv' : 'html5';
1379 openVNCViewer: function(vmtype
, vmid
, nodename
, vmname
, cmd
) {
1380 let scaling
= 'off';
1381 if (Proxmox
.Utils
.toolkit
!== 'touch') {
1382 var sp
= Ext
.state
.Manager
.getProvider();
1383 scaling
= sp
.get('novnc-scaling', 'off');
1385 var url
= Ext
.Object
.toQueryString({
1386 console
: vmtype
, // kvm, lxc, upgrade or shell
1394 var nw
= window
.open("?" + url
, '_blank', "innerWidth=745,innerheight=427");
1400 openSpiceViewer: function(url
, params
) {
1401 var downloadWithName = function(uri
, name
) {
1402 var link
= Ext
.DomHelper
.append(document
.body
, {
1405 css
: 'display:none;visibility:hidden;height:0px;',
1408 // Note: we need to tell Android and Chrome the correct file name extension
1409 // but we do not set 'download' tag for other environments, because
1410 // It can have strange side effects (additional user prompt on firefox)
1411 if (navigator
.userAgent
.match(/Android|Chrome/i)) {
1412 link
.download
= name
;
1415 if (link
.fireEvent
) {
1416 link
.fireEvent('onclick');
1418 let evt
= document
.createEvent("MouseEvents");
1419 evt
.initMouseEvent('click', true, true, window
, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
1420 link
.dispatchEvent(evt
);
1424 Proxmox
.Utils
.API2Request({
1428 failure: function(response
, opts
) {
1429 Ext
.Msg
.alert('Error', response
.htmlStatus
);
1431 success: function(response
, opts
) {
1432 let cfg
= response
.result
.data
;
1433 let raw
= Object
.entries(cfg
).reduce((acc
, [k
, v
]) => acc
+ `${k}=${v}\n`, "[virt-viewer]\n");
1434 let spiceDownload
= 'data:application/x-virt-viewer;charset=UTF-8,' + encodeURIComponent(raw
);
1435 downloadWithName(spiceDownload
, "pve-spice.vv");
1440 openTreeConsole: function(tree
, record
, item
, index
, e
) {
1442 let nodename
= record
.data
.node
;
1443 let vmid
= record
.data
.vmid
;
1444 let vmname
= record
.data
.name
;
1445 if (record
.data
.type
=== 'qemu' && !record
.data
.template
) {
1446 Proxmox
.Utils
.API2Request({
1447 url
: `/nodes/${nodename}/qemu/${vmid}/status/current`,
1448 failure
: response
=> Ext
.Msg
.alert('Error', response
.htmlStatus
),
1449 success: function(response
, opts
) {
1450 let conf
= response
.result
.data
;
1452 spice
: !!conf
.spice
,
1453 xtermjs
: !!conf
.serial
,
1455 PVE
.Utils
.openDefaultConsoleWindow(consoles
, 'kvm', vmid
, nodename
, vmname
);
1458 } else if (record
.data
.type
=== 'lxc' && !record
.data
.template
) {
1459 PVE
.Utils
.openDefaultConsoleWindow(true, 'lxc', vmid
, nodename
, vmname
);
1463 // test automation helper
1464 call_menu_handler: function(menu
, text
) {
1465 let item
= menu
.query('menuitem').find(el
=> el
.text
=== text
);
1466 if (item
&& item
.handler
) {
1471 createCmdMenu: function(v
, record
, item
, index
, event
) {
1473 if (!(v
instanceof Ext
.tree
.View
)) {
1477 let type
= record
.data
.type
;
1479 if (record
.data
.template
) {
1480 if (type
=== 'qemu' || type
=== 'lxc') {
1481 menu
= Ext
.create('PVE.menu.TemplateMenu', {
1485 } else if (type
=== 'qemu' || type
=== 'lxc' || type
=== 'node') {
1486 menu
= Ext
.create('PVE.' + type
+ '.CmdMenu', {
1488 nodename
: record
.data
.node
,
1494 menu
.showAt(event
.getXY());
1498 // helper for deleting field which are set to there default values
1499 delete_if_default: function(values
, fieldname
, default_val
, create
) {
1500 if (values
[fieldname
] === '' || values
[fieldname
] === default_val
) {
1502 if (values
.delete) {
1503 if (Ext
.isArray(values
.delete)) {
1504 values
.delete.push(fieldname
);
1506 values
.delete += ',' + fieldname
;
1509 values
.delete = fieldname
;
1513 delete values
[fieldname
];
1517 loadSSHKeyFromFile: function(file
, callback
) {
1518 // ssh-keygen produces ~ 740 bytes for a 4096 bit RSA key, current max is 16 kbit, so assume:
1519 // 740 * 8 for max. 32kbit (5920 bytes), round upwards to 8192 bytes, leaves lots of comment space
1520 PVE
.Utils
.loadFile(file
, callback
, 8192);
1523 loadFile: function(file
, callback
, maxSize
) {
1524 maxSize
= maxSize
|| 32 * 1024;
1525 if (file
.size
> maxSize
) {
1526 Ext
.Msg
.alert(gettext('Error'), `${gettext("Invalid file size")}: ${file.size} > ${maxSize}`);
1529 let reader
= new FileReader();
1530 reader
.onload
= evt
=> callback(evt
.target
.result
);
1531 reader
.readAsText(file
);
1534 loadTextFromFile: function(file
, callback
, maxBytes
) {
1535 let maxSize
= maxBytes
|| 8192;
1536 if (file
.size
> maxSize
) {
1537 Ext
.Msg
.alert(gettext('Error'), gettext("Invalid file size: ") + file
.size
);
1540 let reader
= new FileReader();
1541 reader
.onload
= evt
=> callback(evt
.target
.result
);
1542 reader
.readAsText(file
);
1545 diskControllerMaxIDs
: {
1552 // types is either undefined (all busses), an array of busses, or a single bus
1553 forEachBus: function(types
, func
) {
1554 let busses
= Object
.keys(PVE
.Utils
.diskControllerMaxIDs
);
1556 if (Ext
.isArray(types
)) {
1558 } else if (Ext
.isDefined(types
)) {
1562 // check if we only have valid busses
1563 for (let i
= 0; i
< busses
.length
; i
++) {
1564 if (!PVE
.Utils
.diskControllerMaxIDs
[busses
[i
]]) {
1565 throw "invalid bus: '" + busses
[i
] + "'";
1569 for (let i
= 0; i
< busses
.length
; i
++) {
1570 let count
= PVE
.Utils
.diskControllerMaxIDs
[busses
[i
]];
1571 for (let j
= 0; j
< count
; j
++) {
1572 let cont
= func(busses
[i
], j
);
1573 if (!cont
&& cont
!== undefined) {
1585 forEachMP: function(func
, includeUnused
) {
1586 for (let i
= 0; i
< PVE
.Utils
.mp_counts
.mps
; i
++) {
1587 let cont
= func('mp', i
);
1588 if (!cont
&& cont
!== undefined) {
1593 if (!includeUnused
) {
1597 for (let i
= 0; i
< PVE
.Utils
.mp_counts
.unused
; i
++) {
1598 let cont
= func('unused', i
);
1599 if (!cont
&& cont
!== undefined) {
1605 hardware_counts
: { net
: 32, usb
: 5, hostpci
: 16, audio
: 1, efidisk
: 1, serial
: 4, rng
: 1, tpmstate
: 1 },
1607 cleanEmptyObjectKeys: function(obj
) {
1608 for (const propName
of Object
.keys(obj
)) {
1609 if (obj
[propName
] === null || obj
[propName
] === undefined) {
1610 delete obj
[propName
];
1615 acmedomain_count
: 5,
1617 add_domain_to_acme: function(acme
, domain
) {
1618 if (acme
.domains
=== undefined) {
1619 acme
.domains
= [domain
];
1621 acme
.domains
.push(domain
);
1622 acme
.domains
= acme
.domains
.filter((value
, index
, self
) => self
.indexOf(value
) === index
);
1627 remove_domain_from_acme: function(acme
, domain
) {
1628 if (acme
.domains
!== undefined) {
1631 .filter((value
, index
, self
) => self
.indexOf(value
) === index
&& value
!== domain
);
1636 handleStoreErrorOrMask: function(view
, store
, regex
, callback
) {
1637 view
.mon(store
, 'load', function(proxy
, response
, success
, operation
) {
1639 Proxmox
.Utils
.setErrorMask(view
, false);
1643 if (operation
.error
.statusText
) {
1644 if (operation
.error
.statusText
.match(regex
)) {
1645 callback(view
, operation
.error
);
1648 msg
= operation
.error
.statusText
+ ' (' + operation
.error
.status
+ ')';
1651 msg
= gettext('Connection error');
1653 Proxmox
.Utils
.setErrorMask(view
, msg
);
1657 showCephInstallOrMask: function(container
, msg
, nodename
, callback
) {
1658 if (msg
.match(/not (installed|initialized)/i)) {
1659 if (Proxmox
.UserName
=== 'root@pam') {
1660 container
.el
.mask();
1661 if (!container
.down('pveCephInstallWindow')) {
1662 var isInstalled
= !!msg
.match(/not initialized/i);
1663 var win
= Ext
.create('PVE.ceph.Install', {
1666 win
.getViewModel().set('isInstalled', isInstalled
);
1672 container
.mask(Ext
.String
.format(gettext('{0} not installed.') +
1673 ' ' + gettext('Log in as root to install.'), 'Ceph'), ['pve-static-mask']);
1681 monitor_ceph_installed: function(view
, rstore
, nodename
, maskOwnerCt
) {
1682 PVE
.Utils
.handleStoreErrorOrMask(
1685 /not (installed|initialized)/i,
1687 nodename
= nodename
|| 'localhost';
1688 let maskTarget
= maskOwnerCt
? view
.ownerCt
: view
;
1689 rstore
.stopUpdate();
1690 PVE
.Utils
.showCephInstallOrMask(maskTarget
, error
.statusText
, nodename
, win
=> {
1691 view
.mon(win
, 'cephInstallWindowClosed', () => rstore
.startUpdate());
1698 propertyStringSet: function(target
, source
, name
, value
) {
1700 if (value
=== undefined) {
1701 target
[name
] = source
;
1703 target
[name
] = value
;
1706 delete target
[name
];
1710 forEachCorosyncLink: function(nodeinfo
, cb
) {
1711 let re
= /(?:ring|link)(\d+)_addr/;
1712 Ext
.iterate(nodeinfo
, (prop
, val
) => {
1713 let match
= re
.exec(prop
);
1715 cb(Number(match
[1]), val
);
1722 'AuthenticAMD': 'AMD',
1723 'GenuineIntel': 'Intel',
1731 "_default_": 5, // includes custom models
1734 verify_ip64_address_list: function(value
, with_suffix
) {
1735 for (let addr
of value
.split(/[ ,;]+/)) {
1741 let parts
= addr
.split('%');
1744 if (parts
.length
> 2) {
1748 if (parts
.length
> 1 && !addr
.startsWith('fe80:')) {
1753 if (!Proxmox
.Utils
.IP64_match
.test(addr
)) {
1761 sortByPreviousUsage: function(vmconfig
, controllerList
) {
1762 if (!controllerList
) {
1763 controllerList
= ['ide', 'virtio', 'scsi', 'sata'];
1765 let usedControllers
= {};
1766 for (const type
of Object
.keys(PVE
.Utils
.diskControllerMaxIDs
)) {
1767 usedControllers
[type
] = 0;
1770 for (const property
of Object
.keys(vmconfig
)) {
1771 if (property
.match(PVE
.Utils
.bus_match
) && !vmconfig
[property
].match(/media=cdrom/)) {
1772 const foundController
= property
.match(PVE
.Utils
.bus_match
)[1];
1773 usedControllers
[foundController
]++;
1777 let sortPriority
= PVE
.qemu
.OSDefaults
.getDefaults(vmconfig
.ostype
).busPriority
;
1779 let sortedList
= Ext
.clone(controllerList
);
1780 sortedList
.sort(function(a
, b
) {
1781 if (usedControllers
[b
] === usedControllers
[a
]) {
1782 return sortPriority
[b
] - sortPriority
[a
];
1784 return usedControllers
[b
] - usedControllers
[a
];
1790 nextFreeDisk: function(controllers
, config
) {
1791 for (const controller
of controllers
) {
1792 for (let i
= 0; i
< PVE
.Utils
.diskControllerMaxIDs
[controller
]; i
++) {
1793 let confid
= controller
+ i
.toString();
1794 if (!Ext
.isDefined(config
[confid
])) {
1809 constructor: function() {
1811 Ext
.apply(me
, me
.utilities
);
1813 Proxmox
.Utils
.override_task_descriptions({
1814 acmedeactivate
: ['ACME Account', gettext('Deactivate')],
1815 acmenewcert
: ['SRV', gettext('Order Certificate')],
1816 acmerefresh
: ['ACME Account', gettext('Refresh')],
1817 acmeregister
: ['ACME Account', gettext('Register')],
1818 acmerenew
: ['SRV', gettext('Renew Certificate')],
1819 acmerevoke
: ['SRV', gettext('Revoke Certificate')],
1820 acmeupdate
: ['ACME Account', gettext('Update')],
1821 'auth-realm-sync': [gettext('Realm'), gettext('Sync')],
1822 'auth-realm-sync-test': [gettext('Realm'), gettext('Sync Preview')],
1823 cephcreatemds
: ['Ceph Metadata Server', gettext('Create')],
1824 cephcreatemgr
: ['Ceph Manager', gettext('Create')],
1825 cephcreatemon
: ['Ceph Monitor', gettext('Create')],
1826 cephcreateosd
: ['Ceph OSD', gettext('Create')],
1827 cephcreatepool
: ['Ceph Pool', gettext('Create')],
1828 cephdestroymds
: ['Ceph Metadata Server', gettext('Destroy')],
1829 cephdestroymgr
: ['Ceph Manager', gettext('Destroy')],
1830 cephdestroymon
: ['Ceph Monitor', gettext('Destroy')],
1831 cephdestroyosd
: ['Ceph OSD', gettext('Destroy')],
1832 cephdestroypool
: ['Ceph Pool', gettext('Destroy')],
1833 cephfscreate
: ['CephFS', gettext('Create')],
1834 cephsetpool
: ['Ceph Pool', gettext('Edit')],
1835 cephsetflags
: ['', gettext('Change global Ceph flags')],
1836 clustercreate
: ['', gettext('Create Cluster')],
1837 clusterjoin
: ['', gettext('Join Cluster')],
1838 dircreate
: [gettext('Directory Storage'), gettext('Create')],
1839 dirremove
: [gettext('Directory'), gettext('Remove')],
1840 download
: [gettext('File'), gettext('Download')],
1841 hamigrate
: ['HA', gettext('Migrate')],
1842 hashutdown
: ['HA', gettext('Shutdown')],
1843 hastart
: ['HA', gettext('Start')],
1844 hastop
: ['HA', gettext('Stop')],
1845 imgcopy
: ['', gettext('Copy data')],
1846 imgdel
: ['', gettext('Erase data')],
1847 lvmcreate
: [gettext('LVM Storage'), gettext('Create')],
1848 lvmthincreate
: [gettext('LVM-Thin Storage'), gettext('Create')],
1849 migrateall
: ['', gettext('Migrate all VMs and Containers')],
1850 'move_volume': ['CT', gettext('Move Volume')],
1851 'pbs-download': ['VM/CT', gettext('File Restore Download')],
1852 pull_file
: ['CT', gettext('Pull file')],
1853 push_file
: ['CT', gettext('Push file')],
1854 qmclone
: ['VM', gettext('Clone')],
1855 qmconfig
: ['VM', gettext('Configure')],
1856 qmcreate
: ['VM', gettext('Create')],
1857 qmdelsnapshot
: ['VM', gettext('Delete Snapshot')],
1858 qmdestroy
: ['VM', gettext('Destroy')],
1859 qmigrate
: ['VM', gettext('Migrate')],
1860 qmmove
: ['VM', gettext('Move disk')],
1861 qmpause
: ['VM', gettext('Pause')],
1862 qmreboot
: ['VM', gettext('Reboot')],
1863 qmreset
: ['VM', gettext('Reset')],
1864 qmrestore
: ['VM', gettext('Restore')],
1865 qmresume
: ['VM', gettext('Resume')],
1866 qmrollback
: ['VM', gettext('Rollback')],
1867 qmshutdown
: ['VM', gettext('Shutdown')],
1868 qmsnapshot
: ['VM', gettext('Snapshot')],
1869 qmstart
: ['VM', gettext('Start')],
1870 qmstop
: ['VM', gettext('Stop')],
1871 qmsuspend
: ['VM', gettext('Hibernate')],
1872 qmtemplate
: ['VM', gettext('Convert to template')],
1873 spiceproxy
: ['VM/CT', gettext('Console') + ' (Spice)'],
1874 spiceshell
: ['', gettext('Shell') + ' (Spice)'],
1875 startall
: ['', gettext('Start all VMs and Containers')],
1876 stopall
: ['', gettext('Stop all VMs and Containers')],
1877 unknownimgdel
: ['', gettext('Destroy image from unknown guest')],
1878 wipedisk
: ['Device', gettext('Wipe Disk')],
1879 vncproxy
: ['VM/CT', gettext('Console')],
1880 vncshell
: ['', gettext('Shell')],
1881 vzclone
: ['CT', gettext('Clone')],
1882 vzcreate
: ['CT', gettext('Create')],
1883 vzdelsnapshot
: ['CT', gettext('Delete Snapshot')],
1884 vzdestroy
: ['CT', gettext('Destroy')],
1885 vzdump
: (type
, id
) => id
? `VM/CT ${id} - ${gettext('Backup')}` : gettext('Backup Job'),
1886 vzmigrate
: ['CT', gettext('Migrate')],
1887 vzmount
: ['CT', gettext('Mount')],
1888 vzreboot
: ['CT', gettext('Reboot')],
1889 vzrestore
: ['CT', gettext('Restore')],
1890 vzresume
: ['CT', gettext('Resume')],
1891 vzrollback
: ['CT', gettext('Rollback')],
1892 vzshutdown
: ['CT', gettext('Shutdown')],
1893 vzsnapshot
: ['CT', gettext('Snapshot')],
1894 vzstart
: ['CT', gettext('Start')],
1895 vzstop
: ['CT', gettext('Stop')],
1896 vzsuspend
: ['CT', gettext('Suspend')],
1897 vztemplate
: ['CT', gettext('Convert to template')],
1898 vzumount
: ['CT', gettext('Unmount')],
1899 zfscreate
: [gettext('ZFS Storage'), gettext('Create')],