diff --git a/nezha-fronted/src/assets/stylus/index.scss b/nezha-fronted/src/assets/stylus/index.scss index 03228651f..f499721ce 100644 --- a/nezha-fronted/src/assets/stylus/index.scss +++ b/nezha-fronted/src/assets/stylus/index.scss @@ -43,6 +43,7 @@ $dropdown-hover-background-color: #fafafa; //下拉鼠标悬停背景色 $danger-color: #DE5D3F; //全局警告色红色 $success-color: #23BF9A; //全局正常色绿色 +$warning-color: $btn-light-txt-color-hover-new; //全局警告橙色 $suspended-color: #9e9c98; //全局停用色灰色 $left-menu-bgcolor:#FFF; diff --git a/nezha-fronted/src/assets/stylus/main.scss b/nezha-fronted/src/assets/stylus/main.scss index 6622ee9e4..2945c96fa 100644 --- a/nezha-fronted/src/assets/stylus/main.scss +++ b/nezha-fronted/src/assets/stylus/main.scss @@ -917,8 +917,8 @@ li{ padding:2px 5px; border-radius: 4px; } -.nz-table td.success .cell>span { - background-color: $success-color; +.nz-table td.warning .cell>span { + background-color: $warning-color; color: white; padding:2px 5px; border-radius: 4px; diff --git a/nezha-fronted/src/components/common/bottomBox/bottomBox.vue b/nezha-fronted/src/components/common/bottomBox/bottomBox.vue index 070251c95..ca8022a91 100644 --- a/nezha-fronted/src/components/common/bottomBox/bottomBox.vue +++ b/nezha-fronted/src/components/common/bottomBox/bottomBox.vue @@ -16,20 +16,24 @@
- - + + - + - + - + - + + + + + @@ -40,6 +44,8 @@ import endpointQueryTab from "./tabs/endpointQueryTab"; import endpointTab from "./tabs/endpointTab"; import panelTab from "./tabs/panelTab"; + import terminalLogRecordTab from "./tabs/terminalLogRecordTab"; + import terminalLogReplayTab from "./tabs/terminalLogReplayTab"; export default { name: "bottomBox", @@ -49,6 +55,8 @@ 'endpoint-query-tab': endpointQueryTab, 'endpoint-tab': endpointTab, 'panel-tab': panelTab, + terminalLogRecordTab, + terminalLogReplayTab }, props: { isFullScreen: false, //是否全屏 diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/terminalLogRecordTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/terminalLogRecordTab.vue new file mode 100644 index 000000000..07449e932 --- /dev/null +++ b/nezha-fronted/src/components/common/bottomBox/tabs/terminalLogRecordTab.vue @@ -0,0 +1,252 @@ + + + + + diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/terminalLogReplayTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/terminalLogReplayTab.vue new file mode 100644 index 000000000..b6fb45414 --- /dev/null +++ b/nezha-fronted/src/components/common/bottomBox/tabs/terminalLogReplayTab.vue @@ -0,0 +1,268 @@ + + + + + diff --git a/nezha-fronted/src/components/common/js/constants.js b/nezha-fronted/src/components/common/js/constants.js index d08d77ffe..f6e550150 100644 --- a/nezha-fronted/src/components/common/js/constants.js +++ b/nezha-fronted/src/components/common/js/constants.js @@ -149,6 +149,18 @@ export const setting = { ] }; +export const terminalLog = { + status: { + 0: i18n.t('config.terminallog.statusItem.connecting'), + 1: i18n.t('config.terminallog.statusItem.connectionFailed'), + 2: i18n.t('config.terminallog.statusItem.over'), + 3: i18n.t('config.terminallog.statusItem.kickedOut'), + 4: i18n.t('config.terminallog.statusItem.unknownError'), + }, + dangerCmd: ['chmod', 'chown', 'kill', 'rm', 'su', 'sudo'], + infoCmd: ['exit'] +}; + //公共组件的跳转来源 export const fromRoute = { panel: "panel", @@ -160,5 +172,6 @@ export const fromRoute = { dc: "dc", endpoint: "endpoint", project: "project", - endpointQuery: "endpointQuery" + endpointQuery: "endpointQuery", + terminalLog: "terminal" }; diff --git a/nezha-fronted/src/components/common/js/tools.js b/nezha-fronted/src/components/common/js/tools.js index 7440c727d..905d0f1df 100644 --- a/nezha-fronted/src/components/common/js/tools.js +++ b/nezha-fronted/src/components/common/js/tools.js @@ -284,7 +284,17 @@ export function stringTimeParseToUnix(stringTime){ let time=new Date(stringTime).getTime(); return time/1000; } - +export function calcDurationByStringTime(startTime, endTime) { + let durationSecond = stringTimeParseToUnix(endTime)-stringTimeParseToUnix(startTime); + let result = `${durationSecond%60}s`; + if (durationSecond > 60) { + result = `${(Math.floor(durationSecond/60))%60}m ${result}`; + } + if (durationSecond > 60*60) { + result = `${Math.floor(durationSecond/(60*60))}h ${result}`; + } + return result; +} export function unixTimeParseToString(unixTime,fmt='yyyy-MM-dd hh:mm:ss'){ let date=new Date(unixTime * 1000); var o = { @@ -592,13 +602,8 @@ export const tableSet = { } case 'temrminallog': switch(prop){ - case 'id': return 'id'; - case 'host': return 'host'; - case 'port': return 'port'; case 'protocol': return 'protocol'; - case 'user': return 'user'; - case 'cmd': return 'cmd'; - case 'time': return 'time'; + case 'startTime': return 'startTime'; default : return prop; } case 'alertRules': diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index cb289e392..d0b976be8 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -631,6 +631,13 @@ const cn = { terminallog: { terminallog: "终端日志", status: "状态", + statusItem: { + connecting: "连接中", + connectionFailed: "连接失败", + over: "已结束", + kickedOut: "被踢出", + unknownError: "未知错误" + }, option: "操作", host: "主机", cmd: "命令", @@ -655,7 +662,18 @@ const cn = { path: "路径", file: "文件", success: "成功", - fail: "失败" + fail: "失败", + startTime: "开始时间", + duration: "持续", + remote: "远程连接", + replay: "回放", + log: "日志", + record: { + record: "记录", + history: "历史记录", + dangerTip: "这条命令可能是危险的", + legendTip: "图例说明", + } }, dc: { dc: "数据中心", diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 542b6d587..21516b532 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -669,6 +669,13 @@ const en = { terminallog: { terminallog: 'Terminal log', status: 'Status',//"状态" + statusItem: { + connecting: "Connecting", + connectionFailed: "Connection failed", + over: "Over", + kickedOut: "Kicked out", + unknownError: "Unknown error" + }, option: 'Operation',//"操作", host: 'Host', cmd: 'CMD', @@ -693,7 +700,18 @@ const en = { path: 'Path', file: 'File', success: 'Success', - fail: 'Fail' + fail: 'Fail', + startTime: "Start time", + duration: "Duration", + remote: "Remote", + replay: "Replay", + log: "Log", + record: { + record: "Record", + history: "History record", + dangerTip: "This CMD may be dangerous", + legendTip: "Legend description", + } }, operationlog: { operationlog: 'Operation log', diff --git a/nezha-fronted/src/components/page/config/account.vue b/nezha-fronted/src/components/page/config/account.vue index b476b1681..3f2179cf1 100644 --- a/nezha-fronted/src/components/page/config/account.vue +++ b/nezha-fronted/src/components/page/config/account.vue @@ -96,14 +96,6 @@ - - - {{scope.row[item.prop] == 'en' ? 'English' : ''}} - {{scope.row[item.prop] == 'zh' ? '中文' : ''}} - {{scope.row[item.prop] == 'ru' ? 'русский' : ''}} - - - -