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/en/proxmox-virtual-environment/pricing">'
38 +'www.proxmox.com</a> to get a list of available options.',
40 getClusterSubscriptionLevel
: async
function() {
41 let { result
} = await Proxmox
.Async
.api2({ url
: '/cluster/status' });
42 let levelMap
= Object
.fromEntries(
43 result
.data
.filter(v
=> v
.type
=== 'node').map(v
=> [v
.name
, v
.level
]),
50 { desc
: '6.x - 2.6 Kernel', val
: 'l26' },
51 { desc
: '2.4 Kernel', val
: 'l24' },
53 'Microsoft Windows': [
54 { desc
: '11/2022', val
: 'win11' },
55 { desc
: '10/2016/2019', val
: 'win10' },
56 { desc
: '8.x/2012/2012r2', val
: 'win8' },
57 { desc
: '7/2008r2', val
: 'win7' },
58 { desc
: 'Vista/2008', val
: 'w2k8' },
59 { desc
: 'XP/2003', val
: 'wxp' },
60 { desc
: '2000', val
: 'w2k' },
63 { desc
: '-', val
: 'solaris' },
66 { desc
: '-', val
: 'other' },
70 is_windows: function(ostype
) {
71 for (let entry
of PVE
.Utils
.kvm_ostypes
['Microsoft Windows']) {
72 if (entry
.val
=== ostype
) {
79 get_health_icon: function(state
, circle
) {
80 if (circle
=== undefined) {
84 if (state
=== undefined) {
88 var icon
= 'faded fa-question';
91 icon
= 'good fa-check';
94 icon
= 'warning fa-upload';
97 icon
= 'warning fa-refresh';
100 icon
= 'warning fa-exclamation';
103 icon
= 'critical fa-times';
115 parse_ceph_version: function(service
) {
116 if (service
.ceph_version_short
) {
117 return service
.ceph_version_short
;
120 if (service
.ceph_version
) {
121 var match
= service
.ceph_version
.match(/version (\d+(\.\d+)*)/);
130 compare_ceph_versions: function(a
, b
) {
138 if (Ext
.isArray(a
)) {
139 avers
= a
.slice(); // copy array
141 avers
= a
.toString().split('.');
144 if (Ext
.isArray(b
)) {
145 bvers
= b
.slice(); // copy array
147 bvers
= b
.toString().split('.');
151 let av
= avers
.shift();
152 let bv
= bvers
.shift();
154 if (av
=== undefined && bv
=== undefined) {
156 } else if (av
=== undefined) {
158 } else if (bv
=== undefined) {
161 let diff
= parseInt(av
, 10) - parseInt(bv
, 10);
162 if (diff
!== 0) return diff
;
163 // else we need to look at the next parts
168 get_ceph_icon_html: function(health
, fw
) {
169 var state
= PVE
.Utils
.map_ceph_health
[health
];
170 var cls
= PVE
.Utils
.get_health_icon(state
);
174 return "<i class='fa " + cls
+ "'></i> ";
179 'HEALTH_UPGRADE': 'upgrade',
181 'HEALTH_WARN': 'warning',
182 'HEALTH_ERR': 'critical',
185 render_sdn_pending: function(rec
, value
, key
, index
) {
186 if (rec
.data
.state
=== undefined || rec
.data
.state
=== null) {
190 if (rec
.data
.state
=== 'deleted') {
191 if (value
=== undefined) {
194 return '<div style="text-decoration: line-through;">'+ value
+'</div>';
196 } else if (rec
.data
.pending
[key
] !== undefined && rec
.data
.pending
[key
] !== null) {
197 if (rec
.data
.pending
[key
] === 'deleted') {
200 return rec
.data
.pending
[key
];
206 render_sdn_pending_state: function(rec
, value
) {
207 if (value
=== undefined || value
=== null) {
211 let icon
= `<i class="fa fa-fw fa-refresh warning"></i>`;
213 if (value
=== 'deleted') {
214 return '<span>' + icon
+ value
+ '</span>';
217 let tip
= gettext('Pending Changes') + ': <br>';
219 for (const [key
, keyvalue
] of Object
.entries(rec
.data
.pending
)) {
220 if ((rec
.data
[key
] !== undefined && rec
.data
.pending
[key
] !== rec
.data
[key
]) ||
221 rec
.data
[key
] === undefined
223 tip
+= `${key}: ${keyvalue} <br>`;
226 return '<span data-qtip="' + tip
+ '">'+ icon
+ value
+ '</span>';
229 render_ceph_health: function(healthObj
) {
231 iconCls
: PVE
.Utils
.get_health_icon(),
235 if (!healthObj
|| !healthObj
.status
) {
239 var health
= PVE
.Utils
.map_ceph_health
[healthObj
.status
];
241 state
.iconCls
= PVE
.Utils
.get_health_icon(health
, true);
242 state
.text
= healthObj
.status
;
247 render_zfs_health: function(value
) {
248 if (typeof value
=== 'undefined') {
251 var iconCls
= 'question-circle';
255 iconCls
= 'check-circle good';
259 iconCls
= 'exclamation-circle warning';
264 iconCls
= 'times-circle critical';
269 return '<i class="fa fa-' + iconCls
+ '"></i> ' + value
;
272 render_pbs_fingerprint
: fp
=> fp
.substring(0, 23),
274 render_backup_encryption: function(v
, meta
, record
) {
276 return gettext('No');
280 if (v
.match(/^[a-fA-F0-9]{2}:/)) { // fingerprint
281 tip
= `Key fingerprint ${PVE.Utils.render_pbs_fingerprint(v)}`;
283 let icon
= `<i class="fa fa-fw fa-lock good"></i>`;
284 return `<span data-qtip="${tip}">${icon} ${gettext('Encrypted')}</span>`;
287 render_backup_verification: function(v
, meta
, record
) {
288 let i
= (cls
, txt
) => `<i class="fa fa-fw fa-${cls}"></i> ${txt}`;
289 if (v
=== undefined || v
=== null) {
290 return i('question-circle-o warning', gettext('None'));
293 let txt
= gettext('Failed');
294 let iconCls
= 'times critical';
295 if (v
.state
=== 'ok') {
297 iconCls
= 'check good';
298 let now
= Date
.now() / 1000;
299 let task
= Proxmox
.Utils
.parse_task_upid(v
.upid
);
300 let verify_time
= Proxmox
.Utils
.render_timestamp(task
.starttime
);
301 tip
= `Last verify task started on ${verify_time}`;
302 if (now
- v
.starttime
> 30 * 24 * 60 * 60) {
303 tip
= `Last verify task over 30 days ago: ${verify_time}`;
304 iconCls
= 'check warning';
307 return `<span data-qtip="${tip}"> ${i(iconCls, txt)} </span>`;
310 render_backup_status: function(value
, meta
, record
) {
311 if (typeof value
=== 'undefined') {
315 let iconCls
= 'check-circle good';
316 let text
= gettext('Yes');
318 if (!PVE
.Parser
.parseBoolean(value
.toString())) {
319 iconCls
= 'times-circle critical';
321 text
= gettext('No');
323 let reason
= record
.get('reason');
324 if (typeof reason
!== 'undefined') {
325 if (reason
in PVE
.Utils
.backup_reasons_table
) {
326 reason
= PVE
.Utils
.backup_reasons_table
[record
.get('reason')];
328 text
= `${text} - ${reason}`;
332 return `<i class="fa fa-${iconCls}"></i> ${text}`;
335 render_backup_days_of_week: function(val
) {
336 var dows
= ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
339 val
.split(',').forEach(function(day
) {
341 var dow
= (dows
.indexOf(day
)+6)%7;
343 if (selected
.length
=== 0 || selected
[selected
.length
-1] === 0) {
346 selected
[selected
.length
-1]++;
359 selected
.forEach(function(item
) {
362 days
.push(Ext
.Date
.dayNames
[cur
+1] + '-' + Ext
.Date
.dayNames
[(cur
+item
)%7]);
364 } else if (item
=== 2) {
365 days
.push(Ext
.Date
.dayNames
[cur
+1]);
366 days
.push(Ext
.Date
.dayNames
[(cur
+2)%7]);
368 } else if (item
=== 1) {
369 days
.push(Ext
.Date
.dayNames
[(cur
+1)%7]);
372 return days
.join(', ');
375 render_backup_selection: function(value
, metaData
, record
) {
376 let allExceptText
= gettext('All except {0}');
377 let allText
= '-- ' + gettext('All') + ' --';
378 if (record
.data
.all
) {
379 if (record
.data
.exclude
) {
380 return Ext
.String
.format(allExceptText
, record
.data
.exclude
);
384 if (record
.data
.vmid
) {
385 return record
.data
.vmid
;
388 if (record
.data
.pool
) {
389 return "Pool '"+ record
.data
.pool
+ "'";
395 backup_reasons_table
: {
396 'backup=yes': gettext('Enabled'),
397 'backup=no': gettext('Disabled'),
398 'enabled': gettext('Enabled'),
399 'disabled': gettext('Disabled'),
400 'not a volume': gettext('Not a volume'),
401 'efidisk but no OMVF BIOS': gettext('EFI Disk without OMVF BIOS'),
404 renderNotFound
: what
=> Ext
.String
.format(gettext("No {0} found"), what
),
406 get_kvm_osinfo: function(value
) {
407 var info
= { base
: 'Other' }; // default
409 Ext
.each(Object
.keys(PVE
.Utils
.kvm_ostypes
), function(k
) {
410 Ext
.each(PVE
.Utils
.kvm_ostypes
[k
], function(e
) {
411 if (e
.val
=== value
) {
412 info
= { desc
: e
.desc
, base
: k
};
420 render_kvm_ostype: function(value
) {
421 var osinfo
= PVE
.Utils
.get_kvm_osinfo(value
);
422 if (osinfo
.desc
&& osinfo
.desc
!== '-') {
423 return osinfo
.base
+ ' ' + osinfo
.desc
;
429 render_hotplug_features: function(value
) {
432 if (!value
|| value
=== '0') {
433 return gettext('Disabled');
437 value
= 'disk,network,usb';
440 Ext
.each(value
.split(','), function(el
) {
442 fa
.push(gettext('Disk'));
443 } else if (el
=== 'network') {
444 fa
.push(gettext('Network'));
445 } else if (el
=== 'usb') {
447 } else if (el
=== 'memory') {
448 fa
.push(gettext('Memory'));
449 } else if (el
=== 'cpu') {
450 fa
.push(gettext('CPU'));
456 return fa
.join(', ');
459 render_localtime: function(value
) {
460 if (value
=== '__default__') {
461 return Proxmox
.Utils
.defaultText
+ ' (' + gettext('Enabled for Windows') + ')';
463 return Proxmox
.Utils
.format_boolean(value
);
466 render_qga_features: function(config
) {
468 return Proxmox
.Utils
.defaultText
+ ' (' + Proxmox
.Utils
.disabledText
+ ')';
470 let qga
= PVE
.Parser
.parsePropertyString(config
, 'enabled');
471 if (!PVE
.Parser
.parseBoolean(qga
.enabled
)) {
472 return Proxmox
.Utils
.disabledText
;
476 let agentstring
= Proxmox
.Utils
.enabledText
;
478 for (const [key
, value
] of Object
.entries(qga
)) {
479 let displayText
= Proxmox
.Utils
.disabledText
;
480 if (key
=== 'type') {
485 displayText
= map
[value
] || Proxmox
.Utils
.unknownText
;
486 } else if (key
=== 'freeze-fs-on-backup' && PVE
.Parser
.parseBoolean(value
)) {
488 } else if (PVE
.Parser
.parseBoolean(value
)) {
489 displayText
= Proxmox
.Utils
.enabledText
;
491 agentstring
+= `, ${key}: ${displayText}`;
497 render_qemu_machine: function(value
) {
498 return value
|| Proxmox
.Utils
.defaultText
+ ' (i440fx)';
501 render_qemu_bios: function(value
) {
503 return Proxmox
.Utils
.defaultText
+ ' (SeaBIOS)';
504 } else if (value
=== 'seabios') {
506 } else if (value
=== 'ovmf') {
507 return "OVMF (UEFI)";
513 render_dc_ha_opts: function(value
) {
515 return Proxmox
.Utils
.defaultText
;
517 return PVE
.Parser
.printPropertyString(value
);
520 render_as_property_string
: v
=> !v
? Proxmox
.Utils
.defaultText
: PVE
.Parser
.printPropertyString(v
),
522 render_scsihw: function(value
) {
523 if (!value
|| value
=== '__default__') {
524 return Proxmox
.Utils
.defaultText
+ ' (LSI 53C895A)';
525 } else if (value
=== 'lsi') {
526 return 'LSI 53C895A';
527 } else if (value
=== 'lsi53c810') {
529 } else if (value
=== 'megasas') {
530 return 'MegaRAID SAS 8708EM2';
531 } else if (value
=== 'virtio-scsi-pci') {
532 return 'VirtIO SCSI';
533 } else if (value
=== 'virtio-scsi-single') {
534 return 'VirtIO SCSI single';
535 } else if (value
=== 'pvscsi') {
536 return 'VMware PVSCSI';
542 render_spice_enhancements: function(values
) {
543 let props
= PVE
.Parser
.parsePropertyString(values
);
544 if (Ext
.Object
.isEmpty(props
)) {
545 return Proxmox
.Utils
.noneText
;
549 if (PVE
.Parser
.parseBoolean(props
.foldersharing
)) {
550 output
.push('Folder Sharing: ' + gettext('Enabled'));
552 if (props
.videostreaming
=== 'all' || props
.videostreaming
=== 'filter') {
553 output
.push('Video Streaming: ' + props
.videostreaming
);
555 return output
.join(', ');
558 // fixme: auto-generate this
559 // for now, please keep in sync with PVE::Tools::kvmkeymaps
561 '__default__': Proxmox
.Utils
.defaultText
,
565 'de-ch': 'German (Swiss)',
566 'en-gb': 'English (UK)',
567 'en-us': 'English (USA)',
571 //fo: 'Faroe Islands',
573 'fr-be': 'French (Belgium)',
574 'fr-ca': 'French (Canada)',
575 'fr-ch': 'French (Swiss)',
585 //'nl-be': 'Dutch (Belgium)',
589 'pt-br': 'Portuguese (Brazil)',
598 '__default__': Proxmox
.Utils
.defaultText
,
599 std
: gettext('Standard VGA'),
600 vmware
: gettext('VMware compatible'),
602 qxl2
: 'SPICE dual monitor',
603 qxl3
: 'SPICE three monitors',
604 qxl4
: 'SPICE four monitors',
605 serial0
: gettext('Serial terminal') + ' 0',
606 serial1
: gettext('Serial terminal') + ' 1',
607 serial2
: gettext('Serial terminal') + ' 2',
608 serial3
: gettext('Serial terminal') + ' 3',
609 virtio
: 'VirtIO-GPU',
610 'virtio-gl': 'VirGL GPU',
611 none
: Proxmox
.Utils
.noneText
,
614 render_kvm_language: function(value
) {
615 if (!value
|| value
=== '__default__') {
616 return Proxmox
.Utils
.defaultText
;
618 let text
= PVE
.Utils
.kvm_keymaps
[value
];
619 return text
? `${text} (${value})` : value
;
623 '__default__': Proxmox
.Utils
.defaultText
+ ' (xterm.js)',
624 'vv': 'SPICE (remote-viewer)',
625 'html5': 'HTML5 (noVNC)',
626 'xtermjs': 'xterm.js',
629 render_console_viewer: function(value
) {
630 value
= value
|| '__default__';
631 return PVE
.Utils
.console_map
[value
] || value
;
634 render_kvm_vga_driver: function(value
) {
636 return Proxmox
.Utils
.defaultText
;
638 let vga
= PVE
.Parser
.parsePropertyString(value
, 'type');
639 let text
= PVE
.Utils
.kvm_vga_drivers
[vga
.type
];
641 text
= Proxmox
.Utils
.defaultText
;
643 return text
? `${text} (${value})` : value
;
646 render_kvm_startup: function(value
) {
647 var startup
= PVE
.Parser
.parseStartup(value
);
650 if (startup
.order
=== undefined) {
653 res
+= startup
.order
;
655 if (startup
.up
!== undefined) {
656 res
+= ',up=' + startup
.up
;
658 if (startup
.down
!== undefined) {
659 res
+= ',down=' + startup
.down
;
665 extractFormActionError: function(action
) {
667 switch (action
.failureType
) {
668 case Ext
.form
.action
.Action
.CLIENT_INVALID
:
669 msg
= gettext('Form fields may not be submitted with invalid values');
671 case Ext
.form
.action
.Action
.CONNECT_FAILURE
:
672 msg
= gettext('Connection error');
673 var resp
= action
.response
;
674 if (resp
.status
&& resp
.statusText
) {
675 msg
+= " " + resp
.status
+ ": " + resp
.statusText
;
678 case Ext
.form
.action
.Action
.LOAD_FAILURE
:
679 case Ext
.form
.action
.Action
.SERVER_INVALID
:
680 msg
= Proxmox
.Utils
.extractRequestError(action
.result
, true);
687 'images': gettext('Disk image'),
688 'backup': gettext('VZDump backup file'),
689 'vztmpl': gettext('Container template'),
690 'iso': gettext('ISO image'),
691 'rootdir': gettext('Container'),
692 'snippets': gettext('Snippets'),
695 volume_is_qemu_backup: function(volid
, format
) {
696 return format
=== 'pbs-vm' || volid
.match(':backup/vzdump-qemu-');
699 volume_is_lxc_backup: function(volid
, format
) {
700 return format
=== 'pbs-ct' || volid
.match(':backup/vzdump-(lxc|openvz)-');
705 name
: gettext('Active Directory Server'),
706 ipanel
: 'pveAuthADPanel',
707 syncipanel
: 'pveAuthLDAPSyncPanel',
713 name
: gettext('LDAP Server'),
714 ipanel
: 'pveAuthLDAPPanel',
715 syncipanel
: 'pveAuthLDAPSyncPanel',
721 name
: gettext('OpenID Connect Server'),
722 ipanel
: 'pveAuthOpenIDPanel',
726 iconCls
: 'pmx-itype-icon-openid-logo',
730 ipanel
: 'pveAuthBasePanel',
736 name
: 'Proxmox VE authentication server',
737 ipanel
: 'pveAuthBasePanel',
746 name
: Proxmox
.Utils
.directoryText
,
747 ipanel
: 'DirInputPanel',
753 ipanel
: 'LVMInputPanel',
759 ipanel
: 'LvmThinInputPanel',
765 ipanel
: 'BTRFSInputPanel',
771 ipanel
: 'NFSInputPanel',
777 ipanel
: 'CIFSInputPanel',
783 ipanel
: 'GlusterFsInputPanel',
789 ipanel
: 'IScsiInputPanel',
795 ipanel
: 'CephFSInputPanel',
800 name
: 'CephFS (PVE)',
801 ipanel
: 'CephFSInputPanel',
808 ipanel
: 'RBDInputPanel',
814 ipanel
: 'RBDInputPanel',
820 name
: 'ZFS over iSCSI',
821 ipanel
: 'ZFSInputPanel',
827 ipanel
: 'ZFSPoolInputPanel',
832 name
: 'Proxmox Backup Server',
833 ipanel
: 'PBSInputPanel',
844 ipanel
: 'ESXIInputPanel',
845 faIcon
: 'cloud-download',
864 ipanel
: 'SimpleInputPanel',
869 ipanel
: 'VlanInputPanel',
874 ipanel
: 'QinQInputPanel',
879 ipanel
: 'VxlanInputPanel',
884 ipanel
: 'EvpnInputPanel',
889 sdncontrollerSchema
: {
896 ipanel
: 'EvpnInputPanel',
897 faIcon
: 'crosshairs',
901 ipanel
: 'BgpInputPanel',
902 faIcon
: 'crosshairs',
906 ipanel
: 'IsisInputPanel',
907 faIcon
: 'crosshairs',
918 ipanel
: 'PVEIpamInputPanel',
924 ipanel
: 'NetboxInputPanel',
929 ipanel
: 'PhpIpamInputPanel',
941 ipanel
: 'PowerdnsInputPanel',
946 format_sdnvnet_type: function(value
, md
, record
) {
947 var schema
= PVE
.Utils
.sdnvnetSchema
[value
];
951 return Proxmox
.Utils
.unknownText
;
954 format_sdnzone_type: function(value
, md
, record
) {
955 var schema
= PVE
.Utils
.sdnzoneSchema
[value
];
959 return Proxmox
.Utils
.unknownText
;
962 format_sdncontroller_type: function(value
, md
, record
) {
963 var schema
= PVE
.Utils
.sdncontrollerSchema
[value
];
967 return Proxmox
.Utils
.unknownText
;
970 format_sdnipam_type: function(value
, md
, record
) {
971 var schema
= PVE
.Utils
.sdnipamSchema
[value
];
975 return Proxmox
.Utils
.unknownText
;
978 format_sdndns_type: function(value
, md
, record
) {
979 var schema
= PVE
.Utils
.sdndnsSchema
[value
];
983 return Proxmox
.Utils
.unknownText
;
986 format_storage_type: function(value
, md
, record
) {
987 if (value
=== 'rbd') {
988 value
= !record
|| record
.get('monhost') ? 'rbd' : 'pveceph';
989 } else if (value
=== 'cephfs') {
990 value
= !record
|| record
.get('monhost') ? 'cephfs' : 'pvecephfs';
993 let schema
= PVE
.Utils
.storageSchema
[value
];
994 return schema
?.name
?? value
;
997 format_ha: function(value
) {
998 var text
= Proxmox
.Utils
.noneText
;
1000 if (value
.managed
) {
1001 text
= value
.state
|| Proxmox
.Utils
.noneText
;
1003 text
+= ', ' + Proxmox
.Utils
.groupText
+ ': ';
1004 text
+= value
.group
|| Proxmox
.Utils
.noneText
;
1010 format_content_types: function(value
) {
1011 return value
.split(',').sort().map(function(ct
) {
1012 return PVE
.Utils
.contentTypes
[ct
] || ct
;
1016 render_storage_content: function(value
, metaData
, record
) {
1017 let data
= record
.data
;
1019 if (Ext
.isNumber(data
.channel
) &&
1020 Ext
.isNumber(data
.id
) &&
1021 Ext
.isNumber(data
.lun
)) {
1023 Ext
.String
.leftPad(data
.channel
, 2, '0') +
1024 " ID " + data
.id
+ " LUN " + data
.lun
;
1026 result
= data
.volid
.replace(/^.*?:(.*?\/)?/, '');
1028 return Ext
.String
.htmlEncode(result
);
1031 render_serverity: function(value
) {
1032 return PVE
.Utils
.log_severity_hash
[value
] || value
;
1035 calculate_hostcpu: function(data
) {
1036 if (!(data
.uptime
&& Ext
.isNumeric(data
.cpu
))) {
1040 if (data
.type
!== 'qemu' && data
.type
!== 'lxc') {
1044 var index
= PVE
.data
.ResourceStore
.findExact('id', 'node/' + data
.node
);
1045 var node
= PVE
.data
.ResourceStore
.getAt(index
);
1046 if (!Ext
.isDefined(node
) || node
=== null) {
1049 var maxcpu
= node
.data
.maxcpu
|| 1;
1051 if (!Ext
.isNumeric(maxcpu
) && (maxcpu
>= 1)) {
1055 return (data
.cpu
/maxcpu
) * data
.maxcpu
;
1058 render_hostcpu: function(value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1059 if (!(record
.data
.uptime
&& Ext
.isNumeric(record
.data
.cpu
))) {
1063 if (record
.data
.type
!== 'qemu' && record
.data
.type
!== 'lxc') {
1067 var index
= PVE
.data
.ResourceStore
.findExact('id', 'node/' + record
.data
.node
);
1068 var node
= PVE
.data
.ResourceStore
.getAt(index
);
1069 if (!Ext
.isDefined(node
) || node
=== null) {
1072 var maxcpu
= node
.data
.maxcpu
|| 1;
1074 if (!Ext
.isNumeric(maxcpu
) && (maxcpu
>= 1)) {
1078 var per
= (record
.data
.cpu
/maxcpu
) * record
.data
.maxcpu
* 100;
1080 return per
.toFixed(1) + '% of ' + maxcpu
.toString() + (maxcpu
> 1 ? 'CPUs' : 'CPU');
1083 render_bandwidth: function(value
) {
1084 if (!Ext
.isNumeric(value
)) {
1088 return Proxmox
.Utils
.format_size(value
) + '/s';
1091 render_timestamp_human_readable: function(value
) {
1092 return Ext
.Date
.format(new Date(value
* 1000), 'l d F Y H:i:s');
1095 // render a timestamp or pending
1096 render_next_event: function(value
) {
1100 let now
= new Date(), next
= new Date(value
* 1000);
1102 return gettext('pending');
1104 return Proxmox
.Utils
.render_timestamp(value
);
1107 calculate_mem_usage: function(data
) {
1108 if (!Ext
.isNumeric(data
.mem
) ||
1109 data
.maxmem
=== 0 ||
1114 return data
.mem
/ data
.maxmem
;
1117 calculate_hostmem_usage: function(data
) {
1118 if (data
.type
!== 'qemu' && data
.type
!== 'lxc') {
1122 var index
= PVE
.data
.ResourceStore
.findExact('id', 'node/' + data
.node
);
1123 var node
= PVE
.data
.ResourceStore
.getAt(index
);
1125 if (!Ext
.isDefined(node
) || node
=== null) {
1128 var maxmem
= node
.data
.maxmem
|| 0;
1130 if (!Ext
.isNumeric(data
.mem
) ||
1136 return data
.mem
/ maxmem
;
1139 render_mem_usage_percent: function(value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1140 if (!Ext
.isNumeric(value
) || value
=== -1) {
1144 // we got no percentage but bytes
1146 var maxmem
= record
.data
.maxmem
;
1147 if (!record
.data
.uptime
||
1149 !Ext
.isNumeric(mem
)) {
1153 return (mem
*100/maxmem
).toFixed(1) + " %";
1155 return (value
*100).toFixed(1) + " %";
1158 render_hostmem_usage_percent: function(value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1159 if (!Ext
.isNumeric(record
.data
.mem
) || value
=== -1) {
1163 if (record
.data
.type
!== 'qemu' && record
.data
.type
!== 'lxc') {
1167 var index
= PVE
.data
.ResourceStore
.findExact('id', 'node/' + record
.data
.node
);
1168 var node
= PVE
.data
.ResourceStore
.getAt(index
);
1169 var maxmem
= node
.data
.maxmem
|| 0;
1171 if (record
.data
.mem
> 1) {
1172 // we got no percentage but bytes
1173 var mem
= record
.data
.mem
;
1174 if (!record
.data
.uptime
||
1176 !Ext
.isNumeric(mem
)) {
1180 return ((mem
*100)/maxmem
).toFixed(1) + " %";
1182 return (value
*100).toFixed(1) + " %";
1185 render_mem_usage: function(value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1187 var maxmem
= record
.data
.maxmem
;
1189 if (!record
.data
.uptime
) {
1193 if (!(Ext
.isNumeric(mem
) && maxmem
)) {
1197 return Proxmox
.Utils
.render_size(value
);
1200 calculate_disk_usage: function(data
) {
1201 if (!Ext
.isNumeric(data
.disk
) ||
1202 ((data
.type
=== 'qemu' || data
.type
=== 'lxc') && data
.uptime
=== 0) ||
1208 return data
.disk
/ data
.maxdisk
;
1211 render_disk_usage_percent: function(value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1212 if (!Ext
.isNumeric(value
) || value
=== -1) {
1216 return (value
* 100).toFixed(1) + " %";
1219 render_disk_usage: function(value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1221 var maxdisk
= record
.data
.maxdisk
;
1222 var type
= record
.data
.type
;
1224 if (!Ext
.isNumeric(disk
) ||
1226 ((type
=== 'qemu' || type
=== 'lxc') && record
.data
.uptime
=== 0)
1231 return Proxmox
.Utils
.render_size(value
);
1234 get_object_icon_class: function(type
, record
) {
1238 if (type
=== 'type') {
1240 objType
= record
.groupbyid
;
1241 } else if (record
.template
) {
1243 objType
= 'template';
1245 } else if (type
=== 'storage' && record
.content
.indexOf('import') !== -1) {
1246 return 'fa fa-cloud-download';
1249 status
= record
.status
+ ' ha-' + record
.hastate
;
1253 status
+= ' locked lock-' + record
.lock
;
1256 var defaults
= PVE
.tree
.ResourceTree
.typeDefaults
[objType
];
1257 if (defaults
&& defaults
.iconCls
) {
1258 var retVal
= defaults
.iconCls
+ ' ' + status
;
1265 render_resource_type: function(value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1266 var cls
= PVE
.Utils
.get_object_icon_class(value
, record
.data
);
1268 var fa
= '<i class="fa-fw x-grid-icon-custom ' + cls
+ '"></i> ';
1272 render_support_level: function(value
, metaData
, record
) {
1273 return PVE
.Utils
.support_level_hash
[value
] || '-';
1276 render_upid: function(value
, metaData
, record
) {
1277 var type
= record
.data
.type
;
1278 var id
= record
.data
.id
;
1280 return Proxmox
.Utils
.format_task_description(type
, id
);
1283 render_optional_url: function(value
) {
1284 if (value
&& value
.match(/^https?:\/\//)) {
1285 return '<a target="_blank" href="' + value
+ '">' + value
+ '</a>';
1290 render_san: function(value
) {
1292 if (Ext
.isArray(value
)) {
1293 value
.forEach(function(val
) {
1294 if (!Ext
.isNumber(val
)) {
1298 return names
.join('<br>');
1303 render_full_name: function(firstname
, metaData
, record
) {
1304 var first
= firstname
|| '';
1305 var last
= record
.data
.lastname
|| '';
1306 return Ext
.htmlEncode(first
+ " " + last
);
1309 // expecting the following format:
1310 // [v2:10.10.10.1:6802/2008,v1:10.10.10.1:6803/2008]
1311 render_ceph_osd_addr: function(value
) {
1312 value
= value
.trim();
1313 if (value
.startsWith('[') && value
.endsWith(']')) {
1314 value
= value
.slice(1, -1); // remove []
1316 value
= value
.replaceAll(',', '\n'); // split IPs in lines
1318 for (const i
of value
.matchAll(/^(v[0-9]):(.*):([0-9]*)\/([0-9]*)$/gm)) {
1319 retVal
+= `${i[1]}: ${i[2]}:${i[3]}<br>`;
1321 return retVal
.length
< 1 ? value
: retVal
;
1324 windowHostname: function() {
1325 return window
.location
.hostname
.replace(Proxmox
.Utils
.IP6_bracket_match
,
1326 function(m
, addr
, offset
, original
) { return addr
; });
1329 openDefaultConsoleWindow: function(consoles
, consoleType
, vmid
, nodename
, vmname
, cmd
) {
1330 var dv
= PVE
.Utils
.defaultViewer(consoles
, consoleType
);
1331 PVE
.Utils
.openConsoleWindow(dv
, consoleType
, vmid
, nodename
, vmname
, cmd
);
1334 openConsoleWindow: function(viewer
, consoleType
, vmid
, nodename
, vmname
, cmd
) {
1335 if (vmid
=== undefined && (consoleType
=== 'kvm' || consoleType
=== 'lxc')) {
1336 throw "missing vmid";
1339 throw "no nodename specified";
1342 if (viewer
=== 'html5') {
1343 PVE
.Utils
.openVNCViewer(consoleType
, vmid
, nodename
, vmname
, cmd
);
1344 } else if (viewer
=== 'xtermjs') {
1345 Proxmox
.Utils
.openXtermJsViewer(consoleType
, vmid
, nodename
, vmname
, cmd
);
1346 } else if (viewer
=== 'vv') {
1347 let url
= '/nodes/' + nodename
+ '/spiceshell';
1349 proxy
: PVE
.Utils
.windowHostname(),
1351 if (consoleType
=== 'kvm') {
1352 url
= '/nodes/' + nodename
+ '/qemu/' + vmid
.toString() + '/spiceproxy';
1353 } else if (consoleType
=== 'lxc') {
1354 url
= '/nodes/' + nodename
+ '/lxc/' + vmid
.toString() + '/spiceproxy';
1355 } else if (consoleType
=== 'upgrade') {
1356 params
.cmd
= 'upgrade';
1357 } else if (consoleType
=== 'cmd') {
1359 } else if (consoleType
!== 'shell') {
1360 throw `unknown spice viewer type '${consoleType}'`;
1362 PVE
.Utils
.openSpiceViewer(url
, params
);
1364 throw `unknown viewer type '${viewer}'`;
1368 defaultViewer: function(consoles
, type
) {
1369 var allowSpice
, allowXtermjs
;
1371 if (consoles
=== true) {
1373 allowXtermjs
= true;
1374 } else if (typeof consoles
=== 'object') {
1375 allowSpice
= consoles
.spice
;
1376 allowXtermjs
= !!consoles
.xtermjs
;
1378 let dv
= PVE
.UIOptions
.options
.console
|| (type
=== 'kvm' ? 'vv' : 'xtermjs');
1379 if (dv
=== 'vv' && !allowSpice
) {
1380 dv
= allowXtermjs
? 'xtermjs' : 'html5';
1381 } else if (dv
=== 'xtermjs' && !allowXtermjs
) {
1382 dv
= allowSpice
? 'vv' : 'html5';
1388 openVNCViewer: function(vmtype
, vmid
, nodename
, vmname
, cmd
) {
1389 let scaling
= 'off';
1390 if (Proxmox
.Utils
.toolkit
!== 'touch') {
1391 var sp
= Ext
.state
.Manager
.getProvider();
1392 scaling
= sp
.get('novnc-scaling', 'off');
1394 var url
= Ext
.Object
.toQueryString({
1395 console
: vmtype
, // kvm, lxc, upgrade or shell
1403 var nw
= window
.open("?" + url
, '_blank', "innerWidth=745,innerheight=427");
1409 openSpiceViewer: function(url
, params
) {
1410 var downloadWithName = function(uri
, name
) {
1411 var link
= Ext
.DomHelper
.append(document
.body
, {
1414 css
: 'display:none;visibility:hidden;height:0px;',
1417 // Note: we need to tell Android, AppleWebKit and Chrome
1418 // the correct file name extension
1419 // but we do not set 'download' tag for other environments, because
1420 // It can have strange side effects (additional user prompt on firefox)
1421 if (navigator
.userAgent
.match(/Android|AppleWebKit|Chrome/i)) {
1422 link
.download
= name
;
1425 if (link
.fireEvent
) {
1426 link
.fireEvent('onclick');
1428 let evt
= document
.createEvent("MouseEvents");
1429 evt
.initMouseEvent('click', true, true, window
, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
1430 link
.dispatchEvent(evt
);
1434 Proxmox
.Utils
.API2Request({
1438 failure: function(response
, opts
) {
1439 Ext
.Msg
.alert('Error', response
.htmlStatus
);
1441 success: function(response
, opts
) {
1442 let cfg
= response
.result
.data
;
1443 let raw
= Object
.entries(cfg
).reduce((acc
, [k
, v
]) => acc
+ `${k}=${v}\n`, "[virt-viewer]\n");
1444 let spiceDownload
= 'data:application/x-virt-viewer;charset=UTF-8,' + encodeURIComponent(raw
);
1445 downloadWithName(spiceDownload
, "pve-spice.vv");
1450 openTreeConsole: function(tree
, record
, item
, index
, e
) {
1452 let nodename
= record
.data
.node
;
1453 let vmid
= record
.data
.vmid
;
1454 let vmname
= record
.data
.name
;
1455 if (record
.data
.type
=== 'qemu' && !record
.data
.template
) {
1456 Proxmox
.Utils
.API2Request({
1457 url
: `/nodes/${nodename}/qemu/${vmid}/status/current`,
1458 failure
: response
=> Ext
.Msg
.alert('Error', response
.htmlStatus
),
1459 success: function(response
, opts
) {
1460 let conf
= response
.result
.data
;
1462 spice
: !!conf
.spice
,
1463 xtermjs
: !!conf
.serial
,
1465 PVE
.Utils
.openDefaultConsoleWindow(consoles
, 'kvm', vmid
, nodename
, vmname
);
1468 } else if (record
.data
.type
=== 'lxc' && !record
.data
.template
) {
1469 PVE
.Utils
.openDefaultConsoleWindow(true, 'lxc', vmid
, nodename
, vmname
);
1473 // test automation helper
1474 call_menu_handler: function(menu
, text
) {
1475 let item
= menu
.query('menuitem').find(el
=> el
.text
=== text
);
1476 if (item
&& item
.handler
) {
1481 createCmdMenu: function(v
, record
, item
, index
, event
) {
1483 if (!(v
instanceof Ext
.tree
.View
)) {
1487 let type
= record
.data
.type
;
1489 if (record
.data
.template
) {
1490 if (type
=== 'qemu' || type
=== 'lxc') {
1491 menu
= Ext
.create('PVE.menu.TemplateMenu', {
1495 } else if (type
=== 'qemu' || type
=== 'lxc' || type
=== 'node') {
1496 menu
= Ext
.create('PVE.' + type
+ '.CmdMenu', {
1498 nodename
: record
.data
.node
,
1504 menu
.showAt(event
.getXY());
1508 // helper for deleting field which are set to there default values
1509 delete_if_default: function(values
, fieldname
, default_val
, create
) {
1510 if (values
[fieldname
] === '' || values
[fieldname
] === default_val
) {
1512 if (values
.delete) {
1513 if (Ext
.isArray(values
.delete)) {
1514 values
.delete.push(fieldname
);
1516 values
.delete += ',' + fieldname
;
1519 values
.delete = fieldname
;
1523 delete values
[fieldname
];
1527 loadSSHKeyFromFile: function(file
, callback
) {
1528 // ssh-keygen produces ~ 740 bytes for a 4096 bit RSA key, current max is 16 kbit, so assume:
1529 // 740 * 8 for max. 32kbit (5920 bytes), round upwards to 8192 bytes, leaves lots of comment space
1530 PVE
.Utils
.loadFile(file
, callback
, 8192);
1533 loadFile: function(file
, callback
, maxSize
) {
1534 maxSize
= maxSize
|| 32 * 1024;
1535 if (file
.size
> maxSize
) {
1536 Ext
.Msg
.alert(gettext('Error'), `${gettext("Invalid file size")}: ${file.size} > ${maxSize}`);
1539 let reader
= new FileReader();
1540 reader
.onload
= evt
=> callback(evt
.target
.result
);
1541 reader
.readAsText(file
);
1544 loadTextFromFile: function(file
, callback
, maxBytes
) {
1545 let maxSize
= maxBytes
|| 8192;
1546 if (file
.size
> maxSize
) {
1547 Ext
.Msg
.alert(gettext('Error'), gettext("Invalid file size: ") + file
.size
);
1550 let reader
= new FileReader();
1551 reader
.onload
= evt
=> callback(evt
.target
.result
);
1552 reader
.readAsText(file
);
1555 diskControllerMaxIDs
: {
1563 // types is either undefined (all busses), an array of busses, or a single bus
1564 forEachBus: function(types
, func
) {
1565 let busses
= Object
.keys(PVE
.Utils
.diskControllerMaxIDs
);
1567 if (Ext
.isArray(types
)) {
1569 } else if (Ext
.isDefined(types
)) {
1573 // check if we only have valid busses
1574 for (let i
= 0; i
< busses
.length
; i
++) {
1575 if (!PVE
.Utils
.diskControllerMaxIDs
[busses
[i
]]) {
1576 throw "invalid bus: '" + busses
[i
] + "'";
1580 for (let i
= 0; i
< busses
.length
; i
++) {
1581 let count
= PVE
.Utils
.diskControllerMaxIDs
[busses
[i
]];
1582 for (let j
= 0; j
< count
; j
++) {
1583 let cont
= func(busses
[i
], j
);
1584 if (!cont
&& cont
!== undefined) {
1596 forEachMP: function(func
, includeUnused
) {
1597 for (let i
= 0; i
< PVE
.Utils
.mp_counts
.mp
; i
++) {
1598 let cont
= func('mp', i
);
1599 if (!cont
&& cont
!== undefined) {
1604 if (!includeUnused
) {
1608 for (let i
= 0; i
< PVE
.Utils
.mp_counts
.unused
; i
++) {
1609 let cont
= func('unused', i
);
1610 if (!cont
&& cont
!== undefined) {
1628 // we can have usb6 and up only for specific machine/ostypes
1629 get_max_usb_count: function(ostype
, machine
) {
1631 return PVE
.Utils
.hardware_counts
.usb_old
;
1634 let match
= /-(\d+).(\d+)/.exec(machine
?? '');
1635 if (!match
|| PVE
.Utils
.qemu_min_version([match
[1], match
[2]], [7, 1])) {
1636 if (ostype
=== 'l26') {
1637 return PVE
.Utils
.hardware_counts
.usb
;
1639 let os_match
= /^win(\d+)$/.exec(ostype
);
1640 if (os_match
&& os_match
[1] > 7) {
1641 return PVE
.Utils
.hardware_counts
.usb
;
1645 return PVE
.Utils
.hardware_counts
.usb_old
;
1648 // parameters are expected to be arrays, e.g. [7,1], [4,0,1]
1649 // returns true if toCheck is equal or greater than minVersion
1650 qemu_min_version: function(toCheck
, minVersion
) {
1652 for (i
= 0; i
< toCheck
.length
&& i
< minVersion
.length
; i
++) {
1653 if (toCheck
[i
] < minVersion
[i
]) {
1658 if (minVersion
.length
> toCheck
.length
) {
1659 for (; i
< minVersion
.length
; i
++) {
1660 if (minVersion
[i
] !== 0) {
1669 cleanEmptyObjectKeys: function(obj
) {
1670 for (const propName
of Object
.keys(obj
)) {
1671 if (obj
[propName
] === null || obj
[propName
] === undefined) {
1672 delete obj
[propName
];
1677 acmedomain_count
: 5,
1679 add_domain_to_acme: function(acme
, domain
) {
1680 if (acme
.domains
=== undefined) {
1681 acme
.domains
= [domain
];
1683 acme
.domains
.push(domain
);
1684 acme
.domains
= acme
.domains
.filter((value
, index
, self
) => self
.indexOf(value
) === index
);
1689 remove_domain_from_acme: function(acme
, domain
) {
1690 if (acme
.domains
!== undefined) {
1693 .filter((value
, index
, self
) => self
.indexOf(value
) === index
&& value
!== domain
);
1698 handleStoreErrorOrMask: function(view
, store
, regex
, callback
) {
1699 view
.mon(store
, 'load', function(proxy
, response
, success
, operation
) {
1701 Proxmox
.Utils
.setErrorMask(view
, false);
1705 if (operation
.error
.statusText
) {
1706 if (operation
.error
.statusText
.match(regex
)) {
1707 callback(view
, operation
.error
);
1710 msg
= operation
.error
.statusText
+ ' (' + operation
.error
.status
+ ')';
1713 msg
= gettext('Connection error');
1715 Proxmox
.Utils
.setErrorMask(view
, msg
);
1719 showCephInstallOrMask: function(container
, msg
, nodename
, callback
) {
1720 if (msg
.match(/not (installed|initialized)/i)) {
1721 if (Proxmox
.UserName
=== 'root@pam') {
1722 container
.el
.mask();
1723 if (!container
.down('pveCephInstallWindow')) {
1724 var isInstalled
= !!msg
.match(/not initialized/i);
1725 var win
= Ext
.create('PVE.ceph.Install', {
1728 win
.getViewModel().set('isInstalled', isInstalled
);
1730 win
.on('close', () => {
1731 container
.el
.unmask();
1737 container
.mask(Ext
.String
.format(gettext('{0} not installed.') +
1738 ' ' + gettext('Log in as root to install.'), 'Ceph'), ['pve-static-mask']);
1746 monitor_ceph_installed: function(view
, rstore
, nodename
, maskOwnerCt
) {
1747 PVE
.Utils
.handleStoreErrorOrMask(
1750 /not (installed|initialized)/i,
1752 nodename
= nodename
|| Proxmox
.NodeName
;
1753 let maskTarget
= maskOwnerCt
? view
.ownerCt
: view
;
1754 rstore
.stopUpdate();
1755 PVE
.Utils
.showCephInstallOrMask(maskTarget
, error
.statusText
, nodename
, win
=> {
1756 view
.mon(win
, 'cephInstallWindowClosed', () => rstore
.startUpdate());
1763 propertyStringSet: function(target
, source
, name
, value
) {
1765 if (value
=== undefined) {
1766 target
[name
] = source
;
1768 target
[name
] = value
;
1771 delete target
[name
];
1775 forEachCorosyncLink: function(nodeinfo
, cb
) {
1776 let re
= /(?:ring|link)(\d+)_addr/;
1777 Ext
.iterate(nodeinfo
, (prop
, val
) => {
1778 let match
= re
.exec(prop
);
1780 cb(Number(match
[1]), val
);
1787 'AuthenticAMD': 'AMD',
1788 'GenuineIntel': 'Intel',
1796 "_default_": 5, // includes custom models
1799 verify_ip64_address_list: function(value
, with_suffix
) {
1800 for (let addr
of value
.split(/[ ,;]+/)) {
1806 let parts
= addr
.split('%');
1809 if (parts
.length
> 2) {
1813 if (parts
.length
> 1 && !addr
.startsWith('fe80:')) {
1818 if (!Proxmox
.Utils
.IP64_match
.test(addr
)) {
1826 sortByPreviousUsage: function(vmconfig
, controllerList
) {
1827 if (!controllerList
) {
1828 controllerList
= ['ide', 'virtio', 'scsi', 'sata'];
1830 let usedControllers
= {};
1831 for (const type
of Object
.keys(PVE
.Utils
.diskControllerMaxIDs
)) {
1832 usedControllers
[type
] = 0;
1835 for (const property
of Object
.keys(vmconfig
)) {
1836 if (property
.match(PVE
.Utils
.bus_match
) && !vmconfig
[property
].match(/media=cdrom/)) {
1837 const foundController
= property
.match(PVE
.Utils
.bus_match
)[1];
1838 usedControllers
[foundController
]++;
1842 let sortPriority
= PVE
.qemu
.OSDefaults
.getDefaults(vmconfig
.ostype
).busPriority
;
1844 let sortedList
= Ext
.clone(controllerList
);
1845 sortedList
.sort(function(a
, b
) {
1846 if (usedControllers
[b
] === usedControllers
[a
]) {
1847 return sortPriority
[b
] - sortPriority
[a
];
1849 return usedControllers
[b
] - usedControllers
[a
];
1855 nextFreeDisk: function(controllers
, config
) {
1856 for (const controller
of controllers
) {
1857 for (let i
= 0; i
< PVE
.Utils
.diskControllerMaxIDs
[controller
]; i
++) {
1858 let confid
= controller
+ i
.toString();
1859 if (!Ext
.isDefined(config
[confid
])) {
1872 nextFreeMP: function(type
, config
) {
1873 for (let i
= 0; i
< PVE
.Utils
.mp_counts
[type
]; i
++) {
1874 let confid
= `${type}${i}`;
1875 if (!Ext
.isDefined(config
[confid
])) {
1887 escapeNotesTemplate: function(value
) {
1892 return value
.replace(/(\\|[\n])/g, match
=> replace
[match
]);
1895 unEscapeNotesTemplate: function(value
) {
1900 return value
.replace(/(\\\\|\\n)/g, match
=> replace
[match
]);
1903 notesTemplateVars
: ['cluster', 'guestname', 'node', 'vmid'],
1905 renderTags: function(tagstext
, overrides
) {
1908 let tags
= (tagstext
.split(/[,; ]/) || []).filter(t
=> !!t
);
1909 if (PVE
.UIOptions
.shouldSortTags()) {
1910 tags
= tags
.sort((a
, b
) => {
1911 let alc
= a
.toLowerCase();
1912 let blc
= b
.toLowerCase();
1913 return alc
< blc
? -1 : blc
< alc
? 1 : a
.localeCompare(b
);
1917 tags
.forEach((tag
) => {
1918 text
+= Proxmox
.Utils
.getTagElement(tag
, overrides
);
1924 tagCharRegex
: /^[a-z0-9+_.-]+$/i,
1926 verificationStateOrder
: {
1933 isStandaloneNode: function() {
1934 return PVE
.data
.ResourceStore
.getNodes().length
< 2;
1937 // main use case of this helper is the login window
1938 getUiLanguage: function() {
1939 let languageCookie
= Ext
.util
.Cookies
.get('PVELangCookie');
1940 if (languageCookie
=== 'kr') {
1941 // fix-up 'kr' being used for Korean by mistake FIXME: remove with PVE 9
1942 let dt
= Ext
.Date
.add(new Date(), Ext
.Date
.YEAR
, 10);
1943 languageCookie
= 'ko';
1944 Ext
.util
.Cookies
.set('PVELangCookie', languageCookie
, dt
);
1946 return languageCookie
|| Proxmox
.defaultLang
|| 'en';
1951 constructor: function() {
1953 Ext
.apply(me
, me
.utilities
);
1955 Proxmox
.Utils
.override_task_descriptions({
1956 acmedeactivate
: ['ACME Account', gettext('Deactivate')],
1957 acmenewcert
: ['SRV', gettext('Order Certificate')],
1958 acmerefresh
: ['ACME Account', gettext('Refresh')],
1959 acmeregister
: ['ACME Account', gettext('Register')],
1960 acmerenew
: ['SRV', gettext('Renew Certificate')],
1961 acmerevoke
: ['SRV', gettext('Revoke Certificate')],
1962 acmeupdate
: ['ACME Account', gettext('Update')],
1963 'auth-realm-sync': [gettext('Realm'), gettext('Sync')],
1964 'auth-realm-sync-test': [gettext('Realm'), gettext('Sync Preview')],
1965 cephcreatemds
: ['Ceph Metadata Server', gettext('Create')],
1966 cephcreatemgr
: ['Ceph Manager', gettext('Create')],
1967 cephcreatemon
: ['Ceph Monitor', gettext('Create')],
1968 cephcreateosd
: ['Ceph OSD', gettext('Create')],
1969 cephcreatepool
: ['Ceph Pool', gettext('Create')],
1970 cephdestroymds
: ['Ceph Metadata Server', gettext('Destroy')],
1971 cephdestroymgr
: ['Ceph Manager', gettext('Destroy')],
1972 cephdestroymon
: ['Ceph Monitor', gettext('Destroy')],
1973 cephdestroyosd
: ['Ceph OSD', gettext('Destroy')],
1974 cephdestroypool
: ['Ceph Pool', gettext('Destroy')],
1975 cephdestroyfs
: ['CephFS', gettext('Destroy')],
1976 cephfscreate
: ['CephFS', gettext('Create')],
1977 cephsetpool
: ['Ceph Pool', gettext('Edit')],
1978 cephsetflags
: ['', gettext('Change global Ceph flags')],
1979 clustercreate
: ['', gettext('Create Cluster')],
1980 clusterjoin
: ['', gettext('Join Cluster')],
1981 dircreate
: [gettext('Directory Storage'), gettext('Create')],
1982 dirremove
: [gettext('Directory'), gettext('Remove')],
1983 download
: [gettext('File'), gettext('Download')],
1984 hamigrate
: ['HA', gettext('Migrate')],
1985 hashutdown
: ['HA', gettext('Shutdown')],
1986 hastart
: ['HA', gettext('Start')],
1987 hastop
: ['HA', gettext('Stop')],
1988 imgcopy
: ['', gettext('Copy data')],
1989 imgdel
: ['', gettext('Erase data')],
1990 lvmcreate
: [gettext('LVM Storage'), gettext('Create')],
1991 lvmremove
: ['Volume Group', gettext('Remove')],
1992 lvmthincreate
: [gettext('LVM-Thin Storage'), gettext('Create')],
1993 lvmthinremove
: ['Thinpool', gettext('Remove')],
1994 migrateall
: ['', gettext('Bulk migrate VMs and Containers')],
1995 'move_volume': ['CT', gettext('Move Volume')],
1996 'pbs-download': ['VM/CT', gettext('File Restore Download')],
1997 pull_file
: ['CT', gettext('Pull file')],
1998 push_file
: ['CT', gettext('Push file')],
1999 qmclone
: ['VM', gettext('Clone')],
2000 qmconfig
: ['VM', gettext('Configure')],
2001 qmcreate
: ['VM', gettext('Create')],
2002 qmdelsnapshot
: ['VM', gettext('Delete Snapshot')],
2003 qmdestroy
: ['VM', gettext('Destroy')],
2004 qmigrate
: ['VM', gettext('Migrate')],
2005 qmmove
: ['VM', gettext('Move disk')],
2006 qmpause
: ['VM', gettext('Pause')],
2007 qmreboot
: ['VM', gettext('Reboot')],
2008 qmreset
: ['VM', gettext('Reset')],
2009 qmrestore
: ['VM', gettext('Restore')],
2010 qmresume
: ['VM', gettext('Resume')],
2011 qmrollback
: ['VM', gettext('Rollback')],
2012 qmshutdown
: ['VM', gettext('Shutdown')],
2013 qmsnapshot
: ['VM', gettext('Snapshot')],
2014 qmstart
: ['VM', gettext('Start')],
2015 qmstop
: ['VM', gettext('Stop')],
2016 qmsuspend
: ['VM', gettext('Hibernate')],
2017 qmtemplate
: ['VM', gettext('Convert to template')],
2018 resize
: ['VM/CT', gettext('Resize')],
2019 spiceproxy
: ['VM/CT', gettext('Console') + ' (Spice)'],
2020 spiceshell
: ['', gettext('Shell') + ' (Spice)'],
2021 startall
: ['', gettext('Bulk start VMs and Containers')],
2022 stopall
: ['', gettext('Bulk shutdown VMs and Containers')],
2023 suspendall
: ['', gettext('Suspend all VMs')],
2024 unknownimgdel
: ['', gettext('Destroy image from unknown guest')],
2025 wipedisk
: ['Device', gettext('Wipe Disk')],
2026 vncproxy
: ['VM/CT', gettext('Console')],
2027 vncshell
: ['', gettext('Shell')],
2028 vzclone
: ['CT', gettext('Clone')],
2029 vzcreate
: ['CT', gettext('Create')],
2030 vzdelsnapshot
: ['CT', gettext('Delete Snapshot')],
2031 vzdestroy
: ['CT', gettext('Destroy')],
2032 vzdump
: (type
, id
) => id
? `VM/CT ${id} - ${gettext('Backup')}` : gettext('Backup Job'),
2033 vzmigrate
: ['CT', gettext('Migrate')],
2034 vzmount
: ['CT', gettext('Mount')],
2035 vzreboot
: ['CT', gettext('Reboot')],
2036 vzrestore
: ['CT', gettext('Restore')],
2037 vzresume
: ['CT', gettext('Resume')],
2038 vzrollback
: ['CT', gettext('Rollback')],
2039 vzshutdown
: ['CT', gettext('Shutdown')],
2040 vzsnapshot
: ['CT', gettext('Snapshot')],
2041 vzstart
: ['CT', gettext('Start')],
2042 vzstop
: ['CT', gettext('Stop')],
2043 vzsuspend
: ['CT', gettext('Suspend')],
2044 vztemplate
: ['CT', gettext('Convert to template')],
2045 vzumount
: ['CT', gettext('Unmount')],
2046 zfscreate
: [gettext('ZFS Storage'), gettext('Create')],
2047 zfsremove
: ['ZFS Pool', gettext('Remove')],