mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-05-09 17:18:33 +00:00
ui: repo status: code cleanup/refactoring
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
de73e0b3d8
commit
df7def01a1
@ -433,16 +433,27 @@ Ext.define('Proxmox.node.APTRepositories', {
|
|||||||
let store = vm.get('errorstore');
|
let store = vm.get('errorstore');
|
||||||
store.removeAll();
|
store.removeAll();
|
||||||
|
|
||||||
|
let status = 'good'; // start with best, the helper below will downgrade if needed
|
||||||
|
let text = gettext('All OK, you have production-ready repositories configured!');
|
||||||
|
|
||||||
let errors = vm.get('errors');
|
let errors = vm.get('errors');
|
||||||
errors.forEach((error) => {
|
errors.forEach((error) => {
|
||||||
|
status = 'critical';
|
||||||
store.add({
|
store.add({
|
||||||
status: 'critical',
|
status: 'critical',
|
||||||
message: `${error.path} - ${error.error}`,
|
message: `${error.path} - ${error.error}`,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
let text = gettext('Repositories are configured in a recommended way');
|
let addGood = message => store.add({ status: 'good', message });
|
||||||
let status = 'good';
|
|
||||||
|
let addWarn = message => {
|
||||||
|
if (status === 'good') {
|
||||||
|
status = 'warning';
|
||||||
|
text = message;
|
||||||
|
}
|
||||||
|
store.add({ status: 'warning', message });
|
||||||
|
};
|
||||||
|
|
||||||
let activeSubscription = vm.get('subscriptionActive');
|
let activeSubscription = vm.get('subscriptionActive');
|
||||||
let enterprise = vm.get('enterpriseRepo');
|
let enterprise = vm.get('enterpriseRepo');
|
||||||
@ -450,22 +461,6 @@ Ext.define('Proxmox.node.APTRepositories', {
|
|||||||
let test = vm.get('testRepo');
|
let test = vm.get('testRepo');
|
||||||
let wrongSuites = vm.get('suitesWarning');
|
let wrongSuites = vm.get('suitesWarning');
|
||||||
|
|
||||||
let addGood = function(message) {
|
|
||||||
store.add({
|
|
||||||
status: 'good',
|
|
||||||
message,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
let addWarn = function(message) {
|
|
||||||
status = 'warning';
|
|
||||||
text = message;
|
|
||||||
store.add({
|
|
||||||
status,
|
|
||||||
message,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!enterprise && !nosubscription && !test) {
|
if (!enterprise && !nosubscription && !test) {
|
||||||
addWarn(Ext.String.format(gettext('No {0} repository is enabled!'), vm.get('product')));
|
addWarn(Ext.String.format(gettext('No {0} repository is enabled!'), vm.get('product')));
|
||||||
} else if (enterprise && !nosubscription && !test && activeSubscription) {
|
} else if (enterprise && !nosubscription && !test && activeSubscription) {
|
||||||
@ -491,11 +486,7 @@ Ext.define('Proxmox.node.APTRepositories', {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (errors.length > 0) {
|
if (errors.length > 0) {
|
||||||
vm.set('state', {
|
text = gettext('Error parsing repositories');
|
||||||
iconCls: Proxmox.Utils.get_health_icon('critical', true),
|
|
||||||
text: gettext('Error parsing repositories'),
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let iconCls = Proxmox.Utils.get_health_icon(status, true);
|
let iconCls = Proxmox.Utils.get_health_icon(status, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user