mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
* dbeaver/pro#6056 adds boilerplate for new combobox ui kit
* removes unused code
* refactors layout
* fixes theme styles
* fixes styles
* fixes search value
* implements ui kit store instead of menu
* reverts search value changes
* fixes search
* cleanup
* adds ellipsis on select items
* selectField supports required for form validations
* adds types for functions
* adds disabled styles
* removes hover border-color for disabled select
* removes popoverProps
* moves some styles from kit select to combobox + fixes some styles
* fixes for QA
* adds custom paddings as it was before refactoring
* fixes item styles, placeholder, title errors
* fixes focus styles for input
* fixes expanded state focus
* splits to Select and Combobox
* removes unused code for select
* pr fixes
* replaces arrow icon + opens select on label click
* fixes click on label
* Revert "fixes click on label"
This reverts commit 772c988b28.
* reverts select label
* removes 1/3 width for preferences
* removes border radius from top of the navigation tab
* fixes selection element
* removes double select border
* qa fixes
* fixes border-radius and outline-offset for select
* fixes outline
* fixes colors
---------
Co-authored-by: mr-anton-t <42037741+mr-anton-t@users.noreply.github.com>
65 lines
2.2 KiB
TypeScript
65 lines
2.2 KiB
TypeScript
/*
|
|
* CloudBeaver - Cloud Database Manager
|
|
* Copyright (C) 2020-2025 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 { observer } from 'mobx-react-lite';
|
|
|
|
import type { AuthProvider, AuthProviderConfiguration, IAuthCredentials } from '@cloudbeaver/core-authentication';
|
|
import { Select, Group, InputField, useFocus } from '@cloudbeaver/core-blocks';
|
|
|
|
interface Props {
|
|
provider: AuthProvider;
|
|
configuration: AuthProviderConfiguration | null;
|
|
credentials: IAuthCredentials;
|
|
authenticate: boolean;
|
|
}
|
|
|
|
export const AuthProviderForm = observer<Props>(function AuthProviderForm({ provider, configuration, credentials, authenticate }) {
|
|
const [elementRef] = useFocus<HTMLDivElement>({ focusFirstChild: true });
|
|
|
|
function handleProfileSelect() {
|
|
credentials.credentials = {};
|
|
}
|
|
|
|
const profile = provider.credentialProfiles[credentials.profile as any as number]!;
|
|
|
|
return (
|
|
<Group ref={elementRef} gap small center>
|
|
{provider.credentialProfiles.length > 1 && (
|
|
<Select
|
|
name="profile"
|
|
state={credentials}
|
|
items={provider.credentialProfiles}
|
|
keySelector={(value, index) => index + ''}
|
|
valueSelector={value => value.label!}
|
|
titleSelector={value => value.description}
|
|
defaultValue="0"
|
|
disabled={authenticate}
|
|
onSelect={handleProfileSelect}
|
|
/>
|
|
)}
|
|
{profile.credentialParameters.map(
|
|
parameter =>
|
|
parameter.user && (
|
|
<InputField
|
|
key={`${provider.id}${configuration?.id ?? ''}${parameter.id}`}
|
|
required={provider.required}
|
|
title={parameter.description}
|
|
type={parameter.encryption === 'none' ? 'text' : 'password'}
|
|
name={parameter.id}
|
|
state={credentials.credentials}
|
|
readOnly={authenticate}
|
|
canShowPassword={false}
|
|
autoComplete={`section-authentication section-${provider.id} ${configuration?.id ?? ''} ${parameter.id}`}
|
|
>
|
|
{parameter.displayName}
|
|
</InputField>
|
|
),
|
|
)}
|
|
</Group>
|
|
);
|
|
});
|