mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 21:49:25 +08:00
chore: refresh datasource (#5980)
This commit is contained in:
parent
c1eb366701
commit
2eb03c21e8
@ -77,8 +77,13 @@ export class DataSourceModel extends Model {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadIntoApplication(options: { app: Application; transaction?: Transaction; loadAtAfterStart?: boolean }) {
|
async loadIntoApplication(options: {
|
||||||
const { app, loadAtAfterStart } = options;
|
app: Application;
|
||||||
|
transaction?: Transaction;
|
||||||
|
loadAtAfterStart?: boolean;
|
||||||
|
refresh?: boolean;
|
||||||
|
}) {
|
||||||
|
const { app, loadAtAfterStart, refresh } = options;
|
||||||
|
|
||||||
const dataSourceKey = this.get('key');
|
const dataSourceKey = this.get('key');
|
||||||
|
|
||||||
@ -129,6 +134,7 @@ export class DataSourceModel extends Model {
|
|||||||
|
|
||||||
await app.dataSourceManager.add(dataSource, {
|
await app.dataSourceManager.add(dataSource, {
|
||||||
localData: await this.loadLocalData(),
|
localData: await this.loadLocalData(),
|
||||||
|
refresh,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
app.logger.error(`load data source failed`, { cause: e });
|
app.logger.error(`load data source failed`, { cause: e });
|
||||||
|
@ -427,6 +427,7 @@ export class PluginDataSourceManagerServer extends Plugin {
|
|||||||
) {
|
) {
|
||||||
dataSourceModel.loadIntoApplication({
|
dataSourceModel.loadIntoApplication({
|
||||||
app: ctx.app,
|
app: ctx.app,
|
||||||
|
refresh: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
ctx.app.syncMessageManager.publish(self.name, {
|
ctx.app.syncMessageManager.publish(self.name, {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user