From 01d08fc3ce7ea8b59b0ff50b508bc91477b17f64 Mon Sep 17 00:00:00 2001 From: sergeyteleshev Date: Mon, 30 Sep 2024 10:13:06 +0200 Subject: [PATCH 1/2] =?UTF-8?q?CB-5709=20user=20create=20button=20in=20set?= =?UTF-8?q?tings=20preloads=20required=20reso=E2=80=A6=20(#2936)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * CB-5709 hotfix: user create button in settings preloads required resources * CB-5709 inverts logic * CB-5709 fixes tab for TE * CB-5709 fix for origin info form --- .../UserForm/Origin/UserFormOriginInfoPanel.tsx | 16 ++++++++++++---- .../Origin/UserFormOriginPartBootstrap.ts | 6 +----- .../Users/UsersTable/CreateUserBootstrap.ts | 7 ++++--- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Origin/UserFormOriginInfoPanel.tsx b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Origin/UserFormOriginInfoPanel.tsx index 353a370913..1b07d91b50 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Origin/UserFormOriginInfoPanel.tsx +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Origin/UserFormOriginInfoPanel.tsx @@ -5,6 +5,7 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import { observable } from 'mobx'; import { observer } from 'mobx-react-lite'; import { Fragment } from 'react'; @@ -17,13 +18,14 @@ import { Group, GroupItem, ObjectPropertyInfoForm, + useObservableRef, useResource, useTranslate, } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; -import { FormMode, type TabContainerPanelComponent, useTab, useTabState } from '@cloudbeaver/core-ui'; +import { FormMode, type TabContainerPanelComponent, useTab } from '@cloudbeaver/core-ui'; import type { UserFormProps } from '../AdministrationUserFormService.js'; @@ -39,9 +41,15 @@ export const UserFormOriginInfoPanel: TabContainerPanelComponent }) { const translate = useTranslate(); const editing = mode === FormMode.Edit; - const localState = useTabState(() => ({ - selectedOrigin: '0', - })); + const localState = useObservableRef( + () => ({ + selectedOrigin: '0', + }), + { + selectedOrigin: observable.ref, + }, + false, + ); const userInfoLoader = useResource(UserFormOriginInfoPanel, UsersResource, state.userId, { active: editing, }); diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Origin/UserFormOriginPartBootstrap.ts b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Origin/UserFormOriginPartBootstrap.ts index b04ff82546..173f07549c 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Origin/UserFormOriginPartBootstrap.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Origin/UserFormOriginPartBootstrap.ts @@ -7,7 +7,6 @@ */ import React from 'react'; -import { UsersResource } from '@cloudbeaver/core-authentication'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { FormMode } from '@cloudbeaver/core-ui'; @@ -25,10 +24,7 @@ const UserFormOriginInfoTab = React.lazy(async () => { @injectable() export class UserFormOriginPartBootstrap extends Bootstrap { - constructor( - private readonly administrationUserFormService: AdministrationUserFormService, - private readonly usersResource: UsersResource, - ) { + constructor(private readonly administrationUserFormService: AdministrationUserFormService) { super(); } diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UsersTable/CreateUserBootstrap.ts b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UsersTable/CreateUserBootstrap.ts index d9d393a554..091ac18c5f 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UsersTable/CreateUserBootstrap.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UsersTable/CreateUserBootstrap.ts @@ -38,10 +38,11 @@ export class CreateUserBootstrap extends Bootstrap { this.actionService.addHandler({ id: 'users-table-base', + menus: [MENU_USERS_ADMINISTRATION], actions: [ACTION_CREATE], - isActionApplicable: (context, action) => { - if (action === ACTION_CREATE && !this.administrationUsersManagementService.externalUserProviderEnabled) { - return this.authProvidersResource.has(AUTH_PROVIDER_LOCAL_ID); + isHidden: (context, action) => { + if (action === ACTION_CREATE) { + return this.administrationUsersManagementService.externalUserProviderEnabled || !this.authProvidersResource.has(AUTH_PROVIDER_LOCAL_ID); } return false; From 38445f3843912d6aa2e6bb87fdcf73e68beac457 Mon Sep 17 00:00:00 2001 From: alex <48489896+devnaumov@users.noreply.github.com> Date: Mon, 30 Sep 2024 10:14:18 +0200 Subject: [PATCH 2/2] CB-5636 fix resource lag (#2942) Co-authored-by: Evgenia Bezborodova <139753579+EvgeniaBzzz@users.noreply.github.com> --- webapp/packages/core-blocks/src/Slide/SlideElement.module.css | 4 ++-- webapp/packages/core-connections/src/DBDriverResource.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/packages/core-blocks/src/Slide/SlideElement.module.css b/webapp/packages/core-blocks/src/Slide/SlideElement.module.css index a12f0a1f81..86b9518fec 100644 --- a/webapp/packages/core-blocks/src/Slide/SlideElement.module.css +++ b/webapp/packages/core-blocks/src/Slide/SlideElement.module.css @@ -11,11 +11,11 @@ display: inline-block; vertical-align: top; white-space: normal; - transition: transform cubic-bezier(0.4, 0, 0.2, 1) 0.6s; + transition: transform ease-in-out 0.4s; transform: translateX(-100%); &:first-child { - transition: width cubic-bezier(0.4, 0, 0.2, 1) 0.6s; + transition: width ease-in-out 0.4s; width: 100%; } } diff --git a/webapp/packages/core-connections/src/DBDriverResource.ts b/webapp/packages/core-connections/src/DBDriverResource.ts index b961c0c4fd..e56aa5f08a 100644 --- a/webapp/packages/core-connections/src/DBDriverResource.ts +++ b/webapp/packages/core-connections/src/DBDriverResource.ts @@ -87,7 +87,7 @@ export class DBDriverResource extends CachedMapResource