apps fixes

This commit is contained in:
Jan Prochazka
2022-02-17 09:52:07 +01:00
parent 070a82333d
commit 11f2a2cb11
3 changed files with 14 additions and 2 deletions

View File

@@ -29,5 +29,5 @@ export async function saveDbToApp(conid: string, database: string, app: string)
export function filterAppsForDatabase(connection, database: string, $apps): ApplicationDefinition[] {
const db = (connection?.databases || []).find(x => x.name == database);
return $apps.filter(app => db && db[`useApp:${app.name}`]);
return $apps?.filter(app => db && db[`useApp:${app.name}`]);
}

View File

@@ -19,9 +19,18 @@ export function getDictionaryDescription(
connections,
skipCheckSaved: boolean = false
): DictionaryDescription {
const conn = connections.find(x => x._id == conid);
const conn = connections?.find(x => x._id == conid);
if (!conn) {
return null;
}
const dbApps = filterAppsForDatabase(conn, database, apps);
if (!dbApps) {
return null;
}
const cached = _.flatten(dbApps.map(x => x.dictionaryDescriptions || [])).find(
x => x.pureName == table.pureName && x.schemaName == table.schemaName
);