Merge branch 'devel' of https://github.com/dbeaver/cloudbeaver into devel

This commit is contained in:
Wroud
2021-10-06 19:05:14 +03:00
4 changed files with 21 additions and 2 deletions
@@ -299,4 +299,11 @@
<rect width="32" height="32" fill="transparent"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 1H22V3H29.077H30V5H28.9229L27.1346 28.2216C27.0186 29.7882 25.7137 31 24.1428 31H7.85748C6.28661 31 4.98172 29.7882 4.86568 28.2216L3.07736 5H2V3H2.92334H10V1ZM5.07697 5L6.86022 28.0739C6.8989 28.5961 7.33386 29 7.85748 29H24.1428C24.6664 29 25.1014 28.5961 25.1401 28.0739L26.9233 5H5.07697ZM14 26L14 8H12L12 26H14ZM21 8L21 26H19V8H21Z" fill="#338ECC"/>
</symbol>
<symbol id="copy" viewBox="0 0 32 32">
<g id="copy" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="ic_content_copy_black_24px-(2)" transform="translate(3.000000, 1.000000)" fill="#338ECC" fill-rule="nonzero">
<path d="M19.4446253,0.501699942 L3.33438223,0.501699942 C1.85760995,0.501699942 0.649341725,1.70996817 0.649341725,3.18674045 L0.649341725,21.982024 L3.33438223,21.982024 L3.33438223,3.18674045 L19.4446253,3.18674045 L19.4446253,0.501699942 Z M23.4721861,5.87178096 L8.70446325,5.87178096 C7.22769097,5.87178096 6.01942274,7.08004919 6.01942274,8.55682147 L6.01942274,27.352105 C6.01942274,28.8288773 7.22769097,30.0371455 8.70446325,30.0371455 L23.4721861,30.0371455 C24.9489583,30.0371455 26.1572266,28.8288773 26.1572266,27.352105 L26.1572266,8.55682147 C26.1572266,7.08004919 24.9489583,5.87178096 23.4721861,5.87178096 Z M23.4721861,27.352105 L8.70446325,27.352105 L8.70446325,8.55682147 L23.4721861,8.55682147 L23.4721861,27.352105 Z" id="Shape"></path>
</g>
</g>
</symbol>
</svg>

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 34 KiB

@@ -65,6 +65,7 @@ type BaseProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' |
mod?: 'surface';
ref?: React.Ref<HTMLInputElement>;
style?: ComponentStyle;
onCustomCopy?: () => void;
};
type ControlledProps = BaseProps & {
@@ -112,6 +113,7 @@ export const InputFieldNew: InputFieldType = observer(function InputFieldNew({
tiny,
autoHide,
onChange,
onCustomCopy,
...rest
}: ControlledProps | ObjectProps<any, any>, ref: React.Ref<HTMLInputElement>) {
const [passwordRevealed, setPasswordRevealed] = useState(false);
@@ -183,6 +185,11 @@ export const InputFieldNew: InputFieldType = observer(function InputFieldNew({
/>
</icon-container>
)}
{onCustomCopy && (
<icon-container title={translate('ui_copy_to_clipboard')} onClick={onCustomCopy}>
<Icon name="copy" viewBox='0 0 32 32' />
</icon-container>
)}
</input-container>
{description && (
<field-description>
@@ -23,6 +23,6 @@ export function copyToClipboard(data: string): void {
document.body.removeChild(shadowElement);
if (activeElement instanceof HTMLElement) {
activeElement.focus();
activeElement.focus({ preventScroll: true });
}
}
@@ -14,7 +14,7 @@ import { AuthConfigurationParametersResource, AuthProvidersResource } from '@clo
import {
BASE_CONTAINERS_STYLES, ColoredContainer, ComboboxNew, FieldCheckboxNew, Group, GroupTitle,
InputFieldNew, Link, ObjectPropertyInfoFormNew, SubmittingForm, TabContainerPanelComponent,
TextareaNew, useMapResource, useObjectPropertyCategories
TextareaNew, useClipboard, useMapResource, useObjectPropertyCategories
} from '@cloudbeaver/core-blocks';
import { useTranslate } from '@cloudbeaver/core-localization';
import { AuthProviderConfigurationParametersFragment, CachedMapAllKey } from '@cloudbeaver/core-sdk';
@@ -37,6 +37,7 @@ export const AuthConfigurationOptions: TabContainerPanelComponent<IAuthConfigura
const formRef = useRef<HTMLFormElement>(null);
const translate = useTranslate();
const copy = useClipboard();
const style = useStyles(BASE_CONTAINERS_STYLES, styles);
const providers = useMapResource(AuthConfigurationOptions, AuthProvidersResource, CachedMapAllKey);
@@ -156,7 +157,9 @@ export const AuthConfigurationOptions: TabContainerPanelComponent<IAuthConfigura
state={state.config}
title={state.config.signInLink}
disabled={state.disabled}
autoHide
readOnly
onCustomCopy={() => copy(state.config.signInLink!, true)}
>
Sign in
</InputFieldNew>
@@ -165,7 +168,9 @@ export const AuthConfigurationOptions: TabContainerPanelComponent<IAuthConfigura
state={state.config}
title={state.config.signOutLink}
disabled={state.disabled}
autoHide
readOnly
onCustomCopy={() => copy(state.config.signOutLink!, true)}
>
Sign out
</InputFieldNew>