]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/Utils.js
3 // avoid errors related to Accessible Rich Internet Applications
4 // (access for people with disabilities)
5 // TODO reenable after all components are upgraded
6 Ext
. enableAria
= false ;
7 Ext
. enableAriaButtons
= false ;
8 Ext
. enableAriaPanels
= false ;
10 // avoid errors when running without development tools
11 if (! Ext
. isDefined ( Ext
. global
. console
)) {
16 console
. log ( "Starting PVE Manager" );
18 Ext
. Ajax
. defaultHeaders
= {
19 'Accept' : 'application/json' ,
22 Ext
. define ( 'PVE.Utils' , {
25 // this singleton contains miscellaneous utilities
27 toolkit
: undefined , // (extjs|touch), set inside Toolkit.js
29 bus_match
: /^(ide|sata|virtio|scsi)\d+$/ ,
43 'c' : gettext ( 'Community' ),
44 'b' : gettext ( 'Basic' ),
45 's' : gettext ( 'Standard' ),
46 'p' : gettext ( 'Premium' ),
49 noSubKeyHtml
: 'You do not have a valid subscription for this server. Please visit <a target="_blank" href="https://www.proxmox.com/products/proxmox-ve/subscription-service-plans">www.proxmox.com</a> to get a list of available options.' ,
53 { desc
: '5.x - 2.6 Kernel' , val
: 'l26' },
54 { desc
: '2.4 Kernel' , val
: 'l24' },
56 'Microsoft Windows' : [
57 { desc
: '10/2016/2019' , val
: 'win10' },
58 { desc
: '8.x/2012/2012r2' , val
: 'win8' },
59 { desc
: '7/2008r2' , val
: 'win7' },
60 { desc
: 'Vista/2008' , val
: 'w2k8' },
61 { desc
: 'XP/2003' , val
: 'wxp' },
62 { desc
: '2000' , val
: 'w2k' },
65 { desc
: '-' , val
: 'solaris' },
68 { desc
: '-' , val
: 'other' },
72 is_windows : function ( ostype
) {
73 for ( let entry
of PVE
. Utils
. kvm_ostypes
[ 'Microsoft Windows' ]) {
74 if ( entry
. val
=== ostype
) {
81 get_health_icon : function ( state
, circle
) {
82 if ( circle
=== undefined ) {
86 if ( state
=== undefined ) {
90 var icon
= 'faded fa-question' ;
93 icon
= 'good fa-check' ;
96 icon
= 'warning fa-upload' ;
99 icon
= 'warning fa-refresh' ;
102 icon
= 'warning fa-exclamation' ;
105 icon
= 'critical fa-times' ;
117 parse_ceph_version : function ( service
) {
118 if ( service
. ceph_version_short
) {
119 return service
. ceph_version_short
;
122 if ( service
. ceph_version
) {
123 var match
= service
. ceph_version
. match ( /version (\d+(\.\d+)*)/ );
132 compare_ceph_versions : function ( a
, b
) {
140 if ( Ext
. isArray ( a
)) {
141 avers
= a
. slice (); // copy array
143 avers
= a
. toString (). split ( '.' );
146 if ( Ext
. isArray ( b
)) {
147 bvers
= b
. slice (); // copy array
149 bvers
= b
. toString (). split ( '.' );
153 let av
= avers
. shift ();
154 let bv
= bvers
. shift ();
156 if ( av
=== undefined && bv
=== undefined ) {
158 } else if ( av
=== undefined ) {
160 } else if ( bv
=== undefined ) {
163 let diff
= parseInt ( av
, 10 ) - parseInt ( bv
, 10 );
164 if ( diff
!= 0 ) return diff
;
165 // else we need to look at the next parts
170 get_ceph_icon_html : function ( health
, fw
) {
171 var state
= PVE
. Utils
. map_ceph_health
[ health
];
172 var cls
= PVE
. Utils
. get_health_icon ( state
);
176 return "<i class='fa " + cls
+ "'></i> " ;
181 'HEALTH_UPGRADE' : 'upgrade' ,
183 'HEALTH_WARN' : 'warning' ,
184 'HEALTH_ERR' : 'critical' ,
187 render_ceph_health : function ( healthObj
) {
189 iconCls
: PVE
. Utils
. get_health_icon (),
193 if (! healthObj
|| ! healthObj
. status
) {
197 var health
= PVE
. Utils
. map_ceph_health
[ healthObj
. status
];
199 state
. iconCls
= PVE
. Utils
. get_health_icon ( health
, true );
200 state
. text
= healthObj
. status
;
205 render_zfs_health : function ( value
) {
206 if ( typeof value
== 'undefined' ) {
209 var iconCls
= 'question-circle' ;
213 iconCls
= 'check-circle good' ;
217 iconCls
= 'exclamation-circle warning' ;
222 iconCls
= 'times-circle critical' ;
227 return '<i class="fa fa-' + iconCls
+ '"></i> ' + value
;
230 render_pbs_fingerprint
: fp
=> fp
. substring ( 0 , 23 ),
232 render_backup_encryption : function ( v
, meta
, record
) {
234 return gettext ( 'No' );
238 if ( v
. match ( /^[a-fA-F0-9]{2}:/ )) { // fingerprint
239 tip
= `Key fingerprint ${PVE.Utils.render_pbs_fingerprint(v)} ` ;
241 let icon
= `<i class="fa fa-fw fa-lock good"></i>` ;
242 return `<span data-qtip=" ${tip} "> ${icon} ${gettext('Encrypted')} </span>` ;
245 render_backup_verification : function ( v
, meta
, record
) {
246 let i
= ( cls
, txt
) => `<i class="fa fa-fw fa- ${cls} "></i> ${txt} ` ;
247 if ( v
=== undefined || v
=== null ) {
248 return i ( 'question-circle-o warning' , gettext ( 'None' ));
251 let txt
= gettext ( 'Failed' );
252 let iconCls
= 'times critical' ;
253 if ( v
. state
=== 'ok' ) {
255 iconCls
= 'check good' ;
256 let now
= Date
. now () / 1000 ;
257 let task
= Proxmox
. Utils
. parse_task_upid ( v
. upid
);
258 let verify_time
= Proxmox
. Utils
. render_timestamp ( task
. starttime
);
259 tip
= `Last verify task started on ${verify_time} ` ;
260 if ( now
- v
. starttime
> 30 * 24 * 60 * 60 ) {
261 tip
= `Last verify task over 30 days ago: ${verify_time} ` ;
262 iconCls
= 'check warning' ;
265 return `<span data-qtip=" ${tip} "> ${i(iconCls, txt)} </span>` ;
268 render_backup_status : function ( value
, meta
, record
) {
269 if ( typeof value
== 'undefined' ) {
273 let iconCls
= 'check-circle good' ;
274 let text
= gettext ( 'Yes' );
276 if (! PVE
. Parser
. parseBoolean ( value
. toString ())) {
277 iconCls
= 'times-circle critical' ;
279 text
= gettext ( 'No' );
281 let reason
= record
. get ( 'reason' );
282 if ( typeof reason
!== 'undefined' ) {
283 if ( reason
in PVE
. Utils
. backup_reasons_table
) {
284 reason
= PVE
. Utils
. backup_reasons_table
[ record
. get ( 'reason' )];
286 text
= ` ${text} - ${reason} ` ;
290 return `<i class="fa fa- ${iconCls} "></i> ${text} ` ;
293 render_backup_days_of_week : function ( val
) {
294 var dows
= [ 'sun' , 'mon' , 'tue' , 'wed' , 'thu' , 'fri' , 'sat' ];
297 val
. split ( ',' ). forEach ( function ( day
) {
299 var dow
= ( dows
. indexOf ( day
)+ 6 )% 7 ;
301 if ( selected
. length
=== 0 || selected
[ selected
. length
- 1 ] === 0 ) {
304 selected
[ selected
. length
- 1 ]++;
317 selected
. forEach ( function ( item
) {
320 days
. push ( Ext
. Date
. dayNames
[ cur
+ 1 ] + '-' + Ext
. Date
. dayNames
[( cur
+ item
)% 7 ]);
322 } else if ( item
== 2 ) {
323 days
. push ( Ext
. Date
. dayNames
[ cur
+ 1 ]);
324 days
. push ( Ext
. Date
. dayNames
[( cur
+ 2 )% 7 ]);
326 } else if ( item
== 1 ) {
327 days
. push ( Ext
. Date
. dayNames
[( cur
+ 1 )% 7 ]);
330 return days
. join ( ', ' );
333 render_backup_selection : function ( value
, metaData
, record
) {
334 let allExceptText
= gettext ( 'All except {0}' );
335 let allText
= '-- ' + gettext ( 'All' ) + ' --' ;
336 if ( record
. data
. all
) {
337 if ( record
. data
. exclude
) {
338 return Ext
. String
. format ( allExceptText
, record
. data
. exclude
);
342 if ( record
. data
. vmid
) {
343 return record
. data
. vmid
;
346 if ( record
. data
. pool
) {
347 return "Pool '" + record
. data
. pool
+ "'" ;
353 backup_reasons_table
: {
354 'backup=yes' : gettext ( 'Enabled' ),
355 'backup=no' : gettext ( 'Disabled' ),
356 'enabled' : gettext ( 'Enabled' ),
357 'disabled' : gettext ( 'Disabled' ),
358 'not a volume' : gettext ( 'Not a volume' ),
359 'efidisk but no OMVF BIOS' : gettext ( 'EFI Disk without OMVF BIOS' ),
362 get_kvm_osinfo : function ( value
) {
363 var info
= { base
: 'Other' }; // default
365 Ext
. each ( Object
. keys ( PVE
. Utils
. kvm_ostypes
), function ( k
) {
366 Ext
. each ( PVE
. Utils
. kvm_ostypes
[ k
], function ( e
) {
367 if ( e
. val
=== value
) {
368 info
= { desc
: e
. desc
, base
: k
};
376 render_kvm_ostype : function ( value
) {
377 var osinfo
= PVE
. Utils
. get_kvm_osinfo ( value
);
378 if ( osinfo
. desc
&& osinfo
. desc
!== '-' ) {
379 return osinfo
. base
+ ' ' + osinfo
. desc
;
385 render_hotplug_features : function ( value
) {
388 if (! value
|| value
=== '0' ) {
389 return gettext ( 'Disabled' );
393 value
= 'disk,network,usb' ;
396 Ext
. each ( value
. split ( ',' ), function ( el
) {
398 fa
. push ( gettext ( 'Disk' ));
399 } else if ( el
=== 'network' ) {
400 fa
. push ( gettext ( 'Network' ));
401 } else if ( el
=== 'usb' ) {
403 } else if ( el
=== 'memory' ) {
404 fa
. push ( gettext ( 'Memory' ));
405 } else if ( el
=== 'cpu' ) {
406 fa
. push ( gettext ( 'CPU' ));
412 return fa
. join ( ', ' );
415 render_localtime : function ( value
) {
416 if ( value
=== '__default__' ) {
417 return Proxmox
. Utils
. defaultText
+ ' (' + gettext ( 'Enabled for Windows' ) + ')' ;
419 return Proxmox
. Utils
. format_boolean ( value
);
422 render_qga_features : function ( value
) {
424 return Proxmox
. Utils
. defaultText
+ ' (' + Proxmox
. Utils
. disabledText
+ ')' ;
426 var props
= PVE
. Parser
. parsePropertyString ( value
, 'enabled' );
427 if (! PVE
. Parser
. parseBoolean ( props
. enabled
)) {
428 return Proxmox
. Utils
. disabledText
;
431 delete props
. enabled
;
432 var agentstring
= Proxmox
. Utils
. enabledText
;
434 Ext
. Object
. each ( props
, function ( key
, value
) {
436 agentstring
+= ', ' + key
+ ': ' ;
438 if ( key
=== 'type' ) {
443 agentstring
+= map
[ value
] || Proxmox
. Utils
. unknownText
;
445 if ( PVE
. Parser
. parseBoolean ( value
)) {
446 agentstring
+= Proxmox
. Utils
. enabledText
;
448 agentstring
+= Proxmox
. Utils
. disabledText
;
456 render_qemu_machine : function ( value
) {
457 return value
|| Proxmox
. Utils
. defaultText
+ ' (i440fx)' ;
460 render_qemu_bios : function ( value
) {
462 return Proxmox
. Utils
. defaultText
+ ' (SeaBIOS)' ;
463 } else if ( value
=== 'seabios' ) {
465 } else if ( value
=== 'ovmf' ) {
466 return "OVMF (UEFI)" ;
472 render_dc_ha_opts : function ( value
) {
474 return Proxmox
. Utils
. defaultText
;
476 return PVE
. Parser
. printPropertyString ( value
);
479 render_as_property_string : function ( value
) {
480 return ! value
? Proxmox
. Utils
. defaultText
481 : PVE
. Parser
. printPropertyString ( value
);
484 render_scsihw : function ( value
) {
486 return Proxmox
. Utils
. defaultText
+ ' (LSI 53C895A)' ;
487 } else if ( value
=== 'lsi' ) {
488 return 'LSI 53C895A' ;
489 } else if ( value
=== 'lsi53c810' ) {
491 } else if ( value
=== 'megasas' ) {
492 return 'MegaRAID SAS 8708EM2' ;
493 } else if ( value
=== 'virtio-scsi-pci' ) {
494 return 'VirtIO SCSI' ;
495 } else if ( value
=== 'virtio-scsi-single' ) {
496 return 'VirtIO SCSI single' ;
497 } else if ( value
=== 'pvscsi' ) {
498 return 'VMware PVSCSI' ;
504 render_spice_enhancements : function ( values
) {
505 let props
= PVE
. Parser
. parsePropertyString ( values
);
506 if ( Ext
. Object
. isEmpty ( props
)) {
507 return Proxmox
. Utils
. noneText
;
511 if ( PVE
. Parser
. parseBoolean ( props
. foldersharing
)) {
512 output
. push ( 'Folder Sharing: ' + gettext ( 'Enabled' ));
514 if ( props
. videostreaming
=== 'all' || props
. videostreaming
=== 'filter' ) {
515 output
. push ( 'Video Streaming: ' + props
. videostreaming
);
517 return output
. join ( ', ' );
520 // fixme: auto-generate this
521 // for now, please keep in sync with PVE::Tools::kvmkeymaps
526 'de-ch' : 'German (Swiss)' ,
527 'en-gb' : 'English (UK)' ,
528 'en-us' : 'English (USA)' ,
532 //fo: 'Faroe Islands',
534 'fr-be' : 'French (Belgium)' ,
535 'fr-ca' : 'French (Canada)' ,
536 'fr-ch' : 'French (Swiss)' ,
546 //'nl-be': 'Dutch (Belgium)',
550 'pt-br' : 'Portuguese (Brazil)' ,
559 std
: gettext ( 'Standard VGA' ),
560 vmware
: gettext ( 'VMware compatible' ),
562 qxl2
: 'SPICE dual monitor' ,
563 qxl3
: 'SPICE three monitors' ,
564 qxl4
: 'SPICE four monitors' ,
565 serial0
: gettext ( 'Serial terminal' ) + ' 0' ,
566 serial1
: gettext ( 'Serial terminal' ) + ' 1' ,
567 serial2
: gettext ( 'Serial terminal' ) + ' 2' ,
568 serial3
: gettext ( 'Serial terminal' ) + ' 3' ,
569 virtio
: 'VirtIO-GPU' ,
570 none
: Proxmox
. Utils
. noneText
,
573 render_kvm_language : function ( value
) {
574 if (! value
|| value
=== '__default__' ) {
575 return Proxmox
. Utils
. defaultText
;
577 var text
= PVE
. Utils
. kvm_keymaps
[ value
];
579 return text
+ ' (' + value
+ ')' ;
584 kvm_keymap_array : function () {
585 var data
= [[ '__default__' , PVE
. Utils
. render_kvm_language ( '' )]];
586 Ext
. Object
. each ( PVE
. Utils
. kvm_keymaps
, function ( key
, value
) {
587 data
. push ([ key
, PVE
. Utils
. render_kvm_language ( value
)]);
594 '__default__' : Proxmox
. Utils
. defaultText
+ ' (xterm.js)' ,
595 'vv' : 'SPICE (remote-viewer)' ,
596 'html5' : 'HTML5 (noVNC)' ,
597 'xtermjs' : 'xterm.js' ,
600 render_console_viewer : function ( value
) {
601 value
= value
|| '__default__' ;
602 if ( PVE
. Utils
. console_map
[ value
]) {
603 return PVE
. Utils
. console_map
[ value
];
608 console_viewer_array : function () {
609 return Ext
. Array
. map ( Object
. keys ( PVE
. Utils
. console_map
), function ( v
) {
610 return [ v
, PVE
. Utils
. render_console_viewer ( v
)];
614 render_kvm_vga_driver : function ( value
) {
616 return Proxmox
. Utils
. defaultText
;
618 var vga
= PVE
. Parser
. parsePropertyString ( value
, 'type' );
619 var text
= PVE
. Utils
. kvm_vga_drivers
[ vga
. type
];
621 text
= Proxmox
. Utils
. defaultText
;
624 return text
+ ' (' + value
+ ')' ;
629 kvm_vga_driver_array : function () {
630 var data
= [[ '__default__' , PVE
. Utils
. render_kvm_vga_driver ( '' )]];
631 Ext
. Object
. each ( PVE
. Utils
. kvm_vga_drivers
, function ( key
, value
) {
632 data
. push ([ key
, PVE
. Utils
. render_kvm_vga_driver ( value
)]);
638 render_kvm_startup : function ( value
) {
639 var startup
= PVE
. Parser
. parseStartup ( value
);
642 if ( startup
. order
=== undefined ) {
645 res
+= startup
. order
;
647 if ( startup
. up
!== undefined ) {
648 res
+= ',up=' + startup
. up
;
650 if ( startup
. down
!== undefined ) {
651 res
+= ',down=' + startup
. down
;
657 extractFormActionError : function ( action
) {
659 switch ( action
. failureType
) {
660 case Ext
. form
. action
. Action
. CLIENT_INVALID
:
661 msg
= gettext ( 'Form fields may not be submitted with invalid values' );
663 case Ext
. form
. action
. Action
. CONNECT_FAILURE
:
664 msg
= gettext ( 'Connection error' );
665 var resp
= action
. response
;
666 if ( resp
. status
&& resp
. statusText
) {
667 msg
+= " " + resp
. status
+ ": " + resp
. statusText
;
670 case Ext
. form
. action
. Action
. LOAD_FAILURE
:
671 case Ext
. form
. action
. Action
. SERVER_INVALID
:
672 msg
= Proxmox
. Utils
. extractRequestError ( action
. result
, true );
679 'images' : gettext ( 'Disk image' ),
680 'backup' : gettext ( 'VZDump backup file' ),
681 'vztmpl' : gettext ( 'Container template' ),
682 'iso' : gettext ( 'ISO image' ),
683 'rootdir' : gettext ( 'Container' ),
684 'snippets' : gettext ( 'Snippets' ),
687 volume_is_qemu_backup : function ( volid
, format
) {
688 return format
=== 'pbs-vm' || volid
. match ( ':backup/vzdump-qemu-' );
691 volume_is_lxc_backup : function ( volid
, format
) {
692 return format
=== 'pbs-ct' || volid
. match ( ':backup/vzdump-(lxc|openvz)-' );
697 name
: gettext ( 'Active Directory Server' ),
698 ipanel
: 'pveAuthADPanel' ,
699 syncipanel
: 'pveAuthLDAPSyncPanel' ,
703 name
: gettext ( 'LDAP Server' ),
704 ipanel
: 'pveAuthLDAPPanel' ,
705 syncipanel
: 'pveAuthLDAPSyncPanel' ,
710 ipanel
: 'pveAuthBasePanel' ,
714 name
: 'Proxmox VE authentication server' ,
715 ipanel
: 'pveAuthBasePanel' ,
722 name
: Proxmox
. Utils
. directoryText
,
723 ipanel
: 'DirInputPanel' ,
729 ipanel
: 'LVMInputPanel' ,
735 ipanel
: 'LvmThinInputPanel' ,
741 ipanel
: 'NFSInputPanel' ,
747 ipanel
: 'CIFSInputPanel' ,
753 ipanel
: 'GlusterFsInputPanel' ,
759 ipanel
: 'IScsiInputPanel' ,
765 ipanel
: 'CephFSInputPanel' ,
770 name
: 'CephFS (PVE)' ,
771 ipanel
: 'CephFSInputPanel' ,
778 ipanel
: 'RBDInputPanel' ,
784 ipanel
: 'RBDInputPanel' ,
790 name
: 'ZFS over iSCSI' ,
791 ipanel
: 'ZFSInputPanel' ,
797 ipanel
: 'ZFSPoolInputPanel' ,
802 name
: 'Proxmox Backup Server' ,
803 ipanel
: 'PBSInputPanel' ,
828 ipanel
: 'SimpleInputPanel' ,
833 ipanel
: 'VlanInputPanel' ,
838 ipanel
: 'QinQInputPanel' ,
843 ipanel
: 'VxlanInputPanel' ,
848 ipanel
: 'EvpnInputPanel' ,
853 sdncontrollerSchema
: {
860 ipanel
: 'EvpnInputPanel' ,
861 faIcon
: 'crosshairs' ,
865 format_sdnvnet_type : function ( value
, md
, record
) {
866 var schema
= PVE
. Utils
. sdnvnetSchema
[ value
];
870 return Proxmox
. Utils
. unknownText
;
873 format_sdnzone_type : function ( value
, md
, record
) {
874 var schema
= PVE
. Utils
. sdnzoneSchema
[ value
];
878 return Proxmox
. Utils
. unknownText
;
881 format_sdncontroller_type : function ( value
, md
, record
) {
882 var schema
= PVE
. Utils
. sdncontrollerSchema
[ value
];
886 return Proxmox
. Utils
. unknownText
;
889 format_storage_type : function ( value
, md
, record
) {
890 if ( value
=== 'rbd' ) {
891 value
= ! record
|| record
. get ( 'monhost' ) ? 'rbd' : 'pveceph' ;
892 } else if ( value
=== 'cephfs' ) {
893 value
= ! record
|| record
. get ( 'monhost' ) ? 'cephfs' : 'pvecephfs' ;
896 var schema
= PVE
. Utils
. storageSchema
[ value
];
900 return Proxmox
. Utils
. unknownText
;
903 format_ha : function ( value
) {
904 var text
= Proxmox
. Utils
. noneText
;
907 text
= value
. state
|| Proxmox
. Utils
. noneText
;
909 text
+= ', ' + Proxmox
. Utils
. groupText
+ ': ' ;
910 text
+= value
. group
|| Proxmox
. Utils
. noneText
;
916 format_content_types : function ( value
) {
917 return value
. split ( ',' ). sort (). map ( function ( ct
) {
918 return PVE
. Utils
. contentTypes
[ ct
] || ct
;
922 render_storage_content : function ( value
, metaData
, record
) {
923 var data
= record
. data
;
924 if ( Ext
. isNumber ( data
. channel
) &&
925 Ext
. isNumber ( data
. id
) &&
926 Ext
. isNumber ( data
. lun
)) {
928 Ext
. String
. leftPad ( data
. channel
, 2 , '0' ) +
929 " ID " + data
. id
+ " LUN " + data
. lun
;
931 return data
. volid
. replace ( /^.*?:(.*?\/)?/ , '' );
934 render_serverity : function ( value
) {
935 return PVE
. Utils
. log_severity_hash
[ value
] || value
;
938 calculate_hostcpu : function ( data
) {
940 if (!( data
. uptime
&& Ext
. isNumeric ( data
. cpu
))) {
944 if ( data
. type
!== 'qemu' && data
. type
!== 'lxc' ) {
948 var index
= PVE
. data
. ResourceStore
. findExact ( 'id' , 'node/' + data
. node
);
949 var node
= PVE
. data
. ResourceStore
. getAt ( index
);
950 if (! Ext
. isDefined ( node
) || node
=== null ) {
953 var maxcpu
= node
. data
. maxcpu
|| 1 ;
955 if (! Ext
. isNumeric ( maxcpu
) && ( maxcpu
>= 1 )) {
959 return (( data
. cpu
/ maxcpu
) * data
. maxcpu
);
962 render_hostcpu : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
964 if (!( record
. data
. uptime
&& Ext
. isNumeric ( record
. data
. cpu
))) {
968 if ( record
. data
. type
!== 'qemu' && record
. data
. type
!== 'lxc' ) {
972 var index
= PVE
. data
. ResourceStore
. findExact ( 'id' , 'node/' + record
. data
. node
);
973 var node
= PVE
. data
. ResourceStore
. getAt ( index
);
974 if (! Ext
. isDefined ( node
) || node
=== null ) {
977 var maxcpu
= node
. data
. maxcpu
|| 1 ;
979 if (! Ext
. isNumeric ( maxcpu
) && ( maxcpu
>= 1 )) {
983 var per
= ( record
. data
. cpu
/ maxcpu
) * record
. data
. maxcpu
* 100 ;
985 return per
. toFixed ( 1 ) + '% of ' + maxcpu
. toString () + ( maxcpu
> 1 ? 'CPUs' : 'CPU' );
988 render_bandwidth : function ( value
) {
989 if (! Ext
. isNumeric ( value
)) {
993 return Proxmox
. Utils
. format_size ( value
) + '/s' ;
996 render_timestamp_human_readable : function ( value
) {
997 return Ext
. Date
. format ( new Date ( value
* 1000 ), 'l d F Y H:i:s' );
1000 calculate_mem_usage : function ( data
) {
1001 if (! Ext
. isNumeric ( data
. mem
) ||
1002 data
. maxmem
=== 0 ||
1007 return data
. mem
/ data
. maxmem
;
1010 calculate_hostmem_usage : function ( data
) {
1012 if ( data
. type
!== 'qemu' && data
. type
!== 'lxc' ) {
1016 var index
= PVE
. data
. ResourceStore
. findExact ( 'id' , 'node/' + data
. node
);
1017 var node
= PVE
. data
. ResourceStore
. getAt ( index
);
1019 if (! Ext
. isDefined ( node
) || node
=== null ) {
1022 var maxmem
= node
. data
. maxmem
|| 0 ;
1024 if (! Ext
. isNumeric ( data
. mem
) ||
1030 return ( data
. mem
/ maxmem
);
1033 render_mem_usage_percent : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1034 if (! Ext
. isNumeric ( value
) || value
=== - 1 ) {
1038 // we got no percentage but bytes
1040 var maxmem
= record
. data
. maxmem
;
1041 if (! record
. data
. uptime
||
1043 ! Ext
. isNumeric ( mem
)) {
1047 return ( mem
* 100 / maxmem
). toFixed ( 1 ) + " %" ;
1049 return ( value
* 100 ). toFixed ( 1 ) + " %" ;
1052 render_hostmem_usage_percent : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1054 if (! Ext
. isNumeric ( record
. data
. mem
) || value
=== - 1 ) {
1058 if ( record
. data
. type
!== 'qemu' && record
. data
. type
!== 'lxc' ) {
1062 var index
= PVE
. data
. ResourceStore
. findExact ( 'id' , 'node/' + record
. data
. node
);
1063 var node
= PVE
. data
. ResourceStore
. getAt ( index
);
1064 var maxmem
= node
. data
. maxmem
|| 0 ;
1066 if ( record
. data
. mem
> 1 ) {
1067 // we got no percentage but bytes
1068 var mem
= record
. data
. mem
;
1069 if (! record
. data
. uptime
||
1071 ! Ext
. isNumeric ( mem
)) {
1075 return (( mem
* 100 )/ maxmem
). toFixed ( 1 ) + " %" ;
1077 return ( value
* 100 ). toFixed ( 1 ) + " %" ;
1080 render_mem_usage : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1082 var maxmem
= record
. data
. maxmem
;
1084 if (! record
. data
. uptime
) {
1088 if (!( Ext
. isNumeric ( mem
) && maxmem
)) {
1092 return Proxmox
. Utils
. render_size ( value
);
1095 calculate_disk_usage : function ( data
) {
1096 if (! Ext
. isNumeric ( data
. disk
) ||
1097 data
. type
=== 'qemu' ||
1098 data
. type
=== 'lxc' && data
. uptime
=== 0 ||
1099 data
. maxdisk
=== 0 ) {
1103 return data
. disk
/ data
. maxdisk
;
1106 render_disk_usage_percent : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1107 if (! Ext
. isNumeric ( value
) || value
=== - 1 ) {
1111 return ( value
* 100 ). toFixed ( 1 ) + " %" ;
1114 render_disk_usage : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1116 var maxdisk
= record
. data
. maxdisk
;
1117 var type
= record
. data
. type
;
1119 if (! Ext
. isNumeric ( disk
) ||
1122 type
=== 'lxc' && record
. data
. uptime
=== 0 ) {
1126 return Proxmox
. Utils
. render_size ( value
);
1129 get_object_icon_class : function ( type
, record
) {
1133 if ( type
=== 'type' ) {
1135 objType
= record
. groupbyid
;
1136 } else if ( record
. template
) {
1138 objType
= 'template' ;
1142 status
= record
. status
+ ' ha-' + record
. hastate
;
1146 status
+= ' locked lock-' + record
. lock
;
1149 var defaults
= PVE
. tree
. ResourceTree
. typeDefaults
[ objType
];
1150 if ( defaults
&& defaults
. iconCls
) {
1151 var retVal
= defaults
. iconCls
+ ' ' + status
;
1158 render_resource_type : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1159 var cls
= PVE
. Utils
. get_object_icon_class ( value
, record
. data
);
1161 var fa
= '<i class="fa-fw x-grid-icon-custom ' + cls
+ '"></i> ' ;
1165 render_support_level : function ( value
, metaData
, record
) {
1166 return PVE
. Utils
. support_level_hash
[ value
] || '-' ;
1169 render_upid : function ( value
, metaData
, record
) {
1170 var type
= record
. data
. type
;
1171 var id
= record
. data
. id
;
1173 return Proxmox
. Utils
. format_task_description ( type
, id
);
1176 render_optional_url : function ( value
) {
1178 if ( value
&& ( match
= value
. match ( /^https?:\/\// )) !== null ) {
1179 return '<a target="_blank" href="' + value
+ '">' + value
+ '</a>' ;
1184 render_san : function ( value
) {
1186 if ( Ext
. isArray ( value
)) {
1187 value
. forEach ( function ( val
) {
1188 if (! Ext
. isNumber ( val
)) {
1192 return names
. join ( '<br>' );
1197 render_full_name : function ( firstname
, metaData
, record
) {
1198 var first
= firstname
|| '' ;
1199 var last
= record
. data
. lastname
|| '' ;
1200 return Ext
. htmlEncode ( first
+ " " + last
);
1203 render_u2f_error : function ( error
) {
1205 '1' : gettext ( 'Other Error' ),
1206 '2' : gettext ( 'Bad Request' ),
1207 '3' : gettext ( 'Configuration Unsupported' ),
1208 '4' : gettext ( 'Device Ineligible' ),
1209 '5' : gettext ( 'Timeout' ),
1211 return "U2F Error: " + ErrorNames
[ error
] || Proxmox
. Utils
. unknownText
;
1214 windowHostname : function () {
1215 return window
. location
. hostname
. replace ( Proxmox
. Utils
. IP6_bracket_match
,
1216 function ( m
, addr
, offset
, original
) { return addr
; });
1219 openDefaultConsoleWindow : function ( consoles
, consoleType
, vmid
, nodename
, vmname
, cmd
) {
1220 var dv
= PVE
. Utils
. defaultViewer ( consoles
, consoleType
);
1221 PVE
. Utils
. openConsoleWindow ( dv
, consoleType
, vmid
, nodename
, vmname
, cmd
);
1224 openConsoleWindow : function ( viewer
, consoleType
, vmid
, nodename
, vmname
, cmd
) {
1225 if ( vmid
== undefined && ( consoleType
=== 'kvm' || consoleType
=== 'lxc' )) {
1226 throw "missing vmid" ;
1229 throw "no nodename specified" ;
1232 if ( viewer
=== 'html5' ) {
1233 PVE
. Utils
. openVNCViewer ( consoleType
, vmid
, nodename
, vmname
, cmd
);
1234 } else if ( viewer
=== 'xtermjs' ) {
1235 Proxmox
. Utils
. openXtermJsViewer ( consoleType
, vmid
, nodename
, vmname
, cmd
);
1236 } else if ( viewer
=== 'vv' ) {
1237 let url
= '/nodes/' + nodename
+ '/spiceshell' ;
1239 proxy
: PVE
. Utils
. windowHostname (),
1241 if ( consoleType
=== 'kvm' ) {
1242 url
= '/nodes/' + nodename
+ '/qemu/' + vmid
. toString () + '/spiceproxy' ;
1243 } else if ( consoleType
=== 'lxc' ) {
1244 url
= '/nodes/' + nodename
+ '/lxc/' + vmid
. toString () + '/spiceproxy' ;
1245 } else if ( consoleType
=== 'upgrade' ) {
1246 params
. cmd
= 'upgrade' ;
1247 } else if ( consoleType
=== 'cmd' ) {
1249 } else if ( consoleType
!== 'shell' ) {
1250 throw `unknown spice viewer type ' ${consoleType} '` ;
1252 PVE
. Utils
. openSpiceViewer ( url
, params
);
1254 throw `unknown viewer type ' ${viewer} '` ;
1258 defaultViewer : function ( consoles
, type
) {
1259 var allowSpice
, allowXtermjs
;
1261 if ( consoles
=== true ) {
1263 allowXtermjs
= true ;
1264 } else if ( typeof consoles
=== 'object' ) {
1265 allowSpice
= consoles
. spice
;
1266 allowXtermjs
= !! consoles
. xtermjs
;
1268 let dv
= PVE
. VersionInfo
. console
|| ( type
=== 'kvm' ? 'vv' : 'xtermjs' );
1269 if ( dv
=== 'vv' && ! allowSpice
) {
1270 dv
= allowXtermjs
? 'xtermjs' : 'html5' ;
1271 } else if ( dv
=== 'xtermjs' && ! allowXtermjs
) {
1272 dv
= allowSpice
? 'vv' : 'html5' ;
1278 openVNCViewer : function ( vmtype
, vmid
, nodename
, vmname
, cmd
) {
1279 let scaling
= 'off' ;
1280 if ( Proxmox
. Utils
. toolkit
!== 'touch' ) {
1281 var sp
= Ext
. state
. Manager
. getProvider ();
1282 scaling
= sp
. get ( 'novnc-scaling' , 'off' );
1284 var url
= Ext
. Object
. toQueryString ({
1285 console
: vmtype
, // kvm, lxc, upgrade or shell
1293 var nw
= window
. open ( "?" + url
, '_blank' , "innerWidth=745,innerheight=427" );
1299 openSpiceViewer : function ( url
, params
) {
1300 var downloadWithName = function ( uri
, name
) {
1301 var link
= Ext
. DomHelper
. append ( document
. body
, {
1304 css
: 'display:none;visibility:hidden;height:0px;' ,
1307 // Note: we need to tell Android and Chrome the correct file name extension
1308 // but we do not set 'download' tag for other environments, because
1309 // It can have strange side effects (additional user prompt on firefox)
1310 if ( navigator
. userAgent
. match ( /Android|Chrome/i )) {
1311 link
. download
= name
;
1314 if ( link
. fireEvent
) {
1315 link
. fireEvent ( 'onclick' );
1317 let evt
= document
. createEvent ( "MouseEvents" );
1318 evt
. initMouseEvent ( 'click' , true , true , window
, 1 , 0 , 0 , 0 , 0 , false , false , false , false , 0 , null );
1319 link
. dispatchEvent ( evt
);
1323 Proxmox
. Utils
. API2Request ({
1327 failure : function ( response
, opts
) {
1328 Ext
. Msg
. alert ( 'Error' , response
. htmlStatus
);
1330 success : function ( response
, opts
) {
1331 var raw
= "[virt-viewer] \n " ;
1332 Ext
. Object
. each ( response
. result
. data
, function ( k
, v
) {
1333 raw
+= k
+ "=" + v
+ " \n " ;
1335 var url
= 'data:application/x-virt-viewer;charset=UTF-8,' +
1336 encodeURIComponent ( raw
);
1338 downloadWithName ( url
, "pve-spice.vv" );
1343 openTreeConsole : function ( tree
, record
, item
, index
, e
) {
1345 var nodename
= record
. data
. node
;
1346 var vmid
= record
. data
. vmid
;
1347 var vmname
= record
. data
. name
;
1348 if ( record
. data
. type
=== 'qemu' && ! record
. data
. template
) {
1349 Proxmox
. Utils
. API2Request ({
1350 url
: '/nodes/' + nodename
+ '/qemu/' + vmid
+ '/status/current' ,
1351 failure : function ( response
, opts
) {
1352 Ext
. Msg
. alert ( 'Error' , response
. htmlStatus
);
1354 success : function ( response
, opts
) {
1355 let conf
= response
. result
. data
;
1357 spice
: !! conf
. spice
,
1358 xtermjs
: !! conf
. serial
,
1360 PVE
. Utils
. openDefaultConsoleWindow ( consoles
, 'kvm' , vmid
, nodename
, vmname
);
1363 } else if ( record
. data
. type
=== 'lxc' && ! record
. data
. template
) {
1364 PVE
. Utils
. openDefaultConsoleWindow ( true , 'lxc' , vmid
, nodename
, vmname
);
1368 // test automation helper
1369 call_menu_handler : function ( menu
, text
) {
1370 var list
= menu
. query ( 'menuitem' );
1372 Ext
. Array
. each ( list
, function ( item
) {
1373 if ( item
. text
=== text
) {
1384 createCmdMenu : function ( v
, record
, item
, index
, event
) {
1386 if (!( v
instanceof Ext
. tree
. View
)) {
1390 var template
= !! record
. data
. template
;
1391 var type
= record
. data
. type
;
1394 if ( type
=== 'qemu' || type
== 'lxc' ) {
1395 menu
= Ext
. create ( 'PVE.menu.TemplateMenu' , {
1399 } else if ( type
=== 'qemu' ||
1402 menu
= Ext
. create ( 'PVE.' + type
+ '.CmdMenu' , {
1404 nodename
: record
. data
. node
,
1410 menu
. showAt ( event
. getXY ());
1414 // helper for deleting field which are set to there default values
1415 delete_if_default : function ( values
, fieldname
, default_val
, create
) {
1416 if ( values
[ fieldname
] === '' || values
[ fieldname
] === default_val
) {
1418 if ( values
. delete ) {
1419 if ( Ext
. isArray ( values
. delete )) {
1420 values
. delete . push ( fieldname
);
1422 values
. delete += ',' + fieldname
;
1425 values
. delete = fieldname
;
1429 delete values
[ fieldname
];
1433 loadSSHKeyFromFile : function ( file
, callback
) {
1434 // ssh-keygen produces 740 bytes for an average 4096 bit rsa key, with
1435 // a user@host comment, 1420 for 8192 bits; current max is 16kbit
1436 // assume: 740*8 for max. 32kbit (5920 byte file)
1437 // round upwards to nearest nice number => 8192 bytes, leaves lots of comment space
1438 if ( file
. size
> 8192 ) {
1439 Ext
. Msg
. alert ( gettext ( 'Error' ), gettext ( "Invalid file size: " ) + file
. size
);
1445 var reader
= new FileReader ();
1446 reader
. onload = function ( evt
) {
1447 callback ( evt
. target
. result
);
1449 reader
. readAsText ( file
);
1452 loadTextFromFile : function ( file
, callback
, maxBytes
) {
1453 let maxSize
= maxBytes
|| 8192 ;
1454 if ( file
. size
> maxSize
) {
1455 Ext
. Msg
. alert ( gettext ( 'Error' ), gettext ( "Invalid file size: " ) + file
. size
);
1461 let reader
= new FileReader ();
1462 reader
. onload
= evt
=> callback ( evt
. target
. result
);
1463 reader
. readAsText ( file
);
1466 diskControllerMaxIDs
: {
1473 // types is either undefined (all busses), an array of busses, or a single bus
1474 forEachBus : function ( types
, func
) {
1475 var busses
= Object
. keys ( PVE
. Utils
. diskControllerMaxIDs
);
1476 var i
, j
, count
, cont
;
1478 if ( Ext
. isArray ( types
)) {
1480 } else if ( Ext
. isDefined ( types
)) {
1484 // check if we only have valid busses
1485 for ( i
= 0 ; i
< busses
. length
; i
++) {
1486 if (! PVE
. Utils
. diskControllerMaxIDs
[ busses
[ i
]]) {
1487 throw "invalid bus: '" + busses
[ i
] + "'" ;
1491 for ( i
= 0 ; i
< busses
. length
; i
++) {
1492 count
= PVE
. Utils
. diskControllerMaxIDs
[ busses
[ i
]];
1493 for ( j
= 0 ; j
< count
; j
++) {
1494 cont
= func ( busses
[ i
], j
);
1495 if (! cont
&& cont
!== undefined ) {
1502 mp_counts
: { mps
: 256 , unused
: 256 },
1504 forEachMP : function ( func
, includeUnused
) {
1506 for ( i
= 0 ; i
< PVE
. Utils
. mp_counts
. mps
; i
++) {
1507 cont
= func ( 'mp' , i
);
1508 if (! cont
&& cont
!== undefined ) {
1513 if (! includeUnused
) {
1517 for ( i
= 0 ; i
< PVE
. Utils
. mp_counts
. unused
; i
++) {
1518 cont
= func ( 'unused' , i
);
1519 if (! cont
&& cont
!== undefined ) {
1525 hardware_counts
: { net
: 32 , usb
: 5 , hostpci
: 16 , audio
: 1 , efidisk
: 1 , serial
: 4 , rng
: 1 },
1527 cleanEmptyObjectKeys : function ( obj
) {
1529 for ( propName
in obj
) {
1530 if ( obj
. hasOwnProperty ( propName
)) {
1531 if ( obj
[ propName
] === null || obj
[ propName
] === undefined ) {
1532 delete obj
[ propName
];
1538 acmedomain_count
: 5 ,
1540 add_domain_to_acme : function ( acme
, domain
) {
1541 if ( acme
. domains
=== undefined ) {
1542 acme
. domains
= [ domain
];
1544 acme
. domains
. push ( domain
);
1545 acme
. domains
= acme
. domains
. filter (( value
, index
, self
) => self
. indexOf ( value
) === index
);
1550 remove_domain_from_acme : function ( acme
, domain
) {
1551 if ( acme
. domains
!== undefined ) {
1552 acme
. domains
= acme
. domains
. filter (( value
, index
, self
) => self
. indexOf ( value
) === index
&& value
!== domain
);
1557 handleStoreErrorOrMask : function ( me
, store
, regex
, callback
) {
1558 me
. mon ( store
, 'load' , function ( proxy
, response
, success
, operation
) {
1560 Proxmox
. Utils
. setErrorMask ( me
, false );
1565 if ( operation
. error
. statusText
) {
1566 if ( operation
. error
. statusText
. match ( regex
)) {
1567 callback ( me
, operation
. error
);
1570 msg
= operation
. error
. statusText
+ ' (' + operation
. error
. status
+ ')' ;
1573 msg
= gettext ( 'Connection error' );
1575 Proxmox
. Utils
. setErrorMask ( me
, msg
);
1579 showCephInstallOrMask : function ( container
, msg
, nodename
, callback
) {
1580 var regex
= new RegExp ( "not (installed|initialized)" , "i" );
1581 if ( msg
. match ( regex
)) {
1582 if ( Proxmox
. UserName
=== 'root@pam' ) {
1583 container
. el
. mask ();
1584 if (! container
. down ( 'pveCephInstallWindow' )) {
1585 var isInstalled
= !! msg
. match ( /not initialized/i );
1586 var win
= Ext
. create ( 'PVE.ceph.Install' , {
1589 win
. getViewModel (). set ( 'isInstalled' , isInstalled
);
1595 container
. mask ( Ext
. String
. format ( gettext ( '{0} not installed.' ) +
1596 ' ' + gettext ( 'Log in as root to install.' ), 'Ceph' ), [ 'pve-static-mask' ]);
1604 propertyStringSet : function ( target
, source
, name
, value
) {
1606 if ( value
=== undefined ) {
1607 target
[ name
] = source
;
1609 target
[ name
] = value
;
1612 delete target
[ name
];
1616 forEachCorosyncLink : function ( nodeinfo
, cb
) {
1617 let re
= /(?:ring|link)(\d+)_addr/ ;
1618 Ext
. iterate ( nodeinfo
, ( prop
, val
) => {
1619 let match
= re
. exec ( prop
);
1621 cb ( Number ( match
[ 1 ]), val
);
1628 'AuthenticAMD' : 'AMD' ,
1629 'GenuineIntel' : 'Intel' ,
1637 "_default_" : 5 , // includes custom models
1640 verify_ip64_address_list : function ( value
, with_suffix
) {
1641 for ( let addr
of value
. split ( /[ ,;]+/ )) {
1647 let parts
= addr
. split ( '%' );
1650 if ( parts
. length
> 2 ) {
1654 if ( parts
. length
> 1 && ! addr
. startsWith ( 'fe80:' )) {
1659 if (! Proxmox
. Utils
. IP64_match
. test ( addr
)) {
1669 constructor : function () {
1671 Ext
. apply ( me
, me
. utilities
);
1673 Proxmox
. Utils
. override_task_descriptions ({
1674 acmedeactivate
: [ 'ACME Account' , gettext ( 'Deactivate' )],
1675 acmenewcert
: [ 'SRV' , gettext ( 'Order Certificate' )],
1676 acmerefresh
: [ 'ACME Account' , gettext ( 'Refresh' )],
1677 acmeregister
: [ 'ACME Account' , gettext ( 'Register' )],
1678 acmerenew
: [ 'SRV' , gettext ( 'Renew Certificate' )],
1679 acmerevoke
: [ 'SRV' , gettext ( 'Revoke Certificate' )],
1680 acmeupdate
: [ 'ACME Account' , gettext ( 'Update' )],
1681 'auth-realm-sync' : [ gettext ( 'Realm' ), gettext ( 'Sync' )],
1682 'auth-realm-sync-test' : [ gettext ( 'Realm' ), gettext ( 'Sync Preview' )],
1683 cephcreatemds
: [ 'Ceph Metadata Server' , gettext ( 'Create' )],
1684 cephcreatemgr
: [ 'Ceph Manager' , gettext ( 'Create' )],
1685 cephcreatemon
: [ 'Ceph Monitor' , gettext ( 'Create' )],
1686 cephcreateosd
: [ 'Ceph OSD' , gettext ( 'Create' )],
1687 cephcreatepool
: [ 'Ceph Pool' , gettext ( 'Create' )],
1688 cephdestroymds
: [ 'Ceph Metadata Server' , gettext ( 'Destroy' )],
1689 cephdestroymgr
: [ 'Ceph Manager' , gettext ( 'Destroy' )],
1690 cephdestroymon
: [ 'Ceph Monitor' , gettext ( 'Destroy' )],
1691 cephdestroyosd
: [ 'Ceph OSD' , gettext ( 'Destroy' )],
1692 cephdestroypool
: [ 'Ceph Pool' , gettext ( 'Destroy' )],
1693 cephfscreate
: [ 'CephFS' , gettext ( 'Create' )],
1694 clustercreate
: [ '' , gettext ( 'Create Cluster' )],
1695 clusterjoin
: [ '' , gettext ( 'Join Cluster' )],
1696 dircreate
: [ gettext ( 'Directory Storage' ), gettext ( 'Create' )],
1697 dirremove
: [ gettext ( 'Directory' ), gettext ( 'Remove' )],
1698 download
: [ '' , gettext ( 'Download' )],
1699 hamigrate
: [ 'HA' , gettext ( 'Migrate' )],
1700 hashutdown
: [ 'HA' , gettext ( 'Shutdown' )],
1701 hastart
: [ 'HA' , gettext ( 'Start' )],
1702 hastop
: [ 'HA' , gettext ( 'Stop' )],
1703 imgcopy
: [ '' , gettext ( 'Copy data' )],
1704 imgdel
: [ '' , gettext ( 'Erase data' )],
1705 lvmcreate
: [ gettext ( 'LVM Storage' ), gettext ( 'Create' )],
1706 lvmthincreate
: [ gettext ( 'LVM-Thin Storage' ), gettext ( 'Create' )],
1707 migrateall
: [ '' , gettext ( 'Migrate all VMs and Containers' )],
1708 'move_volume' : [ 'CT' , gettext ( 'Move Volume' )],
1709 'pbs-download' : [ 'VM/CT' , gettext ( 'File Restore Download' )],
1710 pull_file
: [ 'CT' , gettext ( 'Pull file' )],
1711 push_file
: [ 'CT' , gettext ( 'Push file' )],
1712 qmclone
: [ 'VM' , gettext ( 'Clone' )],
1713 qmconfig
: [ 'VM' , gettext ( 'Configure' )],
1714 qmcreate
: [ 'VM' , gettext ( 'Create' )],
1715 qmdelsnapshot
: [ 'VM' , gettext ( 'Delete Snapshot' )],
1716 qmdestroy
: [ 'VM' , gettext ( 'Destroy' )],
1717 qmigrate
: [ 'VM' , gettext ( 'Migrate' )],
1718 qmmove
: [ 'VM' , gettext ( 'Move disk' )],
1719 qmpause
: [ 'VM' , gettext ( 'Pause' )],
1720 qmreboot
: [ 'VM' , gettext ( 'Reboot' )],
1721 qmreset
: [ 'VM' , gettext ( 'Reset' )],
1722 qmrestore
: [ 'VM' , gettext ( 'Restore' )],
1723 qmresume
: [ 'VM' , gettext ( 'Resume' )],
1724 qmrollback
: [ 'VM' , gettext ( 'Rollback' )],
1725 qmshutdown
: [ 'VM' , gettext ( 'Shutdown' )],
1726 qmsnapshot
: [ 'VM' , gettext ( 'Snapshot' )],
1727 qmstart
: [ 'VM' , gettext ( 'Start' )],
1728 qmstop
: [ 'VM' , gettext ( 'Stop' )],
1729 qmsuspend
: [ 'VM' , gettext ( 'Hibernate' )],
1730 qmtemplate
: [ 'VM' , gettext ( 'Convert to template' )],
1731 spiceproxy
: [ 'VM/CT' , gettext ( 'Console' ) + ' (Spice)' ],
1732 spiceshell
: [ '' , gettext ( 'Shell' ) + ' (Spice)' ],
1733 startall
: [ '' , gettext ( 'Start all VMs and Containers' )],
1734 stopall
: [ '' , gettext ( 'Stop all VMs and Containers' )],
1735 unknownimgdel
: [ '' , gettext ( 'Destroy image from unknown guest' )],
1736 vncproxy
: [ 'VM/CT' , gettext ( 'Console' )],
1737 vncshell
: [ '' , gettext ( 'Shell' )],
1738 vzclone
: [ 'CT' , gettext ( 'Clone' )],
1739 vzcreate
: [ 'CT' , gettext ( 'Create' )],
1740 vzdelsnapshot
: [ 'CT' , gettext ( 'Delete Snapshot' )],
1741 vzdestroy
: [ 'CT' , gettext ( 'Destroy' )],
1742 vzdump
: ( type
, id
) => id
? `VM/CT ${id} - ${gettext('Backup')} ` : gettext ( 'Backup Job' ),
1743 vzmigrate
: [ 'CT' , gettext ( 'Migrate' )],
1744 vzmount
: [ 'CT' , gettext ( 'Mount' )],
1745 vzreboot
: [ 'CT' , gettext ( 'Reboot' )],
1746 vzrestore
: [ 'CT' , gettext ( 'Restore' )],
1747 vzresume
: [ 'CT' , gettext ( 'Resume' )],
1748 vzrollback
: [ 'CT' , gettext ( 'Rollback' )],
1749 vzshutdown
: [ 'CT' , gettext ( 'Shutdown' )],
1750 vzsnapshot
: [ 'CT' , gettext ( 'Snapshot' )],
1751 vzstart
: [ 'CT' , gettext ( 'Start' )],
1752 vzstop
: [ 'CT' , gettext ( 'Stop' )],
1753 vzsuspend
: [ 'CT' , gettext ( 'Suspend' )],
1754 vztemplate
: [ 'CT' , gettext ( 'Convert to template' )],
1755 vzumount
: [ 'CT' , gettext ( 'Unmount' )],
1756 zfscreate
: [ gettext ( 'ZFS Storage' ), gettext ( 'Create' )],