fix:删除监控的kill按钮 修改duration显示规则 以及 添加鼠标hover
This commit is contained in:
@@ -82,7 +82,15 @@
|
|||||||
<!--<i class="nz-icon nz-icon-arrow-down"></i> {{returnSeverityLabel(scope.row[item.prop])}}-->
|
<!--<i class="nz-icon nz-icon-arrow-down"></i> {{returnSeverityLabel(scope.row[item.prop])}}-->
|
||||||
</span>
|
</span>
|
||||||
<span v-else-if="item.prop == 'startAt'">{{utcTimeToTimezoneStr(scope.row[item.prop])}}</span>
|
<span v-else-if="item.prop == 'startAt'">{{utcTimeToTimezoneStr(scope.row[item.prop])}}</span>
|
||||||
<span v-else-if="item.prop == 'endAt'">{{utcTimeToTimezoneStr(scope.row[item.prop])}}</span>
|
<template v-else-if="item.prop == 'duration'">
|
||||||
|
<el-tooltip placement="right" effect="light" :disabled="!scope.row.endAt">
|
||||||
|
<div slot="content">
|
||||||
|
{{$t('config.terminallog.endTime')}}<br/>
|
||||||
|
{{scope.row.endAt}}
|
||||||
|
</div>
|
||||||
|
<span>{{getDuration(scope.row)}}</span>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
<template v-else-if="item.prop == 'labels'" class="labels">
|
<template v-else-if="item.prop == 'labels'" class="labels">
|
||||||
<span v-for="(item,i) in labelsSort(scope.row.labels)">
|
<span v-for="(item,i) in labelsSort(scope.row.labels)">
|
||||||
<span
|
<span
|
||||||
@@ -223,6 +231,7 @@
|
|||||||
import chartDataFormat from "../../charts/chartDataFormat";
|
import chartDataFormat from "../../charts/chartDataFormat";
|
||||||
import alertRuleInfo from '../../common/alert/alertRuleInfo'
|
import alertRuleInfo from '../../common/alert/alertRuleInfo'
|
||||||
import alertLabel from '../../common/alert/alertLabel'
|
import alertLabel from '../../common/alert/alertLabel'
|
||||||
|
import {calcDurationByStringTimeB} from "../../common/js/tools";
|
||||||
export default {
|
export default {
|
||||||
name:"alertMessageTable",
|
name:"alertMessageTable",
|
||||||
components: {
|
components: {
|
||||||
@@ -245,6 +254,7 @@
|
|||||||
},
|
},
|
||||||
from: {type: String},
|
from: {type: String},
|
||||||
id:String,
|
id:String,
|
||||||
|
nowTime:{},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
vm = this;
|
vm = this;
|
||||||
@@ -336,12 +346,18 @@
|
|||||||
prop: 'startAt',
|
prop: 'startAt',
|
||||||
show: true,
|
show: true,
|
||||||
width: 150
|
width: 150
|
||||||
}, {
|
}, /*{
|
||||||
label: this.$t('alert.endAt'),
|
label: this.$t('alert.endAt'),
|
||||||
prop: 'endAt',
|
prop: 'endAt',
|
||||||
show: true,
|
show: true,
|
||||||
width: 150
|
width: 150
|
||||||
}, {
|
},*/
|
||||||
|
{
|
||||||
|
label: this.$t('config.terminallog.duration'),
|
||||||
|
prop: 'duration',
|
||||||
|
show: true,
|
||||||
|
width: 150
|
||||||
|
},{
|
||||||
label: this.$t('overall.value'),
|
label: this.$t('overall.value'),
|
||||||
prop: 'current',
|
prop: 'current',
|
||||||
show: true,
|
show: true,
|
||||||
@@ -385,7 +401,15 @@
|
|||||||
}
|
}
|
||||||
return key + ":" + value;
|
return key + ":" + value;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
getDuration() {
|
||||||
|
return function(record) {
|
||||||
|
if (record.endTime) {
|
||||||
|
return calcDurationByStringTimeB(record.startAt, record.endAt);
|
||||||
|
}
|
||||||
|
return calcDurationByStringTimeB(record.startAt, this.nowTime);
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
labelsSort:function(obj){
|
labelsSort:function(obj){
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
@select-change="(selection)=>{this.batchDeleteObjs=selection}"
|
@select-change="(selection)=>{this.batchDeleteObjs=selection}"
|
||||||
:showTopBtn="false"
|
:showTopBtn="false"
|
||||||
:from="`${from}_alerts`"
|
:from="`${from}_alerts`"
|
||||||
|
:nowTime="nowTime"
|
||||||
></alertMessageTable>
|
></alertMessageTable>
|
||||||
<Pagination :tableId="tableId" :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
<Pagination :tableId="tableId" :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
||||||
<!--导出-->
|
<!--导出-->
|
||||||
@@ -251,6 +252,7 @@
|
|||||||
dropCol: [],
|
dropCol: [],
|
||||||
tableData: [],
|
tableData: [],
|
||||||
defaultPick:12,
|
defaultPick:12,
|
||||||
|
nowTime:'',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -526,6 +528,7 @@
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$get('alert/message', this.searchLabel).then(response => {
|
this.$get('alert/message', this.searchLabel).then(response => {
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
|
this.nowTime=response.time;
|
||||||
this.tableData = response.data.list;
|
this.tableData = response.data.list;
|
||||||
let axiosAll=[]
|
let axiosAll=[]
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
|||||||
@@ -7,13 +7,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="replay-container">
|
<div class="replay-container">
|
||||||
<div class="replay-operate">
|
|
||||||
<div>
|
|
||||||
<button :title="$t('config.terminallog.record.pause')" @click="shutdown"
|
|
||||||
class="nz-btn nz-btn-style-light nz-btn-size-large" id="terminal-kill" v-show="isPlaying"><i
|
|
||||||
class="nz-icon nz-icon-ZD"></i></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="record-console" ref="recordConsole">
|
<div class="record-console" ref="recordConsole">
|
||||||
<div :id="obj.uuid" class="record-terminal"></div>
|
<div :id="obj.uuid" class="record-terminal"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -121,7 +114,6 @@
|
|||||||
});
|
});
|
||||||
//返回
|
//返回
|
||||||
this.terminalSocket.onmessage=function(evt){
|
this.terminalSocket.onmessage=function(evt){
|
||||||
console.log(evt,'evt')
|
|
||||||
let backContent=evt.data;
|
let backContent=evt.data;
|
||||||
/*
|
/*
|
||||||
if(that.inputSecret){//当前为密码输入状态
|
if(that.inputSecret){//当前为密码输入状态
|
||||||
|
|||||||
@@ -295,6 +295,18 @@ export function calcDurationByStringTime(startTime, endTime) {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
export function calcDurationByStringTimeB(startTime, endTime) {
|
||||||
|
let durationSecond = stringTimeParseToUnix(endTime)-stringTimeParseToUnix(startTime);
|
||||||
|
let result = `${durationSecond%60}s`;
|
||||||
|
if (durationSecond > 60*60) {
|
||||||
|
result = `${(Math.floor(durationSecond/60))%60}m`
|
||||||
|
result = `${Math.floor(durationSecond/(60*60))}h ${result}`;
|
||||||
|
}else if(durationSecond > 60) {
|
||||||
|
result = `${(Math.floor(durationSecond/60))%60}m ${result}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
export function unixTimeParseToString(unixTime,fmt='yyyy-MM-dd hh:mm:ss'){
|
export function unixTimeParseToString(unixTime,fmt='yyyy-MM-dd hh:mm:ss'){
|
||||||
let date=new Date(unixTime * 1000);
|
let date=new Date(unixTime * 1000);
|
||||||
var o = {
|
var o = {
|
||||||
|
|||||||
@@ -395,6 +395,7 @@ const cn = {
|
|||||||
},
|
},
|
||||||
tip: {
|
tip: {
|
||||||
confirmDelete: "确认删除吗?",
|
confirmDelete: "确认删除吗?",
|
||||||
|
killTerm:'确认关闭 terminal 吗?',
|
||||||
confirmBatchDelete:'确定删除这{0}条数据吗?',
|
confirmBatchDelete:'确定删除这{0}条数据吗?',
|
||||||
assetConfirmDelete: "关联的Endpoint和告警将会被删除,确认删除吗?",
|
assetConfirmDelete: "关联的Endpoint和告警将会被删除,确认删除吗?",
|
||||||
yes: "是",
|
yes: "是",
|
||||||
@@ -653,6 +654,9 @@ const cn = {
|
|||||||
selectFile: "选择文件",
|
selectFile: "选择文件",
|
||||||
SSH: "SSH",
|
SSH: "SSH",
|
||||||
TELNET: "TELNET",
|
TELNET: "TELNET",
|
||||||
|
password:'密码',
|
||||||
|
key:'密钥',
|
||||||
|
endTime:'结束时间',
|
||||||
id: "ID",
|
id: "ID",
|
||||||
time: "时间",
|
time: "时间",
|
||||||
width: "窗口宽度",
|
width: "窗口宽度",
|
||||||
|
|||||||
@@ -398,6 +398,7 @@ const en = {
|
|||||||
},
|
},
|
||||||
tip: {
|
tip: {
|
||||||
confirmDelete: "Are you sure you want to delete?", //Are you sure you want to delete?
|
confirmDelete: "Are you sure you want to delete?", //Are you sure you want to delete?
|
||||||
|
killTerm:'Are you sure you want to kill terminal?',
|
||||||
confirmBatchDelete:'Are you sure to delete these {0} pieces of data',
|
confirmBatchDelete:'Are you sure to delete these {0} pieces of data',
|
||||||
assetConfirmDelete: 'Related endpoints and alerts will be removed, are you sure you want to delete this asset?',//Related endpoints and alerts will be removed, are you sure you want to delete this asset?
|
assetConfirmDelete: 'Related endpoints and alerts will be removed, are you sure you want to delete this asset?',//Related endpoints and alerts will be removed, are you sure you want to delete this asset?
|
||||||
yes: 'Yes', //"是"
|
yes: 'Yes', //"是"
|
||||||
@@ -691,6 +692,9 @@ const en = {
|
|||||||
selectFile: 'Select file',
|
selectFile: 'Select file',
|
||||||
SSH: 'SSH',
|
SSH: 'SSH',
|
||||||
TELNET: 'TELNET',
|
TELNET: 'TELNET',
|
||||||
|
password:'Password',
|
||||||
|
key:'Key',
|
||||||
|
endTime:'EndTime',
|
||||||
id: 'ID',
|
id: 'ID',
|
||||||
time: 'Time',
|
time: 'Time',
|
||||||
width: 'Width',
|
width: 'Width',
|
||||||
|
|||||||
@@ -315,7 +315,8 @@
|
|||||||
searchLabel:{
|
searchLabel:{
|
||||||
|
|
||||||
},
|
},
|
||||||
deleteBox:{}
|
deleteBox:{},
|
||||||
|
nowTime:''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created(){
|
created(){
|
||||||
@@ -344,6 +345,7 @@
|
|||||||
this.$get('alert/message', {...this.searchLabel}).then(response => {
|
this.$get('alert/message', {...this.searchLabel}).then(response => {
|
||||||
this.loading=false;
|
this.loading=false;
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
|
this.nowTime=response.time;
|
||||||
this.tableData = response.data.list;
|
this.tableData = response.data.list;
|
||||||
this.tableData.forEach((item) => {
|
this.tableData.forEach((item) => {
|
||||||
item.labels = JSON.parse(item.labels);
|
item.labels = JSON.parse(item.labels);
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
:from="$CONSTANTS.fromRoute.message"
|
:from="$CONSTANTS.fromRoute.message"
|
||||||
@deleteMessage="deleteMessage"
|
@deleteMessage="deleteMessage"
|
||||||
@select-change="(selection)=>{this.batchDeleteObjs=selection}"
|
@select-change="(selection)=>{this.batchDeleteObjs=selection}"
|
||||||
|
:now-time="nowTime"
|
||||||
></alertMessageTable>
|
></alertMessageTable>
|
||||||
<div class="pagination-bottom" v-show="!bottomBox.showSubList">
|
<div class="pagination-bottom" v-show="!bottomBox.showSubList">
|
||||||
<Pagination :tableId="tableId" :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
<Pagination :tableId="tableId" :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
||||||
@@ -291,6 +292,7 @@
|
|||||||
tableData: [],
|
tableData: [],
|
||||||
requestIndex:0,
|
requestIndex:0,
|
||||||
viewAssetState: false,
|
viewAssetState: false,
|
||||||
|
nowTime:'',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -353,6 +355,7 @@
|
|||||||
this.$get('alert/message', this.searchLabel).then(response => {
|
this.$get('alert/message', this.searchLabel).then(response => {
|
||||||
this.tools.loading = false;
|
this.tools.loading = false;
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
|
this.nowTime=response.time;
|
||||||
this.tableData = response.data.list;
|
this.tableData = response.data.list;
|
||||||
let axiosAll=[]
|
let axiosAll=[]
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
|||||||
@@ -58,7 +58,13 @@
|
|||||||
<span>{{getRemoteText(scope.row)}}</span>
|
<span>{{getRemoteText(scope.row)}}</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.prop == 'duration'">
|
<template v-else-if="item.prop == 'duration'">
|
||||||
<span>{{getDuration(scope.row)}}</span>
|
<el-tooltip placement="right" effect="light" :disabled="!scope.row.status">
|
||||||
|
<div slot="content">
|
||||||
|
{{$t('config.terminallog.endTime')}}<br/>
|
||||||
|
{{scope.row.endTime}}
|
||||||
|
</div>
|
||||||
|
<span>{{getDuration(scope.row)}}</span>
|
||||||
|
</el-tooltip>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.prop == 'option'">
|
<template v-else-if="item.prop == 'option'">
|
||||||
<template v-if="scope.row.status == 0">
|
<template v-if="scope.row.status == 0">
|
||||||
@@ -73,6 +79,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
<template v-else-if="item.prop == 'authType'">
|
||||||
|
<span v-if="scope.row.authType==1">{{$t('config.terminallog.password')}}</span>
|
||||||
|
<span v-else-if="scope.row.authType==2">{{$t('config.terminallog.key')}}</span>
|
||||||
|
</template>
|
||||||
<span v-else>{{scope.row[item.prop]}}</span>
|
<span v-else>{{scope.row[item.prop]}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -100,7 +110,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import bus from "../../../libs/bus";
|
import bus from "../../../libs/bus";
|
||||||
import {terminalLog} from "../../common/js/constants";
|
import {terminalLog} from "../../common/js/constants";
|
||||||
import {calcDurationByStringTime} from "../../common/js/tools";
|
import {calcDurationByStringTimeB} from "../../common/js/tools";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "terminallog",
|
name: "terminallog",
|
||||||
@@ -234,7 +244,7 @@
|
|||||||
},
|
},
|
||||||
searchLabel: {}, //搜索参数
|
searchLabel: {}, //搜索参数
|
||||||
scrollbarWrap: null,
|
scrollbarWrap: null,
|
||||||
|
nowTime:'',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -251,9 +261,9 @@
|
|||||||
getDuration() {
|
getDuration() {
|
||||||
return function(record) {
|
return function(record) {
|
||||||
if (record.endTime) {
|
if (record.endTime) {
|
||||||
return calcDurationByStringTime(record.startTime, record.endTime);
|
return calcDurationByStringTimeB(record.startTime, record.endTime);
|
||||||
}
|
}
|
||||||
return "";
|
return calcDurationByStringTimeB(record.startTime, this.nowTime);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -274,6 +284,7 @@
|
|||||||
this.tools.loading = false;
|
this.tools.loading = false;
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.tableData = response.data.list;
|
this.tableData = response.data.list;
|
||||||
|
this.nowTime=response.time;
|
||||||
this.pageObj.total = response.data.total;
|
this.pageObj.total = response.data.total;
|
||||||
if (!this.scrollbarWrap) {
|
if (!this.scrollbarWrap) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
@@ -302,14 +313,20 @@
|
|||||||
console.log(record);
|
console.log(record);
|
||||||
},
|
},
|
||||||
shutdown(record) {
|
shutdown(record) {
|
||||||
this.$put("/terminal/kill", {uuid: record.uuid}).then(res => {
|
this.$confirm(this.$t("tip.killTerm"),{
|
||||||
if (res.code === 200) {
|
confirmButtonText:this.$t("tip.yes"),
|
||||||
this.$message.success(this.$t("config.terminallog.success"));
|
cancelButtonText:this.$t("tip.no"),
|
||||||
this.bottomBox.showSubList = false;
|
type:'warning'
|
||||||
this.getTableData();
|
}).then(()=>{
|
||||||
} else {
|
this.$put("/terminal/kill", {uuid: record.uuid}).then(res => {
|
||||||
this.$message.error(this.$t("config.terminallog.killErrorTip"));
|
if (res.code === 200) {
|
||||||
}
|
this.$message.success(this.$t("config.terminallog.success"));
|
||||||
|
this.bottomBox.showSubList = false;
|
||||||
|
this.getTableData();
|
||||||
|
} else {
|
||||||
|
this.$message.error(this.$t("config.terminallog.killErrorTip"));
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 全屏
|
// 全屏
|
||||||
|
|||||||
Reference in New Issue
Block a user