refactor: Update logs to outputs in relevant classes and methods
This commit is contained in:
parent
36681d2d34
commit
e19d9c90ea
7 changed files with 29 additions and 29 deletions
|
|
@ -22,7 +22,7 @@ const SwitchOutputView: React.FC<SwitchOutputViewProps> = ({
|
||||||
const flowPoolNode = (flowPool[nodeId] ?? [])[
|
const flowPoolNode = (flowPool[nodeId] ?? [])[
|
||||||
(flowPool[nodeId]?.length ?? 1) - 1
|
(flowPool[nodeId]?.length ?? 1) - 1
|
||||||
];
|
];
|
||||||
let results = flowPoolNode?.data?.logs[outputName] ?? "";
|
let results = flowPoolNode?.data?.outputs[outputName] ?? "";
|
||||||
if (Array.isArray(results)) {
|
if (Array.isArray(results)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,17 +7,17 @@ const useValidationStatusString = (
|
||||||
setValidationString,
|
setValidationString,
|
||||||
) => {
|
) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (validationStatus && validationStatus.data?.logs) {
|
if (validationStatus && validationStatus.data?.outputs) {
|
||||||
// if it is not a string turn it into a string
|
// if it is not a string turn it into a string
|
||||||
let newValidationString = "";
|
let newValidationString = "";
|
||||||
Object.values(validationStatus?.data?.logs).forEach((log: any) => {
|
Object.values(validationStatus?.data?.outputs).forEach((output: any) => {
|
||||||
if (isErrorLog(log)) {
|
if (isErrorLog(output)) {
|
||||||
newValidationString += `${log.message.errorMessage}\n`;
|
newValidationString += `${output.message.errorMessage}\n`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setValidationString(newValidationString);
|
setValidationString(newValidationString);
|
||||||
}
|
}
|
||||||
}, [validationStatus, validationStatus?.data?.logs, setValidationString]);
|
}, [validationStatus, validationStatus?.data?.outputs, setValidationString]);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useValidationStatusString;
|
export default useValidationStatusString;
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ export type ErrorLogType = {
|
||||||
stackTrace: string;
|
stackTrace: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type LogType = {
|
export type OutputLogType = {
|
||||||
message: any | ErrorLogType;
|
message: any | ErrorLogType;
|
||||||
type: string;
|
type: string;
|
||||||
};
|
};
|
||||||
|
|
@ -195,7 +195,7 @@ export type LogType = {
|
||||||
// it has results, artifacts, timedelta, duration
|
// it has results, artifacts, timedelta, duration
|
||||||
export type VertexDataTypeAPI = {
|
export type VertexDataTypeAPI = {
|
||||||
results: { [key: string]: string };
|
results: { [key: string]: string };
|
||||||
logs: { [key: string]: LogType };
|
outputs: { [key: string]: OutputLogType };
|
||||||
messages: ChatOutputType[] | ChatInputType[];
|
messages: ChatOutputType[] | ChatInputType[];
|
||||||
inactive?: boolean;
|
inactive?: boolean;
|
||||||
timedelta?: number;
|
timedelta?: number;
|
||||||
|
|
|
||||||
|
|
@ -732,7 +732,7 @@ export type Log = {
|
||||||
export type validationStatusType = {
|
export type validationStatusType = {
|
||||||
id: string;
|
id: string;
|
||||||
data: object | any;
|
data: object | any;
|
||||||
logs: Log[];
|
outputs: Log[];
|
||||||
progress?: number;
|
progress?: number;
|
||||||
valid: boolean;
|
valid: boolean;
|
||||||
duration?: string;
|
duration?: string;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ export type FlowPoolObjectTypeNew = {
|
||||||
timestamp: string;
|
timestamp: string;
|
||||||
valid: boolean;
|
valid: boolean;
|
||||||
data: {
|
data: {
|
||||||
logs?: any | ChatOutputType | ChatInputType;
|
outputs?: any | ChatOutputType | ChatInputType;
|
||||||
results: any | ChatOutputType | ChatInputType;
|
results: any | ChatOutputType | ChatInputType;
|
||||||
};
|
};
|
||||||
duration?: string;
|
duration?: string;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ function getInactiveVertexData(vertexId: string): VertexBuildTypeAPI {
|
||||||
// Build VertexBuildTypeAPI
|
// Build VertexBuildTypeAPI
|
||||||
let inactiveData = {
|
let inactiveData = {
|
||||||
results: {},
|
results: {},
|
||||||
logs: {},
|
outputs: {},
|
||||||
messages: [],
|
messages: [],
|
||||||
inactive: true,
|
inactive: true,
|
||||||
};
|
};
|
||||||
|
|
@ -276,17 +276,17 @@ async function buildVertex({
|
||||||
if (!buildData.valid) {
|
if (!buildData.valid) {
|
||||||
// lots is a dictionary with the key the output field name and the value the log object
|
// lots is a dictionary with the key the output field name and the value the log object
|
||||||
// logs: { [key: string]: { message: any; type: string }[] };
|
// logs: { [key: string]: { message: any; type: string }[] };
|
||||||
const errorMessages = Object.keys(buildData.data.logs).map((key) => {
|
const errorMessages = Object.keys(buildData.data.outputs).map((key) => {
|
||||||
const logs = buildData.data.logs[key];
|
const outputs = buildData.data.outputs[key];
|
||||||
if (Array.isArray(logs)) {
|
if (Array.isArray(outputs)) {
|
||||||
return logs
|
return outputs
|
||||||
.filter((log) => isErrorLogType(log.message))
|
.filter((log) => isErrorLogType(log.message))
|
||||||
.map((log) => log.message.errorMessage);
|
.map((log) => log.message.errorMessage);
|
||||||
}
|
}
|
||||||
if (!isErrorLogType(logs.message)) {
|
if (!isErrorLogType(outputs.message)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
return [logs.message.errorMessage];
|
return [outputs.message.errorMessage];
|
||||||
});
|
});
|
||||||
onBuildError!(
|
onBuildError!(
|
||||||
"Error Building Component",
|
"Error Building Component",
|
||||||
|
|
|
||||||
|
|
@ -430,11 +430,11 @@ export const logHasMessage = (
|
||||||
outputName: string | undefined,
|
outputName: string | undefined,
|
||||||
) => {
|
) => {
|
||||||
if (!outputName) return;
|
if (!outputName) return;
|
||||||
const logs = data?.logs[outputName];
|
const outputs = data?.outputs[outputName];
|
||||||
if (Array.isArray(logs) && logs.length > 1) {
|
if (Array.isArray(outputs) && outputs.length > 1) {
|
||||||
return logs.some((log) => log.message);
|
return outputs.some((outputLog) => outputLog.message);
|
||||||
} else {
|
} else {
|
||||||
return logs?.message;
|
return outputs?.message;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -443,11 +443,11 @@ export const logTypeIsUnknown = (
|
||||||
outputName: string | undefined,
|
outputName: string | undefined,
|
||||||
) => {
|
) => {
|
||||||
if (!outputName) return;
|
if (!outputName) return;
|
||||||
const logs = data?.logs[outputName];
|
const outputs = data?.outputs[outputName];
|
||||||
if (Array.isArray(logs) && logs.length > 1) {
|
if (Array.isArray(outputs) && outputs.length > 1) {
|
||||||
return logs.some((log) => log.type === "unknown");
|
return outputs.some((outputLog) => outputLog.type === "unknown");
|
||||||
} else {
|
} else {
|
||||||
return logs?.type === "unknown";
|
return outputs?.type === "unknown";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -456,10 +456,10 @@ export const logTypeIsError = (
|
||||||
outputName: string | undefined,
|
outputName: string | undefined,
|
||||||
) => {
|
) => {
|
||||||
if (!outputName) return;
|
if (!outputName) return;
|
||||||
const logs = data?.logs[outputName];
|
const outputs = data?.outputs[outputName];
|
||||||
if (Array.isArray(logs) && logs.length > 1) {
|
if (Array.isArray(outputs) && outputs.length > 1) {
|
||||||
return logs.some((log) => isErrorLog(log));
|
return outputs.some((log) => isErrorLog(log));
|
||||||
} else {
|
} else {
|
||||||
return isErrorLog(logs);
|
return isErrorLog(outputs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue