filemanager: show owner
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
import superagent from 'superagent';
|
||||
import { sanitize } from 'pankow/utils';
|
||||
|
||||
const BASE_URL = import.meta.env.BASE_URL || '/';
|
||||
|
||||
export function createDirectoryModel(origin, accessToken, api) {
|
||||
|
||||
return {
|
||||
@@ -21,12 +23,23 @@ export function createDirectoryModel(origin, accessToken, api) {
|
||||
|
||||
// this prepares the entries to be compatible with all components
|
||||
result.body.entries.forEach(item => {
|
||||
item.id = item.fileName;
|
||||
item.name = item.fileName;
|
||||
item.folderPath = path;
|
||||
item.modified = new Date(item.mtime);
|
||||
item.type = item.isDirectory ? 'directory' : 'file',
|
||||
item.icon = `${BASE_URL}mime-types/${item.mimeType === 'inode/symlink' ? 'none' : item.mimeType.split('/').join('-')}.svg`;
|
||||
|
||||
// if we have an image, attach previewUrl
|
||||
if (item.mimeType.indexOf('image/') === 0) {
|
||||
item.previewUrl = `${origin}/api/v1/${api}/files/${encodeURIComponent(path + '/' + item.fileName)}?access_token=${accessToken}`;
|
||||
}
|
||||
|
||||
item.folderPath = path;
|
||||
item.owner = 'unkown';
|
||||
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';
|
||||
});
|
||||
|
||||
return result.body.entries;
|
||||
|
||||
@@ -44,6 +44,9 @@
|
||||
<div class="main-view">
|
||||
<div class="main-view-col">
|
||||
<DirectoryView
|
||||
:show-owner="true"
|
||||
:show-size="true"
|
||||
:show-modified="true"
|
||||
@selection-changed="onSelectionChanged"
|
||||
@item-activated="onItemActivated"
|
||||
:delete-handler="deleteHandler"
|
||||
@@ -252,21 +255,7 @@ export default {
|
||||
await this.loadCwd();
|
||||
},
|
||||
async loadCwd() {
|
||||
const items = await this.directoryModel.listFiles(this.cwd);
|
||||
|
||||
// convert to format DirectoryView currently wants
|
||||
this.items = items.map(function (i) {
|
||||
return {
|
||||
id: i.fileName,
|
||||
name: i.fileName,
|
||||
size: i.size,
|
||||
modified: new Date(i.mtime),
|
||||
type: i.isDirectory ? 'directory' : 'file',
|
||||
mimeType: i.mimeType,
|
||||
previewUrl: i.previewUrl || null,
|
||||
icon: `${BASE_URL}mime-types/${i.mimeType === 'inode/symlink' ? 'none' : i.mimeType.split('/').join('-')}.svg`
|
||||
};
|
||||
});
|
||||
this.items = await this.directoryModel.listFiles(this.cwd);
|
||||
|
||||
const tmp = this.cwd.split('/').slice(1);
|
||||
let name = this.activeResource.fqdn;
|
||||
|
||||
Reference in New Issue
Block a user