]>
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 get_health_icon : function ( state
, circle
) {
73 if ( circle
=== undefined ) {
77 if ( state
=== undefined ) {
81 var icon
= 'faded fa-question' ;
84 icon
= 'good fa-check' ;
87 icon
= 'warning fa-upload' ;
90 icon
= 'warning fa-refresh' ;
93 icon
= 'warning fa-exclamation' ;
96 icon
= 'critical fa-times' ;
108 parse_ceph_version : function ( service
) {
109 if ( service
. ceph_version_short
) {
110 return service
. ceph_version_short
;
113 if ( service
. ceph_version
) {
114 var match
= service
. ceph_version
. match ( /version (\d+(\.\d+)*)/ );
123 compare_ceph_versions : function ( a
, b
) {
131 if ( Ext
. isArray ( a
)) {
132 avers
= a
. slice (); // copy array
134 avers
= a
. toString (). split ( '.' );
137 if ( Ext
. isArray ( b
)) {
138 bvers
= b
. slice (); // copy array
140 bvers
= b
. toString (). split ( '.' );
144 let av
= avers
. shift ();
145 let bv
= bvers
. shift ();
147 if ( av
=== undefined && bv
=== undefined ) {
149 } else if ( av
=== undefined ) {
151 } else if ( bv
=== undefined ) {
154 let diff
= parseInt ( av
, 10 ) - parseInt ( bv
, 10 );
155 if ( diff
!= 0 ) return diff
;
156 // 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
;
221 render_pbs_fingerprint
: fp
=> fp
. substring ( 0 , 23 ),
223 render_backup_encryption : function ( v
, meta
, record
) {
225 return gettext ( 'No' );
229 if ( v
. match ( /^[a-fA-F0-9]{2}:/ )) { // fingerprint
230 tip
= `Key fingerprint ${PVE.Utils.render_pbs_fingerprint(v)} ` ;
232 let icon
= `<i class="fa fa-fw fa-lock good"></i>` ;
233 return `<span data-qtip=" ${tip} "> ${icon} ${gettext('Encrypted')} </span>` ;
236 render_backup_verification : function ( v
, meta
, record
) {
237 let i
= ( cls
, txt
) => `<i class="fa fa-fw fa- ${cls} "></i> ${txt} ` ;
238 if ( v
=== undefined || v
=== null ) {
239 return i ( 'question-circle-o warning' , gettext ( 'None' ));
242 let txt
= gettext ( 'Failed' );
243 let iconCls
= 'times critical' ;
244 if ( v
. state
=== 'ok' ) {
246 iconCls
= 'check good' ;
247 let now
= Date
. now () / 1000 ;
248 let task
= Proxmox
. Utils
. parse_task_upid ( v
. upid
);
249 let verify_time
= Proxmox
. Utils
. render_timestamp ( task
. starttime
);
250 tip
= `Last verify task started on ${verify_time} ` ;
251 if ( now
- v
. starttime
> 30 * 24 * 60 * 60 ) {
252 tip
= `Last verify task over 30 days ago: ${verify_time} ` ;
253 iconCls
= 'check warning' ;
256 return `<span data-qtip=" ${tip} "> ${i(iconCls, txt)} </span>` ;
259 render_backup_status : function ( value
, meta
, record
) {
260 if ( typeof value
== 'undefined' ) {
264 let iconCls
= 'check-circle good' ;
265 let text
= gettext ( 'Yes' );
267 if (! PVE
. Parser
. parseBoolean ( value
. toString ())) {
268 iconCls
= 'times-circle critical' ;
270 text
= gettext ( 'No' );
272 let reason
= record
. get ( 'reason' );
273 if ( typeof reason
!== 'undefined' ) {
274 if ( reason
in PVE
. Utils
. backup_reasons_table
) {
275 reason
= PVE
. Utils
. backup_reasons_table
[ record
. get ( 'reason' )];
277 text
= ` ${text} - ${reason} ` ;
281 return `<i class="fa fa- ${iconCls} "></i> ${text} ` ;
284 render_backup_days_of_week : function ( val
) {
285 var dows
= [ 'sun' , 'mon' , 'tue' , 'wed' , 'thu' , 'fri' , 'sat' ];
288 val
. split ( ',' ). forEach ( function ( day
) {
290 var dow
= ( dows
. indexOf ( day
)+ 6 )% 7 ;
292 if ( selected
. length
=== 0 || selected
[ selected
. length
- 1 ] === 0 ) {
295 selected
[ selected
. length
- 1 ]++;
308 selected
. forEach ( function ( item
) {
311 days
. push ( Ext
. Date
. dayNames
[ cur
+ 1 ] + '-' + Ext
. Date
. dayNames
[( cur
+ item
)% 7 ]);
313 } else if ( item
== 2 ) {
314 days
. push ( Ext
. Date
. dayNames
[ cur
+ 1 ]);
315 days
. push ( Ext
. Date
. dayNames
[( cur
+ 2 )% 7 ]);
317 } else if ( item
== 1 ) {
318 days
. push ( Ext
. Date
. dayNames
[( cur
+ 1 )% 7 ]);
321 return days
. join ( ', ' );
324 render_backup_selection : function ( value
, metaData
, record
) {
325 let allExceptText
= gettext ( 'All except {0}' );
326 let allText
= '-- ' + gettext ( 'All' ) + ' --' ;
327 if ( record
. data
. all
) {
328 if ( record
. data
. exclude
) {
329 return Ext
. String
. format ( allExceptText
, record
. data
. exclude
);
333 if ( record
. data
. vmid
) {
334 return record
. data
. vmid
;
337 if ( record
. data
. pool
) {
338 return "Pool '" + record
. data
. pool
+ "'" ;
344 backup_reasons_table
: {
345 'backup=yes' : gettext ( 'Enabled' ),
346 'backup=no' : gettext ( 'Disabled' ),
347 'enabled' : gettext ( 'Enabled' ),
348 'disabled' : gettext ( 'Disabled' ),
349 'not a volume' : gettext ( 'Not a volume' ),
350 'efidisk but no OMVF BIOS' : gettext ( 'EFI Disk without OMVF BIOS' ),
353 get_kvm_osinfo : function ( value
) {
354 var info
= { base
: 'Other' }; // default
356 Ext
. each ( Object
. keys ( PVE
. Utils
. kvm_ostypes
), function ( k
) {
357 Ext
. each ( PVE
. Utils
. kvm_ostypes
[ k
], function ( e
) {
358 if ( e
. val
=== value
) {
359 info
= { desc
: e
. desc
, base
: k
};
367 render_kvm_ostype : function ( value
) {
368 var osinfo
= PVE
. Utils
. get_kvm_osinfo ( value
);
369 if ( osinfo
. desc
&& osinfo
. desc
!== '-' ) {
370 return osinfo
. base
+ ' ' + osinfo
. desc
;
376 render_hotplug_features : function ( value
) {
379 if (! value
|| value
=== '0' ) {
380 return gettext ( 'Disabled' );
384 value
= 'disk,network,usb' ;
387 Ext
. each ( value
. split ( ',' ), function ( el
) {
389 fa
. push ( gettext ( 'Disk' ));
390 } else if ( el
=== 'network' ) {
391 fa
. push ( gettext ( 'Network' ));
392 } else if ( el
=== 'usb' ) {
394 } else if ( el
=== 'memory' ) {
395 fa
. push ( gettext ( 'Memory' ));
396 } else if ( el
=== 'cpu' ) {
397 fa
. push ( gettext ( 'CPU' ));
403 return fa
. join ( ', ' );
406 render_localtime : function ( value
) {
407 if ( value
=== '__default__' ) {
408 return Proxmox
. Utils
. defaultText
+ ' (' + gettext ( 'Enabled for Windows' ) + ')' ;
410 return Proxmox
. Utils
. format_boolean ( value
);
413 render_qga_features : function ( value
) {
415 return Proxmox
. Utils
. defaultText
+ ' (' + Proxmox
. Utils
. disabledText
+ ')' ;
417 var props
= PVE
. Parser
. parsePropertyString ( value
, 'enabled' );
418 if (! PVE
. Parser
. parseBoolean ( props
. enabled
)) {
419 return Proxmox
. Utils
. disabledText
;
422 delete props
. enabled
;
423 var agentstring
= Proxmox
. Utils
. enabledText
;
425 Ext
. Object
. each ( props
, function ( key
, value
) {
427 agentstring
+= ', ' + key
+ ': ' ;
429 if ( key
=== 'type' ) {
434 agentstring
+= map
[ value
] || Proxmox
. Utils
. unknownText
;
436 if ( PVE
. Parser
. parseBoolean ( value
)) {
437 agentstring
+= Proxmox
. Utils
. enabledText
;
439 agentstring
+= Proxmox
. Utils
. disabledText
;
447 render_qemu_machine : function ( value
) {
448 return value
|| Proxmox
. Utils
. defaultText
+ ' (i440fx)' ;
451 render_qemu_bios : function ( value
) {
453 return Proxmox
. Utils
. defaultText
+ ' (SeaBIOS)' ;
454 } else if ( value
=== 'seabios' ) {
456 } else if ( value
=== 'ovmf' ) {
457 return "OVMF (UEFI)" ;
463 render_dc_ha_opts : function ( value
) {
465 return Proxmox
. Utils
. defaultText
;
467 return PVE
. Parser
. printPropertyString ( value
);
470 render_as_property_string : function ( value
) {
471 return ! value
? Proxmox
. Utils
. defaultText
472 : PVE
. Parser
. printPropertyString ( value
);
475 render_scsihw : function ( value
) {
477 return Proxmox
. Utils
. defaultText
+ ' (LSI 53C895A)' ;
478 } else if ( value
=== 'lsi' ) {
479 return 'LSI 53C895A' ;
480 } else if ( value
=== 'lsi53c810' ) {
482 } else if ( value
=== 'megasas' ) {
483 return 'MegaRAID SAS 8708EM2' ;
484 } else if ( value
=== 'virtio-scsi-pci' ) {
485 return 'VirtIO SCSI' ;
486 } else if ( value
=== 'virtio-scsi-single' ) {
487 return 'VirtIO SCSI single' ;
488 } else if ( value
=== 'pvscsi' ) {
489 return 'VMware PVSCSI' ;
495 render_spice_enhancements : function ( values
) {
496 let props
= PVE
. Parser
. parsePropertyString ( values
);
497 if ( Ext
. Object
. isEmpty ( props
)) {
498 return Proxmox
. Utils
. noneText
;
502 if ( PVE
. Parser
. parseBoolean ( props
. foldersharing
)) {
503 output
. push ( 'Folder Sharing: ' + gettext ( 'Enabled' ));
505 if ( props
. videostreaming
=== 'all' || props
. videostreaming
=== 'filter' ) {
506 output
. push ( 'Video Streaming: ' + props
. videostreaming
);
508 return output
. join ( ', ' );
511 // fixme: auto-generate this
512 // for now, please keep in sync with PVE::Tools::kvmkeymaps
517 'de-ch' : 'German (Swiss)' ,
518 'en-gb' : 'English (UK)' ,
519 'en-us' : 'English (USA)' ,
523 //fo: 'Faroe Islands',
525 'fr-be' : 'French (Belgium)' ,
526 'fr-ca' : 'French (Canada)' ,
527 'fr-ch' : 'French (Swiss)' ,
537 //'nl-be': 'Dutch (Belgium)',
541 'pt-br' : 'Portuguese (Brazil)' ,
550 std
: gettext ( 'Standard VGA' ),
551 vmware
: gettext ( 'VMware compatible' ),
553 qxl2
: 'SPICE dual monitor' ,
554 qxl3
: 'SPICE three monitors' ,
555 qxl4
: 'SPICE four monitors' ,
556 serial0
: gettext ( 'Serial terminal' ) + ' 0' ,
557 serial1
: gettext ( 'Serial terminal' ) + ' 1' ,
558 serial2
: gettext ( 'Serial terminal' ) + ' 2' ,
559 serial3
: gettext ( 'Serial terminal' ) + ' 3' ,
560 virtio
: 'VirtIO-GPU' ,
561 none
: Proxmox
. Utils
. noneText
,
564 render_kvm_language : function ( value
) {
565 if (! value
|| value
=== '__default__' ) {
566 return Proxmox
. Utils
. defaultText
;
568 var text
= PVE
. Utils
. kvm_keymaps
[ value
];
570 return text
+ ' (' + value
+ ')' ;
575 kvm_keymap_array : function () {
576 var data
= [[ '__default__' , PVE
. Utils
. render_kvm_language ( '' )]];
577 Ext
. Object
. each ( PVE
. Utils
. kvm_keymaps
, function ( key
, value
) {
578 data
. push ([ key
, PVE
. Utils
. render_kvm_language ( value
)]);
585 '__default__' : Proxmox
. Utils
. defaultText
+ ' (xterm.js)' ,
586 'vv' : 'SPICE (remote-viewer)' ,
587 'html5' : 'HTML5 (noVNC)' ,
588 'xtermjs' : 'xterm.js' ,
591 render_console_viewer : function ( value
) {
592 value
= value
|| '__default__' ;
593 if ( PVE
. Utils
. console_map
[ value
]) {
594 return PVE
. Utils
. console_map
[ value
];
599 console_viewer_array : function () {
600 return Ext
. Array
. map ( Object
. keys ( PVE
. Utils
. console_map
), function ( v
) {
601 return [ v
, PVE
. Utils
. render_console_viewer ( v
)];
605 render_kvm_vga_driver : function ( value
) {
607 return Proxmox
. Utils
. defaultText
;
609 var vga
= PVE
. Parser
. parsePropertyString ( value
, 'type' );
610 var text
= PVE
. Utils
. kvm_vga_drivers
[ vga
. type
];
612 text
= Proxmox
. Utils
. defaultText
;
615 return text
+ ' (' + value
+ ')' ;
620 kvm_vga_driver_array : function () {
621 var data
= [[ '__default__' , PVE
. Utils
. render_kvm_vga_driver ( '' )]];
622 Ext
. Object
. each ( PVE
. Utils
. kvm_vga_drivers
, function ( key
, value
) {
623 data
. push ([ key
, PVE
. Utils
. render_kvm_vga_driver ( value
)]);
629 render_kvm_startup : function ( value
) {
630 var startup
= PVE
. Parser
. parseStartup ( value
);
633 if ( startup
. order
=== undefined ) {
636 res
+= startup
. order
;
638 if ( startup
. up
!== undefined ) {
639 res
+= ',up=' + startup
. up
;
641 if ( startup
. down
!== undefined ) {
642 res
+= ',down=' + startup
. down
;
648 extractFormActionError : function ( action
) {
650 switch ( action
. failureType
) {
651 case Ext
. form
. action
. Action
. CLIENT_INVALID
:
652 msg
= gettext ( 'Form fields may not be submitted with invalid values' );
654 case Ext
. form
. action
. Action
. CONNECT_FAILURE
:
655 msg
= gettext ( 'Connection error' );
656 var resp
= action
. response
;
657 if ( resp
. status
&& resp
. statusText
) {
658 msg
+= " " + resp
. status
+ ": " + resp
. statusText
;
661 case Ext
. form
. action
. Action
. LOAD_FAILURE
:
662 case Ext
. form
. action
. Action
. SERVER_INVALID
:
663 msg
= Proxmox
. Utils
. extractRequestError ( action
. result
, true );
670 'images' : gettext ( 'Disk image' ),
671 'backup' : gettext ( 'VZDump backup file' ),
672 'vztmpl' : gettext ( 'Container template' ),
673 'iso' : gettext ( 'ISO image' ),
674 'rootdir' : gettext ( 'Container' ),
675 'snippets' : gettext ( 'Snippets' ),
678 volume_is_qemu_backup : function ( volid
, format
) {
679 return format
=== 'pbs-vm' || volid
. match ( ':backup/vzdump-qemu-' );
682 volume_is_lxc_backup : function ( volid
, format
) {
683 return format
=== 'pbs-ct' || volid
. match ( ':backup/vzdump-(lxc|openvz)-' );
688 name
: gettext ( 'Active Directory Server' ),
689 ipanel
: 'pveAuthADPanel' ,
690 syncipanel
: 'pveAuthLDAPSyncPanel' ,
694 name
: gettext ( 'LDAP Server' ),
695 ipanel
: 'pveAuthLDAPPanel' ,
696 syncipanel
: 'pveAuthLDAPSyncPanel' ,
701 ipanel
: 'pveAuthBasePanel' ,
705 name
: 'Proxmox VE authentication server' ,
706 ipanel
: 'pveAuthBasePanel' ,
713 name
: Proxmox
. Utils
. directoryText
,
714 ipanel
: 'DirInputPanel' ,
720 ipanel
: 'LVMInputPanel' ,
726 ipanel
: 'LvmThinInputPanel' ,
732 ipanel
: 'NFSInputPanel' ,
738 ipanel
: 'CIFSInputPanel' ,
744 ipanel
: 'GlusterFsInputPanel' ,
750 ipanel
: 'IScsiInputPanel' ,
756 ipanel
: 'CephFSInputPanel' ,
761 name
: 'CephFS (PVE)' ,
762 ipanel
: 'CephFSInputPanel' ,
769 ipanel
: 'RBDInputPanel' ,
775 ipanel
: 'RBDInputPanel' ,
781 name
: 'ZFS over iSCSI' ,
782 ipanel
: 'ZFSInputPanel' ,
788 ipanel
: 'ZFSPoolInputPanel' ,
793 name
: 'Proxmox Backup Server' ,
794 ipanel
: 'PBSInputPanel' ,
819 ipanel
: 'SimpleInputPanel' ,
824 ipanel
: 'VlanInputPanel' ,
829 ipanel
: 'QinQInputPanel' ,
834 ipanel
: 'VxlanInputPanel' ,
839 ipanel
: 'EvpnInputPanel' ,
844 sdncontrollerSchema
: {
851 ipanel
: 'EvpnInputPanel' ,
852 faIcon
: 'crosshairs' ,
856 format_sdnvnet_type : function ( value
, md
, record
) {
857 var schema
= PVE
. Utils
. sdnvnetSchema
[ value
];
861 return Proxmox
. Utils
. unknownText
;
864 format_sdnzone_type : function ( value
, md
, record
) {
865 var schema
= PVE
. Utils
. sdnzoneSchema
[ value
];
869 return Proxmox
. Utils
. unknownText
;
872 format_sdncontroller_type : function ( value
, md
, record
) {
873 var schema
= PVE
. Utils
. sdncontrollerSchema
[ value
];
877 return Proxmox
. Utils
. unknownText
;
880 format_storage_type : function ( value
, md
, record
) {
881 if ( value
=== 'rbd' ) {
882 value
= ! record
|| record
. get ( 'monhost' ) ? 'rbd' : 'pveceph' ;
883 } else if ( value
=== 'cephfs' ) {
884 value
= ! record
|| record
. get ( 'monhost' ) ? 'cephfs' : 'pvecephfs' ;
887 var schema
= PVE
. Utils
. storageSchema
[ value
];
891 return Proxmox
. Utils
. unknownText
;
894 format_ha : function ( value
) {
895 var text
= Proxmox
. Utils
. noneText
;
898 text
= value
. state
|| Proxmox
. Utils
. noneText
;
900 text
+= ', ' + Proxmox
. Utils
. groupText
+ ': ' ;
901 text
+= value
. group
|| Proxmox
. Utils
. noneText
;
907 format_content_types : function ( value
) {
908 return value
. split ( ',' ). sort (). map ( function ( ct
) {
909 return PVE
. Utils
. contentTypes
[ ct
] || ct
;
913 render_storage_content : function ( value
, metaData
, record
) {
914 var data
= record
. data
;
915 if ( Ext
. isNumber ( data
. channel
) &&
916 Ext
. isNumber ( data
. id
) &&
917 Ext
. isNumber ( data
. lun
)) {
919 Ext
. String
. leftPad ( data
. channel
, 2 , '0' ) +
920 " ID " + data
. id
+ " LUN " + data
. lun
;
922 return data
. volid
. replace ( /^.*?:(.*?\/)?/ , '' );
925 render_serverity : function ( value
) {
926 return PVE
. Utils
. log_severity_hash
[ value
] || value
;
929 render_cpu : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
930 if (!( record
. data
. uptime
&& Ext
. isNumeric ( value
))) {
934 var maxcpu
= record
. data
. maxcpu
|| 1 ;
936 if (! Ext
. isNumeric ( maxcpu
) && maxcpu
>= 1 ) {
940 var per
= value
* 100 ;
942 return per
. toFixed ( 1 ) + '% of ' + maxcpu
. toString () + ( maxcpu
> 1 ? 'CPUs' : 'CPU' );
945 render_size : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
946 if (! Ext
. isNumeric ( value
)) {
950 return Proxmox
. Utils
. format_size ( value
);
953 render_bandwidth : function ( value
) {
954 if (! Ext
. isNumeric ( value
)) {
958 return Proxmox
. Utils
. format_size ( value
) + '/s' ;
961 render_timestamp_human_readable : function ( value
) {
962 return Ext
. Date
. format ( new Date ( value
* 1000 ), 'l d F Y H:i:s' );
965 calculate_mem_usage : function ( data
) {
966 if (! Ext
. isNumeric ( data
. mem
) ||
972 return data
. mem
/ data
. maxmem
;
975 render_mem_usage_percent : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
976 if (! Ext
. isNumeric ( value
) || value
=== - 1 ) {
980 // we got no percentage but bytes
982 var maxmem
= record
. data
. maxmem
;
983 if (! record
. data
. uptime
||
985 ! Ext
. isNumeric ( mem
)) {
989 return ( mem
* 100 / maxmem
). toFixed ( 1 ) + " %" ;
991 return ( value
* 100 ). toFixed ( 1 ) + " %" ;
994 render_mem_usage : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
996 var maxmem
= record
. data
. maxmem
;
998 if (! record
. data
. uptime
) {
1002 if (!( Ext
. isNumeric ( mem
) && maxmem
)) {
1006 return PVE
. Utils
. render_size ( value
);
1009 calculate_disk_usage : function ( data
) {
1010 if (! Ext
. isNumeric ( data
. disk
) ||
1011 data
. type
=== 'qemu' ||
1012 data
. type
=== 'lxc' && data
. uptime
=== 0 ||
1013 data
. maxdisk
=== 0 ) {
1017 return data
. disk
/ data
. maxdisk
;
1020 render_disk_usage_percent : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1021 if (! Ext
. isNumeric ( value
) || value
=== - 1 ) {
1025 return ( value
* 100 ). toFixed ( 1 ) + " %" ;
1028 render_disk_usage : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1030 var maxdisk
= record
. data
. maxdisk
;
1031 var type
= record
. data
. type
;
1033 if (! Ext
. isNumeric ( disk
) ||
1036 type
=== 'lxc' && record
. data
. uptime
=== 0 ) {
1040 return PVE
. Utils
. render_size ( value
);
1043 get_object_icon_class : function ( type
, record
) {
1047 if ( type
=== 'type' ) {
1049 objType
= record
. groupbyid
;
1050 } else if ( record
. template
) {
1052 objType
= 'template' ;
1056 status
= record
. status
+ ' ha-' + record
. hastate
;
1060 status
+= ' locked lock-' + record
. lock
;
1063 var defaults
= PVE
. tree
. ResourceTree
. typeDefaults
[ objType
];
1064 if ( defaults
&& defaults
. iconCls
) {
1065 var retVal
= defaults
. iconCls
+ ' ' + status
;
1072 render_resource_type : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1073 var cls
= PVE
. Utils
. get_object_icon_class ( value
, record
. data
);
1075 var fa
= '<i class="fa-fw x-grid-icon-custom ' + cls
+ '"></i> ' ;
1079 render_support_level : function ( value
, metaData
, record
) {
1080 return PVE
. Utils
. support_level_hash
[ value
] || '-' ;
1083 render_upid : function ( value
, metaData
, record
) {
1084 var type
= record
. data
. type
;
1085 var id
= record
. data
. id
;
1087 return Proxmox
. Utils
. format_task_description ( type
, id
);
1090 /* render functions for new status panel */
1092 render_usage : function ( val
) {
1093 return ( val
* 100 ). toFixed ( 2 ) + '%' ;
1096 render_cpu_usage : function ( val
, max
) {
1097 return Ext
. String
. format ( gettext ( '{0}% of {1}' ) +
1098 ' ' + gettext ( 'CPU(s)' ), ( val
* 100 ). toFixed ( 2 ), max
);
1101 render_size_usage : function ( val
, max
) {
1103 return gettext ( 'N/A' );
1105 return ( val
* 100 / max
). toFixed ( 2 ) + '% ' + '(' +
1106 Ext
. String
. format ( gettext ( '{0} of {1}' ),
1107 PVE
. Utils
. render_size ( val
), PVE
. Utils
. render_size ( max
)) + ')' ;
1110 /* this is different for nodes */
1111 render_node_cpu_usage : function ( value
, record
) {
1112 return PVE
. Utils
. render_cpu_usage ( value
, record
. cpus
);
1115 /* this is different for nodes */
1116 render_node_size_usage : function ( record
) {
1117 return PVE
. Utils
. render_size_usage ( record
. used
, record
. total
);
1120 render_optional_url : function ( value
) {
1122 if ( value
&& ( match
= value
. match ( /^https?:\/\// )) !== null ) {
1123 return '<a target="_blank" href="' + value
+ '">' + value
+ '</a>' ;
1128 render_san : function ( value
) {
1130 if ( Ext
. isArray ( value
)) {
1131 value
. forEach ( function ( val
) {
1132 if (! Ext
. isNumber ( val
)) {
1136 return names
. join ( '<br>' );
1141 render_full_name : function ( firstname
, metaData
, record
) {
1142 var first
= firstname
|| '' ;
1143 var last
= record
. data
. lastname
|| '' ;
1144 return Ext
. htmlEncode ( first
+ " " + last
);
1147 render_u2f_error : function ( error
) {
1149 '1' : gettext ( 'Other Error' ),
1150 '2' : gettext ( 'Bad Request' ),
1151 '3' : gettext ( 'Configuration Unsupported' ),
1152 '4' : gettext ( 'Device Ineligible' ),
1153 '5' : gettext ( 'Timeout' ),
1155 return "U2F Error: " + ErrorNames
[ error
] || Proxmox
. Utils
. unknownText
;
1158 windowHostname : function () {
1159 return window
. location
. hostname
. replace ( Proxmox
. Utils
. IP6_bracket_match
,
1160 function ( m
, addr
, offset
, original
) { return addr
; });
1163 openDefaultConsoleWindow : function ( consoles
, consoleType
, vmid
, nodename
, vmname
, cmd
) {
1164 var dv
= PVE
. Utils
. defaultViewer ( consoles
);
1165 PVE
. Utils
. openConsoleWindow ( dv
, consoleType
, vmid
, nodename
, vmname
, cmd
);
1168 openConsoleWindow : function ( viewer
, consoleType
, vmid
, nodename
, vmname
, cmd
) {
1169 if ( vmid
== undefined && ( consoleType
=== 'kvm' || consoleType
=== 'lxc' )) {
1170 throw "missing vmid" ;
1173 throw "no nodename specified" ;
1176 if ( viewer
=== 'html5' ) {
1177 PVE
. Utils
. openVNCViewer ( consoleType
, vmid
, nodename
, vmname
, cmd
);
1178 } else if ( viewer
=== 'xtermjs' ) {
1179 Proxmox
. Utils
. openXtermJsViewer ( consoleType
, vmid
, nodename
, vmname
, cmd
);
1180 } else if ( viewer
=== 'vv' ) {
1181 let url
= '/nodes/' + nodename
+ '/spiceshell' ;
1183 proxy
: PVE
. Utils
. windowHostname (),
1185 if ( consoleType
=== 'kvm' ) {
1186 url
= '/nodes/' + nodename
+ '/qemu/' + vmid
. toString () + '/spiceproxy' ;
1187 } else if ( consoleType
=== 'lxc' ) {
1188 url
= '/nodes/' + nodename
+ '/lxc/' + vmid
. toString () + '/spiceproxy' ;
1189 } else if ( consoleType
=== 'upgrade' ) {
1190 params
. cmd
= 'upgrade' ;
1191 } else if ( consoleType
=== 'cmd' ) {
1193 } else if ( consoleType
!== 'shell' ) {
1194 throw `unknown spice viewer type ' ${consoleType} '` ;
1196 PVE
. Utils
. openSpiceViewer ( url
, params
);
1198 throw `unknown viewer type ' ${viewer} '` ;
1202 defaultViewer : function ( consoles
) {
1203 var allowSpice
, allowXtermjs
;
1205 if ( consoles
=== true ) {
1207 allowXtermjs
= true ;
1208 } else if ( typeof consoles
=== 'object' ) {
1209 allowSpice
= consoles
. spice
;
1210 allowXtermjs
= !! consoles
. xtermjs
;
1212 var dv
= PVE
. VersionInfo
. console
|| 'xtermjs' ;
1213 if ( dv
=== 'vv' && ! allowSpice
) {
1214 dv
= allowXtermjs
? 'xtermjs' : 'html5' ;
1215 } else if ( dv
=== 'xtermjs' && ! allowXtermjs
) {
1216 dv
= allowSpice
? 'vv' : 'html5' ;
1222 openVNCViewer : function ( vmtype
, vmid
, nodename
, vmname
, cmd
) {
1223 let scaling
= 'off' ;
1224 if ( Proxmox
. Utils
. toolkit
!== 'touch' ) {
1225 var sp
= Ext
. state
. Manager
. getProvider ();
1226 scaling
= sp
. get ( 'novnc-scaling' , 'off' );
1228 var url
= Ext
. Object
. toQueryString ({
1229 console
: vmtype
, // kvm, lxc, upgrade or shell
1237 var nw
= window
. open ( "?" + url
, '_blank' , "innerWidth=745,innerheight=427" );
1243 openSpiceViewer : function ( url
, params
) {
1244 var downloadWithName = function ( uri
, name
) {
1245 var link
= Ext
. DomHelper
. append ( document
. body
, {
1248 css
: 'display:none;visibility:hidden;height:0px;' ,
1251 // Note: we need to tell android the correct file name extension
1252 // but we do not set 'download' tag for other environments, because
1253 // It can have strange side effects (additional user prompt on firefox)
1254 var andriod
= !! navigator
. userAgent
. match ( /Android/i );
1256 link
. download
= name
;
1259 if ( link
. fireEvent
) {
1260 link
. fireEvent ( 'onclick' );
1262 let evt
= document
. createEvent ( "MouseEvents" );
1263 evt
. initMouseEvent ( 'click' , true , true , window
, 1 , 0 , 0 , 0 , 0 , false , false , false , false , 0 , null );
1264 link
. dispatchEvent ( evt
);
1268 Proxmox
. Utils
. API2Request ({
1272 failure : function ( response
, opts
) {
1273 Ext
. Msg
. alert ( 'Error' , response
. htmlStatus
);
1275 success : function ( response
, opts
) {
1276 var raw
= "[virt-viewer] \n " ;
1277 Ext
. Object
. each ( response
. result
. data
, function ( k
, v
) {
1278 raw
+= k
+ "=" + v
+ " \n " ;
1280 var url
= 'data:application/x-virt-viewer;charset=UTF-8,' +
1281 encodeURIComponent ( raw
);
1283 downloadWithName ( url
, "pve-spice.vv" );
1288 openTreeConsole : function ( tree
, record
, item
, index
, e
) {
1290 var nodename
= record
. data
. node
;
1291 var vmid
= record
. data
. vmid
;
1292 var vmname
= record
. data
. name
;
1293 if ( record
. data
. type
=== 'qemu' && ! record
. data
. template
) {
1294 Proxmox
. Utils
. API2Request ({
1295 url
: '/nodes/' + nodename
+ '/qemu/' + vmid
+ '/status/current' ,
1296 failure : function ( response
, opts
) {
1297 Ext
. Msg
. alert ( 'Error' , response
. htmlStatus
);
1299 success : function ( response
, opts
) {
1300 let conf
= response
. result
. data
;
1302 spice
: !! conf
. spice
,
1303 xtermjs
: !! conf
. serial
,
1305 PVE
. Utils
. openDefaultConsoleWindow ( consoles
, 'kvm' , vmid
, nodename
, vmname
);
1308 } else if ( record
. data
. type
=== 'lxc' && ! record
. data
. template
) {
1309 PVE
. Utils
. openDefaultConsoleWindow ( true , 'lxc' , vmid
, nodename
, vmname
);
1313 // test automation helper
1314 call_menu_handler : function ( menu
, text
) {
1315 var list
= menu
. query ( 'menuitem' );
1317 Ext
. Array
. each ( list
, function ( item
) {
1318 if ( item
. text
=== text
) {
1329 createCmdMenu : function ( v
, record
, item
, index
, event
) {
1331 if (!( v
instanceof Ext
. tree
. View
)) {
1335 var template
= !! record
. data
. template
;
1336 var type
= record
. data
. type
;
1339 if ( type
=== 'qemu' || type
== 'lxc' ) {
1340 menu
= Ext
. create ( 'PVE.menu.TemplateMenu' , {
1344 } else if ( type
=== 'qemu' ||
1347 menu
= Ext
. create ( 'PVE.' + type
+ '.CmdMenu' , {
1349 nodename
: record
. data
. node
,
1355 menu
. showAt ( event
. getXY ());
1359 // helper for deleting field which are set to there default values
1360 delete_if_default : function ( values
, fieldname
, default_val
, create
) {
1361 if ( values
[ fieldname
] === '' || values
[ fieldname
] === default_val
) {
1363 if ( values
[ 'delete' ]) {
1364 if ( Ext
. isArray ( values
[ 'delete' ])) {
1365 values
[ 'delete' ]. push ( fieldname
);
1367 values
[ 'delete' ] += ',' + fieldname
;
1370 values
[ 'delete' ] = fieldname
;
1374 delete values
[ fieldname
];
1378 loadSSHKeyFromFile : function ( file
, callback
) {
1379 // ssh-keygen produces 740 bytes for an average 4096 bit rsa key, with
1380 // a user@host comment, 1420 for 8192 bits; current max is 16kbit
1381 // assume: 740*8 for max. 32kbit (5920 byte file)
1382 // round upwards to nearest nice number => 8192 bytes, leaves lots of comment space
1383 if ( file
. size
> 8192 ) {
1384 Ext
. Msg
. alert ( gettext ( 'Error' ), gettext ( "Invalid file size: " ) + file
. size
);
1390 var reader
= new FileReader ();
1391 reader
. onload = function ( evt
) {
1392 callback ( evt
. target
. result
);
1394 reader
. readAsText ( file
);
1397 loadTextFromFile : function ( file
, callback
, maxBytes
) {
1398 let maxSize
= maxBytes
|| 8192 ;
1399 if ( file
. size
> maxSize
) {
1400 Ext
. Msg
. alert ( gettext ( 'Error' ), gettext ( "Invalid file size: " ) + file
. size
);
1406 let reader
= new FileReader ();
1407 reader
. onload
= evt
=> callback ( evt
. target
. result
);
1408 reader
. readAsText ( file
);
1411 diskControllerMaxIDs
: {
1418 // types is either undefined (all busses), an array of busses, or a single bus
1419 forEachBus : function ( types
, func
) {
1420 var busses
= Object
. keys ( PVE
. Utils
. diskControllerMaxIDs
);
1421 var i
, j
, count
, cont
;
1423 if ( Ext
. isArray ( types
)) {
1425 } else if ( Ext
. isDefined ( types
)) {
1429 // check if we only have valid busses
1430 for ( i
= 0 ; i
< busses
. length
; i
++) {
1431 if (! PVE
. Utils
. diskControllerMaxIDs
[ busses
[ i
]]) {
1432 throw "invalid bus: '" + busses
[ i
] + "'" ;
1436 for ( i
= 0 ; i
< busses
. length
; i
++) {
1437 count
= PVE
. Utils
. diskControllerMaxIDs
[ busses
[ i
]];
1438 for ( j
= 0 ; j
< count
; j
++) {
1439 cont
= func ( busses
[ i
], j
);
1440 if (! cont
&& cont
!== undefined ) {
1447 mp_counts
: { mps
: 256 , unused
: 256 },
1449 forEachMP : function ( func
, includeUnused
) {
1451 for ( i
= 0 ; i
< PVE
. Utils
. mp_counts
. mps
; i
++) {
1452 cont
= func ( 'mp' , i
);
1453 if (! cont
&& cont
!== undefined ) {
1458 if (! includeUnused
) {
1462 for ( i
= 0 ; i
< PVE
. Utils
. mp_counts
. unused
; i
++) {
1463 cont
= func ( 'unused' , i
);
1464 if (! cont
&& cont
!== undefined ) {
1470 hardware_counts
: { net
: 32 , usb
: 5 , hostpci
: 16 , audio
: 1 , efidisk
: 1 , serial
: 4 , rng
: 1 },
1472 cleanEmptyObjectKeys : function ( obj
) {
1474 for ( propName
in obj
) {
1475 if ( obj
. hasOwnProperty ( propName
)) {
1476 if ( obj
[ propName
] === null || obj
[ propName
] === undefined ) {
1477 delete obj
[ propName
];
1483 acmedomain_count
: 5 ,
1485 add_domain_to_acme : function ( acme
, domain
) {
1486 if ( acme
. domains
=== undefined ) {
1487 acme
. domains
= [ domain
];
1489 acme
. domains
. push ( domain
);
1490 acme
. domains
= acme
. domains
. filter (( value
, index
, self
) => self
. indexOf ( value
) === index
);
1495 remove_domain_from_acme : function ( acme
, domain
) {
1496 if ( acme
. domains
!== undefined ) {
1497 acme
. domains
= acme
. domains
. filter (( value
, index
, self
) => self
. indexOf ( value
) === index
&& value
!== domain
);
1502 handleStoreErrorOrMask : function ( me
, store
, regex
, callback
) {
1503 me
. mon ( store
, 'load' , function ( proxy
, response
, success
, operation
) {
1505 Proxmox
. Utils
. setErrorMask ( me
, false );
1510 if ( operation
. error
. statusText
) {
1511 if ( operation
. error
. statusText
. match ( regex
)) {
1512 callback ( me
, operation
. error
);
1515 msg
= operation
. error
. statusText
+ ' (' + operation
. error
. status
+ ')' ;
1518 msg
= gettext ( 'Connection error' );
1520 Proxmox
. Utils
. setErrorMask ( me
, msg
);
1524 showCephInstallOrMask : function ( container
, msg
, nodename
, callback
) {
1525 var regex
= new RegExp ( "not (installed|initialized)" , "i" );
1526 if ( msg
. match ( regex
)) {
1527 if ( Proxmox
. UserName
=== 'root@pam' ) {
1528 container
. el
. mask ();
1529 if (! container
. down ( 'pveCephInstallWindow' )) {
1530 var isInstalled
= !! msg
. match ( /not initialized/i );
1531 var win
= Ext
. create ( 'PVE.ceph.Install' , {
1534 win
. getViewModel (). set ( 'isInstalled' , isInstalled
);
1540 container
. mask ( Ext
. String
. format ( gettext ( '{0} not installed.' ) +
1541 ' ' + gettext ( 'Log in as root to install.' ), 'Ceph' ), [ 'pve-static-mask' ]);
1549 propertyStringSet : function ( target
, source
, name
, value
) {
1551 if ( value
=== undefined ) {
1552 target
[ name
] = source
;
1554 target
[ name
] = value
;
1557 delete target
[ name
];
1561 updateColumns : function ( container
) {
1562 let mode
= Ext
. state
. Manager
. get ( 'summarycolumns' ) || 'auto' ;
1564 if ( mode
!== 'auto' ) {
1565 factor
= parseInt ( mode
, 10 );
1566 if ( Number
. isNaN ( factor
)) {
1570 factor
= container
. getSize (). width
< 1400 ? 1 : 2 ;
1573 if ( container
. oldFactor
=== factor
) {
1577 let items
= container
. query ( '>' ); // direct childs
1578 factor
= Math
. min ( factor
, items
. length
);
1579 container
. oldFactor
= factor
;
1581 items
. forEach (( item
) => {
1582 item
. columnWidth
= 1 / factor
;
1585 // we have to update the layout twice, since the first layout change
1586 // can trigger the scrollbar which reduces the amount of space left
1587 container
. updateLayout ();
1588 container
. updateLayout ();
1591 forEachCorosyncLink : function ( nodeinfo
, cb
) {
1592 let re
= /(?:ring|link)(\d+)_addr/ ;
1593 Ext
. iterate ( nodeinfo
, ( prop
, val
) => {
1594 let match
= re
. exec ( prop
);
1596 cb ( Number ( match
[ 1 ]), val
);
1603 'AuthenticAMD' : 'AMD' ,
1604 'GenuineIntel' : 'Intel' ,
1612 "_default_" : 5 , // includes custom models
1615 verify_ip64_address_list : function ( value
, with_suffix
) {
1616 for ( let addr
of value
. split ( /[ ,;]+/ )) {
1622 let parts
= addr
. split ( '%' );
1625 if ( parts
. length
> 2 ) {
1629 if ( parts
. length
> 1 && ! addr
. startsWith ( 'fe80:' )) {
1634 if (! Proxmox
. Utils
. IP64_match
. test ( addr
)) {
1644 constructor : function () {
1646 Ext
. apply ( me
, me
. utilities
);
1648 Proxmox
. Utils
. override_task_descriptions ({
1649 acmedeactivate
: [ 'ACME Account' , gettext ( 'Deactivate' )],
1650 acmenewcert
: [ 'SRV' , gettext ( 'Order Certificate' )],
1651 acmerefresh
: [ 'ACME Account' , gettext ( 'Refresh' )],
1652 acmeregister
: [ 'ACME Account' , gettext ( 'Register' )],
1653 acmerenew
: [ 'SRV' , gettext ( 'Renew Certificate' )],
1654 acmerevoke
: [ 'SRV' , gettext ( 'Revoke Certificate' )],
1655 acmeupdate
: [ 'ACME Account' , gettext ( 'Update' )],
1656 'auth-realm-sync' : [ gettext ( 'Realm' ), gettext ( 'Sync' )],
1657 'auth-realm-sync-test' : [ gettext ( 'Realm' ), gettext ( 'Sync Preview' )],
1658 cephcreatemds
: [ 'Ceph Metadata Server' , gettext ( 'Create' )],
1659 cephcreatemgr
: [ 'Ceph Manager' , gettext ( 'Create' )],
1660 cephcreatemon
: [ 'Ceph Monitor' , gettext ( 'Create' )],
1661 cephcreateosd
: [ 'Ceph OSD' , gettext ( 'Create' )],
1662 cephcreatepool
: [ 'Ceph Pool' , gettext ( 'Create' )],
1663 cephdestroymds
: [ 'Ceph Metadata Server' , gettext ( 'Destroy' )],
1664 cephdestroymgr
: [ 'Ceph Manager' , gettext ( 'Destroy' )],
1665 cephdestroymon
: [ 'Ceph Monitor' , gettext ( 'Destroy' )],
1666 cephdestroyosd
: [ 'Ceph OSD' , gettext ( 'Destroy' )],
1667 cephdestroypool
: [ 'Ceph Pool' , gettext ( 'Destroy' )],
1668 cephfscreate
: [ 'CephFS' , gettext ( 'Create' )],
1669 clustercreate
: [ '' , gettext ( 'Create Cluster' )],
1670 clusterjoin
: [ '' , gettext ( 'Join Cluster' )],
1671 dircreate
: [ gettext ( 'Directory Storage' ), gettext ( 'Create' )],
1672 dirremove
: [ gettext ( 'Directory' ), gettext ( 'Remove' )],
1673 download
: [ '' , gettext ( 'Download' )],
1674 hamigrate
: [ 'HA' , gettext ( 'Migrate' )],
1675 hashutdown
: [ 'HA' , gettext ( 'Shutdown' )],
1676 hastart
: [ 'HA' , gettext ( 'Start' )],
1677 hastop
: [ 'HA' , gettext ( 'Stop' )],
1678 imgcopy
: [ '' , gettext ( 'Copy data' )],
1679 imgdel
: [ '' , gettext ( 'Erase data' )],
1680 lvmcreate
: [ gettext ( 'LVM Storage' ), gettext ( 'Create' )],
1681 lvmthincreate
: [ gettext ( 'LVM-Thin Storage' ), gettext ( 'Create' )],
1682 migrateall
: [ '' , gettext ( 'Migrate all VMs and Containers' )],
1683 'move_volume' : [ 'CT' , gettext ( 'Move Volume' )],
1684 pull_file
: [ 'CT' , gettext ( 'Pull file' )],
1685 push_file
: [ 'CT' , gettext ( 'Push file' )],
1686 qmclone
: [ 'VM' , gettext ( 'Clone' )],
1687 qmconfig
: [ 'VM' , gettext ( 'Configure' )],
1688 qmcreate
: [ 'VM' , gettext ( 'Create' )],
1689 qmdelsnapshot
: [ 'VM' , gettext ( 'Delete Snapshot' )],
1690 qmdestroy
: [ 'VM' , gettext ( 'Destroy' )],
1691 qmigrate
: [ 'VM' , gettext ( 'Migrate' )],
1692 qmmove
: [ 'VM' , gettext ( 'Move disk' )],
1693 qmpause
: [ 'VM' , gettext ( 'Pause' )],
1694 qmreboot
: [ 'VM' , gettext ( 'Reboot' )],
1695 qmreset
: [ 'VM' , gettext ( 'Reset' )],
1696 qmrestore
: [ 'VM' , gettext ( 'Restore' )],
1697 qmresume
: [ 'VM' , gettext ( 'Resume' )],
1698 qmrollback
: [ 'VM' , gettext ( 'Rollback' )],
1699 qmshutdown
: [ 'VM' , gettext ( 'Shutdown' )],
1700 qmsnapshot
: [ 'VM' , gettext ( 'Snapshot' )],
1701 qmstart
: [ 'VM' , gettext ( 'Start' )],
1702 qmstop
: [ 'VM' , gettext ( 'Stop' )],
1703 qmsuspend
: [ 'VM' , gettext ( 'Hibernate' )],
1704 qmtemplate
: [ 'VM' , gettext ( 'Convert to template' )],
1705 spiceproxy
: [ 'VM/CT' , gettext ( 'Console' ) + ' (Spice)' ],
1706 spiceshell
: [ '' , gettext ( 'Shell' ) + ' (Spice)' ],
1707 startall
: [ '' , gettext ( 'Start all VMs and Containers' )],
1708 stopall
: [ '' , gettext ( 'Stop all VMs and Containers' )],
1709 unknownimgdel
: [ '' , gettext ( 'Destroy image from unknown guest' )],
1710 vncproxy
: [ 'VM/CT' , gettext ( 'Console' )],
1711 vncshell
: [ '' , gettext ( 'Shell' )],
1712 vzclone
: [ 'CT' , gettext ( 'Clone' )],
1713 vzcreate
: [ 'CT' , gettext ( 'Create' )],
1714 vzdelsnapshot
: [ 'CT' , gettext ( 'Delete Snapshot' )],
1715 vzdestroy
: [ 'CT' , gettext ( 'Destroy' )],
1716 vzdump
: ( type
, id
) => id
? `VM/CT ${id} - ${gettext('Backup')} ` : gettext ( 'Backup Job' ),
1717 vzmigrate
: [ 'CT' , gettext ( 'Migrate' )],
1718 vzmount
: [ 'CT' , gettext ( 'Mount' )],
1719 vzreboot
: [ 'CT' , gettext ( 'Reboot' )],
1720 vzrestore
: [ 'CT' , gettext ( 'Restore' )],
1721 vzresume
: [ 'CT' , gettext ( 'Resume' )],
1722 vzrollback
: [ 'CT' , gettext ( 'Rollback' )],
1723 vzshutdown
: [ 'CT' , gettext ( 'Shutdown' )],
1724 vzsnapshot
: [ 'CT' , gettext ( 'Snapshot' )],
1725 vzstart
: [ 'CT' , gettext ( 'Start' )],
1726 vzstop
: [ 'CT' , gettext ( 'Stop' )],
1727 vzsuspend
: [ 'CT' , gettext ( 'Suspend' )],
1728 vztemplate
: [ 'CT' , gettext ( 'Convert to template' )],
1729 vzumount
: [ 'CT' , gettext ( 'Unmount' )],
1730 zfscreate
: [ gettext ( 'ZFS Storage' ), gettext ( 'Create' )],