-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'devel' into CB-4382-anonymous-access-restricted-error
- Loading branch information
Showing
39 changed files
with
1,000 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM ubuntu:23.04 | ||
FROM ubuntu:23.10 | ||
|
||
MAINTAINER DBeaver Corp, [email protected] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
webapp/packages/core-blocks/src/Tree/TreeNode/TreeNodeNested.m.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
.treeNodeNested { | ||
box-sizing: border-box; | ||
padding-left: 8px; | ||
display: none; | ||
|
||
&.root { | ||
padding: 0; | ||
display: block; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
webapp/packages/core-navigation-tree/src/NodesManager/DATA_CONTEXT_NAV_NODE_ID.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* 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 { createDataContext } from '@cloudbeaver/core-data-context'; | ||
|
||
export const DATA_CONTEXT_NAV_NODE_ID = createDataContext<string>('nav-node-id'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
webapp/packages/plugin-navigation-tree/src/TreeNew/DataTransformers/TreeDataTransformer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export type TreeDataTransformer<T> = (nodeId: string, data: T) => T; |
20 changes: 20 additions & 0 deletions
20
webapp/packages/plugin-navigation-tree/src/TreeNew/DataTransformers/applyTransforms.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* 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 type { TreeDataTransformer } from './TreeDataTransformer'; | ||
|
||
export function applyTransforms<T>(id: string, data: T, transformers?: TreeDataTransformer<T>[]) { | ||
if (!transformers) { | ||
return data; | ||
} | ||
|
||
for (const transformer of transformers) { | ||
data = transformer(id, data); | ||
} | ||
|
||
return data; | ||
} |
36 changes: 36 additions & 0 deletions
36
webapp/packages/plugin-navigation-tree/src/TreeNew/DataTransformers/rootTransformers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* 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 type { INode } from '../INode'; | ||
import type { INodeState } from '../INodeState'; | ||
import type { TreeDataTransformer } from './TreeDataTransformer'; | ||
|
||
export function rootNodeStateTransformer(root: string): TreeDataTransformer<INodeState> { | ||
return function rootNodeStateTransformer(nodeId, data) { | ||
if (nodeId === root) { | ||
return { | ||
...data, | ||
expanded: true, | ||
}; | ||
} | ||
|
||
return data; | ||
}; | ||
} | ||
|
||
export function rootNodeTransformer(root: string): TreeDataTransformer<INode> { | ||
return function rootNodeTransformer(nodeId, data) { | ||
if (nodeId === root) { | ||
return { | ||
...data, | ||
leaf: false, | ||
}; | ||
} | ||
|
||
return data; | ||
}; | ||
} |
14 changes: 14 additions & 0 deletions
14
webapp/packages/plugin-navigation-tree/src/TreeNew/INode.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export interface INode { | ||
name: string; | ||
tooltip?: string; | ||
icon?: string; | ||
leaf?: boolean; | ||
} |
20 changes: 20 additions & 0 deletions
20
webapp/packages/plugin-navigation-tree/src/TreeNew/INodeRenderer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export interface INodeComponentBaseProps { | ||
nodeId: string; | ||
offsetHeight: number; | ||
} | ||
|
||
export interface INodeComponentProps extends INodeComponentBaseProps { | ||
childrenRenderer: React.FC<INodeComponentBaseProps>; | ||
} | ||
|
||
export type NodeComponent = React.FC<INodeComponentProps>; | ||
|
||
export type INodeRenderer = (nodeId: string) => NodeComponent | null; |
12 changes: 12 additions & 0 deletions
12
webapp/packages/plugin-navigation-tree/src/TreeNew/INodeState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export interface INodeState { | ||
selected: boolean; | ||
expanded: boolean; | ||
} |
51 changes: 51 additions & 0 deletions
51
webapp/packages/plugin-navigation-tree/src/TreeNew/Node.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* 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 { observer } from 'mobx-react-lite'; | ||
import { useContext } from 'react'; | ||
|
||
import { TreeNode } from '@cloudbeaver/core-blocks'; | ||
|
||
import { TreeContext } from './contexts/TreeContext'; | ||
import { TreeDataContext } from './contexts/TreeDataContext'; | ||
import type { NodeComponent } from './INodeRenderer'; | ||
import { NodeControl } from './NodeControl'; | ||
import { useNodeDnD } from './useNodeDnD'; | ||
|
||
export const Node: NodeComponent = observer(function Node({ nodeId, offsetHeight, childrenRenderer }) { | ||
const tree = useContext(TreeContext)!; | ||
const data = useContext(TreeDataContext)!; | ||
|
||
const { expanded, selected } = data.getState(nodeId); | ||
|
||
const dndData = useNodeDnD(nodeId, () => { | ||
if (!selected) { | ||
tree.selectNode(nodeId, true); | ||
} | ||
}); | ||
|
||
function handleOpen() { | ||
return tree.openNode(nodeId); | ||
} | ||
|
||
function handleToggleExpand() { | ||
return tree.expandNode(nodeId, !expanded); | ||
} | ||
|
||
function handleSelect() { | ||
tree.selectNode(nodeId, !selected); | ||
} | ||
|
||
const NavigationTreeChildrenNew = childrenRenderer; | ||
|
||
return ( | ||
<TreeNode selected={selected} expanded={expanded} onExpand={handleToggleExpand} onOpen={handleOpen} onSelect={handleSelect}> | ||
<NodeControl ref={dndData.setTargetRef} nodeId={nodeId} /> | ||
{expanded && <NavigationTreeChildrenNew nodeId={nodeId} offsetHeight={offsetHeight + tree.getNodeHeight(nodeId)} />} | ||
</TreeNode> | ||
); | ||
}); |
Oops, something went wrong.