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 {
|
||||
str += [month, day].join('-')
|
||||
}
|
||||
if (diffSec <= secOneDay) { // 同一天
|
||||
if (diffSec <= secOneDay - 100) { // 同一天
|
||||
return [hour, minute].join(':')
|
||||
} else if (diffSec < secOneMonth) { // 大于1天,小于30天
|
||||
return str + '\n' + [hour, minute].join(':')
|
||||
|
||||
@@ -26,7 +26,13 @@
|
||||
<!-- <div class="time-no-data">{{ showTime.text }}</div> -->
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
@@ -153,7 +159,7 @@ export default {
|
||||
type: String
|
||||
},
|
||||
sign: [Number, String],
|
||||
showLocked: { type: Boolean, default: false },
|
||||
showLocked: { type: Boolean, default: false }
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
@@ -210,6 +216,9 @@ export default {
|
||||
computed: {
|
||||
timeBoxClass () {
|
||||
return this.$store.getters.getTimeBoxClass
|
||||
},
|
||||
nztimePickerLocked () {
|
||||
return this.$store.getters.getTimePickerLocked
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
@@ -334,6 +343,13 @@ export default {
|
||||
this.timePickerLocked = !this.timePickerLocked
|
||||
localStorage.setItem('nz-time-picker-locked', JSON.stringify(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) {
|
||||
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()
|
||||
}
|
||||
}
|
||||
},
|
||||
nztimePickerLocked (n) {
|
||||
this.timePickerLocked = n
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
|
||||
@@ -103,7 +103,7 @@ export default {
|
||||
this.$store.commit('isShrink')
|
||||
},
|
||||
jump (route) {
|
||||
this.$store.commit('setTimePickerRange', []) // 切换路由时清空已选择的时间
|
||||
// this.$store.commit('setTimePickerRange', []) // 切换路由时清空已选择的时间
|
||||
if (route === this.route) {
|
||||
this.refresh()
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<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">
|
||||
{{$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('overall.query')}}</template>
|
||||
</pick-time>
|
||||
@@ -3631,6 +3631,7 @@ export default {
|
||||
mounted () {
|
||||
this.scrollbarWrap = this.$refs.exploreScrollbar
|
||||
this.scrollbarWrap.addEventListener('scroll', this.onScroll)
|
||||
this.setTimePickerRange()
|
||||
this.initQueryFromPath()
|
||||
},
|
||||
beforeDestroy () {
|
||||
@@ -3656,6 +3657,16 @@ export default {
|
||||
const dom = document.getElementsByClassName('nz-explore-' + this.tabIndex)[0]
|
||||
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) {
|
||||
if (val) {
|
||||
this.selectIcon = icon
|
||||
@@ -4513,6 +4524,12 @@ export default {
|
||||
const exploreItems = this.$parent.exploreItems
|
||||
const tabIndex = exploreItems.indexOf(this.tabIndex)
|
||||
return tabIndex ? 'right' : 'left'
|
||||
},
|
||||
timePickerLocked () {
|
||||
return this.$store.getters.getTimePickerLocked
|
||||
},
|
||||
timePickerRange () {
|
||||
return this.$store.getters.getTimePickerRange
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const timePicker = {
|
||||
state: {
|
||||
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: {
|
||||
setTimePickerLocked (state, flag) {
|
||||
@@ -9,6 +9,7 @@ const timePicker = {
|
||||
},
|
||||
setTimePickerRange (state, range) {
|
||||
state.timePickerRange = range
|
||||
localStorage.setItem('nz-time-picker-range', JSON.stringify(range))
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
|
||||
Reference in New Issue
Block a user