diff --git a/webapp/packages/core-authentication/src/AuthProvidersResource.ts b/webapp/packages/core-authentication/src/AuthProvidersResource.ts index 4056802585..a17f5c53c3 100644 --- a/webapp/packages/core-authentication/src/AuthProvidersResource.ts +++ b/webapp/packages/core-authentication/src/AuthProvidersResource.ts @@ -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; export type AuthProviderConfiguration = NonNullable; @@ -31,8 +31,13 @@ export class AuthProvidersResource extends CachedMapResource 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, @@ -64,7 +69,7 @@ export class AuthProvidersResource extends CachedMapResource = IFormPr readonly parts: TabsContainer; readonly actionsContainer: PlaceholderContainer; - readonly onConfigure: IExecutorHandlersCollection>; - readonly onFillDefaultConfig: IExecutorHandlersCollection>; - readonly onPrepareConfig: IExecutorHandlersCollection; readonly onFormat: IExecutorHandlersCollection>; readonly onValidate: IExecutorHandlersCollection>; readonly onSubmit: IExecutorHandlersCollection>; + readonly onLoaded: IExecutorHandlersCollection>; readonly onState: IExecutorHandlersCollection; constructor( @@ -35,17 +33,12 @@ export class FormBaseService = 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); } diff --git a/webapp/packages/core-ui/src/Form/FormPart.ts b/webapp/packages/core-ui/src/Form/FormPart.ts index 031a59e35c..65f78ff32d 100644 --- a/webapp/packages/core-ui/src/Form/FormPart.ts +++ b/webapp/packages/core-ui/src/Form/FormPart.ts @@ -127,6 +127,7 @@ export abstract class FormPart 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 { diff --git a/webapp/packages/core-ui/src/Form/FormState.ts b/webapp/packages/core-ui/src/Form/FormState.ts index 7bf9e76bf8..25bcc384d3 100644 --- a/webapp/packages/core-ui/src/Form/FormState.ts +++ b/webapp/packages/core-ui/src/Form/FormState.ts @@ -44,7 +44,7 @@ export class FormState implements IFormState { readonly dataContext: IDataContext; readonly formStateTask: IExecutor; - readonly fillDefaultConfigTask: IExecutor>; + readonly loadedTask: IExecutor>; readonly submitTask: IExecutor>; readonly formatTask: IExecutor>; readonly validationTask: IExecutor>; @@ -66,8 +66,8 @@ export class FormState implements IFormState { this.formStateTask = new Executor(state, () => true); this.formStateTask.addCollection(service.onState).addPostHandler(this.updateFormState.bind(this)); - this.fillDefaultConfigTask = new Executor(this as IFormState, () => true); - this.fillDefaultConfigTask.addCollection(service.onFillDefaultConfig).next(this.formStateTask, form => form.state); + this.loadedTask = new Executor(this as IFormState, () => true); + this.loadedTask.addCollection(service.onLoaded).next(this.formStateTask).addPostHandler(this.onLoadedHandler.bind(this)); this.formatTask = new Executor(this as IFormState, () => true); this.formatTask.addCollection(service.onFormat); @@ -82,7 +82,7 @@ export class FormState implements IFormState { this.dataContext.set(DATA_CONTEXT_FORM_STATE, this, this.id); dataContextAddDIProvider(this.dataContext, serviceProvider, this.id); - makeObservable(this, { + makeObservable(this, { mode: observable, parts: observable.ref, promise: observable.ref, @@ -93,6 +93,7 @@ export class FormState implements IFormState { setMode: action, setPartsState: action, setState: action, + updateFormState: action, isChanged: computed, partsValues: computed[]>({ equals: isArraysEqual, @@ -182,6 +183,15 @@ export class FormState implements IFormState { return false; } + private onLoadedHandler(data: IFormState, contexts: IExecutionContextProvider>): void { + for (const part of this.parts.values()) { + if (!part.isLoaded()) { + ExecutorInterrupter.interrupt(contexts); + return; + } + } + } + private updateFormState(data: TState, contexts: IExecutionContextProvider): void { const context = contexts.getContext(formStateContext); diff --git a/webapp/packages/core-ui/src/Form/IFormState.ts b/webapp/packages/core-ui/src/Form/IFormState.ts index 7bb4132074..4b30e0589b 100644 --- a/webapp/packages/core-ui/src/Form/IFormState.ts +++ b/webapp/packages/core-ui/src/Form/IFormState.ts @@ -30,8 +30,8 @@ export interface IFormState { readonly statusMessage: string | string[] | null; readonly statusType: ENotificationType | null; + readonly loadedTask: IExecutor>; readonly formStateTask: IExecutor; - readonly fillDefaultConfigTask: IExecutor>; readonly submitTask: IExecutor>; readonly formatTask: IExecutor>; readonly validationTask: IExecutor>; diff --git a/webapp/packages/plugin-administration/src/index.ts b/webapp/packages/plugin-administration/src/index.ts index 0aab2652e4..cec5d64acc 100644 --- a/webapp/packages/plugin-administration/src/index.ts +++ b/webapp/packages/plugin-administration/src/index.ts @@ -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'; diff --git a/webapp/packages/plugin-authentication-administration/src/locales/en.ts b/webapp/packages/plugin-authentication-administration/src/locales/en.ts index ad0780f4be..4e61e5157e 100644 --- a/webapp/packages/plugin-authentication-administration/src/locales/en.ts +++ b/webapp/packages/plugin-authentication-administration/src/locales/en.ts @@ -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'], diff --git a/webapp/packages/plugin-authentication-administration/src/locales/fr.ts b/webapp/packages/plugin-authentication-administration/src/locales/fr.ts index 276217c574..c9351c4be1 100644 --- a/webapp/packages/plugin-authentication-administration/src/locales/fr.ts +++ b/webapp/packages/plugin-authentication-administration/src/locales/fr.ts @@ -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'], diff --git a/webapp/packages/plugin-authentication-administration/src/locales/ru.ts b/webapp/packages/plugin-authentication-administration/src/locales/ru.ts index bad87efebe..70e9a8873a 100644 --- a/webapp/packages/plugin-authentication-administration/src/locales/ru.ts +++ b/webapp/packages/plugin-authentication-administration/src/locales/ru.ts @@ -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', 'Удалить выбранные конфигурации'], diff --git a/webapp/packages/plugin-authentication-administration/src/locales/zh.ts b/webapp/packages/plugin-authentication-administration/src/locales/zh.ts index d2818eb3de..56a7fb058e 100644 --- a/webapp/packages/plugin-authentication-administration/src/locales/zh.ts +++ b/webapp/packages/plugin-authentication-administration/src/locales/zh.ts @@ -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', '登录'], @@ -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', '删除选中配置'],