]>
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' , { utilities
: {
24 // this singleton contains miscellaneous utilities
26 toolkit
: undefined , // (extjs|touch), set inside Toolkit.js
28 bus_match
: /^(ide|sata|virtio|scsi)\d+$/ ,
42 'c' : gettext ( 'Community' ),
43 'b' : gettext ( 'Basic' ),
44 's' : gettext ( 'Standard' ),
45 'p' : gettext ( 'Premium' )
48 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.' ,
52 { desc
: '5.x - 2.6 Kernel' , val
: 'l26' },
53 { desc
: '2.4 Kernel' , val
: 'l24' }
55 'Microsoft Windows' : [
56 { desc
: '10/2016/2019' , val
: 'win10' },
57 { desc
: '8.x/2012/2012r2' , val
: 'win8' },
58 { desc
: '7/2008r2' , val
: 'win7' },
59 { desc
: 'Vista/2008' , val
: 'w2k8' },
60 { desc
: 'XP/2003' , val
: 'wxp' },
61 { desc
: '2000' , val
: 'w2k' }
64 { desc
: '-' , val
: 'solaris' }
67 { desc
: '-' , val
: 'other' }
71 get_health_icon : function ( state
, circle
) {
72 if ( circle
=== undefined ) {
76 if ( state
=== undefined ) {
80 var icon
= 'faded fa-question' ;
83 icon
= 'good fa-check' ;
86 icon
= 'warning fa-upload' ;
89 icon
= 'warning fa-refresh' ;
92 icon
= 'warning fa-exclamation' ;
95 icon
= 'critical fa-times' ;
107 parse_ceph_version : function ( service
) {
108 if ( service
. ceph_version_short
) {
109 return service
. ceph_version_short
;
112 if ( service
. ceph_version
) {
113 var match
= service
. ceph_version
. match ( /version (\d+(\.\d+)*)/ );
122 compare_ceph_versions : function ( a
, b
) {
130 if ( Ext
. isArray ( a
)) {
131 avers
= a
. slice (); // copy array
133 avers
= a
. toString (). split ( '.' );
136 if ( Ext
. isArray ( b
)) {
137 bvers
= b
. slice (); // copy array
139 bvers
= b
. toString (). split ( '.' );
143 let av
= avers
. shift ();
144 let bv
= bvers
. shift ();
146 if ( av
=== undefined && bv
=== undefined ) {
148 } else if ( av
=== undefined ) {
150 } else if ( bv
=== undefined ) {
153 let diff
= parseInt ( av
, 10 ) - parseInt ( bv
, 10 );
154 if ( diff
!= 0 ) return diff
;
155 // else we need to look at the next parts
161 get_ceph_icon_html : function ( health
, fw
) {
162 var state
= PVE
. Utils
. map_ceph_health
[ health
];
163 var cls
= PVE
. Utils
. get_health_icon ( state
);
167 return "<i class='fa " + cls
+ "'></i> " ;
172 'HEALTH_UPGRADE' : 'upgrade' ,
174 'HEALTH_WARN' : 'warning' ,
175 'HEALTH_ERR' : 'critical'
178 render_ceph_health : function ( healthObj
) {
180 iconCls
: PVE
. Utils
. get_health_icon (),
184 if (! healthObj
|| ! healthObj
. status
) {
188 var health
= PVE
. Utils
. map_ceph_health
[ healthObj
. status
];
190 state
. iconCls
= PVE
. Utils
. get_health_icon ( health
, true );
191 state
. text
= healthObj
. status
;
196 render_zfs_health : function ( value
) {
197 if ( typeof value
== 'undefined' ){
200 var iconCls
= 'question-circle' ;
204 iconCls
= 'check-circle good' ;
208 iconCls
= 'exclamation-circle warning' ;
213 iconCls
= 'times-circle critical' ;
218 return '<i class="fa fa-' + iconCls
+ '"></i> ' + value
;
222 render_pbs_fingerprint
: fp
=> fp
. substring ( 0 , 23 ),
224 render_backup_encryption : function ( v
, meta
, record
) {
226 return gettext ( 'No' );
230 if ( v
. match ( /^[a-fA-F0-9]{2}:/ )) { // fingerprint
231 tip
= `Key fingerprint ${PVE.Utils.render_pbs_fingerprint(v)} ` ;
233 let icon
= `<i class="fa fa-fw fa-lock good"></i>` ;
234 return `<span data-qtip=" ${tip} "> ${icon} ${gettext('Encrypted')} </span>` ;
237 render_backup_verification : function ( v
, meta
, record
) {
238 let i
= ( cls
, txt
) => `<i class="fa fa-fw fa- ${cls} "></i> ${txt} ` ;
239 if ( v
=== undefined || v
=== null ) {
240 return i ( 'question-circle-o warning' , gettext ( 'None' ));
243 let txt
= gettext ( 'Failed' );
244 let iconCls
= 'times critical' ;
245 if ( v
. state
=== 'ok' ) {
247 iconCls
= 'check good' ;
248 let now
= Date
. now () / 1000 ;
249 let task
= Proxmox
. Utils
. parse_task_upid ( v
. upid
);
250 let verify_time
= Proxmox
. Utils
. render_timestamp ( task
. starttime
);
251 tip
= `Last verify task started on ${verify_time} ` ;
252 if ( now
- v
. starttime
> 30 * 24 * 60 * 60 ) {
253 tip
= `Last verify task over 30 days ago: ${verify_time} ` ;
254 iconCls
= 'check warning' ;
257 return `<span data-qtip=" ${tip} "> ${i(iconCls, txt)} </span>` ;
260 render_backup_status : function ( value
, meta
, record
) {
261 if ( typeof value
== 'undefined' ) {
265 let iconCls
= 'check-circle good' ;
266 let text
= gettext ( 'Yes' );
268 if (! PVE
. Parser
. parseBoolean ( value
. toString ())) {
269 iconCls
= 'times-circle critical' ;
271 text
= gettext ( 'No' );
273 let reason
= record
. get ( 'reason' );
274 if ( typeof reason
!== 'undefined' ) {
275 if ( reason
in PVE
. Utils
. backup_reasons_table
) {
276 reason
= PVE
. Utils
. backup_reasons_table
[ record
. get ( 'reason' )];
278 text
= ` ${text} - ${reason} ` ;
282 return `<i class="fa fa- ${iconCls} "></i> ${text} ` ;
285 render_backup_days_of_week : function ( val
) {
286 var dows
= [ 'sun' , 'mon' , 'tue' , 'wed' , 'thu' , 'fri' , 'sat' ];
289 val
. split ( ',' ). forEach ( function ( day
){
291 var dow
= ( dows
. indexOf ( day
)+ 6 )% 7 ;
293 if ( selected
. length
=== 0 || selected
[ selected
. length
- 1 ] === 0 ) {
296 selected
[ selected
. length
- 1 ]++;
309 selected
. forEach ( function ( item
) {
312 days
. push ( Ext
. Date
. dayNames
[( cur
+ 1 )] + '-' + Ext
. Date
. dayNames
[( cur
+ item
)% 7 ]);
314 } else if ( item
== 2 ) {
315 days
. push ( Ext
. Date
. dayNames
[ cur
+ 1 ]);
316 days
. push ( Ext
. Date
. dayNames
[( cur
+ 2 )% 7 ]);
318 } else if ( item
== 1 ) {
319 days
. push ( Ext
. Date
. dayNames
[( cur
+ 1 )% 7 ]);
322 return days
. join ( ', ' );
325 render_backup_selection : function ( value
, metaData
, record
) {
326 let allExceptText
= gettext ( 'All except {0}' );
327 let allText
= '-- ' + gettext ( 'All' ) + ' --' ;
328 if ( record
. data
. all
) {
329 if ( record
. data
. exclude
) {
330 return Ext
. String
. format ( allExceptText
, record
. data
. exclude
);
334 if ( record
. data
. vmid
) {
335 return record
. data
. vmid
;
338 if ( record
. data
. pool
) {
339 return "Pool '" + record
. data
. pool
+ "'" ;
345 backup_reasons_table
: {
346 'backup=yes' : gettext ( 'Enabled' ),
347 'backup=no' : gettext ( 'Disabled' ),
348 'enabled' : gettext ( 'Enabled' ),
349 'disabled' : gettext ( 'Disabled' ),
350 'not a volume' : gettext ( 'Not a volume' ),
351 'efidisk but no OMVF BIOS' : gettext ( 'EFI Disk without OMVF BIOS' ),
354 get_kvm_osinfo : function ( value
) {
355 var info
= { base
: 'Other' }; // default
357 Ext
. each ( Object
. keys ( PVE
. Utils
. kvm_ostypes
), function ( k
) {
358 Ext
. each ( PVE
. Utils
. kvm_ostypes
[ k
], function ( e
) {
359 if ( e
. val
=== value
) {
360 info
= { desc
: e
. desc
, base
: k
};
368 render_kvm_ostype : function ( value
) {
369 var osinfo
= PVE
. Utils
. get_kvm_osinfo ( value
);
370 if ( osinfo
. desc
&& osinfo
. desc
!== '-' ) {
371 return osinfo
. base
+ ' ' + osinfo
. desc
;
377 render_hotplug_features : function ( value
) {
380 if (! value
|| ( value
=== '0' )) {
381 return gettext ( 'Disabled' );
385 value
= 'disk,network,usb' ;
388 Ext
. each ( value
. split ( ',' ), function ( el
) {
390 fa
. push ( gettext ( 'Disk' ));
391 } else if ( el
=== 'network' ) {
392 fa
. push ( gettext ( 'Network' ));
393 } else if ( el
=== 'usb' ) {
395 } else if ( el
=== 'memory' ) {
396 fa
. push ( gettext ( 'Memory' ));
397 } else if ( el
=== 'cpu' ) {
398 fa
. push ( gettext ( 'CPU' ));
404 return fa
. join ( ', ' );
407 render_localtime : function ( value
) {
408 if ( value
=== '__default__' ) {
409 return Proxmox
. Utils
. defaultText
+ ' (' + gettext ( 'Enabled for Windows' ) + ')' ;
411 return Proxmox
. Utils
. format_boolean ( value
);
414 render_qga_features : function ( value
) {
416 return Proxmox
. Utils
. defaultText
+ ' (' + Proxmox
. Utils
. disabledText
+ ')' ;
418 var props
= PVE
. Parser
. parsePropertyString ( value
, 'enabled' );
419 if (! PVE
. Parser
. parseBoolean ( props
. enabled
)) {
420 return Proxmox
. Utils
. disabledText
;
423 delete props
. enabled
;
424 var agentstring
= Proxmox
. Utils
. enabledText
;
426 Ext
. Object
. each ( props
, function ( key
, value
) {
428 agentstring
+= ', ' + key
+ ': ' ;
430 if ( key
=== 'type' ) {
435 agentstring
+= map
[ value
] || Proxmox
. Utils
. unknownText
;
437 if ( PVE
. Parser
. parseBoolean ( value
)) {
438 agentstring
+= Proxmox
. Utils
. enabledText
;
440 agentstring
+= Proxmox
. Utils
. disabledText
;
448 render_qemu_machine : function ( value
) {
449 return value
|| ( Proxmox
. Utils
. defaultText
+ ' (i440fx)' );
452 render_qemu_bios : function ( value
) {
454 return Proxmox
. Utils
. defaultText
+ ' (SeaBIOS)' ;
455 } else if ( value
=== 'seabios' ) {
457 } else if ( value
=== 'ovmf' ) {
458 return "OVMF (UEFI)" ;
464 render_dc_ha_opts : function ( value
) {
466 return Proxmox
. Utils
. defaultText
;
468 return PVE
. Parser
. printPropertyString ( value
);
471 render_as_property_string : function ( value
) {
472 return (! value
) ? Proxmox
. Utils
. defaultText
473 : PVE
. Parser
. printPropertyString ( value
);
476 render_scsihw : function ( value
) {
478 return Proxmox
. Utils
. defaultText
+ ' (LSI 53C895A)' ;
479 } else if ( value
=== 'lsi' ) {
480 return 'LSI 53C895A' ;
481 } else if ( value
=== 'lsi53c810' ) {
483 } else if ( value
=== 'megasas' ) {
484 return 'MegaRAID SAS 8708EM2' ;
485 } else if ( value
=== 'virtio-scsi-pci' ) {
486 return 'VirtIO SCSI' ;
487 } else if ( value
=== 'virtio-scsi-single' ) {
488 return 'VirtIO SCSI single' ;
489 } else if ( value
=== 'pvscsi' ) {
490 return 'VMware PVSCSI' ;
496 render_spice_enhancements : function ( values
) {
497 let props
= PVE
. Parser
. parsePropertyString ( values
);
498 if ( Ext
. Object
. isEmpty ( props
)) {
499 return Proxmox
. Utils
. noneText
;
503 if ( PVE
. Parser
. parseBoolean ( props
. foldersharing
)) {
504 output
. push ( 'Folder Sharing: ' + gettext ( 'Enabled' ));
506 if ( props
. videostreaming
=== 'all' || props
. videostreaming
=== 'filter' ) {
507 output
. push ( 'Video Streaming: ' + props
. videostreaming
);
509 return output
. join ( ', ' );
512 // fixme: auto-generate this
513 // for now, please keep in sync with PVE::Tools::kvmkeymaps
518 'de-ch' : 'German (Swiss)' ,
519 'en-gb' : 'English (UK)' ,
520 'en-us' : 'English (USA)' ,
524 //fo: 'Faroe Islands',
526 'fr-be' : 'French (Belgium)' ,
527 'fr-ca' : 'French (Canada)' ,
528 'fr-ch' : 'French (Swiss)' ,
538 //'nl-be': 'Dutch (Belgium)',
542 'pt-br' : 'Portuguese (Brazil)' ,
551 std
: gettext ( 'Standard VGA' ),
552 vmware
: gettext ( 'VMware compatible' ),
554 qxl2
: 'SPICE dual monitor' ,
555 qxl3
: 'SPICE three monitors' ,
556 qxl4
: 'SPICE four monitors' ,
557 serial0
: gettext ( 'Serial terminal' ) + ' 0' ,
558 serial1
: gettext ( 'Serial terminal' ) + ' 1' ,
559 serial2
: gettext ( 'Serial terminal' ) + ' 2' ,
560 serial3
: gettext ( 'Serial terminal' ) + ' 3' ,
561 virtio
: 'VirtIO-GPU' ,
562 none
: Proxmox
. Utils
. noneText
565 render_kvm_language : function ( value
) {
566 if (! value
|| value
=== '__default__' ) {
567 return Proxmox
. Utils
. defaultText
;
569 var text
= PVE
. Utils
. kvm_keymaps
[ value
];
571 return text
+ ' (' + value
+ ')' ;
576 kvm_keymap_array : function () {
577 var data
= [[ '__default__' , PVE
. Utils
. render_kvm_language ( '' )]];
578 Ext
. Object
. each ( PVE
. Utils
. kvm_keymaps
, function ( key
, value
) {
579 data
. push ([ key
, PVE
. Utils
. render_kvm_language ( value
)]);
586 '__default__' : Proxmox
. Utils
. defaultText
+ ' (xterm.js)' ,
587 'vv' : 'SPICE (remote-viewer)' ,
588 'html5' : 'HTML5 (noVNC)' ,
589 'xtermjs' : 'xterm.js'
592 render_console_viewer : function ( value
) {
593 value
= value
|| '__default__' ;
594 if ( PVE
. Utils
. console_map
[ value
]) {
595 return PVE
. Utils
. console_map
[ value
];
600 console_viewer_array : function () {
601 return Ext
. Array
. map ( Object
. keys ( PVE
. Utils
. console_map
), function ( v
) {
602 return [ v
, PVE
. Utils
. render_console_viewer ( v
)];
606 render_kvm_vga_driver : function ( value
) {
608 return Proxmox
. Utils
. defaultText
;
610 var vga
= PVE
. Parser
. parsePropertyString ( value
, 'type' );
611 var text
= PVE
. Utils
. kvm_vga_drivers
[ vga
. type
];
613 text
= Proxmox
. Utils
. defaultText
;
616 return text
+ ' (' + value
+ ')' ;
621 kvm_vga_driver_array : function () {
622 var data
= [[ '__default__' , PVE
. Utils
. render_kvm_vga_driver ( '' )]];
623 Ext
. Object
. each ( PVE
. Utils
. kvm_vga_drivers
, function ( key
, value
) {
624 data
. push ([ key
, PVE
. Utils
. render_kvm_vga_driver ( value
)]);
630 render_kvm_startup : function ( value
) {
631 var startup
= PVE
. Parser
. parseStartup ( value
);
634 if ( startup
. order
=== undefined ) {
637 res
+= startup
. order
;
639 if ( startup
. up
!== undefined ) {
640 res
+= ',up=' + startup
. up
;
642 if ( startup
. down
!== undefined ) {
643 res
+= ',down=' + startup
. down
;
649 extractFormActionError : function ( action
) {
651 switch ( action
. failureType
) {
652 case Ext
. form
. action
. Action
. CLIENT_INVALID
:
653 msg
= gettext ( 'Form fields may not be submitted with invalid values' );
655 case Ext
. form
. action
. Action
. CONNECT_FAILURE
:
656 msg
= gettext ( 'Connection error' );
657 var resp
= action
. response
;
658 if ( resp
. status
&& resp
. statusText
) {
659 msg
+= " " + resp
. status
+ ": " + resp
. statusText
;
662 case Ext
. form
. action
. Action
. LOAD_FAILURE
:
663 case Ext
. form
. action
. Action
. SERVER_INVALID
:
664 msg
= Proxmox
. Utils
. extractRequestError ( action
. result
, true );
671 'images' : gettext ( 'Disk image' ),
672 'backup' : gettext ( 'VZDump backup file' ),
673 'vztmpl' : gettext ( 'Container template' ),
674 'iso' : gettext ( 'ISO image' ),
675 'rootdir' : gettext ( 'Container' ),
676 'snippets' : gettext ( 'Snippets' )
679 volume_is_qemu_backup : function ( volid
, format
) {
680 return format
=== 'pbs-vm' || volid
. match ( ':backup/vzdump-qemu-' );
683 volume_is_lxc_backup : function ( volid
, format
) {
684 return format
=== 'pbs-ct' || volid
. match ( ':backup/vzdump-(lxc|openvz)-' );
689 name
: gettext ( 'Active Directory Server' ),
690 ipanel
: 'pveAuthADPanel' ,
691 syncipanel
: 'pveAuthLDAPSyncPanel' ,
695 name
: gettext ( 'LDAP Server' ),
696 ipanel
: 'pveAuthLDAPPanel' ,
697 syncipanel
: 'pveAuthLDAPSyncPanel' ,
702 ipanel
: 'pveAuthBasePanel' ,
706 name
: 'Proxmox VE authentication server' ,
707 ipanel
: 'pveAuthBasePanel' ,
714 name
: Proxmox
. Utils
. directoryText
,
715 ipanel
: 'DirInputPanel' ,
720 ipanel
: 'LVMInputPanel' ,
725 ipanel
: 'LvmThinInputPanel' ,
730 ipanel
: 'NFSInputPanel' ,
735 ipanel
: 'CIFSInputPanel' ,
740 ipanel
: 'GlusterFsInputPanel' ,
745 ipanel
: 'IScsiInputPanel' ,
750 ipanel
: 'CephFSInputPanel' ,
754 name
: 'CephFS (PVE)' ,
755 ipanel
: 'CephFSInputPanel' ,
761 ipanel
: 'RBDInputPanel' ,
766 ipanel
: 'RBDInputPanel' ,
771 name
: 'ZFS over iSCSI' ,
772 ipanel
: 'ZFSInputPanel' ,
777 ipanel
: 'ZFSPoolInputPanel' ,
781 name
: 'Proxmox Backup Server' ,
782 ipanel
: 'PBSInputPanel' ,
805 ipanel
: 'SimpleInputPanel' ,
810 ipanel
: 'VlanInputPanel' ,
815 ipanel
: 'QinQInputPanel' ,
820 ipanel
: 'VxlanInputPanel' ,
825 ipanel
: 'EvpnInputPanel' ,
830 sdncontrollerSchema
: {
837 ipanel
: 'EvpnInputPanel' ,
842 format_sdnvnet_type : function ( value
, md
, record
) {
843 var schema
= PVE
. Utils
. sdnvnetSchema
[ value
];
847 return Proxmox
. Utils
. unknownText
;
850 format_sdnzone_type : function ( value
, md
, record
) {
851 var schema
= PVE
. Utils
. sdnzoneSchema
[ value
];
855 return Proxmox
. Utils
. unknownText
;
858 format_sdncontroller_type : function ( value
, md
, record
) {
859 var schema
= PVE
. Utils
. sdncontrollerSchema
[ value
];
863 return Proxmox
. Utils
. unknownText
;
866 format_storage_type : function ( value
, md
, record
) {
867 if ( value
=== 'rbd' ) {
868 value
= (! record
|| record
. get ( 'monhost' ) ? 'rbd' : 'pveceph' );
869 } else if ( value
=== 'cephfs' ) {
870 value
= (! record
|| record
. get ( 'monhost' ) ? 'cephfs' : 'pvecephfs' );
873 var schema
= PVE
. Utils
. storageSchema
[ value
];
877 return Proxmox
. Utils
. unknownText
;
880 format_ha : function ( value
) {
881 var text
= Proxmox
. Utils
. noneText
;
884 text
= value
. state
|| Proxmox
. Utils
. noneText
;
886 text
+= ', ' + Proxmox
. Utils
. groupText
+ ': ' ;
887 text
+= value
. group
|| Proxmox
. Utils
. noneText
;
893 format_content_types : function ( value
) {
894 return value
. split ( ',' ). sort (). map ( function ( ct
) {
895 return PVE
. Utils
. contentTypes
[ ct
] || ct
;
899 render_storage_content : function ( value
, metaData
, record
) {
900 var data
= record
. data
;
901 if ( Ext
. isNumber ( data
. channel
) &&
902 Ext
. isNumber ( data
. id
) &&
903 Ext
. isNumber ( data
. lun
)) {
905 Ext
. String
. leftPad ( data
. channel
, 2 , '0' ) +
906 " ID " + data
. id
+ " LUN " + data
. lun
;
908 return data
. volid
. replace ( /^.*?:(.*?\/)?/ , '' );
911 render_serverity : function ( value
) {
912 return PVE
. Utils
. log_severity_hash
[ value
] || value
;
915 render_cpu : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
917 if (!( record
. data
. uptime
&& Ext
. isNumeric ( value
))) {
921 var maxcpu
= record
. data
. maxcpu
|| 1 ;
923 if (! Ext
. isNumeric ( maxcpu
) && ( maxcpu
>= 1 )) {
927 var per
= value
* 100 ;
929 return per
. toFixed ( 1 ) + '% of ' + maxcpu
. toString () + ( maxcpu
> 1 ? 'CPUs' : 'CPU' );
932 render_size : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
934 if (! Ext
. isNumeric ( value
)) {
938 return Proxmox
. Utils
. format_size ( value
);
941 render_bandwidth : function ( value
) {
942 if (! Ext
. isNumeric ( value
)) {
946 return Proxmox
. Utils
. format_size ( value
) + '/s' ;
949 render_timestamp_human_readable : function ( value
) {
950 return Ext
. Date
. format ( new Date ( value
* 1000 ), 'l d F Y H:i:s' );
953 calculate_mem_usage : function ( data
) {
954 if (! Ext
. isNumeric ( data
. mem
) ||
960 return ( data
. mem
/ data
. maxmem
);
963 render_mem_usage_percent : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
964 if (! Ext
. isNumeric ( value
) || value
=== - 1 ) {
968 // we got no percentage but bytes
970 var maxmem
= record
. data
. maxmem
;
971 if (! record
. data
. uptime
||
973 ! Ext
. isNumeric ( mem
)) {
977 return (( mem
* 100 )/ maxmem
). toFixed ( 1 ) + " %" ;
979 return ( value
* 100 ). toFixed ( 1 ) + " %" ;
982 render_mem_usage : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
985 var maxmem
= record
. data
. maxmem
;
987 if (! record
. data
. uptime
) {
991 if (!( Ext
. isNumeric ( mem
) && maxmem
)) {
995 return PVE
. Utils
. render_size ( value
);
998 calculate_disk_usage : function ( data
) {
1000 if (! Ext
. isNumeric ( data
. disk
) ||
1001 data
. type
=== 'qemu' ||
1002 ( data
. type
=== 'lxc' && data
. uptime
=== 0 ) ||
1003 data
. maxdisk
=== 0 ) {
1007 return ( data
. disk
/ data
. maxdisk
);
1010 render_disk_usage_percent : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1011 if (! Ext
. isNumeric ( value
) || value
=== - 1 ) {
1015 return ( value
* 100 ). toFixed ( 1 ) + " %" ;
1018 render_disk_usage : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1021 var maxdisk
= record
. data
. maxdisk
;
1022 var type
= record
. data
. type
;
1024 if (! Ext
. isNumeric ( disk
) ||
1027 ( type
=== 'lxc' && record
. data
. uptime
=== 0 )) {
1031 return PVE
. Utils
. render_size ( value
);
1034 get_object_icon_class : function ( type
, record
) {
1038 if ( type
=== 'type' ) {
1040 objType
= record
. groupbyid
;
1041 } else if ( record
. template
) {
1043 objType
= 'template' ;
1047 status
= record
. status
+ ' ha-' + record
. hastate
;
1051 status
+= ' locked lock-' + record
. lock
;
1054 var defaults
= PVE
. tree
. ResourceTree
. typeDefaults
[ objType
];
1055 if ( defaults
&& defaults
. iconCls
) {
1056 var retVal
= defaults
. iconCls
+ ' ' + status
;
1063 render_resource_type : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1065 var cls
= PVE
. Utils
. get_object_icon_class ( value
, record
. data
);
1067 var fa
= '<i class="fa-fw x-grid-icon-custom ' + cls
+ '"></i> ' ;
1071 render_support_level : function ( value
, metaData
, record
) {
1072 return PVE
. Utils
. support_level_hash
[ value
] || '-' ;
1075 render_upid : function ( value
, metaData
, record
) {
1076 var type
= record
. data
. type
;
1077 var id
= record
. data
. id
;
1079 return Proxmox
. Utils
. format_task_description ( type
, id
);
1082 /* render functions for new status panel */
1084 render_usage : function ( val
) {
1085 return ( val
* 100 ). toFixed ( 2 ) + '%' ;
1088 render_cpu_usage : function ( val
, max
) {
1089 return Ext
. String
. format ( gettext ( '{0}% of {1}' ) +
1090 ' ' + gettext ( 'CPU(s)' ), ( val
* 100 ). toFixed ( 2 ), max
);
1093 render_size_usage : function ( val
, max
) {
1095 return gettext ( 'N/A' );
1097 return ( val
* 100 / max
). toFixed ( 2 ) + '% ' + '(' +
1098 Ext
. String
. format ( gettext ( '{0} of {1}' ),
1099 PVE
. Utils
. render_size ( val
), PVE
. Utils
. render_size ( max
)) + ')' ;
1102 /* this is different for nodes */
1103 render_node_cpu_usage : function ( value
, record
) {
1104 return PVE
. Utils
. render_cpu_usage ( value
, record
. cpus
);
1107 /* this is different for nodes */
1108 render_node_size_usage : function ( record
) {
1109 return PVE
. Utils
. render_size_usage ( record
. used
, record
. total
);
1112 render_optional_url : function ( value
) {
1114 if ( value
&& ( match
= value
. match ( /^https?:\/\// )) !== null ) {
1115 return '<a target="_blank" href="' + value
+ '">' + value
+ '</a>' ;
1120 render_san : function ( value
) {
1122 if ( Ext
. isArray ( value
)) {
1123 value
. forEach ( function ( val
) {
1124 if (! Ext
. isNumber ( val
)) {
1128 return names
. join ( '<br>' );
1133 render_full_name : function ( firstname
, metaData
, record
) {
1134 var first
= firstname
|| '' ;
1135 var last
= record
. data
. lastname
|| '' ;
1136 return Ext
. htmlEncode ( first
+ " " + last
);
1139 render_u2f_error : function ( error
) {
1141 '1' : gettext ( 'Other Error' ),
1142 '2' : gettext ( 'Bad Request' ),
1143 '3' : gettext ( 'Configuration Unsupported' ),
1144 '4' : gettext ( 'Device Ineligible' ),
1145 '5' : gettext ( 'Timeout' )
1147 return "U2F Error: " + ErrorNames
[ error
] || Proxmox
. Utils
. unknownText
;
1150 windowHostname : function () {
1151 return window
. location
. hostname
. replace ( Proxmox
. Utils
. IP6_bracket_match
,
1152 function ( m
, addr
, offset
, original
) { return addr
; });
1155 openDefaultConsoleWindow : function ( consoles
, consoleType
, vmid
, nodename
, vmname
, cmd
) {
1156 var dv
= PVE
. Utils
. defaultViewer ( consoles
);
1157 PVE
. Utils
. openConsoleWindow ( dv
, consoleType
, vmid
, nodename
, vmname
, cmd
);
1160 openConsoleWindow : function ( viewer
, consoleType
, vmid
, nodename
, vmname
, cmd
) {
1161 if ( vmid
== undefined && ( consoleType
=== 'kvm' || consoleType
=== 'lxc' )) {
1162 throw "missing vmid" ;
1165 throw "no nodename specified" ;
1168 if ( viewer
=== 'html5' ) {
1169 PVE
. Utils
. openVNCViewer ( consoleType
, vmid
, nodename
, vmname
, cmd
);
1170 } else if ( viewer
=== 'xtermjs' ) {
1171 Proxmox
. Utils
. openXtermJsViewer ( consoleType
, vmid
, nodename
, vmname
, cmd
);
1172 } else if ( viewer
=== 'vv' ) {
1173 let url
= '/nodes/' + nodename
+ '/spiceshell' ;
1175 proxy
: PVE
. Utils
. windowHostname (),
1177 if ( consoleType
=== 'kvm' ) {
1178 url
= '/nodes/' + nodename
+ '/qemu/' + vmid
. toString () + '/spiceproxy' ;
1179 } else if ( consoleType
=== 'lxc' ) {
1180 url
= '/nodes/' + nodename
+ '/lxc/' + vmid
. toString () + '/spiceproxy' ;
1181 } else if ( consoleType
=== 'upgrade' ) {
1182 params
. cmd
= 'upgrade' ;
1183 } else if ( consoleType
=== 'cmd' ) {
1185 } else if ( consoleType
!== 'shell' ) {
1186 throw `unknown spice viewer type ' ${consoleType} '` ;
1188 PVE
. Utils
. openSpiceViewer ( url
, params
);
1190 throw `unknown viewer type ' ${viewer} '` ;
1194 defaultViewer : function ( consoles
) {
1196 var allowSpice
, allowXtermjs
;
1198 if ( consoles
=== true ) {
1200 allowXtermjs
= true ;
1201 } else if ( typeof consoles
=== 'object' ) {
1202 allowSpice
= consoles
. spice
;
1203 allowXtermjs
= !! consoles
. xtermjs
;
1205 var dv
= PVE
. VersionInfo
. console
|| 'xtermjs' ;
1206 if ( dv
=== 'vv' && ! allowSpice
) {
1207 dv
= ( allowXtermjs
) ? 'xtermjs' : 'html5' ;
1208 } else if ( dv
=== 'xtermjs' && ! allowXtermjs
) {
1209 dv
= ( allowSpice
) ? 'vv' : 'html5' ;
1215 openVNCViewer : function ( vmtype
, vmid
, nodename
, vmname
, cmd
) {
1216 let scaling
= 'off' ;
1217 if ( Proxmox
. Utils
. toolkit
!== 'touch' ) {
1218 var sp
= Ext
. state
. Manager
. getProvider ();
1219 scaling
= sp
. get ( 'novnc-scaling' , 'off' );
1221 var url
= Ext
. Object
. toQueryString ({
1222 console
: vmtype
, // kvm, lxc, upgrade or shell
1230 var nw
= window
. open ( "?" + url
, '_blank' , "innerWidth=745,innerheight=427" );
1236 openSpiceViewer : function ( url
, params
){
1238 var downloadWithName = function ( uri
, name
) {
1239 var link
= Ext
. DomHelper
. append ( document
. body
, {
1242 css
: 'display:none;visibility:hidden;height:0px;'
1245 // Note: we need to tell android the correct file name extension
1246 // but we do not set 'download' tag for other environments, because
1247 // It can have strange side effects (additional user prompt on firefox)
1248 var andriod
= navigator
. userAgent
. match ( /Android/i ) ? true : false ;
1250 link
. download
= name
;
1253 if ( link
. fireEvent
) {
1254 link
. fireEvent ( 'onclick' );
1256 let evt
= document
. createEvent ( "MouseEvents" );
1257 evt
. initMouseEvent ( 'click' , true , true , window
, 1 , 0 , 0 , 0 , 0 , false , false , false , false , 0 , null );
1258 link
. dispatchEvent ( evt
);
1262 Proxmox
. Utils
. API2Request ({
1266 failure : function ( response
, opts
){
1267 Ext
. Msg
. alert ( 'Error' , response
. htmlStatus
);
1269 success : function ( response
, opts
){
1270 var raw
= "[virt-viewer] \n " ;
1271 Ext
. Object
. each ( response
. result
. data
, function ( k
, v
) {
1272 raw
+= k
+ "=" + v
+ " \n " ;
1274 var url
= 'data:application/x-virt-viewer;charset=UTF-8,' +
1275 encodeURIComponent ( raw
);
1277 downloadWithName ( url
, "pve-spice.vv" );
1282 openTreeConsole : function ( tree
, record
, item
, index
, e
) {
1284 var nodename
= record
. data
. node
;
1285 var vmid
= record
. data
. vmid
;
1286 var vmname
= record
. data
. name
;
1287 if ( record
. data
. type
=== 'qemu' && ! record
. data
. template
) {
1288 Proxmox
. Utils
. API2Request ({
1289 url
: '/nodes/' + nodename
+ '/qemu/' + vmid
+ '/status/current' ,
1290 failure : function ( response
, opts
) {
1291 Ext
. Msg
. alert ( 'Error' , response
. htmlStatus
);
1293 success : function ( response
, opts
) {
1294 let conf
= response
. result
. data
;
1296 spice
: !! conf
. spice
,
1297 xtermjs
: !! conf
. serial
,
1299 PVE
. Utils
. openDefaultConsoleWindow ( consoles
, 'kvm' , vmid
, nodename
, vmname
);
1302 } else if ( record
. data
. type
=== 'lxc' && ! record
. data
. template
) {
1303 PVE
. Utils
. openDefaultConsoleWindow ( true , 'lxc' , vmid
, nodename
, vmname
);
1307 // test automation helper
1308 call_menu_handler : function ( menu
, text
) {
1310 var list
= menu
. query ( 'menuitem' );
1312 Ext
. Array
. each ( list
, function ( item
) {
1313 if ( item
. text
=== text
) {
1324 createCmdMenu : function ( v
, record
, item
, index
, event
) {
1326 if (!( v
instanceof Ext
. tree
. View
)) {
1330 var template
= !! record
. data
. template
;
1331 var type
= record
. data
. type
;
1334 if ( type
=== 'qemu' || type
== 'lxc' ) {
1335 menu
= Ext
. create ( 'PVE.menu.TemplateMenu' , {
1339 } else if ( type
=== 'qemu' ||
1342 menu
= Ext
. create ( 'PVE.' + type
+ '.CmdMenu' , {
1344 nodename
: record
. data
. node
1350 menu
. showAt ( event
. getXY ());
1354 // helper for deleting field which are set to there default values
1355 delete_if_default : function ( values
, fieldname
, default_val
, create
) {
1356 if ( values
[ fieldname
] === '' || values
[ fieldname
] === default_val
) {
1358 if ( values
[ 'delete' ]) {
1359 if ( Ext
. isArray ( values
[ 'delete' ])) {
1360 values
[ 'delete' ]. push ( fieldname
);
1362 values
[ 'delete' ] += ',' + fieldname
;
1365 values
[ 'delete' ] = fieldname
;
1369 delete values
[ fieldname
];
1373 loadSSHKeyFromFile : function ( file
, callback
) {
1374 // ssh-keygen produces 740 bytes for an average 4096 bit rsa key, with
1375 // a user@host comment, 1420 for 8192 bits; current max is 16kbit
1376 // assume: 740*8 for max. 32kbit (5920 byte file)
1377 // round upwards to nearest nice number => 8192 bytes, leaves lots of comment space
1378 if ( file
. size
> 8192 ) {
1379 Ext
. Msg
. alert ( gettext ( 'Error' ), gettext ( "Invalid file size: " ) + file
. size
);
1385 var reader
= new FileReader ();
1386 reader
. onload = function ( evt
) {
1387 callback ( evt
. target
. result
);
1389 reader
. readAsText ( file
);
1392 loadTextFromFile : function ( file
, callback
, maxBytes
) {
1393 let maxSize
= maxBytes
|| 8192 ;
1394 if ( file
. size
> maxSize
) {
1395 Ext
. Msg
. alert ( gettext ( 'Error' ), gettext ( "Invalid file size: " ) + file
. size
);
1401 let reader
= new FileReader ();
1402 reader
. onload
= evt
=> callback ( evt
. target
. result
);
1403 reader
. readAsText ( file
);
1406 diskControllerMaxIDs
: {
1413 // types is either undefined (all busses), an array of busses, or a single bus
1414 forEachBus : function ( types
, func
) {
1415 var busses
= Object
. keys ( PVE
. Utils
. diskControllerMaxIDs
);
1416 var i
, j
, count
, cont
;
1418 if ( Ext
. isArray ( types
)) {
1420 } else if ( Ext
. isDefined ( types
)) {
1424 // check if we only have valid busses
1425 for ( i
= 0 ; i
< busses
. length
; i
++) {
1426 if (! PVE
. Utils
. diskControllerMaxIDs
[ busses
[ i
]]) {
1427 throw "invalid bus: '" + busses
[ i
] + "'" ;
1431 for ( i
= 0 ; i
< busses
. length
; i
++) {
1432 count
= PVE
. Utils
. diskControllerMaxIDs
[ busses
[ i
]];
1433 for ( j
= 0 ; j
< count
; j
++) {
1434 cont
= func ( busses
[ i
], j
);
1435 if (! cont
&& cont
!== undefined ) {
1442 mp_counts
: { mps
: 256 , unused
: 256 },
1444 forEachMP : function ( func
, includeUnused
) {
1446 for ( i
= 0 ; i
< PVE
. Utils
. mp_counts
. mps
; i
++) {
1447 cont
= func ( 'mp' , i
);
1448 if (! cont
&& cont
!== undefined ) {
1453 if (! includeUnused
) {
1457 for ( i
= 0 ; i
< PVE
. Utils
. mp_counts
. unused
; i
++) {
1458 cont
= func ( 'unused' , i
);
1459 if (! cont
&& cont
!== undefined ) {
1465 hardware_counts
: { net
: 32 , usb
: 5 , hostpci
: 16 , audio
: 1 , efidisk
: 1 , serial
: 4 , rng
: 1 },
1467 cleanEmptyObjectKeys : function ( obj
) {
1469 for ( propName
in obj
) {
1470 if ( obj
. hasOwnProperty ( propName
)) {
1471 if ( obj
[ propName
] === null || obj
[ propName
] === undefined ) {
1472 delete obj
[ propName
];
1478 acmedomain_count
: 5 ,
1480 add_domain_to_acme : function ( acme
, domain
) {
1481 if ( acme
. domains
=== undefined ) {
1482 acme
. domains
= [ domain
];
1484 acme
. domains
. push ( domain
);
1485 acme
. domains
= acme
. domains
. filter (( value
, index
, self
) => {
1486 return self
. indexOf ( value
) === index
;
1492 remove_domain_from_acme : function ( acme
, domain
) {
1493 if ( acme
. domains
!== undefined ) {
1494 acme
. domains
= acme
. domains
. filter (( value
, index
, self
) => {
1495 return self
. indexOf ( value
) === index
&& value
!== domain
;
1501 handleStoreErrorOrMask : function ( me
, store
, regex
, callback
) {
1503 me
. mon ( store
, 'load' , function ( proxy
, response
, success
, operation
) {
1506 Proxmox
. Utils
. setErrorMask ( me
, false );
1511 if ( operation
. error
. statusText
) {
1512 if ( operation
. error
. statusText
. match ( regex
)) {
1513 callback ( me
, operation
. error
);
1516 msg
= operation
. error
. statusText
+ ' (' + operation
. error
. status
+ ')' ;
1519 msg
= gettext ( 'Connection error' );
1521 Proxmox
. Utils
. setErrorMask ( me
, msg
);
1525 showCephInstallOrMask : function ( container
, msg
, nodename
, callback
){
1526 var regex
= new RegExp ( "not (installed|initialized)" , "i" );
1527 if ( msg
. match ( regex
)) {
1528 if ( Proxmox
. UserName
=== 'root@pam' ) {
1529 container
. el
. mask ();
1530 if (! container
. down ( 'pveCephInstallWindow' )){
1531 var isInstalled
= msg
. match ( /not initialized/i ) ? true : false ;
1532 var win
= Ext
. create ( 'PVE.ceph.Install' , {
1535 win
. getViewModel (). set ( 'isInstalled' , isInstalled
);
1541 container
. mask ( Ext
. String
. format ( gettext ( '{0} not installed.' ) +
1542 ' ' + gettext ( 'Log in as root to install.' ), 'Ceph' ), [ 'pve-static-mask' ]);
1550 propertyStringSet : function ( target
, source
, name
, value
) {
1552 if ( value
=== undefined ) {
1553 target
[ name
] = source
;
1555 target
[ name
] = value
;
1558 delete target
[ name
];
1562 updateColumns : function ( container
) {
1563 let mode
= Ext
. state
. Manager
. get ( 'summarycolumns' ) || 'auto' ;
1565 if ( mode
!== 'auto' ) {
1566 factor
= parseInt ( mode
, 10 );
1567 if ( Number
. isNaN ( factor
)) {
1571 factor
= container
. getSize (). width
< 1400 ? 1 : 2 ;
1574 if ( container
. oldFactor
=== factor
) {
1578 let items
= container
. query ( '>' ); // direct childs
1579 factor
= Math
. min ( factor
, items
. length
);
1580 container
. oldFactor
= factor
;
1582 items
. forEach (( item
) => {
1583 item
. columnWidth
= 1 / factor
;
1586 // we have to update the layout twice, since the first layout change
1587 // can trigger the scrollbar which reduces the amount of space left
1588 container
. updateLayout ();
1589 container
. updateLayout ();
1592 forEachCorosyncLink : function ( nodeinfo
, cb
) {
1593 let re
= /(?:ring|link)(\d+)_addr/ ;
1594 Ext
. iterate ( nodeinfo
, ( prop
, val
) => {
1595 let match
= re
. exec ( prop
);
1597 cb ( Number ( match
[ 1 ]), val
);
1604 'AuthenticAMD' : 'AMD' ,
1605 'GenuineIntel' : 'Intel'
1613 "_default_" : 5 , // includes custom models
1616 verify_ip64_address_list : function ( value
, with_suffix
) {
1617 for ( let addr
of value
. split ( /[ ,;]+/ )) {
1623 let parts
= addr
. split ( '%' );
1626 if ( parts
. length
> 2 ) {
1630 if ( parts
. length
> 1 && ! addr
. startsWith ( 'fe80:' )) {
1635 if (! Proxmox
. Utils
. IP64_match
. test ( addr
)) {
1645 constructor : function () {
1647 Ext
. apply ( me
, me
. utilities
);
1649 Proxmox
. Utils
. override_task_descriptions ({
1650 acmedeactivate
: [ 'ACME Account' , gettext ( 'Deactivate' )],
1651 acmenewcert
: [ 'SRV' , gettext ( 'Order Certificate' )],
1652 acmerefresh
: [ 'ACME Account' , gettext ( 'Refresh' )],
1653 acmeregister
: [ 'ACME Account' , gettext ( 'Register' )],
1654 acmerenew
: [ 'SRV' , gettext ( 'Renew Certificate' )],
1655 acmerevoke
: [ 'SRV' , gettext ( 'Revoke Certificate' )],
1656 acmeupdate
: [ 'ACME Account' , gettext ( 'Update' )],
1657 'auth-realm-sync' : [ gettext ( 'Realm' ), gettext ( 'Sync' )],
1658 'auth-realm-sync-test' : [ gettext ( 'Realm' ), gettext ( 'Sync Preview' )],
1659 cephcreatemds
: [ 'Ceph Metadata Server' , gettext ( 'Create' )],
1660 cephcreatemgr
: [ 'Ceph Manager' , gettext ( 'Create' )],
1661 cephcreatemon
: [ 'Ceph Monitor' , gettext ( 'Create' )],
1662 cephcreateosd
: [ 'Ceph OSD' , gettext ( 'Create' )],
1663 cephcreatepool
: [ 'Ceph Pool' , gettext ( 'Create' )],
1664 cephdestroymds
: [ 'Ceph Metadata Server' , gettext ( 'Destroy' )],
1665 cephdestroymgr
: [ 'Ceph Manager' , gettext ( 'Destroy' )],
1666 cephdestroymon
: [ 'Ceph Monitor' , gettext ( 'Destroy' )],
1667 cephdestroyosd
: [ 'Ceph OSD' , gettext ( 'Destroy' )],
1668 cephdestroypool
: [ 'Ceph Pool' , gettext ( 'Destroy' )],
1669 cephfscreate
: [ 'CephFS' , gettext ( 'Create' )],
1670 clustercreate
: [ '' , gettext ( 'Create Cluster' )],
1671 clusterjoin
: [ '' , gettext ( 'Join Cluster' )],
1672 dircreate
: [ gettext ( 'Directory Storage' ), gettext ( 'Create' )],
1673 dirremove
: [ gettext ( 'Directory' ), gettext ( 'Remove' )],
1674 download
: [ '' , gettext ( 'Download' )],
1675 hamigrate
: [ 'HA' , gettext ( 'Migrate' )],
1676 hashutdown
: [ 'HA' , gettext ( 'Shutdown' )],
1677 hastart
: [ 'HA' , gettext ( 'Start' )],
1678 hastop
: [ 'HA' , gettext ( 'Stop' )],
1679 imgcopy
: [ '' , gettext ( 'Copy data' )],
1680 imgdel
: [ '' , gettext ( 'Erase data' )],
1681 lvmcreate
: [ gettext ( 'LVM Storage' ), gettext ( 'Create' )],
1682 lvmthincreate
: [ gettext ( 'LVM-Thin Storage' ), gettext ( 'Create' )],
1683 migrateall
: [ '' , gettext ( 'Migrate all VMs and Containers' )],
1684 'move_volume' : [ 'CT' , gettext ( 'Move Volume' )],
1685 pull_file
: [ 'CT' , gettext ( 'Pull file' )],
1686 push_file
: [ 'CT' , gettext ( 'Push file' )],
1687 qmclone
: [ 'VM' , gettext ( 'Clone' )],
1688 qmconfig
: [ 'VM' , gettext ( 'Configure' )],
1689 qmcreate
: [ 'VM' , gettext ( 'Create' )],
1690 qmdelsnapshot
: [ 'VM' , gettext ( 'Delete Snapshot' )],
1691 qmdestroy
: [ 'VM' , gettext ( 'Destroy' )],
1692 qmigrate
: [ 'VM' , gettext ( 'Migrate' )],
1693 qmmove
: [ 'VM' , gettext ( 'Move disk' )],
1694 qmpause
: [ 'VM' , gettext ( 'Pause' )],
1695 qmreboot
: [ 'VM' , gettext ( 'Reboot' )],
1696 qmreset
: [ 'VM' , gettext ( 'Reset' )],
1697 qmrestore
: [ 'VM' , gettext ( 'Restore' )],
1698 qmresume
: [ 'VM' , gettext ( 'Resume' )],
1699 qmrollback
: [ 'VM' , gettext ( 'Rollback' )],
1700 qmshutdown
: [ 'VM' , gettext ( 'Shutdown' )],
1701 qmsnapshot
: [ 'VM' , gettext ( 'Snapshot' )],
1702 qmstart
: [ 'VM' , gettext ( 'Start' )],
1703 qmstop
: [ 'VM' , gettext ( 'Stop' )],
1704 qmsuspend
: [ 'VM' , gettext ( 'Hibernate' )],
1705 qmtemplate
: [ 'VM' , gettext ( 'Convert to template' )],
1706 spiceproxy
: [ 'VM/CT' , gettext ( 'Console' ) + ' (Spice)' ],
1707 spiceshell
: [ '' , gettext ( 'Shell' ) + ' (Spice)' ],
1708 startall
: [ '' , gettext ( 'Start all VMs and Containers' )],
1709 stopall
: [ '' , gettext ( 'Stop all VMs and Containers' )],
1710 unknownimgdel
: [ '' , gettext ( 'Destroy image from unknown guest' )],
1711 vncproxy
: [ 'VM/CT' , gettext ( 'Console' )],
1712 vncshell
: [ '' , gettext ( 'Shell' )],
1713 vzclone
: [ 'CT' , gettext ( 'Clone' )],
1714 vzcreate
: [ 'CT' , gettext ( 'Create' )],
1715 vzdelsnapshot
: [ 'CT' , gettext ( 'Delete Snapshot' )],
1716 vzdestroy
: [ 'CT' , gettext ( 'Destroy' )],
1717 vzdump
: ( type
, id
) => id
? `VM/CT ${id} - ${gettext('Backup')} ` : gettext ( 'Backup Job' ),
1718 vzmigrate
: [ 'CT' , gettext ( 'Migrate' )],
1719 vzmount
: [ 'CT' , gettext ( 'Mount' )],
1720 vzreboot
: [ 'CT' , gettext ( 'Reboot' )],
1721 vzrestore
: [ 'CT' , gettext ( 'Restore' )],
1722 vzresume
: [ 'CT' , gettext ( 'Resume' )],
1723 vzrollback
: [ 'CT' , gettext ( 'Rollback' )],
1724 vzshutdown
: [ 'CT' , gettext ( 'Shutdown' )],
1725 vzsnapshot
: [ 'CT' , gettext ( 'Snapshot' )],
1726 vzstart
: [ 'CT' , gettext ( 'Start' )],
1727 vzstop
: [ 'CT' , gettext ( 'Stop' )],
1728 vzsuspend
: [ 'CT' , gettext ( 'Suspend' )],
1729 vztemplate
: [ 'CT' , gettext ( 'Convert to template' )],
1730 vzumount
: [ 'CT' , gettext ( 'Unmount' )],
1731 zfscreate
: [ gettext ( 'ZFS Storage' ), gettext ( 'Create' )],