in packages/graph-explorer/src/core/fetchEntityDetails.ts [88:132]
export function createFetchEntityDetailsCompletionNotification(
result: FetchEntityDetailsResult
): Notification {
if (result.counts.errors.total > 0) {
const errorMessage = formatEntityCounts(
result.counts.errors.vertices,
result.counts.errors.edges
);
return {
message: `Finished loading the graph, but ${errorMessage} encountered an error.`,
type: "error",
};
}
if (result.counts.notFound.total > 0) {
const errorMessage = formatEntityCounts(
result.counts.notFound.vertices,
result.counts.notFound.edges
);
const verb = result.counts.notFound.total > 1 ? "were" : "was";
return {
message: `Finished loading the graph, but ${errorMessage} ${verb} not found.`,
type: "info",
};
}
const anyImported =
result.entities.vertices.length + result.entities.edges.length > 0;
if (!anyImported) {
return {
message: `Finished loading the graph, but no nodes or edges were loaded.`,
type: "error",
};
}
const entityCountMessage = formatEntityCounts(
result.entities.vertices.length,
result.entities.edges.length
);
return {
message: `Finished loading ${entityCountMessage} from the graph file.`,
type: "success",
};
}