i18n: pages dispatch fix

This commit is contained in:
a20070322 2024-04-28 13:34:56 +08:00
parent 1945aa7c4d
commit a9b020156c
3 changed files with 227 additions and 110 deletions

View File

@ -1,44 +1,46 @@
export default {
"c": {},
"p": {
"node": "Node",
"chooseNode": "Please select a node",
"searchKeyword": "Search keyword",
"keywordHighlight": "Keyword highlight, supports regex (using regex may affect performance, please use it appropriately)",
"keywordRegex": "Keyword, supports regex",
"showFirstNLines": "Show first N lines",
"showLastNLines": "Show last N lines",
"regexReference": "Regex syntax reference",
"matchLinesWithNumbers": "Match lines containing numbers",
"matchLinesWithAorB": "Match lines containing a or b",
"exception": "Exception",
"matchLinesWithException": "Match lines containing exceptions",
"syntaxReference": "Syntax reference",
"searchMode": "Search mode",
"searchModeDescription": "Search mode. By default, it views the last N lines of the file. Searching from the start means searching from the specified line downwards. Searching from the end means searching upwards from the end of the file for N lines.",
"searchFromEnd": "Search from the end",
"searchFromStart": "Search from the start",
"firstNFileLines": "First N lines of the file",
"lastNFileLines": "Last N lines of the file",
"searchConfigReference": "Search configuration reference",
"searchFromEndExample1": "Search from the end, first 0 lines of the file, last 3 lines of the file",
"searchLastNLines": "Search within the last 3 lines of the file",
"searchFromStartExample1": "Search from the start, first 0 lines of the file, last 3 lines of the file",
"searchLineRange1": "Search within lines 3 - 2147483647 of the file",
"searchFromEndExample2": "Search from the end, first 2 lines of the file, last 3 lines of the file",
"searchLineRange2": "Search within lines 1 - 2 of the file",
"searchFromEndExample3": "Search from the end, first 100 lines of the file, last 100 lines of the file",
"searchLineRange3": "Search within lines 1 - 100 of the file",
"searchFromStartExample2": "Search from the start, first 2 lines of the file, last 3 lines of the file",
"searchLineRange4": "Search within lines 2 - 2 of the file",
"searchFromEndExample4": "Search from the end, first 20 lines of the file, last 3 lines of the file",
"searchLineRange5": "Search within lines 17 - 20 of the file",
"searchFromStartExample3": "Search from the start, first 20 lines of the file, last 3 lines of the file",
"searchLineRange6": "Search within lines 3 - 20 of the file",
"searchReference": "Search reference",
"error": "Error",
"checkWsProxy": "Please check if the ws proxy is enabled",
"sessionClosed": "The session has been closed",
"fileNotReadable": "The current file is not readable. You need to configure readable file authorization."
c: {},
p: {
node: 'Node',
chooseNode: 'Please select a node',
searchKeyword: 'Search keyword',
keywordHighlight:
'Keyword highlight, supports regex (using regex may affect performance, please use it appropriately)',
keywordRegex: 'Keyword, supports regex',
showFirstNLines: 'Show first N lines',
showLastNLines: 'Show last N lines',
regexReference: 'Regex syntax reference',
matchLinesWithNumbers: 'Match lines containing numbers',
matchLinesWithAorB: 'Match lines containing a or b',
exception: 'Exception',
matchLinesWithException: 'Match lines containing exceptions',
syntaxReference: 'Syntax reference',
searchMode: 'Search mode',
searchModeDescription:
'Search mode. By default, it views the last N lines of the file. Searching from the start means searching from the specified line downwards. Searching from the end means searching upwards from the end of the file for N lines.',
searchFromEnd: 'Search from the end',
searchFromStart: 'Search from the start',
firstNFileLines: 'First N lines of the file',
lastNFileLines: 'Last N lines of the file',
searchConfigReference: 'Search configuration reference',
searchFromEndExample1: 'Search from the end, first 0 lines of the file, last 3 lines of the file',
searchLastNLines: 'Search within the last 3 lines of the file',
searchFromStartExample1: 'Search from the start, first 0 lines of the file, last 3 lines of the file',
searchLineRange1: 'Search within lines 3 - 2147483647 of the file',
searchFromEndExample2: 'Search from the end, first 2 lines of the file, last 3 lines of the file',
searchLineRange2: 'Search within lines 1 - 2 of the file',
searchFromEndExample3: 'Search from the end, first 100 lines of the file, last 100 lines of the file',
searchLineRange3: 'Search within lines 1 - 100 of the file',
searchFromStartExample2: 'Search from the start, first 2 lines of the file, last 3 lines of the file',
searchLineRange4: 'Search within lines 2 - 2 of the file',
searchFromEndExample4: 'Search from the end, first 20 lines of the file, last 3 lines of the file',
searchLineRange5: 'Search within lines 17 - 20 of the file',
searchFromStartExample3: 'Search from the start, first 20 lines of the file, last 3 lines of the file',
searchLineRange6: 'Search within lines 3 - 20 of the file',
searchReference: 'Search reference',
error: 'Error',
checkWsProxy: 'Please check if the ws proxy is enabled',
sessionClosed: 'The session has been closed',
fileNotReadable: 'The current file is not readable. You need to configure readable file authorization.'
}
}

View File

@ -1,44 +1,45 @@
export default {
"c": {},
"p": {
"node": "节点",
"chooseNode": "请选择节点",
"searchKeyword": "搜关键词",
"keywordHighlight": "关键词高亮,支持正则(正则可能影响性能请酌情使用)",
"keywordRegex": "关键词,支持正则",
"showFirstNLines": "显示前N行",
"showLastNLines": "显示后N行",
"regexReference": "正则语法参考",
"matchLinesWithNumbers": "匹配包含数字的行",
"matchLinesWithAorB": "匹配包含 a 或者 b 的行",
"exception": "异常",
"matchLinesWithException": "匹配包含 异常 的行",
"syntaxReference": "语法参考",
"searchMode": "搜索模式",
"searchModeDescription": "搜索模式,默认查看文件最后多少行,从头搜索指从指定行往下搜索,从尾搜索指从文件尾往上搜索多少行",
"searchFromEnd": "从尾搜索",
"searchFromStart": "从头搜索",
"firstNFileLines": "文件前N行",
"lastNFileLines": "文件后N行",
"searchConfigReference": "搜索配置参考",
"searchFromEndExample1": "从尾搜索、文件前0行、文件后3行",
"searchLastNLines": "在文件最后 3 行中搜索",
"searchFromStartExample1": "从头搜索、文件前0行、文件后3行",
"searchLineRange1": "在文件第 3 - 2147483647 行中搜索",
"searchFromEndExample2": "从尾搜索、文件前2行、文件后3行",
"searchLineRange2": "在文件第 1 - 2 行中搜索",
"searchFromEndExample3": "从尾搜索、文件前100行、文件后100行",
"searchLineRange3": "在文件第 1 - 100 行中搜索",
"searchFromStartExample2": "从头搜索、文件前2行、文件后3行",
"searchLineRange4": "在文件第 2 - 2 行中搜索",
"searchFromEndExample4": "从尾搜索、文件前20行、文件后3行",
"searchLineRange5": "在文件第 17 - 20 行中搜索",
"searchFromStartExample3": "从头搜索、文件前20行、文件后3行",
"searchLineRange6": "在文件第 3 - 20 行中搜索",
"searchReference": "搜索参考",
"error": "错误",
"checkWsProxy": "请检查是否开启 ws 代理",
"sessionClosed": "会话已经关闭",
"fileNotReadable": "当前文件不可读,需要配置可读文件授权"
c: {},
p: {
node: '节点',
chooseNode: '请选择节点',
searchKeyword: '搜关键词',
keywordHighlight: '关键词高亮,支持正则(正则可能影响性能请酌情使用)',
keywordRegex: '关键词,支持正则',
showFirstNLines: '显示前N行',
showLastNLines: '显示后N行',
regexReference: '正则语法参考',
matchLinesWithNumbers: '匹配包含数字的行',
matchLinesWithAorB: '匹配包含 a 或者 b 的行',
exception: '异常',
matchLinesWithException: '匹配包含 异常 的行',
syntaxReference: '语法参考',
searchMode: '搜索模式',
searchModeDescription:
'搜索模式,默认查看文件最后多少行,从头搜索指从指定行往下搜索,从尾搜索指从文件尾往上搜索多少行',
searchFromEnd: '从尾搜索',
searchFromStart: '从头搜索',
firstNFileLines: '文件前N行',
lastNFileLines: '文件后N行',
searchConfigReference: '搜索配置参考',
searchFromEndExample1: '从尾搜索、文件前0行、文件后3行',
searchLastNLines: '在文件最后 3 行中搜索',
searchFromStartExample1: '从头搜索、文件前0行、文件后3行',
searchLineRange1: '在文件第 3 - 2147483647 行中搜索',
searchFromEndExample2: '从尾搜索、文件前2行、文件后3行',
searchLineRange2: '在文件第 1 - 2 行中搜索',
searchFromEndExample3: '从尾搜索、文件前100行、文件后100行',
searchLineRange3: '在文件第 1 - 100 行中搜索',
searchFromStartExample2: '从头搜索、文件前2行、文件后3行',
searchLineRange4: '在文件第 2 - 2 行中搜索',
searchFromEndExample4: '从尾搜索、文件前20行、文件后3行',
searchLineRange5: '在文件第 17 - 20 行中搜索',
searchFromStartExample3: '从头搜索、文件前20行、文件后3行',
searchLineRange6: '在文件第 3 - 20 行中搜索',
searchReference: '搜索参考',
error: '错误',
checkWsProxy: '请检查是否开启 ws 代理',
sessionClosed: '会话已经关闭',
fileNotReadable: '当前文件不可读,需要配置可读文件授权'
}
}

View File

@ -32,14 +32,25 @@
<div>
{{ $tl('p.currentStatus') }}
<a-tag v-if="data.status === 2" color="green">{{ statusMap[data.status] || $tl('c.unknown') }}</a-tag>
<a-tag v-else-if="data.status === 1 || data.status === 0" color="orange">{{ statusMap[data.status] || $tl('c.unknown') }}</a-tag>
<a-tag v-else-if="data.status === 3 || data.status === 4" color="red">{{ statusMap[data.status] || $tl('c.unknown') }}</a-tag>
<a-tag v-else-if="data.status === 1 || data.status === 0" color="orange">{{
statusMap[data.status] || $tl('c.unknown')
}}</a-tag>
<a-tag v-else-if="data.status === 3 || data.status === 4" color="red">{{
statusMap[data.status] || $tl('c.unknown')
}}</a-tag>
<a-tag v-else>{{ statusMap[data.status] || $tl('c.unknown') }}</a-tag>
</div>
<div>{{ $tl('p.statusDescription') }}{{ data.statusMsg || '-' }}</div>
<a-button type="primary" size="small" :loading="childLoading" @click="loadData">{{ $tl('p.refresh') }}</a-button>
<a-button type="primary" size="small" :loading="childLoading" @click="loadData">{{
$tl('p.refresh')
}}</a-button>
<a-statistic-countdown format=" {{$tl('p.seconds')}}" :title="$tl('p.refreshCountdown')" :value="countdownTime" @finish="silenceLoadData" />
<a-statistic-countdown
format=" {{$tl('p.seconds')}}"
:title="$tl('p.refreshCountdown')"
:value="countdownTime"
@finish="silenceLoadData"
/>
</a-space>
</template>
<template #bodyCell="{ column, text, record }">
@ -63,13 +74,21 @@
</template>
<template v-else-if="column.dataIndex === 'outGivingStatus'">
<a-tag v-if="text === 2" color="green">{{ dispatchStatusMap[text] || $tl('c.unknown') }}</a-tag>
<a-tag v-else-if="text === 1 || text === 0 || text === 5" color="orange">{{ dispatchStatusMap[text] || $tl('c.unknown') }}</a-tag>
<a-tag v-else-if="text === 3 || text === 4 || text === 6" color="red">{{ dispatchStatusMap[text] || $tl('c.unknown') }}</a-tag>
<a-tag v-else-if="text === 1 || text === 0 || text === 5" color="orange">{{
dispatchStatusMap[text] || $tl('c.unknown')
}}</a-tag>
<a-tag v-else-if="text === 3 || text === 4 || text === 6" color="red">{{
dispatchStatusMap[text] || $tl('c.unknown')
}}</a-tag>
<a-tag v-else>{{ dispatchStatusMap[text] || $tl('c.unknown') }}</a-tag>
</template>
<template v-else-if="column.dataIndex === 'outGivingResultMsg'">
<a-tooltip placement="topLeft" :title="readJsonStrField(record.outGivingResult, 'msg')">
<span>{{ readJsonStrField(record.outGivingResult, 'code') }}-{{ readJsonStrField(record.outGivingResult, 'msg') || record.outGivingResult }}</span>
<span
>{{ readJsonStrField(record.outGivingResult, 'code') }}-{{
readJsonStrField(record.outGivingResult, 'msg') || record.outGivingResult
}}</span
>
</a-tooltip>
</template>
<template v-else-if="column.dataIndex === 'outGivingResultTime'">
@ -84,7 +103,9 @@
</template>
<template v-else-if="column.dataIndex === 'outGivingResultMsgData'">
<a-tooltip placement="topLeft" :title="`${readJsonStrField(record.outGivingResult, 'data')}`">
<template v-if="record.fileSize"> {{ Math.floor((record.progressSize / record.fileSize) * 100) }}% </template>
<template v-if="record.fileSize">
{{ Math.floor((record.progressSize / record.fileSize) * 100) }}%
</template>
{{ readJsonStrField(record.outGivingResult, 'data') }}
</a-tooltip>
</template>
@ -93,19 +114,37 @@
<a-tooltip v-if="record.errorMsg" :title="record.errorMsg">
<WarningOutlined />
</a-tooltip>
<a-switch v-else :checked="text" :disabled="true" size="small" :checked-children="$tl('p.running')" :un-checked-children="$tl('p.notRunning')" />
<a-switch
v-else
:checked="text"
:disabled="true"
size="small"
:checked-children="$tl('p.running')"
:un-checked-children="$tl('p.notRunning')"
/>
</template>
<template v-else-if="column.dataIndex === 'projectPid'">
<a-tooltip placement="topLeft" :title="`${$tl('p.processId')}${record.projectPid || '-'} / ${$tl('p.portNumber')}${record.projectPort || '-'}`">
<a-tooltip
placement="topLeft"
:title="`${$tl('p.processId')}${record.projectPid || '-'} / ${$tl('p.portNumber')}${record.projectPort || '-'}`"
>
<span>{{ record.projectPid || '-' }}/{{ record.projectPort || '-' }}</span>
</a-tooltip>
</template>
<template v-else-if="column.dataIndex === 'child-operation'">
<a-space>
<a-button size="small" :disabled="!record.projectName" type="primary" @click="handleFile(record)">{{ $tl('p.file') }}</a-button>
<a-button size="small" :disabled="!record.projectName" type="primary" @click="handleConsole(record)">{{ $tl('c.console') }}</a-button>
<a-button size="small" :disabled="!record.projectName" type="primary" @click="handleFile(record)">{{
$tl('p.file')
}}</a-button>
<a-button
size="small"
:disabled="!record.projectName"
type="primary"
@click="handleConsole(record)"
>{{ $tl('c.console') }}</a-button
>
</a-space>
</template>
</template>
@ -140,7 +179,15 @@
"
/>
<a-button type="primary" danger size="small" :disabled="!list || list.length <= 1" @click="handleRemoveProject(element)"> {{ $tl('p.unbind') }} </a-button>
<a-button
type="primary"
danger
size="small"
:disabled="!list || list.length <= 1"
@click="handleRemoveProject(element)"
>
{{ $tl('p.unbind') }}
</a-button>
<a-tooltip placement="left" :title="`${$tl('p.longPressToDragAndSort')}`" class="move">
<MenuOutlined />
</a-tooltip>
@ -160,25 +207,81 @@
</a-drawer>
<!-- 项目文件组件 -->
<a-drawer destroy-on-close :title="drawerTitle" placement="right" width="85vw" :open="drawerFileVisible" @close="onFileClose">
<file v-if="drawerFileVisible" :id="temp.id" :node-id="temp.nodeId" :project-id="temp.projectId" @go-console="goConsole" @go-read-file="goReadFile" />
<a-drawer
destroy-on-close
:title="drawerTitle"
placement="right"
width="85vw"
:open="drawerFileVisible"
@close="onFileClose"
>
<file
v-if="drawerFileVisible"
:id="temp.id"
:node-id="temp.nodeId"
:project-id="temp.projectId"
@go-console="goConsole"
@go-read-file="goReadFile"
/>
</a-drawer>
<!-- 项目控制台组件 -->
<a-drawer destroy-on-close :title="drawerTitle" placement="right" width="85vw" :open="drawerConsoleVisible" @close="onConsoleClose">
<console v-if="drawerConsoleVisible" :id="temp.id" :node-id="temp.nodeId" :project-id="temp.projectId" @go-file="goFile" />
<a-drawer
destroy-on-close
:title="drawerTitle"
placement="right"
width="85vw"
:open="drawerConsoleVisible"
@close="onConsoleClose"
>
<console
v-if="drawerConsoleVisible"
:id="temp.id"
:node-id="temp.nodeId"
:project-id="temp.projectId"
@go-file="goFile"
/>
</a-drawer>
<!-- 项目跟踪文件组件 -->
<a-drawer destroy-on-close :title="drawerTitle" placement="right" width="85vw" :open="drawerReadFileVisible" @close="onReadFileClose">
<file-read v-if="drawerReadFileVisible" :id="temp.id" :node-id="temp.nodeId" :read-file-path="temp.readFilePath" :project-id="temp.projectId" @go-file="goFile" />
<a-drawer
destroy-on-close
:title="drawerTitle"
placement="right"
width="85vw"
:open="drawerReadFileVisible"
@close="onReadFileClose"
>
<file-read
v-if="drawerReadFileVisible"
:id="temp.id"
:node-id="temp.nodeId"
:read-file-path="temp.readFilePath"
:project-id="temp.projectId"
@go-file="goFile"
/>
</a-drawer>
</div>
</template>
<script>
import { getDispatchProject, dispatchStatusMap, statusMap, removeProject, saveDispatchProjectConfig } from '@/api/dispatch'
import {
getDispatchProject,
dispatchStatusMap,
statusMap,
removeProject,
saveDispatchProjectConfig
} from '@/api/dispatch'
import { getNodeListAll } from '@/api/node'
import { getRuningProjectInfo } from '@/api/node-project'
import { readJsonStrField, concurrentExecution, randomStr, itemGroupBy, parseTime, renderSize, formatDuration, dropApplyDrag } from '@/utils/const'
import {
readJsonStrField,
concurrentExecution,
randomStr,
itemGroupBy,
parseTime,
renderSize,
formatDuration,
dropApplyDrag
} from '@/utils/const'
import File from '@/pages/node/node-layout/project/project-file'
import Console from '@/pages/node/node-layout/project/project-console'
import FileRead from '@/pages/node/node-layout/project/project-file-read'
@ -412,7 +515,9 @@ export default {
return {
...element,
projectStatus: res2.data[element.projectId].pid > 0,
projectPid: (res2.data[element.projectId]?.pids || [res2.data[element.projectId]?.pid || '-']).join(','),
projectPid: (
res2.data[element.projectId]?.pids || [res2.data[element.projectId]?.pid || '-']
).join(','),
projectPort: res2.data[element.projectId]?.port || '-',
errorMsg: res2.data[element.projectId].error,
projectName: res2.data[element.projectId].name
@ -459,7 +564,7 @@ export default {
//
handleFile(record) {
this.temp = Object.assign({}, record)
this.drawerTitle = `${$tl('p.fileManagement')}(${this.temp.projectId})`
this.drawerTitle = `${this.$tl('p.fileManagement')}(${this.temp.projectId})`
this.drawerFileVisible = true
},
//
@ -469,7 +574,7 @@ export default {
//
handleConsole(record) {
this.temp = Object.assign({}, record)
this.drawerTitle = `${$tl('c.console')}(${this.temp.projectId})`
this.drawerTitle = `${this.$tl('c.console')}(${this.temp.projectId})`
this.drawerConsoleVisible = true
},
//
@ -494,7 +599,7 @@ export default {
this.onFileClose()
this.drawerReadFileVisible = true
this.temp.readFilePath = (path + '/' + filename).replace(new RegExp('//', 'gm'), '/')
this.drawerTitle = `${$tl('p.trackFile')}(${filename})`
this.drawerTitle = `${this.$tl('p.trackFile')}(${filename})`
},
onReadFileClose() {
this.drawerReadFileVisible = false
@ -513,7 +618,16 @@ export default {
},
//
handleRemoveProject(item) {
const html = "<b style='font-size: 20px;'>this.$tl('p.reallyReleaseCurrentProject')</b>" + "<ul style='font-size: 20px;color:red;font-weight: bold;'>" + '<li>this.$tl('p.willNotActuallyRequestNodeToDeleteProjectInfo')</b></li>' + '<li>this.$tl('p.generallyUsedWhenServerCannotBeConnectedAndIsNoLongerNeeded')</li>' + '<li>this.$tl('p.willProduceRedundantDataIfMisoperated')</li>' + ' </ul>'
const html = `
<b style='font-size: 20px;'>
${this.$tl('p.reallyReleaseCurrentProject')}
</b>
<ul style='font-size: 20px;color:red;font-weight: bold;'>
<li>this.$tl('p.willNotActuallyRequestNodeToDeleteProjectInfo')</b></li>
<li>this.$tl('p.generallyUsedWhenServerCannotBeConnectedAndIsNoLongerNeeded')</li>
<li>this.$tl('p.willProduceRedundantDataIfMisoperated')</li>
</ul>
`
$confirm({
title: this.$tl('p.dangerousOperation'),
zIndex: 1009,