Move owner/chown model into directoryModel
This commit is contained in:
@@ -4,10 +4,27 @@ import { sanitize } from 'pankow/utils';
|
||||
|
||||
const BASE_URL = import.meta.env.BASE_URL || '/';
|
||||
|
||||
export function createDirectoryModel(origin, accessToken, api, ownersModel) {
|
||||
export function createDirectoryModel(origin, accessToken, api) {
|
||||
const ownersModel = [{
|
||||
uid: 0,
|
||||
label: 'root'
|
||||
}, {
|
||||
uid: 33,
|
||||
label: 'www-data'
|
||||
}, {
|
||||
uid: 808,
|
||||
label: 'yellowtent'
|
||||
}, {
|
||||
uid: 1000,
|
||||
label: 'cloudron'
|
||||
}, {
|
||||
uid: 1001,
|
||||
label: 'git'
|
||||
}];
|
||||
|
||||
return {
|
||||
name: 'DirectoryModel',
|
||||
ownersModel,
|
||||
buildFilePath(filePath, fileName) {
|
||||
// remove leading and trailing slashes
|
||||
while (filePath.startsWith('/')) filePath = filePath.slice(1);
|
||||
|
||||
@@ -198,22 +198,7 @@ export default {
|
||||
busy: false,
|
||||
name: ''
|
||||
},
|
||||
ownersModel: [{
|
||||
uid: 0,
|
||||
label: 'root'
|
||||
}, {
|
||||
uid: 33,
|
||||
label: 'www-data'
|
||||
}, {
|
||||
uid: 808,
|
||||
label: 'yellowtent'
|
||||
}, {
|
||||
uid: 1000,
|
||||
label: 'cloudron'
|
||||
}, {
|
||||
uid: 1001,
|
||||
label: 'git'
|
||||
}],
|
||||
ownersModel: [],
|
||||
// contextMenuModel will have activeItem attached if any command() is called
|
||||
createMenuModel: [{
|
||||
label: () => this.$t('filemanager.toolbar.newFile'),
|
||||
@@ -553,7 +538,9 @@ export default {
|
||||
this.resourceType = type;
|
||||
this.resourceId = resourceId;
|
||||
|
||||
this.directoryModel = createDirectoryModel(this.apiOrigin, this.accessToken, type === 'volume' ? `volumes/${resourceId}` : `apps/${resourceId}`, this.ownersModel);
|
||||
this.directoryModel = createDirectoryModel(this.apiOrigin, this.accessToken, type === 'volume' ? `volumes/${resourceId}` : `apps/${resourceId}`);
|
||||
this.ownersModel = this.directoryModel.ownersModel;
|
||||
|
||||
this.loadCwd();
|
||||
|
||||
this.$watch(() => this.$route.params, (toParams, previousParams) => {
|
||||
|
||||
Reference in New Issue
Block a user