chore: data source list enabled api

This commit is contained in:
Chareice 2024-03-06 18:48:30 +08:00
parent 454d1d34ed
commit 1c0654001f
No known key found for this signature in database

View File

@ -156,20 +156,24 @@ export class PluginDataSourceManagerServer extends Plugin {
const plugin = this;
const mapDataSourceWithCollection = (dataSourceModel, appendCollections = true) => {
const dataSource = app.dataSourceManager.dataSources.get(dataSourceModel.get('key'));
const dataSourceStatus = plugin.dataSourceStatus[dataSourceModel.get('key')];
// @ts-ignore
const isDBInstance = !!dataSource.collectionManager.db;
const item: any = {
key: dataSourceModel.get('key'),
displayName: dataSourceModel.get('displayName'),
status: dataSourceStatus,
type: dataSourceModel.get('type'),
isDBInstance,
};
if (dataSourceStatus === 'loading-failed' || dataSourceStatus === 'reloading-failed') {
item['errorMessage'] = plugin.dataSourceErrors[dataSourceModel.get('key')].message;
}
const dataSource = app.dataSourceManager.dataSources.get(dataSourceModel.get('key'));
if (!dataSource) {
return item;
}