Merge branch 'dev-3.7' of https://git.mesalab.cn/nezha/nezha-fronted into dev-3.8
This commit is contained in:
@@ -351,7 +351,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
str += [month, day].join('-')
|
str += [month, day].join('-')
|
||||||
}
|
}
|
||||||
if (diffSec <= secOneDay) { // 同一天
|
if (diffSec <= secOneDay - 100) { // 同一天
|
||||||
return [hour, minute].join(':')
|
return [hour, minute].join(':')
|
||||||
} else if (diffSec < secOneMonth) { // 大于1天,小于30天
|
} else if (diffSec < secOneMonth) { // 大于1天,小于30天
|
||||||
return str + '\n' + [hour, minute].join(':')
|
return str + '\n' + [hour, minute].join(':')
|
||||||
|
|||||||
@@ -26,7 +26,13 @@
|
|||||||
<!-- <div class="time-no-data">{{ showTime.text }}</div> -->
|
<!-- <div class="time-no-data">{{ showTime.text }}</div> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="calendar-popover-text">
|
<div class="calendar-popover-text">
|
||||||
<i class="nz-icon" v-if="showLocked" @click.stop="changeLocked" :class="timePickerLocked ? 'nz-icon-push-pin-line colorfa901c' : 'nz-icon-push-pin-line'" style="margin-right: 5px;cursor: pointer"/>
|
<i class="nz-icon"
|
||||||
|
v-if="showLocked"
|
||||||
|
@click.stop="changeLocked"
|
||||||
|
:title="timePickerLocked ? $t('timepicker.unlockTime') : $t('timepicker.lockTime')"
|
||||||
|
:class="timePickerLocked ? 'nz-icon-push-pin-line colorfa901c' : 'nz-icon-push-pin-line'"
|
||||||
|
style="margin-right: 5px;cursor: pointer"
|
||||||
|
/>
|
||||||
<i class="el-icon-arrow-down"></i>
|
<i class="el-icon-arrow-down"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -153,7 +159,7 @@ export default {
|
|||||||
type: String
|
type: String
|
||||||
},
|
},
|
||||||
sign: [Number, String],
|
sign: [Number, String],
|
||||||
showLocked: { type: Boolean, default: false },
|
showLocked: { type: Boolean, default: false }
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@@ -210,6 +216,9 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
timeBoxClass () {
|
timeBoxClass () {
|
||||||
return this.$store.getters.getTimeBoxClass
|
return this.$store.getters.getTimeBoxClass
|
||||||
|
},
|
||||||
|
nztimePickerLocked () {
|
||||||
|
return this.$store.getters.getTimePickerLocked
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
@@ -334,6 +343,13 @@ export default {
|
|||||||
this.timePickerLocked = !this.timePickerLocked
|
this.timePickerLocked = !this.timePickerLocked
|
||||||
localStorage.setItem('nz-time-picker-locked', JSON.stringify(this.timePickerLocked))
|
localStorage.setItem('nz-time-picker-locked', JSON.stringify(this.timePickerLocked))
|
||||||
this.$store.dispatch('dispatchTimePickerLocked', this.timePickerLocked)
|
this.$store.dispatch('dispatchTimePickerLocked', this.timePickerLocked)
|
||||||
|
if (this.timePickerLocked) {
|
||||||
|
console.log(this.searchTime, this.nowTimeType)
|
||||||
|
this.$store.dispatch('dispatchTimePickerRange', {
|
||||||
|
time: this.searchTime,
|
||||||
|
nowTimeType: this.nowTimeType
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
dateInputChange (type, v) {
|
dateInputChange (type, v) {
|
||||||
const timeFormatMain = localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss'
|
const timeFormatMain = localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss'
|
||||||
@@ -590,6 +606,9 @@ export default {
|
|||||||
this.getRangeHistoryArr()
|
this.getRangeHistoryArr()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
nztimePickerLocked (n) {
|
||||||
|
this.timePickerLocked = n
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ export default {
|
|||||||
this.$store.commit('isShrink')
|
this.$store.commit('isShrink')
|
||||||
},
|
},
|
||||||
jump (route) {
|
jump (route) {
|
||||||
this.$store.commit('setTimePickerRange', []) // 切换路由时清空已选择的时间
|
// this.$store.commit('setTimePickerRange', []) // 切换路由时清空已选择的时间
|
||||||
if (route === this.route) {
|
if (route === this.route) {
|
||||||
this.refresh()
|
this.refresh()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<div class="top-tool-right">
|
<div class="top-tool-right">
|
||||||
<button v-if="!closable" class="top-tool-btn top-tool-btn--text margin-r-10" style="cursor: pointer;" type="button" @click="split">
|
<button v-if="!closable" class="top-tool-btn top-tool-btn--text margin-r-10" style="cursor: pointer;" type="button" @click="split">
|
||||||
{{$t('overall.split')}}</button>
|
{{$t('overall.split')}}</button>
|
||||||
<pick-time id="explore" ref="pickTime" v-model="filterTime" :class="{'margin-r-10': showMetrics}" :refresh-data-func="expressionChange" @unitChange="chartUnitChange">
|
<pick-time id="explore" ref="pickTime" :show-locked="true" v-model="filterTime" :class="{'margin-r-10': showMetrics}" :refresh-data-func="expressionChange" @unitChange="chartUnitChange">
|
||||||
<!-- <template slot="added-text">{{$t('dashboard.metricPreview.runQuery')}}</template> -->
|
<!-- <template slot="added-text">{{$t('dashboard.metricPreview.runQuery')}}</template> -->
|
||||||
<template slot="added-text">{{$t('overall.query')}}</template>
|
<template slot="added-text">{{$t('overall.query')}}</template>
|
||||||
</pick-time>
|
</pick-time>
|
||||||
@@ -3631,6 +3631,7 @@ export default {
|
|||||||
mounted () {
|
mounted () {
|
||||||
this.scrollbarWrap = this.$refs.exploreScrollbar
|
this.scrollbarWrap = this.$refs.exploreScrollbar
|
||||||
this.scrollbarWrap.addEventListener('scroll', this.onScroll)
|
this.scrollbarWrap.addEventListener('scroll', this.onScroll)
|
||||||
|
this.setTimePickerRange()
|
||||||
this.initQueryFromPath()
|
this.initQueryFromPath()
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
@@ -3656,6 +3657,16 @@ export default {
|
|||||||
const dom = document.getElementsByClassName('nz-explore-' + this.tabIndex)[0]
|
const dom = document.getElementsByClassName('nz-explore-' + this.tabIndex)[0]
|
||||||
dom.querySelector(id).scrollIntoView(true)
|
dom.querySelector(id).scrollIntoView(true)
|
||||||
},
|
},
|
||||||
|
setTimePickerRange () {
|
||||||
|
console.log(this.timePickerLocked, !this.timePickerRange.nowTimeType)
|
||||||
|
if (!this.timePickerLocked || !this.timePickerRange.nowTimeType) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const nowTimeType = this.nowTimeType = this.timePickerRange.nowTimeType
|
||||||
|
this.filterTime = this.timePickerRange.time
|
||||||
|
this.$refs.pickTime.$refs.timePicker.setTimeRange(this.nowTimeType, this.filterTime)
|
||||||
|
this.setSearchTime(nowTimeType.type, nowTimeType.value, nowTimeType)
|
||||||
|
},
|
||||||
selectMetricsLogs (val, icon, label) {
|
selectMetricsLogs (val, icon, label) {
|
||||||
if (val) {
|
if (val) {
|
||||||
this.selectIcon = icon
|
this.selectIcon = icon
|
||||||
@@ -4513,6 +4524,12 @@ export default {
|
|||||||
const exploreItems = this.$parent.exploreItems
|
const exploreItems = this.$parent.exploreItems
|
||||||
const tabIndex = exploreItems.indexOf(this.tabIndex)
|
const tabIndex = exploreItems.indexOf(this.tabIndex)
|
||||||
return tabIndex ? 'right' : 'left'
|
return tabIndex ? 'right' : 'left'
|
||||||
|
},
|
||||||
|
timePickerLocked () {
|
||||||
|
return this.$store.getters.getTimePickerLocked
|
||||||
|
},
|
||||||
|
timePickerRange () {
|
||||||
|
return this.$store.getters.getTimePickerRange
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const timePicker = {
|
const timePicker = {
|
||||||
state: {
|
state: {
|
||||||
timePickerLocked: localStorage.getItem('nz-time-picker-locked') ? JSON.parse(localStorage.getItem('nz-time-picker-locked')) : false,
|
timePickerLocked: localStorage.getItem('nz-time-picker-locked') ? JSON.parse(localStorage.getItem('nz-time-picker-locked')) : false,
|
||||||
timePickerRange: {}
|
timePickerRange: localStorage.getItem('nz-time-picker-range') ? JSON.parse(localStorage.getItem('nz-time-picker-range')) : {},
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
setTimePickerLocked (state, flag) {
|
setTimePickerLocked (state, flag) {
|
||||||
@@ -9,6 +9,7 @@ const timePicker = {
|
|||||||
},
|
},
|
||||||
setTimePickerRange (state, range) {
|
setTimePickerRange (state, range) {
|
||||||
state.timePickerRange = range
|
state.timePickerRange = range
|
||||||
|
localStorage.setItem('nz-time-picker-range', JSON.stringify(range))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
|
|||||||
Reference in New Issue
Block a user