Fix diskusage colors
This commit is contained in:
@@ -19,7 +19,7 @@ function hue(numOfSteps, step) {
|
||||
let colorIndex = 0;
|
||||
let colors = [];
|
||||
function resetColors(n) {
|
||||
colorIndex = 7;
|
||||
colorIndex = 0;
|
||||
colors = [];
|
||||
for (let i = 0; i < n; i++) colors.push(hue(n, i));
|
||||
}
|
||||
@@ -50,20 +50,8 @@ async function refresh() {
|
||||
if (payload.type === 'done') {
|
||||
percent.value = 100;
|
||||
|
||||
// we first 8 colors are reserved for known system contents
|
||||
resetColors(contents.value.length + 8);
|
||||
contents.value.forEach(content => {
|
||||
// assign fixed colors for known entries
|
||||
if (content.id === 'platformdata') content.color = colors[0];
|
||||
else if (content.id === 'boxdata') content.color = colors[1];
|
||||
else if (content.id === 'maildata') content.color = colors[2];
|
||||
else if (content.id === 'cloudron-backup-default') content.color = colors[3];
|
||||
else if (content.id === 'docker') content.color = colors[4];
|
||||
else if (content.id === 'docker-volumes') content.color = colors[5];
|
||||
else if (content.id === '/apps.swap') content.color = colors[6];
|
||||
else if (content.id === 'os') content.color = colors[7];
|
||||
else content.color = getNextColor();
|
||||
});
|
||||
resetColors(contents.value.length);
|
||||
contents.value.forEach(c => c.color = getNextColor());
|
||||
contents.value.sort((a, b) => b.usage - a.usage);
|
||||
|
||||
eventSource.close();
|
||||
|
||||
Reference in New Issue
Block a user