Ext.ns('PVE');
-// avoid errors related to Accessible Rich Internet Applications
-// (access for people with disabilities)
-// TODO reenable after all components are upgraded
-Ext.enableAria = false;
-Ext.enableAriaButtons = false;
-Ext.enableAriaPanels = false;
-
console.log("Starting Proxmox VE Manager");
Ext.Ajax.defaultHeaders = {
toolkit: undefined, // (extjs|touch), set inside Toolkit.js
- bus_match: /^(ide|sata|virtio|scsi)\d+$/,
+ bus_match: /^(ide|sata|virtio|scsi)(\d+)$/,
log_severity_hash: {
0: "panic",
{ desc: '2.4 Kernel', val: 'l24' },
],
'Microsoft Windows': [
+ { desc: '11/2022', val: 'win11' },
{ desc: '10/2016/2019', val: 'win10' },
{ desc: '8.x/2012/2012r2', val: 'win8' },
{ desc: '7/2008r2', val: 'win7' },
return PVE.Parser.printPropertyString(value);
}
},
- render_as_property_string: function(value) {
- return !value ? Proxmox.Utils.defaultText
- : PVE.Parser.printPropertyString(value);
- },
+ render_as_property_string: v => !v ? Proxmox.Utils.defaultText : PVE.Parser.printPropertyString(v),
render_scsihw: function(value) {
if (!value) {
// fixme: auto-generate this
// for now, please keep in sync with PVE::Tools::kvmkeymaps
kvm_keymaps: {
+ '__default__': Proxmox.Utils.defaultText,
//ar: 'Arabic',
da: 'Danish',
de: 'German',
//th: 'Thai',
tr: 'Turkish',
},
+ kvm_keymap_array: () => Object.entries(PVE.Utils.kvm_keymaps),
kvm_vga_drivers: {
+ '__default__': Proxmox.Utils.defaultText,
std: gettext('Standard VGA'),
vmware: gettext('VMware compatible'),
qxl: 'SPICE',
virtio: 'VirtIO-GPU',
none: Proxmox.Utils.noneText,
},
+ kvm_vga_driver_array: () => Object.entries(PVE.Utils.kvm_vga_drivers),
render_kvm_language: function(value) {
- if (!value || value === '__default__') {
+ if (!value) {
return Proxmox.Utils.defaultText;
}
- var text = PVE.Utils.kvm_keymaps[value];
- if (text) {
- return text + ' (' + value + ')';
- }
- return value;
- },
-
- kvm_keymap_array: function() {
- var data = [['__default__', PVE.Utils.render_kvm_language('')]];
- Ext.Object.each(PVE.Utils.kvm_keymaps, function(key, value) {
- data.push([key, PVE.Utils.render_kvm_language(value)]);
- });
-
- return data;
+ let text = PVE.Utils.kvm_keymaps[value];
+ return text ? `${text} (${value})` : value;
},
console_map: {
'html5': 'HTML5 (noVNC)',
'xtermjs': 'xterm.js',
},
+ console_viewer_array: () => Object.entries(PVE.Utils.console_map),
render_console_viewer: function(value) {
value = value || '__default__';
- if (PVE.Utils.console_map[value]) {
- return PVE.Utils.console_map[value];
- }
- return value;
- },
-
- console_viewer_array: function() {
- return Ext.Array.map(Object.keys(PVE.Utils.console_map), function(v) {
- return [v, PVE.Utils.render_console_viewer(v)];
- });
+ return PVE.Utils.console_map[value] || value;
},
render_kvm_vga_driver: function(value) {
if (!value) {
return Proxmox.Utils.defaultText;
}
- var vga = PVE.Parser.parsePropertyString(value, 'type');
- var text = PVE.Utils.kvm_vga_drivers[vga.type];
+ let vga = PVE.Parser.parsePropertyString(value, 'type');
+ let text = PVE.Utils.kvm_vga_drivers[vga.type];
if (!vga.type) {
text = Proxmox.Utils.defaultText;
}
- if (text) {
- return text + ' (' + value + ')';
- }
- return value;
- },
-
- kvm_vga_driver_array: function() {
- var data = [['__default__', PVE.Utils.render_kvm_vga_driver('')]];
- Ext.Object.each(PVE.Utils.kvm_vga_drivers, function(key, value) {
- data.push([key, PVE.Utils.render_kvm_vga_driver(value)]);
- });
-
- return data;
+ return text ? `${text} (${value})` : value;
},
render_kvm_startup: function(value) {
syncipanel: 'pveAuthLDAPSyncPanel',
add: true,
tfa: true,
+ pwchange: true,
},
ldap: {
name: gettext('LDAP Server'),
syncipanel: 'pveAuthLDAPSyncPanel',
add: true,
tfa: true,
+ pwchange: true,
},
openid: {
- name: gettext('OpenID Server'),
+ name: gettext('OpenID Connect Server'),
ipanel: 'pveAuthOpenIDPanel',
add: true,
tfa: false,
+ pwchange: false,
+ iconCls: 'pmx-itype-icon-openid-logo',
},
pam: {
name: 'Linux PAM',
ipanel: 'pveAuthBasePanel',
add: false,
tfa: true,
+ pwchange: true,
},
pve: {
name: 'Proxmox VE authentication server',
ipanel: 'pveAuthBasePanel',
add: false,
+ tfa: true,
+ pwchange: true,
},
},
backups: true,
},
cifs: {
- name: 'CIFS',
+ name: 'SMB/CIFS',
ipanel: 'CIFSInputPanel',
faIcon: 'building',
backups: true,
value = !record || record.get('monhost') ? 'cephfs' : 'pvecephfs';
}
- var schema = PVE.Utils.storageSchema[value];
- if (schema) {
- return schema.name;
- }
- return Proxmox.Utils.unknownText;
+ let schema = PVE.Utils.storageSchema[value];
+ return schema?.name ?? value;
},
format_ha: function(value) {
return Ext.Date.format(new Date(value * 1000), 'l d F Y H:i:s');
},
+ // render a timestamp or pending
+ render_next_event: function(value) {
+ if (!value) {
+ return '-';
+ }
+ let now = new Date(), next = new Date(value * 1000);
+ if (next < now) {
+ return gettext('pending');
+ }
+ return Proxmox.Utils.render_timestamp(value);
+ },
+
calculate_mem_usage: function(data) {
if (!Ext.isNumeric(data.mem) ||
data.maxmem === 0 ||
return Ext.htmlEncode(first + " " + last);
},
- render_u2f_error: function(error) {
- var ErrorNames = {
- '1': gettext('Other Error'),
- '2': gettext('Bad Request'),
- '3': gettext('Configuration Unsupported'),
- '4': gettext('Device Ineligible'),
- '5': gettext('Timeout'),
- };
- return "U2F Error: " + ErrorNames[error] || Proxmox.Utils.unknownText;
- },
-
windowHostname: function() {
return window.location.hostname.replace(Proxmox.Utils.IP6_bracket_match,
function(m, addr, offset, original) { return addr; });
sata: 6,
scsi: 31,
virtio: 16,
+ unused: 256,
},
// types is either undefined (all busses), an array of busses, or a single bus
},
mp_counts: {
- mps: 256,
+ mp: 256,
unused: 256,
},
forEachMP: function(func, includeUnused) {
- for (let i = 0; i < PVE.Utils.mp_counts.mps; i++) {
+ for (let i = 0; i < PVE.Utils.mp_counts.mp; i++) {
let cont = func('mp', i);
if (!cont && cont !== undefined) {
return;
}
},
- hardware_counts: { net: 32, usb: 5, hostpci: 16, audio: 1, efidisk: 1, serial: 4, rng: 1 },
+ hardware_counts: { net: 32, usb: 5, hostpci: 16, audio: 1, efidisk: 1, serial: 4, rng: 1, tpmstate: 1 },
cleanEmptyObjectKeys: function(obj) {
for (const propName of Object.keys(obj)) {
return true;
},
+
+ sortByPreviousUsage: function(vmconfig, controllerList) {
+ if (!controllerList) {
+ controllerList = ['ide', 'virtio', 'scsi', 'sata'];
+ }
+ let usedControllers = {};
+ for (const type of Object.keys(PVE.Utils.diskControllerMaxIDs)) {
+ usedControllers[type] = 0;
+ }
+
+ for (const property of Object.keys(vmconfig)) {
+ if (property.match(PVE.Utils.bus_match) && !vmconfig[property].match(/media=cdrom/)) {
+ const foundController = property.match(PVE.Utils.bus_match)[1];
+ usedControllers[foundController]++;
+ }
+ }
+
+ let sortPriority = PVE.qemu.OSDefaults.getDefaults(vmconfig.ostype).busPriority;
+
+ let sortedList = Ext.clone(controllerList);
+ sortedList.sort(function(a, b) {
+ if (usedControllers[b] === usedControllers[a]) {
+ return sortPriority[b] - sortPriority[a];
+ }
+ return usedControllers[b] - usedControllers[a];
+ });
+
+ return sortedList;
+ },
+
+ nextFreeDisk: function(controllers, config) {
+ for (const controller of controllers) {
+ for (let i = 0; i < PVE.Utils.diskControllerMaxIDs[controller]; i++) {
+ let confid = controller + i.toString();
+ if (!Ext.isDefined(config[confid])) {
+ return {
+ controller,
+ id: i,
+ confid,
+ };
+ }
+ }
+ }
+
+ return undefined;
+ },
+
+ nextFreeMP: function(type, config) {
+ for (let i = 0; i < PVE.Utils.mp_counts[type]; i++) {
+ let confid = `${type}${i}`;
+ if (!Ext.isDefined(config[confid])) {
+ return {
+ type,
+ id: i,
+ confid,
+ };
+ }
+ }
+
+ return undefined;
+ },
},
singleton: true,
cephdestroymon: ['Ceph Monitor', gettext('Destroy')],
cephdestroyosd: ['Ceph OSD', gettext('Destroy')],
cephdestroypool: ['Ceph Pool', gettext('Destroy')],
+ cephdestroyfs: ['CephFS', gettext('Destroy')],
cephfscreate: ['CephFS', gettext('Create')],
cephsetpool: ['Ceph Pool', gettext('Edit')],
cephsetflags: ['', gettext('Change global Ceph flags')],
clusterjoin: ['', gettext('Join Cluster')],
dircreate: [gettext('Directory Storage'), gettext('Create')],
dirremove: [gettext('Directory'), gettext('Remove')],
- download: ['', gettext('Download')],
+ download: [gettext('File'), gettext('Download')],
hamigrate: ['HA', gettext('Migrate')],
hashutdown: ['HA', gettext('Shutdown')],
hastart: ['HA', gettext('Start')],
imgcopy: ['', gettext('Copy data')],
imgdel: ['', gettext('Erase data')],
lvmcreate: [gettext('LVM Storage'), gettext('Create')],
+ lvmremove: ['Volume Group', gettext('Remove')],
lvmthincreate: [gettext('LVM-Thin Storage'), gettext('Create')],
+ lvmthinremove: ['Thinpool', gettext('Remove')],
migrateall: ['', gettext('Migrate all VMs and Containers')],
'move_volume': ['CT', gettext('Move Volume')],
'pbs-download': ['VM/CT', gettext('File Restore Download')],
vztemplate: ['CT', gettext('Convert to template')],
vzumount: ['CT', gettext('Unmount')],
zfscreate: [gettext('ZFS Storage'), gettext('Create')],
+ zfsremove: ['ZFS Pool', gettext('Remove')],
});
},