mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 08:19:15 +08:00
feat:文件列表增加 uid 和 gid 显示 (#2192)
Refs https://github.com/1Panel-dev/1Panel/issues/2066
This commit is contained in:
parent
e6522ded62
commit
e509fb0571
@ -10,6 +10,7 @@ import (
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
@ -23,6 +24,8 @@ type FileInfo struct {
|
||||
Name string `json:"name"`
|
||||
User string `json:"user"`
|
||||
Group string `json:"group"`
|
||||
Uid string `json:"uid"`
|
||||
Gid string `json:"gid"`
|
||||
Extension string `json:"extension"`
|
||||
Content string `json:"content"`
|
||||
Size int64 `json:"size"`
|
||||
@ -77,6 +80,8 @@ func NewFileInfo(op FileOption) (*FileInfo, error) {
|
||||
IsHidden: IsHidden(op.Path),
|
||||
Mode: fmt.Sprintf("%04o", info.Mode().Perm()),
|
||||
User: GetUsername(info.Sys().(*syscall.Stat_t).Uid),
|
||||
Uid: strconv.FormatUint(uint64(info.Sys().(*syscall.Stat_t).Uid), 10),
|
||||
Gid: strconv.FormatUint(uint64(info.Sys().(*syscall.Stat_t).Gid), 10),
|
||||
Group: GetGroup(info.Sys().(*syscall.Stat_t).Gid),
|
||||
MimeType: GetMimeType(op.Path),
|
||||
}
|
||||
@ -208,6 +213,8 @@ func (f *FileInfo) listChildren(dir, showHidden, containSub bool, search string,
|
||||
Mode: fmt.Sprintf("%04o", df.Mode().Perm()),
|
||||
User: GetUsername(df.Sys().(*syscall.Stat_t).Uid),
|
||||
Group: GetGroup(df.Sys().(*syscall.Stat_t).Gid),
|
||||
Uid: strconv.FormatUint(uint64(df.Sys().(*syscall.Stat_t).Uid), 10),
|
||||
Gid: strconv.FormatUint(uint64(df.Sys().(*syscall.Stat_t).Gid), 10),
|
||||
}
|
||||
|
||||
if isSymlink {
|
||||
|
@ -5,6 +5,8 @@ export namespace File {
|
||||
name: string;
|
||||
user: string;
|
||||
group: string;
|
||||
uid: number;
|
||||
gid: number;
|
||||
content: string;
|
||||
size: number;
|
||||
isDir: boolean;
|
||||
|
@ -128,12 +128,16 @@
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('commons.table.user')" prop="user" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-link :underline="false" @click="openChown(row)" type="primary">{{ row.user }}</el-link>
|
||||
<el-link :underline="false" @click="openChown(row)" type="primary">
|
||||
{{ row.user ? row.user : '-' }} ({{ row.uid }})
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('file.group')" prop="group">
|
||||
<template #default="{ row }">
|
||||
<el-link :underline="false" @click="openChown(row)" type="primary">{{ row.group }}</el-link>
|
||||
<el-link :underline="false" @click="openChown(row)" type="primary">
|
||||
{{ row.group ? row.group : '-' }} ({{ row.gid }})
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('file.size')" prop="size" max-width="50">
|
||||
|
Loading…
x
Reference in New Issue
Block a user