diff --git a/src/graphql/fragments/demand-log.ts b/src/graphql/fragments/demand-log.ts index dda6b507..70219fb6 100644 --- a/src/graphql/fragments/demand-log.ts +++ b/src/graphql/fragments/demand-log.ts @@ -14,9 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export const queryNamespaces = { - query: `namespaces: listNamespaces`, -}; export const queryContainers = { variable: "$condition: ContainerQueryCondition", @@ -33,6 +30,5 @@ export const queryStreamingLogs = { contentType content } - total }`, }; diff --git a/src/graphql/query/demand-log.ts b/src/graphql/query/demand-log.ts index 6948b9db..7b02b275 100644 --- a/src/graphql/query/demand-log.ts +++ b/src/graphql/query/demand-log.ts @@ -15,14 +15,8 @@ * limitations under the License. */ -import { - queryContainers, - queryStreamingLogs, - queryNamespaces, -} from "../fragments/demand-log"; +import { queryContainers, queryStreamingLogs } from "../fragments/demand-log"; export const fetchContainers = `query queryContainers(${queryContainers.variable}) {${queryContainers.query}}`; export const fetchDemandPodLogs = `query queryStreamingLogs(${queryStreamingLogs.variable}) {${queryStreamingLogs.query}}`; - -export const fetchNamespaces = `query queryContainers {${queryNamespaces.query}}`; diff --git a/src/store/modules/demand-log.ts b/src/store/modules/demand-log.ts index 0303157a..3c824af5 100644 --- a/src/store/modules/demand-log.ts +++ b/src/store/modules/demand-log.ts @@ -15,7 +15,6 @@ * limitations under the License. */ import { defineStore } from "pinia"; -import { Option } from "@/types/app"; import { Instance } from "@/types/selector"; import { store } from "@/store"; import graphql from "@/graphql"; @@ -31,7 +30,6 @@ interface DemandLogState { selectorStore: any; logs: Log[]; loadLogs: boolean; - namespaces: Option[]; } export const demandLogStore = defineStore({ @@ -40,17 +38,13 @@ export const demandLogStore = defineStore({ containers: [{ label: "Detail", value: "Detail" }], instances: [{ value: "", label: "" }], conditions: { - namespace: "", container: "", - serviceId: "", serviceInstanceId: "", queryDuration: useAppStoreWithOut().durationTime, - paging: { pageNum: 1, pageSize: -1 }, }, selectorStore: useSelectorStore(), logs: [], loadLogs: false, - namespaces: [], }), actions: { setLogCondition(data: Conditions) { @@ -71,23 +65,7 @@ export const demandLogStore = defineStore({ this.instances = res.data.data.pods || []; return res.data; }, - async getNamespaces() { - const res: AxiosResponse = await graphql - .query("fetchNamespaces") - .params({}); - - if (res.data.errors) { - return res.data; - } - this.namespaces = (res.data.data.namespaces || []).map((d: string) => { - return { - label: d, - value: d, - }; - }); - return res.data; - }, - async getContainers(namespace: string, serviceInstanceId: string) { + async getContainers(serviceInstanceId: string) { if (!this.selectorStore.currentService) { return new Promise((resolve) => resolve({ errors: "No service" })); } @@ -95,7 +73,6 @@ export const demandLogStore = defineStore({ const condition = { serviceId, serviceInstanceId, - namespace, }; const res: AxiosResponse = await graphql .query("fetchContainers") diff --git a/src/types/demand-log.ts b/src/types/demand-log.ts index 8ed1a43e..924f8efd 100644 --- a/src/types/demand-log.ts +++ b/src/types/demand-log.ts @@ -14,15 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { DurationTime, Paging } from "./app"; +import { DurationTime } from "./app"; export interface Conditions { - namespace: string; container: string; - serviceId: string; serviceInstanceId: string; queryDuration: DurationTime; - paging: Paging; keywordsOfContent?: string[]; excludingKeywordsOfContent?: string; } diff --git a/src/views/dashboard/related/demand-log/Header.vue b/src/views/dashboard/related/demand-log/Header.vue index 4b851965..0d6163f0 100644 --- a/src/views/dashboard/related/demand-log/Header.vue +++ b/src/views/dashboard/related/demand-log/Header.vue @@ -25,17 +25,6 @@ limitations under the License. --> class="selectors" /> -
- {{ t("namespace") }}: - -
{{ t("container") }}: (1); const state = reactive({ instance: { value: "", label: "" }, container: { value: "", label: "None" }, - namespace: { value: "", label: "None" }, duration: { label: "Last 30 min", value: 1800 }, }); const rangeTime = computed(() => { @@ -199,22 +187,10 @@ async function fetchSelectors() { } else { await getInstances(); } - await getNamespaces(); getContainers(); } -async function getNamespaces() { - const resp = await demandLogStore.getNamespaces(); - if (resp.errors) { - ElMessage.error(resp.errors); - return; - } - state.namespace = demandLogStore.namespaces[0]; -} async function getContainers() { - const resp = await demandLogStore.getContainers( - state.namespace, - state.instance.id || "" - ); + const resp = await demandLogStore.getContainers(state.instance.id || ""); if (resp.errors) { ElMessage.error(resp.errors); return; @@ -235,10 +211,7 @@ function searchLogs() { instance = selectorStore.currentPod.id; } demandLogStore.setLogCondition({ - serviceId: - (selectorStore.currentService && selectorStore.currentService.id) || "", serviceInstanceId: instance || state.instance.id || "", - namespace: state.namespace.value, container: state.container.value, queryDuration: rangeTime.value, keywordsOfContent: keywordsOfContent.value,