]>
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 calculate_hostcpu : function ( data
) {
947 if (!( data
. uptime
&& Ext
. isNumeric ( data
. cpu
))) {
951 if ( data
. type
!== 'qemu' && data
. type
!== 'lxc' ) {
955 var index
= PVE
. data
. ResourceStore
. findExact ( 'id' , 'node/' + data
. node
);
956 var node
= PVE
. data
. ResourceStore
. getAt ( index
);
957 if (! Ext
. isDefined ( node
) || node
=== null ) {
960 var maxcpu
= node
. data
. maxcpu
|| 1 ;
962 if (! Ext
. isNumeric ( maxcpu
) && ( maxcpu
>= 1 )) {
966 return (( data
. cpu
/ maxcpu
) * data
. maxcpu
);
969 render_hostcpu : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
971 if (!( record
. data
. uptime
&& Ext
. isNumeric ( record
. data
. cpu
))) {
975 if ( record
. data
. type
!== 'qemu' && record
. data
. type
!== 'lxc' ) {
979 var index
= PVE
. data
. ResourceStore
. findExact ( 'id' , 'node/' + record
. data
. node
);
980 var node
= PVE
. data
. ResourceStore
. getAt ( index
);
981 if (! Ext
. isDefined ( node
) || node
=== null ) {
984 var maxcpu
= node
. data
. maxcpu
|| 1 ;
986 if (! Ext
. isNumeric ( maxcpu
) && ( maxcpu
>= 1 )) {
990 var per
= ( record
. data
. cpu
/ maxcpu
) * record
. data
. maxcpu
* 100 ;
992 return per
. toFixed ( 1 ) + '% of ' + maxcpu
. toString () + ( maxcpu
> 1 ? 'CPUs' : 'CPU' );
995 render_size : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
996 if (! Ext
. isNumeric ( value
)) {
1000 return Proxmox
. Utils
. format_size ( value
);
1003 render_bandwidth : function ( value
) {
1004 if (! Ext
. isNumeric ( value
)) {
1008 return Proxmox
. Utils
. format_size ( value
) + '/s' ;
1011 render_timestamp_human_readable : function ( value
) {
1012 return Ext
. Date
. format ( new Date ( value
* 1000 ), 'l d F Y H:i:s' );
1015 calculate_mem_usage : function ( data
) {
1016 if (! Ext
. isNumeric ( data
. mem
) ||
1017 data
. maxmem
=== 0 ||
1022 return data
. mem
/ data
. maxmem
;
1025 calculate_hostmem_usage : function ( data
) {
1027 if ( data
. type
!== 'qemu' && data
. type
!== 'lxc' ) {
1031 var index
= PVE
. data
. ResourceStore
. findExact ( 'id' , 'node/' + data
. node
);
1032 var node
= PVE
. data
. ResourceStore
. getAt ( index
);
1034 if (! Ext
. isDefined ( node
) || node
=== null ) {
1037 var maxmem
= node
. data
. maxmem
|| 0 ;
1039 if (! Ext
. isNumeric ( data
. mem
) ||
1045 return ( data
. mem
/ maxmem
);
1048 render_mem_usage_percent : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1049 if (! Ext
. isNumeric ( value
) || value
=== - 1 ) {
1053 // we got no percentage but bytes
1055 var maxmem
= record
. data
. maxmem
;
1056 if (! record
. data
. uptime
||
1058 ! Ext
. isNumeric ( mem
)) {
1062 return ( mem
* 100 / maxmem
). toFixed ( 1 ) + " %" ;
1064 return ( value
* 100 ). toFixed ( 1 ) + " %" ;
1067 render_hostmem_usage_percent : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1069 if (! Ext
. isNumeric ( record
. data
. mem
) || value
=== - 1 ) {
1073 if ( record
. data
. type
!== 'qemu' && record
. data
. type
!== 'lxc' ) {
1077 var index
= PVE
. data
. ResourceStore
. findExact ( 'id' , 'node/' + record
. data
. node
);
1078 var node
= PVE
. data
. ResourceStore
. getAt ( index
);
1079 var maxmem
= node
. data
. maxmem
|| 0 ;
1081 if ( record
. data
. mem
> 1 ) {
1082 // we got no percentage but bytes
1083 var mem
= record
. data
. mem
;
1084 if (! record
. data
. uptime
||
1086 ! Ext
. isNumeric ( mem
)) {
1090 return (( mem
* 100 )/ maxmem
). toFixed ( 1 ) + " %" ;
1092 return ( value
* 100 ). toFixed ( 1 ) + " %" ;
1095 render_mem_usage : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1097 var maxmem
= record
. data
. maxmem
;
1099 if (! record
. data
. uptime
) {
1103 if (!( Ext
. isNumeric ( mem
) && maxmem
)) {
1107 return PVE
. Utils
. render_size ( value
);
1110 calculate_disk_usage : function ( data
) {
1111 if (! Ext
. isNumeric ( data
. disk
) ||
1112 data
. type
=== 'qemu' ||
1113 data
. type
=== 'lxc' && data
. uptime
=== 0 ||
1114 data
. maxdisk
=== 0 ) {
1118 return data
. disk
/ data
. maxdisk
;
1121 render_disk_usage_percent : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1122 if (! Ext
. isNumeric ( value
) || value
=== - 1 ) {
1126 return ( value
* 100 ). toFixed ( 1 ) + " %" ;
1129 render_disk_usage : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1131 var maxdisk
= record
. data
. maxdisk
;
1132 var type
= record
. data
. type
;
1134 if (! Ext
. isNumeric ( disk
) ||
1137 type
=== 'lxc' && record
. data
. uptime
=== 0 ) {
1141 return PVE
. Utils
. render_size ( value
);
1144 get_object_icon_class : function ( type
, record
) {
1148 if ( type
=== 'type' ) {
1150 objType
= record
. groupbyid
;
1151 } else if ( record
. template
) {
1153 objType
= 'template' ;
1157 status
= record
. status
+ ' ha-' + record
. hastate
;
1161 status
+= ' locked lock-' + record
. lock
;
1164 var defaults
= PVE
. tree
. ResourceTree
. typeDefaults
[ objType
];
1165 if ( defaults
&& defaults
. iconCls
) {
1166 var retVal
= defaults
. iconCls
+ ' ' + status
;
1173 render_resource_type : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
1174 var cls
= PVE
. Utils
. get_object_icon_class ( value
, record
. data
);
1176 var fa
= '<i class="fa-fw x-grid-icon-custom ' + cls
+ '"></i> ' ;
1180 render_support_level : function ( value
, metaData
, record
) {
1181 return PVE
. Utils
. support_level_hash
[ value
] || '-' ;
1184 render_upid : function ( value
, metaData
, record
) {
1185 var type
= record
. data
. type
;
1186 var id
= record
. data
. id
;
1188 return Proxmox
. Utils
. format_task_description ( type
, id
);
1191 /* render functions for new status panel */
1193 render_usage : function ( val
) {
1194 return ( val
* 100 ). toFixed ( 2 ) + '%' ;
1197 render_cpu_usage : function ( val
, max
) {
1198 return Ext
. String
. format ( gettext ( '{0}% of {1}' ) +
1199 ' ' + gettext ( 'CPU(s)' ), ( val
* 100 ). toFixed ( 2 ), max
);
1202 render_size_usage : function ( val
, max
) {
1204 return gettext ( 'N/A' );
1206 return ( val
* 100 / max
). toFixed ( 2 ) + '% ' + '(' +
1207 Ext
. String
. format ( gettext ( '{0} of {1}' ),
1208 PVE
. Utils
. render_size ( val
), PVE
. Utils
. render_size ( max
)) + ')' ;
1211 /* this is different for nodes */
1212 render_node_cpu_usage : function ( value
, record
) {
1213 return PVE
. Utils
. render_cpu_usage ( value
, record
. cpus
);
1216 /* this is different for nodes */
1217 render_node_size_usage : function ( record
) {
1218 return PVE
. Utils
. render_size_usage ( record
. used
, record
. total
);
1221 render_optional_url : function ( value
) {
1223 if ( value
&& ( match
= value
. match ( /^https?:\/\// )) !== null ) {
1224 return '<a target="_blank" href="' + value
+ '">' + value
+ '</a>' ;
1229 render_san : function ( value
) {
1231 if ( Ext
. isArray ( value
)) {
1232 value
. forEach ( function ( val
) {
1233 if (! Ext
. isNumber ( val
)) {
1237 return names
. join ( '<br>' );
1242 render_full_name : function ( firstname
, metaData
, record
) {
1243 var first
= firstname
|| '' ;
1244 var last
= record
. data
. lastname
|| '' ;
1245 return Ext
. htmlEncode ( first
+ " " + last
);
1248 render_u2f_error : function ( error
) {
1250 '1' : gettext ( 'Other Error' ),
1251 '2' : gettext ( 'Bad Request' ),
1252 '3' : gettext ( 'Configuration Unsupported' ),
1253 '4' : gettext ( 'Device Ineligible' ),
1254 '5' : gettext ( 'Timeout' ),
1256 return "U2F Error: " + ErrorNames
[ error
] || Proxmox
. Utils
. unknownText
;
1259 windowHostname : function () {
1260 return window
. location
. hostname
. replace ( Proxmox
. Utils
. IP6_bracket_match
,
1261 function ( m
, addr
, offset
, original
) { return addr
; });
1264 openDefaultConsoleWindow : function ( consoles
, consoleType
, vmid
, nodename
, vmname
, cmd
) {
1265 var dv
= PVE
. Utils
. defaultViewer ( consoles
);
1266 PVE
. Utils
. openConsoleWindow ( dv
, consoleType
, vmid
, nodename
, vmname
, cmd
);
1269 openConsoleWindow : function ( viewer
, consoleType
, vmid
, nodename
, vmname
, cmd
) {
1270 if ( vmid
== undefined && ( consoleType
=== 'kvm' || consoleType
=== 'lxc' )) {
1271 throw "missing vmid" ;
1274 throw "no nodename specified" ;
1277 if ( viewer
=== 'html5' ) {
1278 PVE
. Utils
. openVNCViewer ( consoleType
, vmid
, nodename
, vmname
, cmd
);
1279 } else if ( viewer
=== 'xtermjs' ) {
1280 Proxmox
. Utils
. openXtermJsViewer ( consoleType
, vmid
, nodename
, vmname
, cmd
);
1281 } else if ( viewer
=== 'vv' ) {
1282 let url
= '/nodes/' + nodename
+ '/spiceshell' ;
1284 proxy
: PVE
. Utils
. windowHostname (),
1286 if ( consoleType
=== 'kvm' ) {
1287 url
= '/nodes/' + nodename
+ '/qemu/' + vmid
. toString () + '/spiceproxy' ;
1288 } else if ( consoleType
=== 'lxc' ) {
1289 url
= '/nodes/' + nodename
+ '/lxc/' + vmid
. toString () + '/spiceproxy' ;
1290 } else if ( consoleType
=== 'upgrade' ) {
1291 params
. cmd
= 'upgrade' ;
1292 } else if ( consoleType
=== 'cmd' ) {
1294 } else if ( consoleType
!== 'shell' ) {
1295 throw `unknown spice viewer type ' ${consoleType} '` ;
1297 PVE
. Utils
. openSpiceViewer ( url
, params
);
1299 throw `unknown viewer type ' ${viewer} '` ;
1303 defaultViewer : function ( consoles
) {
1304 var allowSpice
, allowXtermjs
;
1306 if ( consoles
=== true ) {
1308 allowXtermjs
= true ;
1309 } else if ( typeof consoles
=== 'object' ) {
1310 allowSpice
= consoles
. spice
;
1311 allowXtermjs
= !! consoles
. xtermjs
;
1313 var dv
= PVE
. VersionInfo
. console
|| 'xtermjs' ;
1314 if ( dv
=== 'vv' && ! allowSpice
) {
1315 dv
= allowXtermjs
? 'xtermjs' : 'html5' ;
1316 } else if ( dv
=== 'xtermjs' && ! allowXtermjs
) {
1317 dv
= allowSpice
? 'vv' : 'html5' ;
1323 openVNCViewer : function ( vmtype
, vmid
, nodename
, vmname
, cmd
) {
1324 let scaling
= 'off' ;
1325 if ( Proxmox
. Utils
. toolkit
!== 'touch' ) {
1326 var sp
= Ext
. state
. Manager
. getProvider ();
1327 scaling
= sp
. get ( 'novnc-scaling' , 'off' );
1329 var url
= Ext
. Object
. toQueryString ({
1330 console
: vmtype
, // kvm, lxc, upgrade or shell
1338 var nw
= window
. open ( "?" + url
, '_blank' , "innerWidth=745,innerheight=427" );
1344 openSpiceViewer : function ( url
, params
) {
1345 var downloadWithName = function ( uri
, name
) {
1346 var link
= Ext
. DomHelper
. append ( document
. body
, {
1349 css
: 'display:none;visibility:hidden;height:0px;' ,
1352 // Note: we need to tell android the correct file name extension
1353 // but we do not set 'download' tag for other environments, because
1354 // It can have strange side effects (additional user prompt on firefox)
1355 var andriod
= !! navigator
. userAgent
. match ( /Android/i );
1357 link
. download
= name
;
1360 if ( link
. fireEvent
) {
1361 link
. fireEvent ( 'onclick' );
1363 let evt
= document
. createEvent ( "MouseEvents" );
1364 evt
. initMouseEvent ( 'click' , true , true , window
, 1 , 0 , 0 , 0 , 0 , false , false , false , false , 0 , null );
1365 link
. dispatchEvent ( evt
);
1369 Proxmox
. Utils
. API2Request ({
1373 failure : function ( response
, opts
) {
1374 Ext
. Msg
. alert ( 'Error' , response
. htmlStatus
);
1376 success : function ( response
, opts
) {
1377 var raw
= "[virt-viewer] \n " ;
1378 Ext
. Object
. each ( response
. result
. data
, function ( k
, v
) {
1379 raw
+= k
+ "=" + v
+ " \n " ;
1381 var url
= 'data:application/x-virt-viewer;charset=UTF-8,' +
1382 encodeURIComponent ( raw
);
1384 downloadWithName ( url
, "pve-spice.vv" );
1389 openTreeConsole : function ( tree
, record
, item
, index
, e
) {
1391 var nodename
= record
. data
. node
;
1392 var vmid
= record
. data
. vmid
;
1393 var vmname
= record
. data
. name
;
1394 if ( record
. data
. type
=== 'qemu' && ! record
. data
. template
) {
1395 Proxmox
. Utils
. API2Request ({
1396 url
: '/nodes/' + nodename
+ '/qemu/' + vmid
+ '/status/current' ,
1397 failure : function ( response
, opts
) {
1398 Ext
. Msg
. alert ( 'Error' , response
. htmlStatus
);
1400 success : function ( response
, opts
) {
1401 let conf
= response
. result
. data
;
1403 spice
: !! conf
. spice
,
1404 xtermjs
: !! conf
. serial
,
1406 PVE
. Utils
. openDefaultConsoleWindow ( consoles
, 'kvm' , vmid
, nodename
, vmname
);
1409 } else if ( record
. data
. type
=== 'lxc' && ! record
. data
. template
) {
1410 PVE
. Utils
. openDefaultConsoleWindow ( true , 'lxc' , vmid
, nodename
, vmname
);
1414 // test automation helper
1415 call_menu_handler : function ( menu
, text
) {
1416 var list
= menu
. query ( 'menuitem' );
1418 Ext
. Array
. each ( list
, function ( item
) {
1419 if ( item
. text
=== text
) {
1430 createCmdMenu : function ( v
, record
, item
, index
, event
) {
1432 if (!( v
instanceof Ext
. tree
. View
)) {
1436 var template
= !! record
. data
. template
;
1437 var type
= record
. data
. type
;
1440 if ( type
=== 'qemu' || type
== 'lxc' ) {
1441 menu
= Ext
. create ( 'PVE.menu.TemplateMenu' , {
1445 } else if ( type
=== 'qemu' ||
1448 menu
= Ext
. create ( 'PVE.' + type
+ '.CmdMenu' , {
1450 nodename
: record
. data
. node
,
1456 menu
. showAt ( event
. getXY ());
1460 // helper for deleting field which are set to there default values
1461 delete_if_default : function ( values
, fieldname
, default_val
, create
) {
1462 if ( values
[ fieldname
] === '' || values
[ fieldname
] === default_val
) {
1464 if ( values
. delete ) {
1465 if ( Ext
. isArray ( values
. delete )) {
1466 values
. delete . push ( fieldname
);
1468 values
. delete += ',' + fieldname
;
1471 values
. delete = fieldname
;
1475 delete values
[ fieldname
];
1479 loadSSHKeyFromFile : function ( file
, callback
) {
1480 // ssh-keygen produces 740 bytes for an average 4096 bit rsa key, with
1481 // a user@host comment, 1420 for 8192 bits; current max is 16kbit
1482 // assume: 740*8 for max. 32kbit (5920 byte file)
1483 // round upwards to nearest nice number => 8192 bytes, leaves lots of comment space
1484 if ( file
. size
> 8192 ) {
1485 Ext
. Msg
. alert ( gettext ( 'Error' ), gettext ( "Invalid file size: " ) + file
. size
);
1491 var reader
= new FileReader ();
1492 reader
. onload = function ( evt
) {
1493 callback ( evt
. target
. result
);
1495 reader
. readAsText ( file
);
1498 loadTextFromFile : function ( file
, callback
, maxBytes
) {
1499 let maxSize
= maxBytes
|| 8192 ;
1500 if ( file
. size
> maxSize
) {
1501 Ext
. Msg
. alert ( gettext ( 'Error' ), gettext ( "Invalid file size: " ) + file
. size
);
1507 let reader
= new FileReader ();
1508 reader
. onload
= evt
=> callback ( evt
. target
. result
);
1509 reader
. readAsText ( file
);
1512 diskControllerMaxIDs
: {
1519 // types is either undefined (all busses), an array of busses, or a single bus
1520 forEachBus : function ( types
, func
) {
1521 var busses
= Object
. keys ( PVE
. Utils
. diskControllerMaxIDs
);
1522 var i
, j
, count
, cont
;
1524 if ( Ext
. isArray ( types
)) {
1526 } else if ( Ext
. isDefined ( types
)) {
1530 // check if we only have valid busses
1531 for ( i
= 0 ; i
< busses
. length
; i
++) {
1532 if (! PVE
. Utils
. diskControllerMaxIDs
[ busses
[ i
]]) {
1533 throw "invalid bus: '" + busses
[ i
] + "'" ;
1537 for ( i
= 0 ; i
< busses
. length
; i
++) {
1538 count
= PVE
. Utils
. diskControllerMaxIDs
[ busses
[ i
]];
1539 for ( j
= 0 ; j
< count
; j
++) {
1540 cont
= func ( busses
[ i
], j
);
1541 if (! cont
&& cont
!== undefined ) {
1548 mp_counts
: { mps
: 256 , unused
: 256 },
1550 forEachMP : function ( func
, includeUnused
) {
1552 for ( i
= 0 ; i
< PVE
. Utils
. mp_counts
. mps
; i
++) {
1553 cont
= func ( 'mp' , i
);
1554 if (! cont
&& cont
!== undefined ) {
1559 if (! includeUnused
) {
1563 for ( i
= 0 ; i
< PVE
. Utils
. mp_counts
. unused
; i
++) {
1564 cont
= func ( 'unused' , i
);
1565 if (! cont
&& cont
!== undefined ) {
1571 hardware_counts
: { net
: 32 , usb
: 5 , hostpci
: 16 , audio
: 1 , efidisk
: 1 , serial
: 4 , rng
: 1 },
1573 cleanEmptyObjectKeys : function ( obj
) {
1575 for ( propName
in obj
) {
1576 if ( obj
. hasOwnProperty ( propName
)) {
1577 if ( obj
[ propName
] === null || obj
[ propName
] === undefined ) {
1578 delete obj
[ propName
];
1584 acmedomain_count
: 5 ,
1586 add_domain_to_acme : function ( acme
, domain
) {
1587 if ( acme
. domains
=== undefined ) {
1588 acme
. domains
= [ domain
];
1590 acme
. domains
. push ( domain
);
1591 acme
. domains
= acme
. domains
. filter (( value
, index
, self
) => self
. indexOf ( value
) === index
);
1596 remove_domain_from_acme : function ( acme
, domain
) {
1597 if ( acme
. domains
!== undefined ) {
1598 acme
. domains
= acme
. domains
. filter (( value
, index
, self
) => self
. indexOf ( value
) === index
&& value
!== domain
);
1603 handleStoreErrorOrMask : function ( me
, store
, regex
, callback
) {
1604 me
. mon ( store
, 'load' , function ( proxy
, response
, success
, operation
) {
1606 Proxmox
. Utils
. setErrorMask ( me
, false );
1611 if ( operation
. error
. statusText
) {
1612 if ( operation
. error
. statusText
. match ( regex
)) {
1613 callback ( me
, operation
. error
);
1616 msg
= operation
. error
. statusText
+ ' (' + operation
. error
. status
+ ')' ;
1619 msg
= gettext ( 'Connection error' );
1621 Proxmox
. Utils
. setErrorMask ( me
, msg
);
1625 showCephInstallOrMask : function ( container
, msg
, nodename
, callback
) {
1626 var regex
= new RegExp ( "not (installed|initialized)" , "i" );
1627 if ( msg
. match ( regex
)) {
1628 if ( Proxmox
. UserName
=== 'root@pam' ) {
1629 container
. el
. mask ();
1630 if (! container
. down ( 'pveCephInstallWindow' )) {
1631 var isInstalled
= !! msg
. match ( /not initialized/i );
1632 var win
= Ext
. create ( 'PVE.ceph.Install' , {
1635 win
. getViewModel (). set ( 'isInstalled' , isInstalled
);
1641 container
. mask ( Ext
. String
. format ( gettext ( '{0} not installed.' ) +
1642 ' ' + gettext ( 'Log in as root to install.' ), 'Ceph' ), [ 'pve-static-mask' ]);
1650 propertyStringSet : function ( target
, source
, name
, value
) {
1652 if ( value
=== undefined ) {
1653 target
[ name
] = source
;
1655 target
[ name
] = value
;
1658 delete target
[ name
];
1662 updateColumns : function ( container
) {
1663 let mode
= Ext
. state
. Manager
. get ( 'summarycolumns' ) || 'auto' ;
1665 if ( mode
!== 'auto' ) {
1666 factor
= parseInt ( mode
, 10 );
1667 if ( Number
. isNaN ( factor
)) {
1671 factor
= container
. getSize (). width
< 1400 ? 1 : 2 ;
1674 if ( container
. oldFactor
=== factor
) {
1678 let items
= container
. query ( '>' ); // direct childs
1679 factor
= Math
. min ( factor
, items
. length
);
1680 container
. oldFactor
= factor
;
1682 items
. forEach (( item
) => {
1683 item
. columnWidth
= 1 / factor
;
1686 // we have to update the layout twice, since the first layout change
1687 // can trigger the scrollbar which reduces the amount of space left
1688 container
. updateLayout ();
1689 container
. updateLayout ();
1692 forEachCorosyncLink : function ( nodeinfo
, cb
) {
1693 let re
= /(?:ring|link)(\d+)_addr/ ;
1694 Ext
. iterate ( nodeinfo
, ( prop
, val
) => {
1695 let match
= re
. exec ( prop
);
1697 cb ( Number ( match
[ 1 ]), val
);
1704 'AuthenticAMD' : 'AMD' ,
1705 'GenuineIntel' : 'Intel' ,
1713 "_default_" : 5 , // includes custom models
1716 verify_ip64_address_list : function ( value
, with_suffix
) {
1717 for ( let addr
of value
. split ( /[ ,;]+/ )) {
1723 let parts
= addr
. split ( '%' );
1726 if ( parts
. length
> 2 ) {
1730 if ( parts
. length
> 1 && ! addr
. startsWith ( 'fe80:' )) {
1735 if (! Proxmox
. Utils
. IP64_match
. test ( addr
)) {
1745 constructor : function () {
1747 Ext
. apply ( me
, me
. utilities
);
1749 Proxmox
. Utils
. override_task_descriptions ({
1750 acmedeactivate
: [ 'ACME Account' , gettext ( 'Deactivate' )],
1751 acmenewcert
: [ 'SRV' , gettext ( 'Order Certificate' )],
1752 acmerefresh
: [ 'ACME Account' , gettext ( 'Refresh' )],
1753 acmeregister
: [ 'ACME Account' , gettext ( 'Register' )],
1754 acmerenew
: [ 'SRV' , gettext ( 'Renew Certificate' )],
1755 acmerevoke
: [ 'SRV' , gettext ( 'Revoke Certificate' )],
1756 acmeupdate
: [ 'ACME Account' , gettext ( 'Update' )],
1757 'auth-realm-sync' : [ gettext ( 'Realm' ), gettext ( 'Sync' )],
1758 'auth-realm-sync-test' : [ gettext ( 'Realm' ), gettext ( 'Sync Preview' )],
1759 cephcreatemds
: [ 'Ceph Metadata Server' , gettext ( 'Create' )],
1760 cephcreatemgr
: [ 'Ceph Manager' , gettext ( 'Create' )],
1761 cephcreatemon
: [ 'Ceph Monitor' , gettext ( 'Create' )],
1762 cephcreateosd
: [ 'Ceph OSD' , gettext ( 'Create' )],
1763 cephcreatepool
: [ 'Ceph Pool' , gettext ( 'Create' )],
1764 cephdestroymds
: [ 'Ceph Metadata Server' , gettext ( 'Destroy' )],
1765 cephdestroymgr
: [ 'Ceph Manager' , gettext ( 'Destroy' )],
1766 cephdestroymon
: [ 'Ceph Monitor' , gettext ( 'Destroy' )],
1767 cephdestroyosd
: [ 'Ceph OSD' , gettext ( 'Destroy' )],
1768 cephdestroypool
: [ 'Ceph Pool' , gettext ( 'Destroy' )],
1769 cephfscreate
: [ 'CephFS' , gettext ( 'Create' )],
1770 clustercreate
: [ '' , gettext ( 'Create Cluster' )],
1771 clusterjoin
: [ '' , gettext ( 'Join Cluster' )],
1772 dircreate
: [ gettext ( 'Directory Storage' ), gettext ( 'Create' )],
1773 dirremove
: [ gettext ( 'Directory' ), gettext ( 'Remove' )],
1774 download
: [ '' , gettext ( 'Download' )],
1775 hamigrate
: [ 'HA' , gettext ( 'Migrate' )],
1776 hashutdown
: [ 'HA' , gettext ( 'Shutdown' )],
1777 hastart
: [ 'HA' , gettext ( 'Start' )],
1778 hastop
: [ 'HA' , gettext ( 'Stop' )],
1779 imgcopy
: [ '' , gettext ( 'Copy data' )],
1780 imgdel
: [ '' , gettext ( 'Erase data' )],
1781 lvmcreate
: [ gettext ( 'LVM Storage' ), gettext ( 'Create' )],
1782 lvmthincreate
: [ gettext ( 'LVM-Thin Storage' ), gettext ( 'Create' )],
1783 migrateall
: [ '' , gettext ( 'Migrate all VMs and Containers' )],
1784 'move_volume' : [ 'CT' , gettext ( 'Move Volume' )],
1785 pull_file
: [ 'CT' , gettext ( 'Pull file' )],
1786 push_file
: [ 'CT' , gettext ( 'Push file' )],
1787 qmclone
: [ 'VM' , gettext ( 'Clone' )],
1788 qmconfig
: [ 'VM' , gettext ( 'Configure' )],
1789 qmcreate
: [ 'VM' , gettext ( 'Create' )],
1790 qmdelsnapshot
: [ 'VM' , gettext ( 'Delete Snapshot' )],
1791 qmdestroy
: [ 'VM' , gettext ( 'Destroy' )],
1792 qmigrate
: [ 'VM' , gettext ( 'Migrate' )],
1793 qmmove
: [ 'VM' , gettext ( 'Move disk' )],
1794 qmpause
: [ 'VM' , gettext ( 'Pause' )],
1795 qmreboot
: [ 'VM' , gettext ( 'Reboot' )],
1796 qmreset
: [ 'VM' , gettext ( 'Reset' )],
1797 qmrestore
: [ 'VM' , gettext ( 'Restore' )],
1798 qmresume
: [ 'VM' , gettext ( 'Resume' )],
1799 qmrollback
: [ 'VM' , gettext ( 'Rollback' )],
1800 qmshutdown
: [ 'VM' , gettext ( 'Shutdown' )],
1801 qmsnapshot
: [ 'VM' , gettext ( 'Snapshot' )],
1802 qmstart
: [ 'VM' , gettext ( 'Start' )],
1803 qmstop
: [ 'VM' , gettext ( 'Stop' )],
1804 qmsuspend
: [ 'VM' , gettext ( 'Hibernate' )],
1805 qmtemplate
: [ 'VM' , gettext ( 'Convert to template' )],
1806 spiceproxy
: [ 'VM/CT' , gettext ( 'Console' ) + ' (Spice)' ],
1807 spiceshell
: [ '' , gettext ( 'Shell' ) + ' (Spice)' ],
1808 startall
: [ '' , gettext ( 'Start all VMs and Containers' )],
1809 stopall
: [ '' , gettext ( 'Stop all VMs and Containers' )],
1810 unknownimgdel
: [ '' , gettext ( 'Destroy image from unknown guest' )],
1811 vncproxy
: [ 'VM/CT' , gettext ( 'Console' )],
1812 vncshell
: [ '' , gettext ( 'Shell' )],
1813 vzclone
: [ 'CT' , gettext ( 'Clone' )],
1814 vzcreate
: [ 'CT' , gettext ( 'Create' )],
1815 vzdelsnapshot
: [ 'CT' , gettext ( 'Delete Snapshot' )],
1816 vzdestroy
: [ 'CT' , gettext ( 'Destroy' )],
1817 vzdump
: ( type
, id
) => id
? `VM/CT ${id} - ${gettext('Backup')} ` : gettext ( 'Backup Job' ),
1818 vzmigrate
: [ 'CT' , gettext ( 'Migrate' )],
1819 vzmount
: [ 'CT' , gettext ( 'Mount' )],
1820 vzreboot
: [ 'CT' , gettext ( 'Reboot' )],
1821 vzrestore
: [ 'CT' , gettext ( 'Restore' )],
1822 vzresume
: [ 'CT' , gettext ( 'Resume' )],
1823 vzrollback
: [ 'CT' , gettext ( 'Rollback' )],
1824 vzshutdown
: [ 'CT' , gettext ( 'Shutdown' )],
1825 vzsnapshot
: [ 'CT' , gettext ( 'Snapshot' )],
1826 vzstart
: [ 'CT' , gettext ( 'Start' )],
1827 vzstop
: [ 'CT' , gettext ( 'Stop' )],
1828 vzsuspend
: [ 'CT' , gettext ( 'Suspend' )],
1829 vztemplate
: [ 'CT' , gettext ( 'Convert to template' )],
1830 vzumount
: [ 'CT' , gettext ( 'Unmount' )],
1831 zfscreate
: [ gettext ( 'ZFS Storage' ), gettext ( 'Create' )],