diff --git a/orion-ops-ui/src/utils/file.ts b/orion-ops-ui/src/utils/file.ts index 23a9a3f0..637f2338 100644 --- a/orion-ops-ui/src/utils/file.ts +++ b/orion-ops-ui/src/utils/file.ts @@ -26,7 +26,7 @@ export function readFileText(e: File, encoding = 'UTF-8'): Promise { /** * 解析路径类型 */ -type PathAnalysis = { +export interface PathAnalysis { name: string; path: string; } @@ -34,23 +34,19 @@ type PathAnalysis = { /** * 获取解析路径 */ -export function getPathAnalysis(analysisPath: string, paths: PathAnalysis[] = []): PathAnalysis[] { - const lastSymbol = analysisPath.lastIndexOf('/'); - if (lastSymbol === -1) { - paths.unshift({ - name: '/', - path: '/' - }); +export function getPathAnalysis(path: string, paths: PathAnalysis[] = []): PathAnalysis[] { + const lastSeparatorIndex = path.lastIndexOf('/'); + if (lastSeparatorIndex === -1) { return paths; } - const name = analysisPath.substring(lastSymbol, analysisPath.length); + const name = path.substring(lastSeparatorIndex, path.length); if (!isEmptyStr(name) && name !== '/') { paths.unshift({ name: name.substring(1, name.length), - path: analysisPath + path: path }); } - return getPathAnalysis(analysisPath.substring(0, lastSymbol), paths); + return getPathAnalysis(path.substring(0, lastSeparatorIndex), paths); } /** @@ -58,7 +54,7 @@ export function getPathAnalysis(analysisPath: string, paths: PathAnalysis[] = [] */ export function getPath(path: string) { return path.replace(new RegExp('\\\\+', 'g'), '/') - .replace(new RegExp('/+', 'g'), '/'); + .replace(new RegExp('/+', 'g'), '/'); } /** diff --git a/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-table-header.vue b/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-table-header.vue index 01c1b92c..616c9759 100644 --- a/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-table-header.vue +++ b/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-table-header.vue @@ -11,27 +11,68 @@ content-class="terminal-tooltip-content" arrow-class="terminal-tooltip-content" content="返回上级"> - + -
- - - - / - root - orion - space - logs +
+ +
+ +
+ + + + + + + + + {{ path.name }} +
- - + + + + + + + + + + + + + + + + + - + @@ -51,9 +93,11 @@ :auto-fix-position="false" content-class="terminal-tooltip-content" arrow-class="terminal-tooltip-content" - content="显示隐藏文件"> - - + :content="showHiddenFile ? '不显示隐藏文件' : '显示隐藏文件'"> + + + @@ -64,7 +108,8 @@ content-class="terminal-tooltip-content" arrow-class="terminal-tooltip-content" content="创建文件"> - + @@ -76,23 +121,25 @@ content-class="terminal-tooltip-content" arrow-class="terminal-tooltip-content" content="创建文件夹"> - + - + - + content="删除选中文件"> + - + - + - + - + @@ -136,7 +184,8 @@ content-class="terminal-tooltip-content" arrow-class="terminal-tooltip-content" content="下载"> - + @@ -151,6 +200,91 @@ diff --git a/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-table.vue b/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-table.vue index 7a16010c..14e052e5 100644 --- a/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-table.vue +++ b/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-table.vue @@ -1,5 +1,5 @@