feat: support cold stage data for metrics, trace and log (#469)

This commit is contained in:
Fine0830
2025-05-21 09:19:06 +08:00
committed by GitHub
parent 0c2cfa5630
commit a28972bc5c
17 changed files with 432 additions and 61 deletions

View File

@@ -169,12 +169,13 @@ limitations under the License. -->
value: { type: Date },
left: { type: Boolean, default: false },
right: { type: Boolean, default: false },
dates: { type: Array as PropType<number[] | string[]>, default: () => [] },
dates: { type: Array as PropType<Date[]>, default: () => [] },
disabledDate: { type: Function, default: () => false },
format: {
type: String,
default: "YYYY-MM-DD",
},
maxRange: { type: Array as PropType<Date[]>, default: () => [] },
});
const state = reactive({
pre: "",
@@ -241,6 +242,12 @@ limitations under the License. -->
const end = computed(() => {
return parse(Number(props.dates[1]));
});
const minStart = computed(() => {
return parse(Number(props.maxRange[0]));
});
const maxEnd = computed(() => {
return parse(Number(props.maxRange[1]));
});
const ys = computed(() => {
return Math.floor(state.year / 10) * 10;
});
@@ -369,7 +376,10 @@ limitations under the License. -->
flag = tf(props.value, format) === tf(time, format);
}
classObj[`${state.pre}-date`] = true;
classObj[`${state.pre}-date-disabled`] = (props.right && t < start.value) || props.disabledDate(time, format);
const rightDisabled = props.right && (t < start.value || t > maxEnd.value || !props.maxRange?.length);
const leftDisabled =
props.left && (t < minStart.value || t > end.value || !props.maxRange?.length || t > maxEnd.value);
classObj[`${state.pre}-date-disabled`] = rightDisabled || leftDisabled || props.disabledDate(time, format);
classObj[`${state.pre}-date-on`] = (props.left && t > start.value) || (props.right && t < end.value);
classObj[`${state.pre}-date-selected`] = flag;
return classObj;

View File

@@ -68,6 +68,7 @@ limitations under the License. -->
:left="true"
:disabledDate="disabledDate"
:format="format"
:maxRange="maxRange"
@ok="ok"
@setDates="setDates"
/>
@@ -78,6 +79,7 @@ limitations under the License. -->
:right="true"
:disabledDate="disabledDate"
:format="format"
:maxRange="maxRange"
@ok="ok"
@setDates="setDates"
/>
@@ -112,11 +114,11 @@ limitations under the License. -->
import { useI18n } from "vue-i18n";
import DateCalendar from "./DateCalendar.vue";
import { useTimeoutFn } from "@/hooks/useTimeout";
/*global defineProps, defineEmits*/
/*global PropType, defineProps, defineEmits*/
const datepicker = ref(null);
const { t } = useI18n();
const show = ref<boolean>(false);
const dates = ref<Date | string[] | any>([]);
const dates = ref<Date[]>([]);
const props = defineProps({
position: { type: String, default: "bottom" },
name: [String],
@@ -149,7 +151,7 @@ limitations under the License. -->
type: Boolean,
default: false,
},
dateRangeSelect: [Function],
maxRange: { type: Array as PropType<Date[]>, default: () => [] },
});
const emit = defineEmits(["clear", "input", "confirm", "cancel"]);
const local = computed(() => {