diff --git a/src/views/dashboard/related/demand-log/Content.vue b/src/views/dashboard/related/demand-log/Content.vue
index b8a32d85..a3577f97 100644
--- a/src/views/dashboard/related/demand-log/Content.vue
+++ b/src/views/dashboard/related/demand-log/Content.vue
@@ -57,9 +57,11 @@ function editorLayout() {
});
}
onUnmounted(() => {
+ if (!toRaw(monacoInstance.value)) {
+ return;
+ }
toRaw(monacoInstance.value).dispose();
monacoInstance.value = null;
- window.removeEventListener("resize", editorLayout);
});
watch(
() => demandLogStore.logs,
diff --git a/src/views/dashboard/related/demand-log/Header.vue b/src/views/dashboard/related/demand-log/Header.vue
index 632953bb..02496f99 100644
--- a/src/views/dashboard/related/demand-log/Header.vue
+++ b/src/views/dashboard/related/demand-log/Header.vue
@@ -59,15 +59,12 @@ limitations under the License. -->
{{ t("interval") }}:
-
- {{ t("seconds") }}
@@ -126,7 +123,12 @@ limitations under the License. -->
type="primary"
@click="runInterval"
>
-
+
{{ intervalFn ? t("pause") : t("start") }}
@@ -140,7 +142,7 @@ import { useAppStoreWithOut } from "@/store/modules/app";
import { useSelectorStore } from "@/store/modules/selectors";
import { ElMessage } from "element-plus";
import { EntityType } from "../../data";
-import { TimeRanges } from "./data";
+import { TimeRanges, IntervalOpts } from "./data";
import getLocalTime from "@/utils/localtime";
import dateFormatStep from "@/utils/dateFormat";
@@ -154,11 +156,11 @@ const excludingKeywordsOfContent = ref([]);
const contentStr = ref("");
const excludingContentStr = ref("");
// const limit = ref(20);
-const intervalTime = ref(30);
const state = reactive({
instance: { value: "", label: "" },
container: { value: "", label: "" },
duration: { label: "Last 30 min", value: 1800 },
+ interval: { label: "30 seconds", value: 30 },
});
/*global Nullable */
const intervalFn = ref>(null);
@@ -217,7 +219,10 @@ function runInterval() {
return;
}
searchLogs();
- intervalFn.value = setInterval(searchLogs, intervalTime.value * 1000);
+ if (state.interval.value === 0) {
+ return;
+ }
+ intervalFn.value = setInterval(searchLogs, state.interval.value * 1000);
setTimeout(() => {
clearTimer();
}, state.duration.value * 1000);
@@ -248,10 +253,10 @@ async function queryLogs() {
}
function changeField(type: string, opt: any) {
clearTimer();
- if (["limit", "interval"].includes(type)) {
- state[type] = opt;
- return;
- }
+ // if (["limit"].includes(type)) {
+ // state[type] = opt;
+ // return;
+ // }
state[type] = opt[0];
if (type === "instance") {
getContainers();
@@ -310,8 +315,8 @@ watch(
() => selectorStore.currentService,
() => {
if (dashboardStore.entity === EntityType[0].value) {
- demandLogStore.setLogs("");
fetchSelectors();
+ demandLogStore.setLogs("");
}
}
);
@@ -319,8 +324,8 @@ watch(
() => [selectorStore.currentPod],
() => {
if (dashboardStore.entity === EntityType[3].value) {
- demandLogStore.setLogs("");
fetchSelectors();
+ demandLogStore.setLogs("");
}
}
);
diff --git a/src/views/dashboard/related/demand-log/data.ts b/src/views/dashboard/related/demand-log/data.ts
index 4f36a1a4..65158781 100644
--- a/src/views/dashboard/related/demand-log/data.ts
+++ b/src/views/dashboard/related/demand-log/data.ts
@@ -21,8 +21,17 @@ export const TimeRanges = [
{ label: "Last 15 seconds", value: 15 },
{ label: "Last 30 seconds", value: 30 },
{ label: "Last 45 seconds", value: 45 },
- { label: "Last 1 min", value: 60 },
- { label: "Last 5 min", value: 300 },
- { label: "Last 15 min", value: 900 },
- { label: "Last 30 min", value: 1800 },
+ { label: "Last 1 minute", value: 60 },
+ { label: "Last 5 minute", value: 300 },
+ { label: "Last 15 minute", value: 900 },
+ { label: "Last 30 minute", value: 1800 },
+];
+export const IntervalOpts = [
+ { label: "None", value: 0 },
+ { label: "5 seconds", value: 5 },
+ { label: "10 seconds", value: 10 },
+ { label: "15 seconds", value: 15 },
+ { label: "30 seconds", value: 30 },
+ { label: "45 seconds", value: 45 },
+ { label: "1 minute", value: 60 },
];