Merge branch 'dev-3.8' of git.mesalab.cn:nezha/nezha-fronted into dev-3.9

This commit is contained in:
zyh
2023-08-28 18:07:53 +08:00
25 changed files with 133 additions and 59 deletions

View File

@@ -14340,7 +14340,7 @@
},
"node-sass": {
"version": "4.14.1",
"resolved": "https://registry.npmmirror.com/node-sass/-/node-sass-4.14.1.tgz",
"resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.14.1.tgz",
"integrity": "sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g==",
"dev": true,
"requires": {
@@ -20727,7 +20727,7 @@
},
"webpack-bundle-analyzer": {
"version": "2.13.1",
"resolved": "https://registry.npmmirror.com/webpack-bundle-analyzer/-/webpack-bundle-analyzer-2.13.1.tgz",
"resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-2.13.1.tgz",
"integrity": "sha512-rwxyfecTAxoarCC9VlHlIpfQCmmJ/qWD5bpbjkof+7HrNhTNZIwZITxN6CdlYL2axGmwNUQ+tFgcSOiNXMf/sQ==",
"dev": true,
"requires": {

View File

@@ -412,6 +412,9 @@
.nz-icon{
color: $--background-color-1 !important;
}
.nz-icon-override{
color: $--color-text-regular !important;
}
}
}
.nz-icon-override{
@@ -419,6 +422,7 @@
font-size: 15px;
margin-left: 5px;
vertical-align: middle;
color: $--color-text-regular !important;
}
.legend-item:hover {
background-color: $--background-color-1;

View File

@@ -229,7 +229,7 @@
color: #F0BF84;
}
}
.dashboard-tab-temp {
.dashboard-tab-template {
.el-tabs__item{
width: 175px !important;
}

View File

@@ -48,7 +48,7 @@
left: 0;
}
.el-form-item__error{
left: 126px;
left: 0px;
padding-top: 5px;
}
.matchers-type{

View File

@@ -190,6 +190,7 @@
:panelLock="panelLock"
:chart-data="chartData"
:chart-info="chartInfo"
:showTool="showTool"
:is-fullscreen="isFullscreen"
@chartIsNoData="chartIsNoData"
:chart-option="chartOption"
@@ -345,6 +346,10 @@ export default {
type: Boolean,
default: false
},
showTool: {
type: Boolean,
default: true
},
globalVariables: {}
},
data () {

View File

@@ -12,6 +12,7 @@
:from="from"
:panel-lock="panelLock"
:isGroup="true"
:showTool="showTool"
:time-range="searchTime"
:groupInfo="chartInfo"
@on-refresh-time="refreshTime"
@@ -29,7 +30,11 @@ export default {
props: {
panelLock: Boolean,
from: String,
filter: {}
filter: {},
showTool: {
type: Boolean,
default: true
}
},
mixins: [chartMixin, chartFormat],
computed: {

View File

@@ -261,9 +261,31 @@ export default {
}
myChart.on('mouseover', (params) => {
if (this.chartInfo.type !== 'point') {
if (this.tooltip.activeIndex != params.seriesIndex) {
const option = myChart.getOption()
option.series[params.seriesIndex].symbol = 'circle'
option.series[params.seriesIndex].emphasis.itemStyle = {
opacity: 1,
borderColor: this.hexToRgb(params.color, 0.4),
borderWidth: 6
}
myChart.setOption(option, true)
}
}
this.tooltip.activeIndex = params.seriesIndex
})
myChart.on('mouseout', () => {
myChart.on('mouseout', (params) => {
if (this.chartInfo.type !== 'point') {
const option = myChart.getOption()
option.series.forEach(item => {
item.symbol = 'emptyCircle'
item.emphasis.itemStyle = {
opacity: 1
}
})
myChart.setOption(option, true)
}
this.tooltip.activeIndex = undefined
})
@@ -484,7 +506,7 @@ export default {
// 鼠标悬浮 series data symbol 时tooltip 中相应的legend 高亮显示
str += `
<div class="${(self.tooltip.activeIndex == item.seriesIndex && self.isGrey.filter(value => value === false).length > 1) ? 'tooltip__row highlight' : 'tooltip__row'}" title="${seriesName}">
<div class="${(self.tooltip.activeIndex == item.seriesIndex) ? 'tooltip__row highlight' : 'tooltip__row'}" title="${seriesName}">
<div class="row__label">
<span class="${className}" style="background-color: ${color};color: ${color}"></span>
<span>${seriesName}</span>

View File

@@ -272,10 +272,12 @@ export default {
this.$emit('clickLegendD3', this.isGrey)
},
hoverLegend (legendName, index, type) {
// legend 已经取消显示,鼠标悬浮,不开启 高亮效果
if (this.isGrey[index]) {
return false
}
if (this.chartInfo.type === 'pie' || this.chartInfo.type === 'doughnut' || this.chartInfo.type === 'rose') {
if (!this.isGrey[index]) {
this.$emit('hoverLegendD3', legendName, index, type)
}
this.$emit('hoverLegendD3', legendName, index, type)
} else if (this.isTimeSeries) {
getChart(this.chartId) && getChart(this.chartId).dispatchAction({
type: type,

View File

@@ -152,16 +152,27 @@ export const chartTimeSeriesLineOption = {
type: 'line',
symbol: 'emptyCircle', // 去掉点
connectNulls: true,
symbolSize: [2, 2],
symbolSize: [6, 6],
smooth: 0.2, // 曲线变平滑
showSymbol: false,
// showSymbol: false,
itemStyle: {
opacity: 0
},
data: [],
lineStyle: {
width: 1,
opacity: 0.9
},
emphasis: {
focus: 'series'
focus: 'series',
itemStyle: {
opacity: 1
}
},
blur: {
lineStyle: {
opacity: 0.3
}
}
}],
useUTC: false // 使用本地时间

View File

@@ -52,6 +52,7 @@
:isExportHtml="isExportHtml"
:filter="filter"
:from="from"
:showTool="showTool"
@refreshLogs="refreshLogs"
:show-header="showHeader"
:isError="isError"

View File

@@ -645,17 +645,19 @@
{{ alertLabelData && alertLabelData.id ? alertLabelData.id : "--" }}
</div>
</div>
<div class="alert-label-box name-labe">
<div class="alert-label-box name-labe document-copy-block">
<div class="alert-label-title">{{$t('overall.name')}}</div>
<div class="alert-label-value">
<div class="alert-label-value document-copy-text">
{{ alertLabelData && alertLabelData.name ? alertLabelData.name : "--" }}
</div>
<i v-if="alertLabelData && alertLabelData.name" class="nz-icon nz-icon-override" style="visibility: hidden" @click.stop="onCopy(alertLabelData.name)" :title="$t('overall.copyText')"></i>
</div>
<div class="alert-label-box">
<div class="alert-label-box document-copy-block">
<div class="alert-label-title">{{ $t("profile.username") }}</div>
<div class="alert-label-value">
<div class="alert-label-value document-copy-text">
{{ alertLabelData && alertLabelData.username ? alertLabelData.username : "--" }}
</div>
<i v-if="alertLabelData && alertLabelData.username" class="nz-icon nz-icon-override" style="visibility: hidden" @click.stop="onCopy(alertLabelData.username)" :title="$t('overall.copyText')"></i>
</div>
<div class="alert-label-box">
<div class="alert-label-title">{{ $t("profile.role") }}</div>

View File

@@ -6,7 +6,7 @@
ref="alertLabels"
>
<div class="alert-label-header-title">
<span style="margin-right: 5px"><i class="nz-icon" :class="statusClass(alertLabelData.status)" style="font-size: 16px"/></span>
<span style="margin-right: 5px;line-height: 24px;width: 24px;height: 24px"><i class="nz-icon" :class="statusClass(alertLabelData.status)" style="font-size: 24px"/></span>
<div class="alert-label-header-name">
{{getRemoteText(alertLabelData)}}
</div>
@@ -33,11 +33,10 @@
{{ alertLabelData && alertLabelData.username ? alertLabelData.username: "--" }}
</div>
</div>
<div class="alert-label-box">
<div class="alert-label-box document-copy-block">
<div class="alert-label-title">{{$t('ping.sourceIp')}}</div>
<div class="alert-label-value">
{{ alertLabelData && alertLabelData.remoteAddr ? alertLabelData.remoteAddr: "--" }}
</div>
<div class="alert-label-value document-copy-text" :title="alertLabelData && alertLabelData.remoteAddr ? alertLabelData.remoteAddr : '--'">{{alertLabelData && alertLabelData.remoteAddr ? alertLabelData.remoteAddr : '--'}}</div>
<i v-if="alertLabelData && alertLabelData.remoteAddr" class="nz-icon nz-icon-override" style="visibility: hidden" @click.stop="onCopy(alertLabelData.remoteAddr)" :title="$t('overall.copyText')"></i>
</div>
<div class="alert-label-box">
<div class="alert-label-title">{{$t('config.terminallog.loginUser')}}</div>
@@ -51,11 +50,10 @@
{{ alertLabelData && alertLabelData.host ? alertLabelData.host: "--" }}
</div>
</div>
<div class="alert-label-box">
<div class="alert-label-box document-copy-block">
<div class="alert-label-title">{{$t('config.terminallog.remote')}}</div>
<div class="alert-label-value">
{{getRemoteText(alertLabelData)}}
</div>
<div class="alert-label-value document-copy-text" :title="getRemoteText(alertLabelData)">{{getRemoteText(alertLabelData)}}</div>
<i v-if="getRemoteText(alertLabelData)" class="nz-icon nz-icon-override" style="visibility: hidden" @click.stop="onCopy(getRemoteText(alertLabelData))" :title="$t('overall.copyText')"></i>
</div>
<div class="alert-label-box">
<div class="alert-label-title">{{$t('webshell.protocol')}}</div>

View File

@@ -402,7 +402,7 @@ export default {
// } else {
// url = this.url
// }
url = this.urlNew
url = this.url
this.$delete(url + '?ids=' + row.id + '&state=' + row.state).then(response => {
if (response.code === 200) {
self.delFlag = true
@@ -604,7 +604,7 @@ export default {
this.alertSilenceUrl = `/alert/silence/${this.obj.id}/rel`
url = this.alertSilenceUrl
} else {
url = this.urlNew
url = this.url
}
this.$put(url, this.deleteBox).then(res => {
if (res.code === 200) {

View File

@@ -9,7 +9,7 @@
:targetTab="targetTab"
@changeTab="changeTab"
class="full-width-height"
:customClassName="'dashboard-tab-temp'"
:customClassName="paramsType === 'template' ? 'dashboard-tab-temp dashboard-tab-template' : 'dashboard-tab-temp'"
:showPagination="false"
>
<template v-slot:title><span :title="obj.name">{{obj.name}}</span></template>

View File

@@ -39,18 +39,23 @@
<button @click="changeTime(10)" class="nz-btn nz-btn-size-normal nz-btn-style-light change-time-height nz-input-group-append" style="height:32px" :title="$t('overall.increaseTime')"><i class="el-icon-d-arrow-right"></i></button>
</div>
<div class="nz-btn-group nz-btn-group-size-normal nz-btn-group-light" style="height: 28px;">
<button class="nz-btn nz-btn-size-normal nz-btn-style-light" :class="{'control-icon-unchecked':selectedEndpoints.length<1,'control-icon-checked':selectedEndpoints.length>0}" @click="viewGraph" :title="$t('overall.showLineChart')">
<i class="nz-icon nz-icon-chart" :class="{'control-icon-unchecked':selectedEndpoints.length<1,'control-icon-checked':selectedEndpoints.length>0}"></i>
<button class="top-tool-btn"
style="border-right: none;"
:disabled="!selectedEndpoints.length"
:class="selectedEndpoints.length > 0 ? '': 'nz-btn-disabled'"
type="button" @click="viewGraph"
:title="$t('overall.showLineChart')">
<i class="nz-icon nz-icon-chart" ></i>
</button>
<button @click="dropdownHandler(dropdownShow)" class="top-tool-btn margin-r-20" id="browser-go" style="border-radius: 0 2px 2px 0;">
<i class="nz-icon nz-icon-arrow-down"></i>
<transition name="el-zoom-in-top">
<div v-if="dropdownShow" class="recordRules-query-dropdown el-popover" style="right: 40px;top: 40px;">
<span style="padding-top: 2px">{{$t('project.endpoint.hideSameLabels')}}</span>
<el-switch v-model="hideSameLabels" size="small"></el-switch>
</div>
</transition>
</button>
<button @click="dropdownHandler(dropdownShow)" class="nz-btn nz-btn-size-normal nz-btn-style-light export-dropdown-btn" id="browser-go">
<i class="nz-icon nz-icon-arrow-down"></i>
<transition name="el-zoom-in-top">
<div v-if="dropdownShow" class="endpoint-query-dropdown el-popover" style="right: 11px;top: 33px;z-index: 1000;">
<span style="padding-top: 2px">{{$t('project.endpoint.hideSameLabels')}}</span>
<el-switch v-model="hideSameLabels" size="small"></el-switch>
</div>
</transition>
</button>
</div>
</div>
</template>

View File

@@ -36,18 +36,23 @@
<button @click="changeTime(10)" class="nz-btn nz-btn-size-normal nz-btn-style-light change-time-height nz-input-group-append" style="height:32px" :title="$t('overall.increaseTime')"><i class="el-icon-d-arrow-right"></i></button>
</div>
<div class="nz-btn-group nz-btn-group-size-normal nz-btn-group-light" style="height: 28px;">
<button class="nz-btn nz-btn-size-normal nz-btn-style-light" :class="{'control-icon-unchecked':selectedrecordRules.length<1,'control-icon-checked':selectedrecordRules.length>0}" @click="viewGraph" :title="$t('overall.showLineChart')">
<i class="nz-icon nz-icon-chart" :class="{'control-icon-unchecked':selectedrecordRules.length<1,'control-icon-checked':selectedrecordRules.length>0}"></i>
<button class="top-tool-btn"
style="border-right: none;"
:disabled="!selectedrecordRules.length"
:class="selectedrecordRules.length > 0 ? '': 'nz-btn-disabled'"
type="button" @click="viewGraph"
:title="$t('overall.showLineChart')">
<i class="nz-icon nz-icon-chart" ></i>
</button>
<button @click="dropdownHandler(dropdownShow)" class="top-tool-btn margin-r-20" id="browser-go" style="border-radius: 0 2px 2px 0;">
<i class="nz-icon nz-icon-arrow-down"></i>
<transition name="el-zoom-in-top">
<div v-if="dropdownShow" class="recordRules-query-dropdown el-popover" style="right: 40px;top: 40px;">
<span style="padding-top: 2px">{{$t('project.endpoint.hideSameLabels')}}</span>
<el-switch v-model="hideSameLabels" size="small"></el-switch>
</div>
</transition>
</button>
<button @click="dropdownHandler(dropdownShow)" class="nz-btn nz-btn-size-normal nz-btn-style-light export-dropdown-btn" id="browser-go">
<i class="nz-icon nz-icon-arrow-down"></i>
<transition name="el-zoom-in-top">
<div v-if="dropdownShow" class="recordRules-query-dropdown el-popover" style="right: 11px;top: 33px;">
<span style="padding-top: 2px">{{$t('project.endpoint.hideSameLabels')}}</span>
<el-switch v-model="hideSameLabels" size="small"></el-switch>
</div>
</transition>
</button>
</div>
</div>
</template>

View File

@@ -49,6 +49,7 @@
:that="alertLabelObj"
:detailList="true"
:type="alertLabelType"
:width="305"
@tipHover='tipHover'
ref="nzTooltip"
class="data-column__"

View File

@@ -50,6 +50,7 @@
:id="alertLabelId"
:that="alertLabelObj"
:type="alertLabelType"
@tipHover='tipHover'
:detail-list="true"
></alertLabel>
</div>

View File

@@ -15,7 +15,7 @@
</el-form-item>
<!--brand-->
<el-form-item :label='$t("asset.brand")' prop="brandId">
<el-select value-key="id" allow-create :maxlength="64" class="right-box__select" popper-class="right-box-select-top prevent-clickoutside" :filterable="true" v-model="editModel.brandId" placeholder="" size="small" id="module-box-input-project">
<el-select value-key="id" allow-create :maxlength="64" class="right-box__select" popper-class="right-box-select-top prevent-clickoutside" :filterable="true" v-model="editModel.brandId" :placeholder="$t('placeholder.newBrand')" size="small" id="module-box-input-project">
<el-option :id="'module-project-'+item.id" v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>

View File

@@ -31,13 +31,14 @@
<div class="cidr-title">CIDR</div>
<div class="cidr">
<el-form-item class="cidr-addr" prop="addr">
<el-input maxlength="256" rows="4" show-word-limit :placeholder="$t('overall.address')" v-model="editipam.addr" size="small"></el-input>
<el-input maxlength="256" rows="4" show-word-limit :placeholder="$t('overall.address')" v-model="editipam.addr" :disabled="!!editipam.id" size="small"></el-input>
</el-form-item>
<el-form-item prop="mask">
<el-select id="account-input-language"
class="right-box__select"
v-model="editipam.mask"
placeholder="mask"
:disabled="!!editipam.id"
popper-class="right-box-select-top right-box__select-width prevent-clickoutside"
size="small">
<template v-for="(item, index) in maskList">

View File

@@ -43,7 +43,7 @@
v-model="editProfile.theme"
popper-class="right-box-select-top prevent-clickoutside"
size="small">
<el-option v-for="item in theme" :key="item.value" :label="item.label" :value="item.value"></el-option>
<el-option v-for="item in theme" :key="item.value" :label="item.label === 'light' ? $t('theme.light'):$t('theme.dark')" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('profile.source')" prop="source">

View File

@@ -54,6 +54,7 @@
{{scope.row[item.prop]}}
</div>
</span>
<span v-else-if="item.prop === 'operation'">{{formatOperation(scope.row)}}</span>
<span v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</span>
<span v-else>-</span>
</template>
@@ -91,9 +92,10 @@
<script>
import table from '@/components/common/mixin/table'
import alertLabelMixin from '@/components/common/mixin/alertLabelMixin'
import searchSelectMixin from '@/components/common/searchSelectInfo'
export default {
name: 'operationLog',
mixins: [table, alertLabelMixin],
mixins: [table, alertLabelMixin, searchSelectMixin],
props: {
loading: Boolean
},
@@ -189,6 +191,14 @@ export default {
return '-'
}
},
formatOperation (row) {
const findItem = this.searchSelectInfo.operation.find(item => item.value === row.operation)
if (findItem) {
return findItem.label
} else {
return '-'
}
},
copyValue (item) {
const str = JSON.stringify(JSON.parse(item), null, 2)
// const domUrl = document.createElement('input')

View File

@@ -564,7 +564,7 @@ export default {
})
arrState.forEach(state => {
const batchDeleteArr = this.batchDeleteObjs.filter(m => m.state === state)
promiseArr.push(this.$delete(this.url + '?ids=' + batchDeleteArr.map(m => m.id).join(',') + '&state=' + state))
promiseArr.push(this.$delete('/alert/message' + '?ids=' + batchDeleteArr.map(m => m.id).join(',') + '&state=' + state))
})
Promise.all(promiseArr)
.then(res => {
@@ -595,7 +595,7 @@ export default {
cancelButtonText: this.$t('tip.no'),
type: 'warning'
}).then(() => {
this.$delete(this.url + '?ids=' + row.id + '&state=' + row.state).then(response => {
this.$delete('/alert/message' + '?ids=' + row.id + '&state=' + row.state).then(response => {
if (response.code === 200) {
this.delFlag = true
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.deleteSuccess') })

View File

@@ -114,7 +114,6 @@ export default {
}, {
label: 'URL',
prop: 'url',
visibility: 'disabled',
show: true
}
],

View File

@@ -3644,7 +3644,9 @@ export default {
try {
// eslint-disable-next-line no-undef
const go = new Go()
const result = await WebAssembly.instantiateStreaming(fetch('/static/wasm/promqlparser.wasm'), go.importObject)
const response = await fetch('/static/wasm/promqlparser.wasm')
const buffer = await response.arrayBuffer()
const result = await WebAssembly.instantiate(buffer, go.importObject)
go.run(result.instance)
// eslint-disable-next-line no-undef
this.parsePromQL = parsePromQL