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-5625 Show only enabled identity providers in configuration section #2927

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
4b2ac99
CB-5625 makes create auth providers list include only enabled auth pr…
sergeyteleshev Sep 19, 2024
c577a72
Revert "CB-5625 makes create auth providers list include only enabled…
sergeyteleshev Sep 20, 2024
3738864
Merge branch 'devel' into CB-5625-show-only-enabled-identity-provider…
sergeyteleshev Sep 20, 2024
a3d06b5
Merge branch 'devel' into CB-5625-show-only-enabled-identity-provider…
sergeyteleshev Sep 23, 2024
f4f0cf1
CB-5625 adds disabled providers logic to identity providers
sergeyteleshev Sep 23, 2024
0fdcada
CB-5625 refactors form loaded task
sergeyteleshev Sep 24, 2024
284bfae
CB-5625 adds link for redirect to the server configuration settings
sergeyteleshev Sep 24, 2024
ef6a8b2
СB-5625 cleanup
sergeyteleshev Sep 24, 2024
24af81f
CB-5625 moves message to the top of the auth providers page
sergeyteleshev Sep 24, 2024
4b6f3be
CB-5625 pr fixes
sergeyteleshev Sep 25, 2024
a8ff431
CB-5625 cleanup
sergeyteleshev Sep 25, 2024
0178e58
Merge branch 'devel' into CB-5625-show-only-enabled-identity-provider…
sergeyteleshev Sep 25, 2024
995850b
CB-5578 pr fixes
sergeyteleshev Sep 25, 2024
37aebc8
Merge branch 'devel' into CB-5625-show-only-enabled-identity-provider…
EvgeniaBzzz Sep 26, 2024
beecd84
Merge branch 'devel' into CB-5625-show-only-enabled-identity-provider…
sergeyteleshev Sep 26, 2024
01d6674
CB-5625 adds tip for create identity provider table
sergeyteleshev Sep 26, 2024
c56e0e2
Merge branch 'devel' into CB-5625-show-only-enabled-identity-provider…
sergeyteleshev Sep 26, 2024
18f0b05
CB-5625 reverts tip message
sergeyteleshev Sep 26, 2024
8548b9c
Merge branch 'devel' into CB-5625-show-only-enabled-identity-provider…
EvgeniaBzzz Sep 27, 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
11 changes: 8 additions & 3 deletions webapp/packages/core-authentication/src/AuthProvidersResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import {
} from '@cloudbeaver/core-resource';
import { ServerConfigResource } from '@cloudbeaver/core-root';
import { type AuthProviderConfigurationInfoFragment, type AuthProviderInfoFragment, GraphQLService } from '@cloudbeaver/core-sdk';
import { isNotNullDefined } from '@cloudbeaver/core-utils';

import { AuthConfigurationsResource } from './AuthConfigurationsResource.js';
import { AuthSettingsService } from './AuthSettingsService.js';

export type AuthProvider = NonNullable<AuthProviderInfoFragment>;
export type AuthProviderConfiguration = NonNullable<AuthProviderConfigurationInfoFragment>;
Expand All @@ -31,8 +31,13 @@ export class AuthProvidersResource extends CachedMapResource<string, AuthProvide
return this.values.filter(provider => provider.configurable);
}

get enabledConfigurableAuthProviders(): AuthProvider[] {
const enabledProviders = new Set(this.serverConfigResource.data?.enabledAuthProviders);

return this.configurable.filter(provider => enabledProviders.has(provider.id));
}

constructor(
private readonly authSettingsService: AuthSettingsService,
private readonly graphQLService: GraphQLService,
private readonly serverConfigResource: ServerConfigResource,
private readonly authConfigurationsResource: AuthConfigurationsResource,
Expand Down Expand Up @@ -64,7 +69,7 @@ export class AuthProvidersResource extends CachedMapResource<string, AuthProvide
}

getEnabledProviders(): AuthProvider[] {
return this.get(resourceKeyList(this.serverConfigResource.enabledAuthProviders)) as AuthProvider[];
return this.get(resourceKeyList(this.serverConfigResource.enabledAuthProviders)).filter(isNotNullDefined);
}

isEnabled(id: string): boolean {
Expand Down
11 changes: 2 additions & 9 deletions webapp/packages/core-ui/src/Form/FormBaseService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ export class FormBaseService<TState, TProps extends IFormProps<TState> = IFormPr
readonly parts: TabsContainer<TProps>;
readonly actionsContainer: PlaceholderContainer<TProps>;

readonly onConfigure: IExecutorHandlersCollection<IFormState<TState>>;
readonly onFillDefaultConfig: IExecutorHandlersCollection<IFormState<TState>>;
readonly onPrepareConfig: IExecutorHandlersCollection<TState>;
readonly onFormat: IExecutorHandlersCollection<IFormState<TState>>;
readonly onValidate: IExecutorHandlersCollection<IFormState<TState>>;
readonly onSubmit: IExecutorHandlersCollection<IFormState<TState>>;
readonly onLoaded: IExecutorHandlersCollection<IFormState<TState>>;
readonly onState: IExecutorHandlersCollection<TState>;

constructor(
Expand All @@ -35,17 +33,12 @@ export class FormBaseService<TState, TProps extends IFormProps<TState> = IFormPr
) {
this.parts = new TabsContainer(name);
this.actionsContainer = new PlaceholderContainer();
this.onConfigure = new ExecutorHandlersCollection();
this.onFillDefaultConfig = new ExecutorHandlersCollection();
this.onPrepareConfig = new ExecutorHandlersCollection();
this.onFormat = new ExecutorHandlersCollection();
this.onValidate = new ExecutorHandlersCollection();
this.onSubmit = new ExecutorHandlersCollection();
this.onLoaded = new ExecutorHandlersCollection();
this.onState = new ExecutorHandlersCollection();

this.onSubmit.before(this.onPrepareConfig);
this.onState.before(this.onPrepareConfig);

this.onSubmit.addPostHandler(this.handleSubmittingStatus);
this.onValidate.addPostHandler(this.handleValidation);
}
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-ui/src/Form/FormPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export abstract class FormPart<TPartState, TFormState = any> implements IFormPar
await this.promise;
this.loaded = true;
this.exception = null;
await this.formState.loadedTask.execute(this.formState);
} catch (exception: any) {
this.exception = exception;
} finally {
Expand Down
18 changes: 14 additions & 4 deletions webapp/packages/core-ui/src/Form/FormState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class FormState<TState> implements IFormState<TState> {
readonly dataContext: IDataContext;

readonly formStateTask: IExecutor<TState>;
readonly fillDefaultConfigTask: IExecutor<IFormState<TState>>;
readonly loadedTask: IExecutor<IFormState<TState>>;
readonly submitTask: IExecutor<IFormState<TState>>;
readonly formatTask: IExecutor<IFormState<TState>>;
readonly validationTask: IExecutor<IFormState<TState>>;
Expand All @@ -66,8 +66,8 @@ export class FormState<TState> implements IFormState<TState> {
this.formStateTask = new Executor<TState>(state, () => true);
this.formStateTask.addCollection(service.onState).addPostHandler(this.updateFormState.bind(this));

this.fillDefaultConfigTask = new Executor(this as IFormState<TState>, () => true);
this.fillDefaultConfigTask.addCollection(service.onFillDefaultConfig).next(this.formStateTask, form => form.state);
this.loadedTask = new Executor(this as IFormState<TState>, () => true);
this.loadedTask.addCollection(service.onLoaded).next(this.formStateTask).addPostHandler(this.onLoadedHandler.bind(this));

this.formatTask = new Executor(this as IFormState<TState>, () => true);
this.formatTask.addCollection(service.onFormat);
Expand All @@ -82,7 +82,7 @@ export class FormState<TState> implements IFormState<TState> {
this.dataContext.set(DATA_CONTEXT_FORM_STATE, this, this.id);
dataContextAddDIProvider(this.dataContext, serviceProvider, this.id);

makeObservable<this>(this, {
makeObservable<this, 'updateFormState'>(this, {
mode: observable,
parts: observable.ref,
promise: observable.ref,
Expand All @@ -93,6 +93,7 @@ export class FormState<TState> implements IFormState<TState> {
setMode: action,
setPartsState: action,
setState: action,
updateFormState: action,
isChanged: computed,
partsValues: computed<IFormPart<any>[]>({
equals: isArraysEqual,
Expand Down Expand Up @@ -182,6 +183,15 @@ export class FormState<TState> implements IFormState<TState> {
return false;
}

private onLoadedHandler(data: IFormState<TState>, contexts: IExecutionContextProvider<IFormState<TState>>): void {
for (const part of this.parts.values()) {
if (!part.isLoaded()) {
ExecutorInterrupter.interrupt(contexts);
return;
}
}
}

private updateFormState(data: TState, contexts: IExecutionContextProvider<TState>): void {
const context = contexts.getContext(formStateContext);

Expand Down
2 changes: 1 addition & 1 deletion webapp/packages/core-ui/src/Form/IFormState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export interface IFormState<TState> {
readonly statusMessage: string | string[] | null;
readonly statusType: ENotificationType | null;

readonly loadedTask: IExecutor<IFormState<TState>>;
readonly formStateTask: IExecutor<TState>;
readonly fillDefaultConfigTask: IExecutor<IFormState<TState>>;
readonly submitTask: IExecutor<IFormState<TState>>;
readonly formatTask: IExecutor<IFormState<TState>>;
readonly validationTask: IExecutor<IFormState<TState>>;
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/plugin-administration/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ export * from './ConfigurationWizard/ServerConfiguration/Form/ServerConfiguratio
export * from './ConfigurationWizard/ServerConfiguration/IServerConfigurationPageState.js';
export * from './ConfigurationWizard/ServerConfiguration/ServerConfigurationService.js';
export * from './ConfigurationWizard/ServerConfigurationAdministrationNavService.js';
export * from './ConfigurationWizard/ServerConfiguration/ADMINISTRATION_SERVER_CONFIGURATION_ITEM.js';
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export default [
['administration_identity_providers_wizard_description', 'Add identity providers'],
['administration_identity_providers_configuration_add', 'Configuration creation'],
['administration_identity_providers_choose_provider_placeholder', 'Select provider...'],
['administration_identity_providers_choose_provider_placeholder_empty', 'No available providers'],
['administration_identity_providers_add_tooltip', 'Add new configuration'],
['administration_identity_providers_refresh_tooltip', 'Refresh configuration list'],
['administration_identity_providers_delete_tooltip', 'Delete selected configurations'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export default [
['administration_identity_providers_wizard_description', "Ajouter des fournisseurs d'identité"],
['administration_identity_providers_configuration_add', 'Création de configuration'],
['administration_identity_providers_choose_provider_placeholder', 'Sélectionner un fournisseur...'],
['administration_identity_providers_choose_provider_placeholder_empty', 'No available providers'],
['administration_identity_providers_add_tooltip', 'Ajouter une nouvelle configuration'],
['administration_identity_providers_refresh_tooltip', 'Rafraîchir la liste des configurations'],
['administration_identity_providers_delete_tooltip', 'Supprimer les configurations sélectionnées'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export default [
['administration_identity_providers_wizard_description', 'Добавьте провайдеры идентификации'],
['administration_identity_providers_configuration_add', 'Создание конфигурации'],
['administration_identity_providers_choose_provider_placeholder', 'Выберите провайдер...'],
['administration_identity_providers_choose_provider_placeholder_empty', 'Нет доступных провайдеров'],
['administration_identity_providers_add_tooltip', 'Добавить новую конфигурацию'],
['administration_identity_providers_refresh_tooltip', 'Обновить список конфигураций'],
['administration_identity_providers_delete_tooltip', 'Удалить выбранные конфигурации'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ export default [

['authentication_administration_user_delete_credentials_error', '删除用户凭证失败'],
['authentication_administration_user_delete_credentials_success', '用户凭证已移除'],
[
'authentication_administration_user_delete_credentials_confirmation_message',
'确定要从“{arg:userId}”中删除“{arg:originName}”身份验证方法吗?',
],
['authentication_administration_user_delete_credentials_confirmation_message', '确定要从“{arg:userId}”中删除“{arg:originName}”身份验证方法吗?'],

['administration_configuration_wizard_configuration_admin', '管理员凭据'],
['administration_configuration_wizard_configuration_admin_name', '登录'],
Expand Down Expand Up @@ -91,6 +88,7 @@ export default [
['administration_identity_providers_wizard_description', '添加身份提供者'],
['administration_identity_providers_configuration_add', '创建配置'],
['administration_identity_providers_choose_provider_placeholder', '选择提供者...'],
['administration_identity_providers_choose_provider_placeholder_empty', 'No available providers'],
['administration_identity_providers_add_tooltip', '添加新配置'],
['administration_identity_providers_refresh_tooltip', '刷新配置列表'],
['administration_identity_providers_delete_tooltip', '删除选中配置'],
Expand Down