},
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">'
+ +'<a target="_blank" href="https://www.proxmox.com/en/proxmox-virtual-environment/pricing">'
+'www.proxmox.com</a> to get a list of available options.',
+ getClusterSubscriptionLevel: async function() {
+ let { result } = await Proxmox.Async.api2({ url: '/cluster/status' });
+ let levelMap = Object.fromEntries(
+ result.data.filter(v => v.type === 'node').map(v => [v.name, v.level]),
+ );
+ return levelMap;
+ },
+
kvm_ostypes: {
'Linux': [
- { desc: '5.x - 2.6 Kernel', val: 'l26' },
+ { desc: '6.x - 2.6 Kernel', val: 'l26' },
{ desc: '2.4 Kernel', val: 'l24' },
],
'Microsoft Windows': [
'efidisk but no OMVF BIOS': gettext('EFI Disk without OMVF BIOS'),
},
+ renderNotFound: what => Ext.String.format(gettext("No {0} found"), what),
+
get_kvm_osinfo: function(value) {
var info = { base: 'Other' }; // default
if (value) {
virtio: "VirtIO",
};
displayText = map[value] || Proxmox.Utils.unknownText;
+ } else if (key === 'freeze-fs-on-backup' && PVE.Parser.parseBoolean(value)) {
+ continue;
} else if (PVE.Parser.parseBoolean(value)) {
displayText = Proxmox.Utils.enabledText;
}
hideAdd: true,
backups: false,
},
+ esxi: {
+ name: 'ESXi',
+ ipanel: 'ESXIInputPanel',
+ faIcon: 'cloud-download',
+ backups: false,
+ },
},
sdnvnetSchema: {
ipanel: 'BgpInputPanel',
faIcon: 'crosshairs',
},
+ isis: {
+ name: 'isis',
+ ipanel: 'IsisInputPanel',
+ faIcon: 'crosshairs',
+ },
},
sdnipamSchema: {
},
render_storage_content: function(value, metaData, record) {
- var data = record.data;
+ let data = record.data;
+ let result;
if (Ext.isNumber(data.channel) &&
Ext.isNumber(data.id) &&
Ext.isNumber(data.lun)) {
- return "CH " +
+ result = "CH " +
Ext.String.leftPad(data.channel, 2, '0') +
" ID " + data.id + " LUN " + data.lun;
+ } else if (data.content === 'import') {
+ result = data.volid.replace(/^.*?:/, '');
+ } else {
+ result = data.volid.replace(/^.*?:(.*?\/)?/, '');
}
- return data.volid.replace(/^.*?:(.*?\/)?/, '');
+ return Ext.String.htmlEncode(result);
},
render_serverity: function(value) {
// templates
objType = 'template';
status = type;
+ } else if (type === 'storage' && record.content.indexOf('import') !== -1) {
+ return 'fa fa-cloud-download';
} else {
// everything else
status = record.status + ' ha-' + record.hastate;
return Ext.htmlEncode(first + " " + last);
},
+ // expecting the following format:
+ // [v2:10.10.10.1:6802/2008,v1:10.10.10.1:6803/2008]
+ render_ceph_osd_addr: function(value) {
+ value = value.trim();
+ if (value.startsWith('[') && value.endsWith(']')) {
+ value = value.slice(1, -1); // remove []
+ }
+ value = value.replaceAll(',', '\n'); // split IPs in lines
+ let retVal = '';
+ for (const i of value.matchAll(/^(v[0-9]):(.*):([0-9]*)\/([0-9]*)$/gm)) {
+ retVal += `${i[1]}: ${i[2]}:${i[3]}<br>`;
+ }
+ return retVal.length < 1 ? value : retVal;
+ },
+
windowHostname: function() {
return window.location.hostname.replace(Proxmox.Utils.IP6_bracket_match,
function(m, addr, offset, original) { return addr; });
allowSpice = consoles.spice;
allowXtermjs = !!consoles.xtermjs;
}
- let dv = PVE.UIOptions.console || (type === 'kvm' ? 'vv' : 'xtermjs');
+ let dv = PVE.UIOptions.options.console || (type === 'kvm' ? 'vv' : 'xtermjs');
if (dv === 'vv' && !allowSpice) {
dv = allowXtermjs ? 'xtermjs' : 'html5';
} else if (dv === 'xtermjs' && !allowXtermjs) {
css: 'display:none;visibility:hidden;height:0px;',
});
- // Note: we need to tell Android and Chrome the correct file name extension
+ // Note: we need to tell Android, AppleWebKit and Chrome
+ // the correct file name extension
// but we do not set 'download' tag for other environments, because
// It can have strange side effects (additional user prompt on firefox)
- if (navigator.userAgent.match(/Android|Chrome/i)) {
+ if (navigator.userAgent.match(/Android|AppleWebKit|Chrome/i)) {
link.download = name;
}
}
},
- mp_counts: {
+ lxc_mp_counts: {
mp: 256,
unused: 256,
},
- forEachMP: function(func, includeUnused) {
- for (let i = 0; i < PVE.Utils.mp_counts.mp; i++) {
- let cont = func('mp', i);
+ forEachLxcMP: function(func, includeUnused) {
+ for (let i = 0; i < PVE.Utils.lxc_mp_counts.mp; i++) {
+ let cont = func('mp', i, `mp${i}`);
if (!cont && cont !== undefined) {
return;
}
return;
}
- for (let i = 0; i < PVE.Utils.mp_counts.unused; i++) {
- let cont = func('unused', i);
+ for (let i = 0; i < PVE.Utils.lxc_mp_counts.unused; i++) {
+ let cont = func('unused', i, `unused${i}`);
+ if (!cont && cont !== undefined) {
+ return;
+ }
+ }
+ },
+
+ lxc_dev_count: 256,
+
+ forEachLxcDev: function(func) {
+ for (let i = 0; i < PVE.Utils.lxc_dev_count; i++) {
+ let cont = func(i, `dev${i}`);
if (!cont && cont !== undefined) {
return;
}
});
win.getViewModel().set('isInstalled', isInstalled);
container.add(win);
+ win.on('close', () => {
+ container.el.unmask();
+ });
win.show();
callback(win);
}
rstore,
/not (installed|initialized)/i,
(_, error) => {
- nodename = nodename || 'localhost';
+ nodename = nodename || Proxmox.NodeName;
let maskTarget = maskOwnerCt ? view.ownerCt : view;
rstore.stopUpdate();
PVE.Utils.showCephInstallOrMask(maskTarget, error.statusText, nodename, win => {
return undefined;
},
- nextFreeMP: function(type, config) {
- for (let i = 0; i < PVE.Utils.mp_counts[type]; i++) {
+ nextFreeLxcMP: function(type, config) {
+ for (let i = 0; i < PVE.Utils.lxc_mp_counts[type]; i++) {
let confid = `${type}${i}`;
if (!Ext.isDefined(config[confid])) {
return {
notesTemplateVars: ['cluster', 'guestname', 'node', 'vmid'],
- updateUIOptions: function() {
- Proxmox.Utils.API2Request({
- url: '/cluster/options',
- method: 'GET',
- success: function(response) {
- PVE.UIOptions = {};
- PVE.UIOptions.console = response?.result?.data?.console;
- },
- });
+ renderTags: function(tagstext, overrides) {
+ let text = '';
+ if (tagstext) {
+ let tags = (tagstext.split(/[,; ]/) || []).filter(t => !!t);
+ if (PVE.UIOptions.shouldSortTags()) {
+ tags = tags.sort((a, b) => {
+ let alc = a.toLowerCase();
+ let blc = b.toLowerCase();
+ return alc < blc ? -1 : blc < alc ? 1 : a.localeCompare(b);
+ });
+ }
+ text += ' ';
+ tags.forEach((tag) => {
+ text += Proxmox.Utils.getTagElement(tag, overrides);
+ });
+ }
+ return text;
+ },
+
+ tagCharRegex: /^[a-z0-9+_.-]+$/i,
+
+ verificationStateOrder: {
+ 'failed': 0,
+ 'none': 1,
+ 'ok': 2,
+ '__default__': 3,
+ },
+
+ isStandaloneNode: function() {
+ return PVE.data.ResourceStore.getNodes().length < 2;
+ },
+
+ // main use case of this helper is the login window
+ getUiLanguage: function() {
+ let languageCookie = Ext.util.Cookies.get('PVELangCookie');
+ if (languageCookie === 'kr') {
+ // fix-up 'kr' being used for Korean by mistake FIXME: remove with PVE 9
+ let dt = Ext.Date.add(new Date(), Ext.Date.YEAR, 10);
+ languageCookie = 'ko';
+ Ext.util.Cookies.set('PVELangCookie', languageCookie, dt);
+ }
+ return languageCookie || Proxmox.defaultLang || 'en';
},
},
lvmremove: ['Volume Group', gettext('Remove')],
lvmthincreate: [gettext('LVM-Thin Storage'), gettext('Create')],
lvmthinremove: ['Thinpool', gettext('Remove')],
- migrateall: ['', gettext('Migrate all VMs and Containers')],
+ migrateall: ['', gettext('Bulk migrate VMs and Containers')],
'move_volume': ['CT', gettext('Move Volume')],
'pbs-download': ['VM/CT', gettext('File Restore Download')],
pull_file: ['CT', gettext('Pull file')],
qmstop: ['VM', gettext('Stop')],
qmsuspend: ['VM', gettext('Hibernate')],
qmtemplate: ['VM', gettext('Convert to template')],
+ resize: ['VM/CT', gettext('Resize')],
spiceproxy: ['VM/CT', gettext('Console') + ' (Spice)'],
spiceshell: ['', gettext('Shell') + ' (Spice)'],
- startall: ['', gettext('Start all VMs and Containers')],
- stopall: ['', gettext('Stop all VMs and Containers')],
+ startall: ['', gettext('Bulk start VMs and Containers')],
+ stopall: ['', gettext('Bulk shutdown VMs and Containers')],
+ suspendall: ['', gettext('Suspend all VMs')],
unknownimgdel: ['', gettext('Destroy image from unknown guest')],
wipedisk: ['Device', gettext('Wipe Disk')],
vncproxy: ['VM/CT', gettext('Console')],