mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 16:13:58 +00:00
apps fixes
This commit is contained in:
@@ -21,6 +21,7 @@ module.exports = {
|
|||||||
const name = await this.getNewAppFolder({ name: folder });
|
const name = await this.getNewAppFolder({ name: folder });
|
||||||
await fs.mkdir(path.join(appdir(), name));
|
await fs.mkdir(path.join(appdir(), name));
|
||||||
socket.emitChanged('app-folders-changed');
|
socket.emitChanged('app-folders-changed');
|
||||||
|
this.emitChangedDbApp(folder);
|
||||||
return name;
|
return name;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -93,6 +94,8 @@ module.exports = {
|
|||||||
if (!folder) throw new Error('Missing folder parameter');
|
if (!folder) throw new Error('Missing folder parameter');
|
||||||
await fs.rmdir(path.join(appdir(), folder), { recursive: true });
|
await fs.rmdir(path.join(appdir(), folder), { recursive: true });
|
||||||
socket.emitChanged(`app-folders-changed`);
|
socket.emitChanged(`app-folders-changed`);
|
||||||
|
socket.emitChanged(`app-files-changed-${folder}`);
|
||||||
|
socket.emitChanged('used-apps-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
async getNewAppFolder({ name }) {
|
async getNewAppFolder({ name }) {
|
||||||
|
|||||||
@@ -29,5 +29,5 @@ export async function saveDbToApp(conid: string, database: string, app: string)
|
|||||||
|
|
||||||
export function filterAppsForDatabase(connection, database: string, $apps): ApplicationDefinition[] {
|
export function filterAppsForDatabase(connection, database: string, $apps): ApplicationDefinition[] {
|
||||||
const db = (connection?.databases || []).find(x => x.name == database);
|
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}`]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,18 @@ export function getDictionaryDescription(
|
|||||||
connections,
|
connections,
|
||||||
skipCheckSaved: boolean = false
|
skipCheckSaved: boolean = false
|
||||||
): DictionaryDescription {
|
): 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);
|
const dbApps = filterAppsForDatabase(conn, database, apps);
|
||||||
|
|
||||||
|
if (!dbApps) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const cached = _.flatten(dbApps.map(x => x.dictionaryDescriptions || [])).find(
|
const cached = _.flatten(dbApps.map(x => x.dictionaryDescriptions || [])).find(
|
||||||
x => x.pureName == table.pureName && x.schemaName == table.schemaName
|
x => x.pureName == table.pureName && x.schemaName == table.schemaName
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user