mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
CB-5863 Redirect to the Server Configuration page when refreshing the Identity Providers page (#3257)
* CB-5863 loads administration items loaders before redirects * CB-5863 removes redirect blockers for administration routes * CB-5863 loads route loaders on route change * CB-5863 cleanup * CB-5863 reverts administration.tsx changes --------- Co-authored-by: Daria Marutkina <125263541+dariamarutkina@users.noreply.github.com>
This commit is contained in:
co-authored by
Daria Marutkina
parent
d3ed80219e
commit
0aafa78926
+29
-2
@@ -13,7 +13,7 @@ import { Executor, type IExecutor } from '@cloudbeaver/core-executor';
|
||||
import { EAdminPermission, PermissionsService, ServerConfigResource, SessionPermissionsResource } from '@cloudbeaver/core-root';
|
||||
import { type RouterState, ScreenService } from '@cloudbeaver/core-routing';
|
||||
import { StorageService } from '@cloudbeaver/core-storage';
|
||||
import { type DefaultValueGetter, GlobalConstants, MetadataMap, schema } from '@cloudbeaver/core-utils';
|
||||
import { type DefaultValueGetter, GlobalConstants, isNotNullDefined, MetadataMap, schema } from '@cloudbeaver/core-utils';
|
||||
|
||||
import { AdministrationItemService } from '../AdministrationItem/AdministrationItemService.js';
|
||||
import type { IAdministrationItemRoute } from '../AdministrationItem/IAdministrationItemRoute.js';
|
||||
@@ -119,11 +119,38 @@ export class AdministrationScreenService {
|
||||
// this is need for this.isConfigurationMode
|
||||
await this.serverConfigResource.load();
|
||||
|
||||
const uniqueItems = this.administrationItemService.getUniqueItems(this.isConfigurationMode);
|
||||
const item = uniqueItems.find(i => i.name === this.activeScreen?.item);
|
||||
|
||||
if (!this.isAdministrationPageActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.activeScreen || !this.administrationItemService.getItem(this.activeScreen.item, this.isConfigurationMode)) {
|
||||
if (!this.activeScreen || !item) {
|
||||
this.navigateToRoot();
|
||||
return;
|
||||
}
|
||||
|
||||
const loaders = [item]
|
||||
.map(loader => loader?.getLoader?.())
|
||||
.filter(isNotNullDefined)
|
||||
.flat();
|
||||
|
||||
for (const loader of loaders) {
|
||||
if (loader.isError()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!loader.isLoaded() || loader.isOutdated?.() === true) {
|
||||
try {
|
||||
await loader.load();
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
|
||||
const loadedItem = this.administrationItemService.getItem(this.activeScreen.item, this.isConfigurationMode);
|
||||
|
||||
if (!loadedItem) {
|
||||
this.navigateToRoot();
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -15,6 +15,7 @@ import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dial
|
||||
import { ServerConfigResource } from '@cloudbeaver/core-root';
|
||||
|
||||
import { CreateConnectionService } from './CreateConnectionService.js';
|
||||
import { CachedMapAllKey, getCachedDataResourceLoaderState, getCachedMapResourceLoaderState } from '@cloudbeaver/core-resource';
|
||||
|
||||
export interface IConnectionDetailsPlaceholderProps {
|
||||
connection: DatabaseConnection;
|
||||
@@ -69,6 +70,10 @@ export class ConnectionsAdministrationService extends Bootstrap {
|
||||
canDeActivate: this.canDeActivateCreate.bind(this),
|
||||
},
|
||||
],
|
||||
getLoader: () => [
|
||||
getCachedDataResourceLoaderState(this.serverConfigResource, () => undefined),
|
||||
getCachedMapResourceLoaderState(this.connectionInfoResource, () => CachedMapAllKey),
|
||||
],
|
||||
isHidden: () => this.serverConfigResource.distributed || !this.connectionInfoResource.values.some(connection => connection.template),
|
||||
getContentComponent: () => ConnectionsAdministration,
|
||||
getDrawerComponent: () => ConnectionsDrawerItem,
|
||||
|
||||
Reference in New Issue
Block a user