From b2707e0e628068b15a133828ed939db21c622254 Mon Sep 17 00:00:00 2001 From: Fine0830 Date: Wed, 15 Feb 2023 13:37:14 +0800 Subject: [PATCH] feat: add period (#235) --- src/locales/lang/en.ts | 1 + src/locales/lang/es.ts | 1 + src/locales/lang/zh.ts | 1 + src/views/dashboard/Widget.vue | 4 ++-- src/views/dashboard/components/WidgetLink.vue | 12 ++++++++++++ 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index c382ba52..d6bc68e1 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -184,6 +184,7 @@ const msg = { generateLink: "Generate Link", setDuration: "Lock Query Duration", openFunction: "OpenFunction", + period: "Period", seconds: "Seconds", hourTip: "Select Hour", minuteTip: "Select Minute", diff --git a/src/locales/lang/es.ts b/src/locales/lang/es.ts index 929d9845..0c186936 100644 --- a/src/locales/lang/es.ts +++ b/src/locales/lang/es.ts @@ -186,6 +186,7 @@ const msg = { when4xx: "Ejemplo de solicitud y respuesta http con seguimiento cuando el Código de respuesta está entre 400 y 499", when5xx: "Ejemplo de solicitud y respuesta http con seguimiento cuando el Código de respuesta está entre 500 y 599", taskTitle: "Reglas de recolección de peticiones y respuestas HTTP", + period: "Period", second: "s", yearSuffix: "Año", monthsHead: "Ene_Feb_Mar_Abr_May_Jun_Jul_Ago_Set_Oct_Nov_Dic", diff --git a/src/locales/lang/zh.ts b/src/locales/lang/zh.ts index 34df4f3b..8c79a7e2 100644 --- a/src/locales/lang/zh.ts +++ b/src/locales/lang/zh.ts @@ -181,6 +181,7 @@ const msg = { generateLink: "生成链接", setDuration: "锁定查询持续时间", openFunction: "OpenFunction", + period: "周期", seconds: "秒", hourTip: "选择小时", minuteTip: "选择分钟", diff --git a/src/views/dashboard/Widget.vue b/src/views/dashboard/Widget.vue index 0858e1fc..e3f480bb 100644 --- a/src/views/dashboard/Widget.vue +++ b/src/views/dashboard/Widget.vue @@ -78,11 +78,11 @@ limitations under the License. --> async function init() { dashboardStore.setLayer(route.params.layer); dashboardStore.setEntity(route.params.entity); - const { auto } = config.value; + const { auto, autoPeriod } = config.value; if (auto) { await setDuration(); - appStoreWithOut.setReloadTimer(setInterval(setDuration, auto)); + appStoreWithOut.setReloadTimer(setInterval(setDuration, autoPeriod * 1000)); } await setSelector(); await queryMetrics(); diff --git a/src/views/dashboard/components/WidgetLink.vue b/src/views/dashboard/components/WidgetLink.vue index 06ec361e..584c24a4 100644 --- a/src/views/dashboard/components/WidgetLink.vue +++ b/src/views/dashboard/components/WidgetLink.vue @@ -31,6 +31,12 @@ limitations under the License. --> +
+ + + {{ t("second") }} + {{ t("timeReload") }} +
{{ t("generateLink") }}
@@ -63,6 +69,7 @@ limitations under the License. --> const dates = ref([]); const host = window.location.host; const auto = ref(true); + const period = ref(6); const freshOpt = ref(RefreshOptions[0].value); function changeTimeRange(val: Date[] | any) { @@ -112,6 +119,7 @@ limitations under the License. --> if (auto.value) { const f = RefreshOptions.filter((d: { value: string }) => d.value === freshOpt.value)[0] || {}; opt.auto = Number(f.value) * 60 * 1000; + opt.autoPeriod = period.value; if (f.step === TimeType.HOUR_TIME) { opt.auto = Number(f.value) * 60 * 60 * 1000; } @@ -150,4 +158,8 @@ limitations under the License. --> display: inline-block; width: 250px; } + + .auto-period { + width: 50px; + }