diff --git a/frontend/src/models/DirectoryModel.js b/frontend/src/models/DirectoryModel.js index 10534b02c..9d37389ef 100644 --- a/frontend/src/models/DirectoryModel.js +++ b/frontend/src/models/DirectoryModel.js @@ -4,7 +4,7 @@ import { sanitize } from 'pankow/utils'; const BASE_URL = import.meta.env.BASE_URL || '/'; -export function createDirectoryModel(origin, accessToken, api) { +export function createDirectoryModel(origin, accessToken, api, ownersModel) { return { name: 'DirectoryModel', @@ -45,10 +45,7 @@ export function createDirectoryModel(origin, accessToken, api) { } item.owner = item.uid; - if (item.uid === 0) item.owner = 'root'; - if (item.uid === 33) item.owner = 'www-data'; - if (item.uid === 1000) item.owner = 'cloudron'; - if (item.uid === 1001) item.owner = 'git'; + if (ownersModel.find((m) => m.uid === item.uid)) item.owner = ownersModel.find((m) => m.uid === item.uid).label; }); return result.body.entries; diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vue index 680660d93..6e8428c85 100644 --- a/frontend/src/views/Home.vue +++ b/frontend/src/views/Home.vue @@ -204,6 +204,9 @@ export default { }, { uid: 33, label: 'www-data' + }, { + uid: 808, + label: 'yellowtent' }, { uid: 1000, label: 'cloudron' @@ -515,20 +518,6 @@ export default { return; } - this.ownersModel = [{ - uid: 0, - label: 'root' - }, { - uid: 33, - label: 'www-data' - }, { - uid: 1000, - label: 'cloudron' - }, { - uid: 1001, - label: 'git' - }]; - this.appLink = `https://${result.body.fqdn}`; this.title = `${result.body.label || result.body.fqdn} (${result.body.manifest.title})`; } else if (type === 'volume') { @@ -545,20 +534,6 @@ export default { return; } - this.ownersModel = [{ - uid: 0, - label: 'root' - }, { - uid: 33, - label: 'www-data' - }, { - uid: 808, - label: 'yellowtent' - }, { - uid: 1001, - label: 'git' - }]; - this.title = result.body.name; } else { this.fatalError = `Unsupported type ${type}`; @@ -578,7 +553,7 @@ export default { this.resourceType = type; this.resourceId = resourceId; - this.directoryModel = createDirectoryModel(this.apiOrigin, this.accessToken, type === 'volume' ? `volumes/${resourceId}` : `apps/${resourceId}`); + this.directoryModel = createDirectoryModel(this.apiOrigin, this.accessToken, type === 'volume' ? `volumes/${resourceId}` : `apps/${resourceId}`, this.ownersModel); this.loadCwd(); this.$watch(() => this.$route.params, (toParams, previousParams) => {