Merge branch 'dev-3.3' of https://git.mesalab.cn/nezha/nezha-fronted into dev-3.3

This commit is contained in:
zhangxiaolong
2022-04-20 19:17:21 +08:00
9 changed files with 651 additions and 297 deletions

View File

@@ -285,6 +285,9 @@
.el-dialog__body {
.alert-message-info-box {
.info-box-right {
#alert .name-labe {
display: none;
}
.el-timeline {
.el-timeline-item {
.el-timeline-item__wrapper {
@@ -294,7 +297,7 @@
font-size: 14px;
font-weight: 400;
padding-left: 5px;
}
}
.alert-message-startAt {
font-size: 14px;
@@ -375,9 +378,22 @@
}
.info-box-left {
.alert .name-labe {
display: block;
}
.name-labe{
display: none;
}
.alert-message-info-tab {
.el-tabs.el-tabs--card.el-tabs--top {
.el-tabs__content {
#pane-alertRule{
.alert-rule-nfo{
.alert-rule-box{
display: flex;
}
}
}
#pane-detail {
.info-box-header {
.info-box-content {
@@ -433,6 +449,7 @@
.alert-label-info {
.alert-label-box {
margin-bottom: 25px;
display: flex;
.alert-label-title {
margin-right: 30px;
@@ -445,7 +462,7 @@
.alert-label-info {
.alert-label-box {
margin-bottom: 25px;
display: flex;
.alert-label-title {
margin-right: 30px;
}
@@ -457,7 +474,7 @@
.alert-label-info {
.alert-label-box {
margin-bottom: 25px;
display: flex;
.alert-label-title {
margin-right: 30px;
}
@@ -469,7 +486,7 @@
.alert-label-info {
.alert-label-box {
margin-bottom: 25px;
display: flex;
.alert-label-title {
margin-right: 30px;
}
@@ -481,7 +498,7 @@
.alert-label-info {
.alert-label-box {
margin-bottom: 25px;
display: flex;
.alert-label-title {
margin-right: 30px;
}
@@ -502,3 +519,6 @@
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -8,13 +8,14 @@
<div v-else-if="(activeName === item.key) && infoData[item.key]" class="no-position-alert-label">
<!-- <searchItemInfo :obj="findData(item.key)" :severityData="severityData" :fa-loading="false"></searchItemInfo>-->
<alertLabel
class="a"
class="alert"
v-if="item.key !=='alertRule'"
:id="infoData[item.key].id"
:that="findData2(item.key)"
:alertTableDialog="true"
:type="item.key"/>
<alertRuleInfo
class="alert"
v-else
:id="infoData[item.key].id"
:severity-data="severityData"
@@ -152,5 +153,7 @@ export default {
}
</script>
<style>
<style scoped>
</style>

View File

@@ -1,5 +1,5 @@
<template>
<div style="height: 100%; width: 100%" class="message-time-line">
<div style="height: 100%; width: 100%" id="alert" class="message-time-line">
<div class="time-line-header">
<span>{{ $t("alert.relatedAlerts") }}</span>
<div class="scope-icon-box">

View File

@@ -13,6 +13,10 @@
<div class="alert-rule-title">ID</div>
<div class="alert-rule-value">{{alertRuleData.id ? alertRuleData.id : '--'}}</div>
</div>
<div class="alert-rule-box name-labe">
<div class="alert-rule-title">Name</div>
<div class="alert-rule-value">{{alertRuleData.name ? alertRuleData.name : '--'}}</div>
</div>
<!-- <div class="alert-rule-box">-->
<!-- <div class="alert-rule-title">{{$t('alert.name')}}</div>-->
<!-- <div class="alert-rule-value">{{alertRuleData.name ? alertRuleData.name : '&#45;&#45;'}}</div>-->

View File

@@ -239,8 +239,8 @@ export default {
{
label: this.$t("alert.alert"),
prop: "alertNum",
show: true,
minWidth: 120,
show: false,
width: 120,
sortable: "custom",
},
{

View File

@@ -262,7 +262,7 @@ export default {
label: this.$t('project.endpoint.alerts'),
prop: 'alerts',
show: true,
minWidth: 180,
Width: 120,
sortable: 'custom'
},
{

View File

@@ -3,16 +3,14 @@
// import ElementUI from 'element-ui'
import bus from '@/libs/bus'
import moment from 'moment-timezone'
// const localVue = createLocalVue()
// localVue.use(ElementUI)
describe('bus时间函数', () => {
localStorage.setItem('nz-sys-timezone', 'America/Danmarkshavn')
// 测试代码可读性最好
// 分组
it('正常替换', function () {
// console.log(bus)
expect(bus.timeFormate(1650006960000)).toBe('2022-04-15 15:16:00')
})
it('文字替换', function () {
// console.log(bus)
expect(bus.timeFormate('2022-04-15 15:16:00')).toBe('2022-04-15 15:16:00')

View File

@@ -1,34 +1,35 @@
import mainMixin from '@/components/common/mixin/mainMixinFun'
import i18n from '@/components/common/i18n'
import moment from 'moment-timezone'
describe('时间函数', () => {
localStorage.setItem('nz-sys-timezone', 'Asia/Shanghai')
localStorage.setItem('nz-sys-timezone', 'America/Danmarkshavn')
it('utc时间转系统时间 返回时间戳', () => {
expect(mainMixin.methods.utcTimeToTimezone(1650006960000)).toBe(1650035760000)
expect(mainMixin.methods.utcTimeToTimezone(1650006960000)).toBe(1650006960000)
})
it('utc时间转系统时间 返回时间戳', () => {
expect(mainMixin.methods.utcTimeToTimezone('2022-04-15 15:16:00')).toBe(1650035760000)
expect(mainMixin.methods.utcTimeToTimezone('2022-04-15 15:16:00')).toBe(1650006960000)
})
it('utc时间转系统时间 返回时间字符串', () => {
expect(mainMixin.methods.utcTimeToTimezoneStr(1650006960000)).toBe('2022-04-15 23:16:00')
expect(mainMixin.methods.utcTimeToTimezoneStr(1650006960000)).toBe('2022-04-15 15:16:00')
})
it('utc时间转系统时间 返回时间字符串', () => {
expect(mainMixin.methods.utcTimeToTimezoneStr('2022-04-15 15:16:00')).toBe('2022-04-15 23:16:00')
expect(mainMixin.methods.utcTimeToTimezoneStr('2022-04-15 15:16:00')).toBe('2022-04-15 15:16:00')
})
it('utc时间转系统时间 返回时间字符串 指定时间格式', () => {
expect(mainMixin.methods.utcTimeToTimezoneStr('2022-04-15 15:16:00', 'DD/MM/YYYY')).toBe('15/04/2022')
})
it('系统时间转utc时间转 返回时间戳', () => {
expect(mainMixin.methods.timezoneToUtcTime(1650006960000)).toBe(1649978160000)
expect(mainMixin.methods.timezoneToUtcTime(1650006960000)).toBe(1650006960000)
})
it('系统时间转utc时间转 返回时间戳', () => {
expect(mainMixin.methods.timezoneToUtcTime('2022-04-15 15:16:00')).toBe(1649978160000)
expect(mainMixin.methods.timezoneToUtcTime('2022-04-15 15:16:00')).toBe(1650006960000)
})
it('系统时间转utc时间转 返回时间字符串', () => {
expect(mainMixin.methods.timezoneToUtcTimeStr(1650006960000)).toBe('2022-04-15 07:16:00')
expect(mainMixin.methods.timezoneToUtcTimeStr(1650006960000)).toBe('2022-04-15 15:16:00')
})
it('系统时间转utc时间转 返回时间字符串', () => {
expect(mainMixin.methods.timezoneToUtcTimeStr('2022-04-15 15:16:00')).toBe('2022-04-15 07:16:00')
expect(mainMixin.methods.timezoneToUtcTimeStr('2022-04-15 15:16:00')).toBe('2022-04-15 15:16:00')
})
it('系统时间转utc时间转 返回时间字符串 指定时间格式', () => {
expect(mainMixin.methods.timezoneToUtcTimeStr('2022-04-15 15:16:00', 'DD/MM/YYYY')).toBe('15/04/2022')