fix: types

This commit is contained in:
Fine 2023-04-06 09:51:59 +08:00
parent 59bfce472d
commit bdd4353b0a
10 changed files with 26 additions and 24 deletions

View File

@ -262,7 +262,7 @@ export function useQueryPodsMetrics(
export function usePodsSource(
pods: Array<Instance | Endpoint>,
resp: { errors: string; data: { [key: string]: any } },
resp: { errors: string; data: Recordable },
config: {
metrics: string[];
metricTypes: string[];

View File

@ -85,9 +85,11 @@ limitations under the License. -->
function getPathNames() {
const p = route.params;
// get names
// set names
if (appStore.pathNames.length && p.layerId === appStore.pathNames[0].layerId) {
const arr = [...appStore.pathNames, p];
const list = deduplication(arr, ["layerId", "entity", "name"]);
appStore.setPathNames(list);
} else {

View File

@ -27,7 +27,7 @@ interface DemandLogState {
containers: Instance[];
instances: Instance[];
conditions: Conditions;
selectorStore: any;
selectorStore: Recordable;
logs: Log[];
loadLogs: boolean;
message: string;

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

@ -74,7 +74,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,7 +92,7 @@ export const networkProfilingStore = defineStore({
}
return prev;
}, []);
const param = {} as any;
const param = {} as Recordable;
calls = data.calls.reduce((prev: (Call | any)[], next: Call | any) => {
if (param[next.targetId + next.sourceId]) {
next.lowerArc = true;
@ -182,6 +182,6 @@ export const networkProfilingStore = defineStore({
},
});
export function useNetworkProfilingStore(): any {
export function useNetworkProfilingStore(): Recordable {
return networkProfilingStore(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]) {

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() {
return traceStore(store);
}

2
src/types/app.d.ts vendored
View File

@ -44,6 +44,6 @@ export type EventParams = {
dataType: string;
value: number | Array;
color: string;
event: any;
event: Record<string, T>;
dataIndex: number;
};

View File

@ -55,8 +55,8 @@ export interface SegmentSpan {
component: string;
isError: boolean;
layer: string;
tags: any[];
logs: any[];
tags: Recordable[];
logs: Recordable[];
}
export interface ProfileTaskCreationRequest {

View File

@ -71,7 +71,7 @@ limitations under the License. -->
import { ElMessage } from "element-plus";
import { useAppStoreWithOut } from "@/store/modules/app";
/*global defineEmits, defineProps */
/*global defineEmits, defineProps, Recordable */
const emit = defineEmits(["update"]);
const props = defineProps({
type: { type: String, default: "TRACE" },
@ -118,7 +118,7 @@ limitations under the License. -->
emit("update", { tagsMap, tagsList: tagsList.value });
}
async function fetchTagKeys() {
let resp: any = {};
let resp: Recordable = {};
if (props.type === "TRACE") {
resp = await traceStore.getTagKeys();
} else {
@ -137,7 +137,7 @@ limitations under the License. -->
async function fetchTagValues() {
const param = tags.value.split("=")[0];
let resp: any = {};
let resp: Recordable = {};
if (props.type === "TRACE") {
resp = await traceStore.getTagValues(param);
} else {