fix: update types

This commit is contained in:
Fine 2023-04-06 17:57:01 +08:00
parent 10b6a70c60
commit 24944d4ad9
11 changed files with 33 additions and 32 deletions

View File

@ -53,7 +53,7 @@ limitations under the License. -->
default: () => [],
},
value: {
type: [Array, String, Number, undefined] as PropType<unknown>,
type: [Array, String, Number, undefined] as PropType<any>,
default: () => [],
},
size: { type: null, default: "default" },

View File

@ -74,7 +74,7 @@ export const dashboardStore = defineStore({
this.currentDashboard = item;
},
addControl(type: string) {
const arr = this.layout.map((d: any) => Number(d.i));
const arr = this.layout.map((d: Recordable) => Number(d.i));
let index = String(Math.max(...arr) + 1);
if (!this.layout.length) {
index = "0";
@ -148,7 +148,7 @@ export const dashboardStore = defineStore({
}
const tabIndex = this.layout[idx].activedTabIndex || 0;
const { children } = (this.layout[idx].children || [])[tabIndex];
const arr = children.map((d: any) => Number(d.i));
const arr = children.map((d: Recordable) => Number(d.i));
let index = String(Math.max(...arr) + 1);
if (!children.length) {
index = "0";
@ -393,7 +393,7 @@ export const dashboardStore = defineStore({
children: this.layout,
...this.currentDashboard,
};
let res: any;
let res: Recordable;
let json;
if (this.currentDashboard.id) {

View File

@ -27,7 +27,7 @@ interface DemandLogState {
containers: Instance[];
instances: Instance[];
conditions: Conditions;
selectorStore: any;
selectorStore: Recordable;
logs: Log[];
loadLogs: boolean;
message: string;
@ -111,6 +111,6 @@ export const demandLogStore = defineStore({
},
});
export function useDemandLogStore(): any {
export function useDemandLogStore(): Recordable {
return demandLogStore(store);
}

View File

@ -153,6 +153,6 @@ export const ebpfStore = defineStore({
},
});
export function useEbpfStore(): any {
export function useEbpfStore(): Recordable {
return ebpfStore(store);
}

View File

@ -106,6 +106,6 @@ export const eventStore = defineStore({
},
});
export function useEventStore(): any {
export function useEventStore(): Recordable {
return eventStore(store);
}

View File

@ -27,10 +27,10 @@ interface LogState {
services: Service[];
instances: Instance[];
endpoints: Endpoint[];
conditions: any;
selectorStore: any;
conditions: Recordable;
selectorStore: Recordable;
supportQueryLogsByKeywords: boolean;
logs: any[];
logs: Recordable[];
loadLogs: boolean;
}
@ -50,7 +50,7 @@ export const logStore = defineStore({
loadLogs: false,
}),
actions: {
setLogCondition(data: any) {
setLogCondition(data: Recordable) {
this.conditions = { ...this.conditions, ...data };
},
resetState() {
@ -152,6 +152,6 @@ export const logStore = defineStore({
},
});
export function useLogStore(): any {
export function useLogStore(): Recordable {
return logStore(store);
}

View File

@ -22,6 +22,7 @@ import type { AxiosResponse } from "axios";
import type { Call } from "@/types/topology";
import type { LayoutConfig } from "@/types/dashboard";
import { ElMessage } from "element-plus";
import type { DurationTime } from "@/types/app";
interface NetworkProfilingState {
networkTasks: Array<Recordable<EBPFTaskList>>;
@ -74,7 +75,7 @@ export const networkProfilingStore = defineStore({
this.activeMetricIndex = index;
},
setTopology(data: { nodes: ProcessNode[]; calls: Call[] }) {
const obj = {} as any;
const obj = {} as Recordable;
let calls = (data.calls || []).reduce((prev: Call[], next: Call) => {
if (!obj[next.id]) {
obj[next.id] = true;
@ -92,8 +93,8 @@ export const networkProfilingStore = defineStore({
}
return prev;
}, []);
const param = {} as any;
calls = data.calls.reduce((prev: (Call | any)[], next: Call | any) => {
const param = {} as Recordable;
calls = data.calls.reduce((prev: (Call & Recordable)[], next: Call & Recordable) => {
if (param[next.targetId + next.sourceId]) {
next.lowerArc = true;
}
@ -165,7 +166,7 @@ export const networkProfilingStore = defineStore({
}
return res.data;
},
async getProcessTopology(params: { duration: any; serviceInstanceId: string }) {
async getProcessTopology(params: { duration: DurationTime; serviceInstanceId: string }) {
this.loadNodes = true;
const res: AxiosResponse = await graphql.query("getProcessTopology").params(params);
this.loadNodes = false;
@ -182,6 +183,6 @@ export const networkProfilingStore = defineStore({
},
});
export function useNetworkProfilingStore(): any {
export function useNetworkProfilingStore(): Recordable {
return networkProfilingStore(store);
}

View File

@ -162,7 +162,7 @@ export const profileStore = defineStore({
return {
...d,
segmentId: this.currentSegment?.segmentId,
traceId: (this.currentSegment.traceIds as any)[0],
traceId: (this.currentSegment.traceIds as string[])[0],
};
});
if (!(segment.spans && segment.spans.length)) {
@ -220,6 +220,6 @@ export const profileStore = defineStore({
},
});
export function useProfileStore(): any {
export function useProfileStore(): Recordable {
return profileStore(store);
}

View File

@ -233,6 +233,6 @@ export const selectorStore = defineStore({
},
});
export function useSelectorStore(): any {
export function useSelectorStore(): Recordable {
return selectorStore(store);
}

View File

@ -73,7 +73,7 @@ export const topologyStore = defineStore({
this.nodes = data.nodes;
},
setTopology(data: { nodes: Node[]; calls: Call[] }) {
const obj = {} as any;
const obj = {} as Recordable;
const services = useSelectorStore().services;
const nodes = (data.nodes || []).reduce((prev: Node[], next: Node) => {
if (!obj[next.id]) {
@ -302,8 +302,8 @@ export const topologyStore = defineStore({
return res.data;
}
const topo = res.data.data;
const calls = [] as any;
const nodes = [] as any;
const calls = [] as Call[];
const nodes = [] as Node[];
for (const key of Object.keys(topo)) {
calls.push(...topo[key].calls);
nodes.push(...topo[key].nodes);
@ -377,7 +377,7 @@ export const topologyStore = defineStore({
}
const data = res.data.data;
const metrics = Object.keys(data);
this.nodes = this.nodes.map((d: Node | any) => {
this.nodes = this.nodes.map((d: Node & Recordable) => {
for (const m of metrics) {
for (const val of data[m].values) {
if (d.id === val.id) {
@ -410,6 +410,6 @@ export const topologyStore = defineStore({
},
});
export function useTopologyStore(): any {
export function useTopologyStore(): Recordable {
return topologyStore(store);
}

View File

@ -31,9 +31,9 @@ interface TraceState {
traceList: Trace[];
traceSpans: Span[];
currentTrace: Recordable<Trace>;
conditions: any;
traceSpanLogs: any[];
selectorStore: any;
conditions: Recordable;
traceSpanLogs: Recordable[];
selectorStore: Recordable;
}
export const traceStore = defineStore({
@ -55,7 +55,7 @@ export const traceStore = defineStore({
selectorStore: useSelectorStore(),
}),
actions: {
setTraceCondition(data: any) {
setTraceCondition(data: Recordable) {
this.conditions = { ...this.conditions, ...data };
},
setCurrentTrace(trace: Recordable<Trace>) {
@ -171,7 +171,7 @@ export const traceStore = defineStore({
this.setTraceSpans(data || []);
return res.data;
},
async getSpanLogs(params: any) {
async getSpanLogs(params: Recordable) {
const res: AxiosResponse = await graphql.query("queryServiceLogs").params(params);
if (res.data.errors) {
this.traceSpanLogs = [];
@ -197,6 +197,6 @@ export const traceStore = defineStore({
},
});
export function useTraceStore(): any {
export function useTraceStore(): Recordable {
return traceStore(store);
}