Show disk usage content name delivered from the backend
This commit is contained in:
@@ -114,9 +114,9 @@ async function getFilesystems() {
|
||||
}
|
||||
|
||||
const standardPaths = [
|
||||
{ type: 'standard', id: 'platformdata', path: paths.PLATFORM_DATA_DIR },
|
||||
{ type: 'standard', id: 'boxdata', path: paths.BOX_DATA_DIR },
|
||||
{ type: 'standard', id: 'maildata', path: paths.MAIL_DATA_DIR },
|
||||
{ type: 'standard', id: 'platformdata', name: 'Platform Data', path: paths.PLATFORM_DATA_DIR },
|
||||
{ type: 'standard', id: 'boxdata', name: 'Box Data', path: paths.BOX_DATA_DIR },
|
||||
{ type: 'standard', id: 'maildata', name: 'Mail Data', path: paths.MAIL_DATA_DIR },
|
||||
];
|
||||
|
||||
for (const stdPath of standardPaths) {
|
||||
@@ -130,7 +130,7 @@ async function getFilesystems() {
|
||||
if (backupSite.provider === 'filesystem') {
|
||||
const [, dfResult] = await safe(df.file(backupSite.config.backupDir));
|
||||
const filesystem = dfResult?.filesystem || rootDisk.filesystem;
|
||||
if (filesystems[filesystem]) filesystems[filesystem].contents.push({ type: 'cloudron-backup', id: backupSite.id, path: backupSite.config.backupDir });
|
||||
if (filesystems[filesystem]) filesystems[filesystem].contents.push({ type: 'cloudron-backup', id: backupSite.id, name: backupSite.name, path: backupSite.config.backupDir });
|
||||
}
|
||||
|
||||
}
|
||||
@@ -140,7 +140,7 @@ async function getFilesystems() {
|
||||
if (!siteForDefault) {
|
||||
const [, dfResult] = await safe(df.file(paths.DEFAULT_BACKUP_DIR));
|
||||
const filesystem = dfResult?.filesystem || rootDisk.filesystem;
|
||||
if (filesystems[filesystem]) filesystems[filesystem].contents.push({ type: 'cloudron-backup-default', id: 'cloudron-backup-default', path: paths.DEFAULT_BACKUP_DIR });
|
||||
if (filesystems[filesystem]) filesystems[filesystem].contents.push({ type: 'cloudron-backup-default', id: 'cloudron-backup-default', name: 'Cloudron Default Backup', path: paths.DEFAULT_BACKUP_DIR });
|
||||
}
|
||||
|
||||
const [dockerError, dockerInfo] = await safe(docker.info());
|
||||
@@ -148,15 +148,15 @@ async function getFilesystems() {
|
||||
const [, dfResult] = await safe(df.file(dockerInfo.DockerRootDir));
|
||||
const filesystem = dfResult?.filesystem || rootDisk.filesystem;
|
||||
if (filesystems[filesystem]) {
|
||||
filesystems[filesystem].contents.push({ type: 'standard', id: 'docker', path: dockerInfo.DockerRootDir });
|
||||
filesystems[filesystem].contents.push({ type: 'standard', id: 'docker-volumes', path: dockerInfo.DockerRootDir });
|
||||
filesystems[filesystem].contents.push({ type: 'standard', id: 'docker', name: 'Docker', path: dockerInfo.DockerRootDir });
|
||||
filesystems[filesystem].contents.push({ type: 'standard', id: 'docker-volumes', name: 'Docker Volumes', path: dockerInfo.DockerRootDir });
|
||||
}
|
||||
}
|
||||
|
||||
for (const volume of await volumes.list()) {
|
||||
const [, dfResult] = await safe(df.file(volume.hostPath));
|
||||
const filesystem = dfResult?.filesystem || rootDisk.filesystem;
|
||||
if (filesystems[filesystem]) filesystems[filesystem].contents.push({ type: 'volume', id: volume.id, path: volume.hostPath });
|
||||
if (filesystems[filesystem]) filesystems[filesystem].contents.push({ type: 'volume', id: volume.id, name: volume.name, path: volume.hostPath });
|
||||
}
|
||||
|
||||
for (const app of await apps.list()) {
|
||||
@@ -166,7 +166,7 @@ async function getFilesystems() {
|
||||
if (dataDir === null) continue;
|
||||
const [, dfResult] = await safe(df.file(dataDir));
|
||||
const filesystem = dfResult?.filesystem || rootDisk.filesystem;
|
||||
if (filesystems[filesystem]) filesystems[filesystem].contents.push({ type: 'app', id: app.id, path: dataDir });
|
||||
if (filesystems[filesystem]) filesystems[filesystem].contents.push({ type: 'app', id: app.id, name: app.label || app.fqdn, path: dataDir });
|
||||
}
|
||||
|
||||
const swaps = await getSwaps();
|
||||
@@ -175,7 +175,7 @@ async function getFilesystems() {
|
||||
if (swap.type !== 'file') continue;
|
||||
|
||||
const [, dfResult] = await safe(df.file(swap.name));
|
||||
filesystems[dfResult?.filesystem || rootDisk.filesystem].contents.push({ type: 'swap', id: swap.name, path: swap.name });
|
||||
filesystems[dfResult?.filesystem || rootDisk.filesystem].contents.push({ type: 'swap', id: swap.name, name: swap.name, path: swap.name });
|
||||
}
|
||||
|
||||
return Object.values(filesystems);
|
||||
@@ -262,7 +262,7 @@ class FilesystemUsageTask extends AsyncTask {
|
||||
this.emitData({ content });
|
||||
}
|
||||
|
||||
if (mountpoint === '/') this.emitData({ content: { type: 'standard', id: 'os', usage: used-usage }});
|
||||
if (mountpoint === '/') this.emitData({ content: { type: 'standard', id: 'os', name: 'Ubuntu', usage: used - usage }});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user