ui: ceph install: add hints depending on selected repo and subscriptions

None hint required if all nodes have subscriptions and enterprise
repo is selected, but otherwise give some hints for better UX and to
(hopefully) reduce the chance for mishaps.

We might want to highlight the label to improve visibility tough.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2023-06-05 18:03:46 +02:00
parent b686fd3774
commit e6a1160f95
2 changed files with 52 additions and 1 deletions

View File

@ -37,6 +37,14 @@ Ext.define('PVE.Utils', {
+'<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.',
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: '6.x - 2.6 Kernel', val: 'l26' },

View File

@ -149,6 +149,31 @@ Ext.define('PVE.ceph.CephInstallWizard', {
cephRepo: 'enterprise',
configuration: true,
isInstalled: false,
nodeHasSubscription: true, // avoid warning hint until fully loaded
allHaveSubscription: true, // avoid warning hint until fully loaded
},
formulas: {
repoHintHidden: get => get('allHaveSubscription') && get('cephRepo') === 'enterprise',
repoHint: function(get) {
let repo = get('cephRepo');
let nodeSub = get('nodeHasSubscription'), allSub = get('allHaveSubscription');
if (repo === 'enterprise') {
if (!nodeSub) {
return gettext('The enterprise repository is enabled, but there is no active subscription!');
} else if (!allSub) {
//return gettext('Not all nodes in the cluster have an active subscription, so not all have access to the enterprise repository and therefore may receive upgrades sooner!');
return gettext('Not all nodes have an active subscription, which is required for cluster-wide enterprise repo access');
}
return ''; // should be hidden
} else if (repo === 'no-subscription') {
return allSub
? gettext("Cluster has active subscriptions and would be elligible for using the enterprise repository.")
: gettext("The no-subscription repository is not the best choice for production setups.");
} else {
return gettext('The test repository should only be used for test setups or after consulting the official Proxmox support!');
}
},
},
},
cbindData: {
@ -175,11 +200,19 @@ Ext.define('PVE.ceph.CephInstallWizard', {
},
onShow: function() {
this.callParent(arguments);
let viewModel = this.getViewModel();
var isInstalled = this.getViewModel().get('isInstalled');
if (isInstalled) {
this.getViewModel().set('configuration', false);
viewModel.set('configuration', false);
this.setInitialTab(2);
}
PVE.Utils.getClusterSubscriptionLevel().then(subcriptionMap => {
viewModel.set('nodeHasSubscription', !!subcriptionMap[this.nodename]);
let allHaveSubscription = Object.values(subcriptionMap).every(level => !!level);
viewModel.set('allHaveSubscription', allHaveSubscription);
});
},
items: [
{
@ -204,6 +237,16 @@ Ext.define('PVE.ceph.CephInstallWizard', {
{
flex: 1,
},
{
xtype: 'displayfield',
fieldLabel: gettext('Hint'),
submitValue: false,
labelWidth: 50,
bind: {
value: '{repoHint}',
hidden: '{repoHintHidden}',
},
},
{
xtype: 'pveCephHighestVersionDisplay',
labelWidth: 150,