mirror of
https://github.com/chartdb/chartdb.git
synced 2026-01-08 12:50:01 -06:00
add includeDependencies in listDiagrams (#270)
This commit is contained in:
@@ -190,7 +190,12 @@ export const StorageProvider: React.FC<React.PropsWithChildren> = ({
|
||||
options: {
|
||||
includeTables?: boolean;
|
||||
includeRelationships?: boolean;
|
||||
} = { includeRelationships: false, includeTables: false }
|
||||
includeDependencies?: boolean;
|
||||
} = {
|
||||
includeRelationships: false,
|
||||
includeTables: false,
|
||||
includeDependencies: false,
|
||||
}
|
||||
): Promise<Diagram[]> => {
|
||||
let diagrams = await db.diagrams.toArray();
|
||||
|
||||
@@ -212,6 +217,15 @@ export const StorageProvider: React.FC<React.PropsWithChildren> = ({
|
||||
);
|
||||
}
|
||||
|
||||
if (options.includeDependencies) {
|
||||
diagrams = await Promise.all(
|
||||
diagrams.map(async (diagram) => {
|
||||
diagram.dependencies = await listDependencies(diagram.id);
|
||||
return diagram;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
return diagrams;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user