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