mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-03 13:45:24 +00:00
feat: auto fresh
This commit is contained in:
parent
2ebc9f25cc
commit
7c94adc8bb
@ -54,6 +54,9 @@ limitations under the License. -->
|
|||||||
import { useQueryProcessor, useSourceProcessor, useGetMetricEntity } from "@/hooks/useMetricsProcessor";
|
import { useQueryProcessor, useSourceProcessor, useGetMetricEntity } from "@/hooks/useMetricsProcessor";
|
||||||
import graphs from "./graphs";
|
import graphs from "./graphs";
|
||||||
import { EntityType } from "./data";
|
import { EntityType } from "./data";
|
||||||
|
import { TimeType } from "@/constants/data";
|
||||||
|
import getLocalTime from "@/utils/localtime";
|
||||||
|
import timeFormat from "@/utils/timeFormat";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "WidgetPage",
|
name: "WidgetPage",
|
||||||
@ -72,18 +75,34 @@ limitations under the License. -->
|
|||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
const title = computed(() => (config.value.widget && config.value.widget.title) || "");
|
const title = computed(() => (config.value.widget && config.value.widget.title) || "");
|
||||||
const tips = computed(() => (config.value.widget && config.value.widget.tips) || "");
|
const tips = computed(() => (config.value.widget && config.value.widget.tips) || "");
|
||||||
|
const gap = ref<number>(0);
|
||||||
|
|
||||||
init();
|
init();
|
||||||
async function init() {
|
async function init() {
|
||||||
|
const { auto } = config.value;
|
||||||
|
|
||||||
|
if (auto) {
|
||||||
|
gap.value = Number(auto.value) * 60 * 1000;
|
||||||
|
if (auto.step === TimeType.HOUR_TIME) {
|
||||||
|
gap.value = Number(auto.value) * 60 * 60 * 1000;
|
||||||
|
}
|
||||||
|
if (auto.step === TimeType.DAY_TIME) {
|
||||||
|
gap.value = Number(auto.value) * 60 * 60 * 60 * 1000;
|
||||||
|
}
|
||||||
|
await setDuration();
|
||||||
|
appStoreWithOut.setReloadTimer(setInterval(setDuration, gap.value));
|
||||||
|
}
|
||||||
dashboardStore.setLayer(route.params.layer);
|
dashboardStore.setLayer(route.params.layer);
|
||||||
dashboardStore.setEntity(route.params.entity);
|
dashboardStore.setEntity(route.params.entity);
|
||||||
await setDuration();
|
|
||||||
await setSelector();
|
await setSelector();
|
||||||
await queryMetrics();
|
await queryMetrics();
|
||||||
}
|
}
|
||||||
async function setDuration() {
|
async function setDuration() {
|
||||||
// if (config.value.auto) {
|
const dates: Date[] = [
|
||||||
// }
|
getLocalTime(appStoreWithOut.utc, new Date(new Date().getTime() - gap.value)),
|
||||||
|
getLocalTime(appStoreWithOut.utc, new Date()),
|
||||||
|
];
|
||||||
|
appStoreWithOut.setDuration(timeFormat(dates));
|
||||||
}
|
}
|
||||||
async function setSelector() {
|
async function setSelector() {
|
||||||
const { serviceId, podId, processId, destServiceId, destPodId, destProcessId, entity } = route.params;
|
const { serviceId, podId, processId, destServiceId, destPodId, destProcessId, entity } = route.params;
|
||||||
|
Loading…
Reference in New Issue
Block a user