Skip to content

Commit

Permalink
Merge branch 'devel' into CB-4070-migrate-project-form-to-form-template
Browse files Browse the repository at this point in the history
  • Loading branch information
dariamarutkina authored Dec 9, 2024
2 parents 1296863 + 2357b0a commit 055145b
Show file tree
Hide file tree
Showing 9 changed files with 2,247 additions and 2,333 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,18 @@ public void importUsers(@NotNull SMUserImportList userImportList) throws DBExcep

protected void importUsers(@NotNull Connection connection, @NotNull SMUserImportList userImportList)
throws DBException, SQLException {
outer:
for (SMUserProvisioning user : userImportList.getUsers()) {
String authRole = user.getAuthRole() == null ? userImportList.getAuthRole() : user.getAuthRole();
if (isSubjectExists(user.getUserId())) {
log.info("User already exist : " + user.getUserId());
setUserAuthRole(connection, user.getUserId(), authRole);
enableUser(connection, user.getUserId(), true);
continue;
for (String possibleUserId : List.of(user.getUserId(), user.getUserId().toLowerCase())) {
if (isSubjectExists(possibleUserId)) {
log.info("User already exist : " + possibleUserId);
setUserAuthRole(connection, possibleUserId, authRole);
enableUser(connection, possibleUserId, true);
continue outer;
}
}
createUser(connection, user.getUserId(), user.getMetaParameters(), true, authRole);
createUser(connection, user.getUserId().toLowerCase(), user.getMetaParameters(), true, authRole);
}
}

Expand Down
3 changes: 2 additions & 1 deletion webapp/packages/core-blocks/src/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { observer } from 'mobx-react-lite';
import React, { forwardRef, useLayoutEffect, useRef, useState } from 'react';
import { MenuButton, type MenuInitialState, useMenuState } from 'reakit';
import type { ExtractHTMLAttributes } from 'reakit-utils';

import { ErrorBoundary } from '../ErrorBoundary.js';
import { s } from '../s.js';
Expand Down Expand Up @@ -141,7 +142,7 @@ export const Menu = observer<IMenuProps, HTMLButtonElement>(
{...props}
{...children.props}
>
{disclosureProps => React.cloneElement(children, { ...disclosureProps, ...children.props })}
{(disclosureProps: ExtractHTMLAttributes<any>) => React.cloneElement(children, { ...disclosureProps, ...children.props })}
</MenuButton>
<MenuPanel
ref={menuPanelRef}
Expand Down
3 changes: 2 additions & 1 deletion webapp/packages/core-blocks/src/MenuPanel/MenuTrigger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { computed } from 'mobx';
import { observer } from 'mobx-react-lite';
import React, { type ButtonHTMLAttributes, forwardRef, useCallback, useEffect, useMemo } from 'react';
import { Menu, MenuButton, type MenuInitialState, MenuItem, MenuItemCheckbox, MenuItemRadio, type MenuStateReturn, useMenuState } from 'reakit';
import type { ExtractHTMLAttributes } from 'reakit-utils';

import type { IMenuItem, IMenuPanel } from '@cloudbeaver/core-dialogs';

Expand Down Expand Up @@ -74,7 +75,7 @@ export const MenuTrigger = React.forwardRef<ButtonHTMLAttributes<any>, IMenuTrig
return (
<div className={s(style, { menuTrigger: true }, className)}>
<MenuButton ref={ref} className={s(style, { menuButton: true })} {...menu} {...props} {...children.props}>
{disclosureProps => React.cloneElement(children, disclosureProps)}
{(disclosureProps: ExtractHTMLAttributes<any>) => React.cloneElement(children, disclosureProps)}
</MenuButton>
{panel && <MenuPanel panel={panel} menu={menu} rtl={rtl} onItemClose={handleItemClose} />}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const webpack = require('webpack');
const httpProxy = require('http-proxy');
const { EsbuildPlugin } = require('esbuild-loader');
const fs = require('fs');
const { URL } = require('url');

const commonConfig = require('./webpack.config.js');
const ssoHtmlTemplate = require.resolve('@cloudbeaver/plugin-sso/src/index.html.ejs');
Expand Down Expand Up @@ -43,7 +42,6 @@ if (fs.existsSync(certPath) && fs.existsSync(keyPath)) {

module.exports = (env, argv) => {
const envServer = env.server ?? process.env.server;
const urlObject = new URL(envServer);

return merge(commonConfig(env, argv), {
mode: 'development',
Expand Down Expand Up @@ -73,15 +71,10 @@ module.exports = (env, argv) => {
server,
proxy: [
{
context: ['/api'],
context: ['/api', '/api/ws'],
target: envServer,
secure: false,
},
{
context: ['/api/ws'],
target: `${urlObject.protocol === 'https:' ? 'wss:' : 'ws:'}//${urlObject.hostname}:${urlObject.port}/api/ws`,
ws: true,
secure: false,
},
],
// onListening: function (devServer, ...args) {
Expand Down
12 changes: 11 additions & 1 deletion webapp/packages/core-cli/tests/test.environment.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 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 { TransformStream } from 'node:stream/web';

const Environment = require('jest-environment-jsdom').default;

/**
JSDOM does not have an implementation for TextDecoder / TextEncoder present on their globals
JSDOM does not have an implementation for TextDecoder / TextEncoder / TransformStream present on their globals
and therefore not only are they not found, but you can't add them without access to their global context inside the VM.
MSW 2.0 related issue.
*/
Expand All @@ -12,6 +21,7 @@ module.exports = class CustomTestEnvironment extends Environment {
this.global.TextDecoder = TextDecoder;
this.global.Response = Response;
this.global.Request = Request;
this.global.TransformStream = TransformStream;
// FIXME https://github.com/jsdom/jsdom/issues/3363
this.global.structuredClone = structuredClone;

Expand Down
4 changes: 2 additions & 2 deletions webapp/packages/core-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
"@timohausmann/quadtree-ts": "^2",
"clsx": "^2",
"fast-deep-equal": "^3",
"i18next": "^23",
"i18next": "^24",
"md5": "^2",
"mobx": "^6",
"underscore": "^1",
"uuid": "^10",
"uuid": "^11",
"whatwg-mimetype": "^4",
"zod": "^3",
"zod-i18n-map": "^2",
Expand Down
23 changes: 4 additions & 19 deletions webapp/packages/core-utils/src/uuid_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,11 @@
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { v4 as uuidv4 } from 'uuid';
import { v4 as uuidv4, type Version1Options, type Version4Options } from 'uuid';

export type OutputBuffer = ArrayLike<number>;
export type InputBuffer = ArrayLike<number>;
export type V4Options = Version4Options;
export type V1Options = Version1Options;

export interface RandomOptions {
random?: InputBuffer;
}
export interface RngOptions {
rng?: () => InputBuffer;
}

export interface V1BaseOptions {
node?: InputBuffer;
clockseq?: number;
msecs?: number | Date;
nsecs?: number;
}
export type V4Options = RandomOptions | RngOptions;

export function uuid(options?: V4Options): string {
export function uuid(options?: Version4Options): string {
return uuidv4(options);
}
1 change: 1 addition & 0 deletions webapp/packages/core-view/src/View/parseHotkey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export function parseHotkey(hotkey: string, combinationKey = '+', description?:
return {
...modifiers,
keys: singleCharKeys,
hotkey,
description,
};
}
Loading

0 comments on commit 055145b

Please sign in to comment.