Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CB-5431 Easy config steps are available via url without a license #2850

Merged
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
0719adc
CB-5431 fixes redirects on unavailable pages during easy config
sergeyteleshev Aug 16, 2024
126e47b
CB-5431 cleanup
sergeyteleshev Aug 19, 2024
d7c01a6
Merge branch 'devel' into CB-5431-easy-config-steps-are-available-via…
sergeyteleshev Aug 20, 2024
0211f91
Revert "CB-5431 cleanup"
sergeyteleshev Aug 20, 2024
a4c97e2
Revert "CB-5431 fixes redirects on unavailable pages during easy config"
sergeyteleshev Aug 20, 2024
50791c4
chore: Add ConfigurationWizardScreenService to core-administration ma…
sergeyteleshev Aug 20, 2024
503f177
fix: Handle non-existing pages during route change in AdministrationS…
sergeyteleshev Aug 20, 2024
8f76b63
CB-5431 pr fix
sergeyteleshev Aug 20, 2024
2fb82fa
Merge branch 'devel' into CB-5431-easy-config-steps-are-available-via…
sergeyteleshev Aug 21, 2024
56bbd89
CB-5431 cleanup
sergeyteleshev Aug 21, 2024
f962442
feat: Remove unused import in AdministrationScreenService
sergeyteleshev Aug 22, 2024
ca07f50
Merge branch 'devel' into CB-5431-easy-config-steps-are-available-via…
EvgeniaBzzz Aug 22, 2024
5331fc1
Merge branch 'devel' into CB-5431-easy-config-steps-are-available-via…
mr-anton-t Aug 23, 2024
6af281b
Merge branch 'devel' into CB-5431-easy-config-steps-are-available-via…
dariamarutkina Aug 23, 2024
d8f4423
Fix issue with loading server configuration on non-admin screens
sergeyteleshev Aug 23, 2024
32c0a59
Merge branch 'devel' into CB-5431-easy-config-steps-are-available-via…
dariamarutkina Aug 23, 2024
df178be
chore: code style
Wroud Aug 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Executor, IExecutor } from '@cloudbeaver/core-executor';
import { EAdminPermission, PermissionsService, ServerConfigResource, SessionPermissionsResource } from '@cloudbeaver/core-root';
import { RouterState, ScreenService } from '@cloudbeaver/core-routing';
import { StorageService } from '@cloudbeaver/core-storage';
import { DefaultValueGetter, GlobalConstants, MetadataMap, schema } from '@cloudbeaver/core-utils';
import { DefaultValueGetter, GlobalConstants, isNotNullDefined, MetadataMap, schema } from '@cloudbeaver/core-utils';

import { AdministrationItemService } from '../AdministrationItem/AdministrationItemService';
import type { IAdministrationItemRoute } from '../AdministrationItem/IAdministrationItemRoute';
Expand Down Expand Up @@ -111,6 +111,18 @@ export class AdministrationScreenService {
this.permissionsResource.onDataUpdate.addPostHandler(() => {
this.checkPermissions(this.screenService.routerService.state);
});

this.screenService.routeChange.addHandler(this.onRouteChange.bind(this));
}

private async onRouteChange() {
const isExistingPage =
isNotNullDefined(this.activeScreen?.item) &&
isNotNullDefined(this.administrationItemService.items.find(page => page.name === this.activeScreen?.item));

if (!isExistingPage) {
this.navigateToRoot();
}
}

getRouteName(item?: string, sub?: string, param?: string) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { Dependency, injectable } from '@cloudbeaver/core-di';
import { ServerConfigResource } from '@cloudbeaver/core-root';
import { ScreenService } from '@cloudbeaver/core-routing';
import { isNotNullDefined } from '@cloudbeaver/core-utils';

import { AdministrationScreenService } from '../AdministrationScreenService';
import { ConfigurationWizardService } from './ConfigurationWizardService';

@injectable()
export class ConfigurationWizardScreenService extends Dependency {
constructor(
private readonly administrationScreenService: AdministrationScreenService,
private readonly screenService: ScreenService,
private readonly serverConfigResource: ServerConfigResource,
private readonly configurationWizardService: ConfigurationWizardService,
) {
super();
this.screenService.routeChange.addHandler(this.onRouteChange.bind(this));
}

private async onRouteChange() {
await this.serverConfigResource.load();

if (!this.serverConfigResource.data?.configurationMode) {
return;
}
Wroud marked this conversation as resolved.
Show resolved Hide resolved

const isCurrentStepAvailable =
isNotNullDefined(this.configurationWizardService.currentStep) &&
this.configurationWizardService.isStepAvailable(this.configurationWizardService.currentStep.name);

if (!isCurrentStepAvailable) {
this.administrationScreenService.navigateToRoot();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ export class ConfigurationWizardService {
}

isStepAvailable(name: string): boolean {
if (this.currentStep?.name === name) {
return true;
}

for (const step of this.steps) {
if (step.name === name) {
return true;
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-administration/src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const coreAdministrationManifest: PluginManifest = {
() => import('./PermissionsResource').then(m => m.PermissionsResource),
() => import('./AdministrationScreen/AdministrationScreenService').then(m => m.AdministrationScreenService),
() => import('./AdministrationScreen/ConfigurationWizard/ConfigurationWizardService').then(m => m.ConfigurationWizardService),
() => import('./AdministrationScreen/ConfigurationWizard/ConfigurationWizardScreenService').then(m => m.ConfigurationWizardScreenService),
() => import('./AdministrationLocaleService').then(m => m.AdministrationLocaleService),
],
};
Loading