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";
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,

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;
seriesName: string;
name: string;
dataIndex: number;
data: unknown;
dataType: string;
value: number | any[];
color: string;
event: Record<string, T>;
event: Recordable;
dataIndex: number;
event: any;
};
export interface MenuOptions extends SubItem {

View File

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

View File

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

View File

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

View File

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

View File

@ -47,7 +47,6 @@ export interface Span {
tags?: Array<Map<string, string>>;
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<string, Span>;
segmentIdGroup: string[];
}