diff --git a/src/graphql/http/index.ts b/src/graphql/http/index.ts index 99fc976d..400220ac 100644 --- a/src/graphql/http/index.ts +++ b/src/graphql/http/index.ts @@ -16,7 +16,7 @@ */ import { httpQuery } from "../base"; -export default async function fetchQuery({ method, json, url }: { method: string; json: unknown; url: string }) { +export default async function fetchQuery({ method, json, url }: { method: string; json?: unknown; url: string }) { const response = await httpQuery({ method, json, diff --git a/src/store/modules/settings.ts b/src/store/modules/settings.ts new file mode 100644 index 00000000..85bd4f48 --- /dev/null +++ b/src/store/modules/settings.ts @@ -0,0 +1,52 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { defineStore } from "pinia"; +import { store } from "@/store"; +import fetchQuery from "@/graphql/http"; +import type { Cluster } from "@/types/settings"; + +interface SettingsState { + loading: boolean; + nodes: Cluster[]; +} + +export const settingsStore = defineStore({ + id: "settings", + state: (): SettingsState => ({ + nodes: [], + loading: false, + }), + actions: { + async getNodes() { + this.loading = true; + const res = await fetchQuery({ + method: "get", + url: "", + }); + this.loading = false; + if (res.errors) { + return res; + } + + return res.data; + }, + }, +}); + +export function useSettingsStore(): Recordable { + return settingsStore(store); +} diff --git a/src/types/alarm.d.ts b/src/types/alarm.ts similarity index 100% rename from src/types/alarm.d.ts rename to src/types/alarm.ts diff --git a/src/types/app.d.ts b/src/types/app.ts similarity index 96% rename from src/types/app.d.ts rename to src/types/app.ts index 36958b54..cf44ed5f 100644 --- a/src/types/app.d.ts +++ b/src/types/app.ts @@ -39,14 +39,12 @@ export type EventParams = { seriesIndex: number; seriesName: string; name: string; - dataIndex: number; data: unknown; dataType: string; value: number | any[]; color: string; - event: Record; + event: Recordable; dataIndex: number; - event: any; }; export interface MenuOptions extends SubItem { diff --git a/src/types/continous-profiling.d.ts b/src/types/continous-profiling.ts similarity index 100% rename from src/types/continous-profiling.d.ts rename to src/types/continous-profiling.ts diff --git a/src/types/dashboard.d.ts b/src/types/dashboard.ts similarity index 100% rename from src/types/dashboard.d.ts rename to src/types/dashboard.ts diff --git a/src/types/ebpf.d.ts b/src/types/ebpf.ts similarity index 95% rename from src/types/ebpf.d.ts rename to src/types/ebpf.ts index 53badf56..53f84d32 100644 --- a/src/types/ebpf.d.ts +++ b/src/types/ebpf.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import type { Process } from "./selector"; +import type { Process as selectorProcess } from "./selector"; + export interface EBPFTaskCreationRequest { serviceId: string; processLabels: string[]; @@ -58,12 +59,12 @@ interface ProfilingCause { export interface EBPFProfilingSchedule { scheduleId: string; taskId: string; - process: Process; + process: selectorProcess; endTime: number; startTime: number; } -export type Process = Process; +export type Process = selectorProcess; export type StackElement = { id: string; originId: string; @@ -106,7 +107,6 @@ export type ProcessNode = { serviceName: string; serviceInstanceId: string; serviceInstanceName: string; - name: string; isReal: boolean; x?: number; y?: number; diff --git a/src/types/events.d.ts b/src/types/events.ts similarity index 96% rename from src/types/events.d.ts rename to src/types/events.ts index e4684134..be611039 100644 --- a/src/types/events.d.ts +++ b/src/types/events.ts @@ -14,6 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import type { Duration } from "./app"; + export type Event = { uuid: string; source: SourceInput; @@ -32,7 +34,7 @@ export interface QueryEventCondition { uuid: string; source: SourceInput; name: string; - type: EventType; + type: string; time: Duration; order: string; paging: { pageNum: number; pageSize: number; needTotal: boolean }; diff --git a/src/types/profile.d.ts b/src/types/profile.ts similarity index 100% rename from src/types/profile.d.ts rename to src/types/profile.ts diff --git a/src/types/selector.d.ts b/src/types/selector.ts similarity index 90% rename from src/types/selector.d.ts rename to src/types/selector.ts index cf8b07d5..928e1244 100644 --- a/src/types/selector.d.ts +++ b/src/types/selector.ts @@ -42,16 +42,6 @@ export type Endpoint = { merge?: string; }; -export type Service = { - id: string; - value: string; - label: string; - group: string; - normal: boolean; - layers: string[]; - shortName: string; -}; - export type Process = { id: string; name: string; diff --git a/src/types/infrastructure.d.ts b/src/types/settings.ts similarity index 73% rename from src/types/infrastructure.d.ts rename to src/types/settings.ts index 788f0102..07d978c8 100644 --- a/src/types/infrastructure.d.ts +++ b/src/types/settings.ts @@ -14,18 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export interface HexagonCreateParams { - hexagonParam: number[]; - count: number; - radius: number; - origin?: number[]; - getShader?: any; -} - -export interface HexagonGeo { - vertices: number[]; - normals: number[]; - insCenters: number[]; - indices: number[]; - origins: number[]; -} +export type Cluster = { + host: string; + port: number; + isSelf: boolean; +}; diff --git a/src/types/topology.d.ts b/src/types/topology.ts similarity index 100% rename from src/types/topology.d.ts rename to src/types/topology.ts diff --git a/src/types/trace.d.ts b/src/types/trace.ts similarity index 98% rename from src/types/trace.d.ts rename to src/types/trace.ts index 8d8d4457..a78db87e 100644 --- a/src/types/trace.d.ts +++ b/src/types/trace.ts @@ -47,7 +47,6 @@ export interface Span { tags?: Array>; logs?: log[]; parentSegmentId?: string; - refs?: Ref[]; key?: string; } export type Ref = { @@ -75,7 +74,7 @@ export interface StatisticsGroupRef { type: string; } -export class TraceTreeRef { +export interface TraceTreeRef { segmentMap: Map; segmentIdGroup: string[]; }