add settings store

This commit is contained in:
Fine 2025-05-27 16:04:44 +08:00
parent c38ba1c0b2
commit 82e0846893
13 changed files with 67 additions and 36 deletions

View File

@ -16,7 +16,7 @@
*/ */
import { httpQuery } from "../base"; 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({ const response = await httpQuery({
method, method,
json, json,

View File

@ -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);
}

View File

@ -39,14 +39,12 @@ export type EventParams = {
seriesIndex: number; seriesIndex: number;
seriesName: string; seriesName: string;
name: string; name: string;
dataIndex: number;
data: unknown; data: unknown;
dataType: string; dataType: string;
value: number | any[]; value: number | any[];
color: string; color: string;
event: Record<string, T>; event: Recordable;
dataIndex: number; dataIndex: number;
event: any;
}; };
export interface MenuOptions extends SubItem { export interface MenuOptions extends SubItem {

View File

@ -15,7 +15,8 @@
* limitations under the License. * limitations under the License.
*/ */
import type { Process } from "./selector"; import type { Process as selectorProcess } from "./selector";
export interface EBPFTaskCreationRequest { export interface EBPFTaskCreationRequest {
serviceId: string; serviceId: string;
processLabels: string[]; processLabels: string[];
@ -58,12 +59,12 @@ interface ProfilingCause {
export interface EBPFProfilingSchedule { export interface EBPFProfilingSchedule {
scheduleId: string; scheduleId: string;
taskId: string; taskId: string;
process: Process; process: selectorProcess;
endTime: number; endTime: number;
startTime: number; startTime: number;
} }
export type Process = Process; export type Process = selectorProcess;
export type StackElement = { export type StackElement = {
id: string; id: string;
originId: string; originId: string;
@ -106,7 +107,6 @@ export type ProcessNode = {
serviceName: string; serviceName: string;
serviceInstanceId: string; serviceInstanceId: string;
serviceInstanceName: string; serviceInstanceName: string;
name: string;
isReal: boolean; isReal: boolean;
x?: number; x?: number;
y?: number; y?: number;

View File

@ -14,6 +14,8 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import type { Duration } from "./app";
export type Event = { export type Event = {
uuid: string; uuid: string;
source: SourceInput; source: SourceInput;
@ -32,7 +34,7 @@ export interface QueryEventCondition {
uuid: string; uuid: string;
source: SourceInput; source: SourceInput;
name: string; name: string;
type: EventType; type: string;
time: Duration; time: Duration;
order: string; order: string;
paging: { pageNum: number; pageSize: number; needTotal: boolean }; paging: { pageNum: number; pageSize: number; needTotal: boolean };

View File

@ -42,16 +42,6 @@ export type Endpoint = {
merge?: string; merge?: string;
}; };
export type Service = {
id: string;
value: string;
label: string;
group: string;
normal: boolean;
layers: string[];
shortName: string;
};
export type Process = { export type Process = {
id: string; id: string;
name: string; name: string;

View File

@ -14,18 +14,8 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export interface HexagonCreateParams { export type Cluster = {
hexagonParam: number[]; host: string;
count: number; port: number;
radius: number; isSelf: boolean;
origin?: number[]; };
getShader?: any;
}
export interface HexagonGeo {
vertices: number[];
normals: number[];
insCenters: number[];
indices: number[];
origins: number[];
}

View File

@ -47,7 +47,6 @@ export interface Span {
tags?: Array<Map<string, string>>; tags?: Array<Map<string, string>>;
logs?: log[]; logs?: log[];
parentSegmentId?: string; parentSegmentId?: string;
refs?: Ref[];
key?: string; key?: string;
} }
export type Ref = { export type Ref = {
@ -75,7 +74,7 @@ export interface StatisticsGroupRef {
type: string; type: string;
} }
export class TraceTreeRef { export interface TraceTreeRef {
segmentMap: Map<string, Span>; segmentMap: Map<string, Span>;
segmentIdGroup: string[]; segmentIdGroup: string[];
} }