mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-10-16 14:50:15 +08:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8155d328a2 | ||
|
|
6118e706e0 | ||
|
|
eab07b9e9f |
@@ -0,0 +1,35 @@
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/java
|
||||
{
|
||||
"name": "Java",
|
||||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
||||
"image": "mcr.microsoft.com/devcontainers/java:1-17-bookworm",
|
||||
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/java:1": {
|
||||
"version": "none",
|
||||
"installMaven": "true",
|
||||
"installGradle": "false"
|
||||
},
|
||||
"ghcr.io/devcontainers/features/github-cli:1": {},
|
||||
"ghcr.io/devcontainers/features/node:1": {}
|
||||
},
|
||||
|
||||
"hostRequirements": {
|
||||
"cpus": 8,
|
||||
"memory": "16gb",
|
||||
"storage": "64gb"
|
||||
}
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
// "postCreateCommand": "java -version",
|
||||
|
||||
// Configure tool-specific properties.
|
||||
// "customizations": {},
|
||||
|
||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||
// "remoteUser": "root"
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve CloudBeaver
|
||||
title: ''
|
||||
labels: bug, wait for review
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here, e.g. error log.
|
||||
@@ -1,61 +0,0 @@
|
||||
name: 🐛 Bug Report
|
||||
description: Create a report to help us improve our product
|
||||
labels: [wait for review]
|
||||
type: Bug
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for reporting a bug in CloudBeaver!
|
||||
To ensure we can address the issue as quickly and efficiently as possible, please provide as much detail as you can in the fields below.
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: |
|
||||
A clear and concise description of the issue being addressed.
|
||||
- Describe the actual problematic behavior.
|
||||
- Ensure private information is redacted.
|
||||
- Include console output or log files if relevant.
|
||||
- If applicable, add screenshots or screen recordings to help explain your problem.
|
||||
placeholder: |
|
||||
Please enter a description of the issue. Here you can also attach log files, screenshots or a video
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduce
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: Describe the steps to reproduce the bug
|
||||
placeholder: |
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: Expected/Desired Behavior
|
||||
description: |
|
||||
A clear and concise description of what happens in the software **after** a fix is created and merged.
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: CloudBeaver Version
|
||||
description: What version of CloudBeaver are you running?
|
||||
placeholder: ex. CloudBeaver Community 25.0.0
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: additional-context
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Any additional context about the environment
|
||||
placeholder: |
|
||||
Example:
|
||||
1. OS: [e.g. iOS, Ubuntu, Windows 11]
|
||||
2. Browser: [e.g. Chrome, Safari]
|
||||
validations:
|
||||
required: false
|
||||
@@ -1,14 +0,0 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Read our documentations
|
||||
url: https://dbeaver.com/docs/cloudbeaver
|
||||
about: Many articles about product deployment and features.
|
||||
- name: Try advanced database management features in DBeaver PRO or CloudBeaver EE
|
||||
url: https://dbeaver.com/download/?utm_source=github&utm_medium=social&utm_campaign=issue
|
||||
about: Download a 14-day free trial on dbeaver.com. No credit card is needed.
|
||||
- name: Learn how to use CloudBeaver effectively with our tutorial videos
|
||||
url: https://www.youtube.com/channel/UC-yOjsQLSaJVEghg6UB3N7A
|
||||
about: Subscribe to our YouTube channel and watch new tutorials every week.
|
||||
- name: Follow us on X (ex. Twitter)
|
||||
url: https://x.com/dbeaver_news
|
||||
about: Get everyday tips, fresh news, and DBeaver/CloudBeaver feature overviews.
|
||||
@@ -1,9 +1,8 @@
|
||||
---
|
||||
name: Feature Request
|
||||
about: Provide a description of your feature request for CloudBeaver. Include the problem you are trying to solve, why it is important, and any specific functionality you believe would improve the platform.
|
||||
name: Feature request
|
||||
about: Suggest an idea for CloudBeaver
|
||||
title: ''
|
||||
labels: wait for review
|
||||
type: Feature
|
||||
labels: feature request, wait for review
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
@@ -13,9 +12,3 @@ A clear and concise description of what the problem is. Ex. I'm always frustrate
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
---
|
||||
name: Question
|
||||
about: Is there something unclear? Ask your question.
|
||||
about: Is there something unclear?
|
||||
title: ''
|
||||
labels: wait for review
|
||||
type: Question
|
||||
labels: question, wait for review
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
name: Backend Build
|
||||
|
||||
on:
|
||||
# Allows you to reuse workflows by referencing their YAML files
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
build-backend:
|
||||
name: Build
|
||||
timeout-minutes: 10
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
path: cloudbeaver
|
||||
|
||||
- name: Clone Deps Repositories
|
||||
uses: dbeaver/github-actions/clone-repositories@devel
|
||||
with:
|
||||
project_deps_path: "./cloudbeaver/project.deps"
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: "21"
|
||||
cache: maven
|
||||
|
||||
- uses: dbeaver/github-actions/install-maven@devel
|
||||
|
||||
- name: Run build script
|
||||
run: ./build-backend.sh
|
||||
shell: bash
|
||||
working-directory: ./cloudbeaver/deploy
|
||||
|
||||
# - name: Archive build artifacts
|
||||
# uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: backend-build-artifacts
|
||||
# path: cloudbeaver/deploy/cloudbeaver
|
||||
# if-no-files-found: error
|
||||
@@ -1,14 +0,0 @@
|
||||
name: Cleanup
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [closed]
|
||||
push:
|
||||
branches:
|
||||
- devel
|
||||
|
||||
jobs:
|
||||
delete-caches:
|
||||
name: Cleanup
|
||||
uses: dbeaver/dbeaver-common/.github/workflows/cleanup-caches.yml@devel
|
||||
secrets: inherit
|
||||
@@ -1,93 +0,0 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# Allows you to reuse workflows by referencing their YAML files
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
build-and-push-docker:
|
||||
name: Build and Push Docker Image
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download backend artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: backend-build-artifacts
|
||||
path: deploy/cloudbeaver/
|
||||
|
||||
- name: Download frontend artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: frontend-build-artifacts
|
||||
path: deploy/cloudbeaver/web
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Run custom Docker build script
|
||||
run: ./make-docker-container.sh
|
||||
shell: bash
|
||||
working-directory: ./deploy/docker
|
||||
|
||||
- name: Tag Docker Image
|
||||
run: |
|
||||
REPO_NAME=$(basename ${{ github.repository }})
|
||||
IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/$REPO_NAME
|
||||
BRANCH_NAME=${{ github.head_ref || github.ref_name }}
|
||||
TAG_NAME=$(echo $BRANCH_NAME | sed 's/[^a-zA-Z0-9._-]/-/g')
|
||||
docker tag dbeaver/cloudbeaver:dev $IMAGE_NAME:$TAG_NAME
|
||||
echo "image=$IMAGE_NAME:$TAG_NAME" >> $GITHUB_ENV
|
||||
|
||||
# - name: Install Docker Credential Helper
|
||||
# run: |
|
||||
# sudo apt-get update
|
||||
# sudo apt-get install -y gnupg2 pass
|
||||
# curl -fsSL https://github.com/docker/docker-credential-helpers/releases/download/v0.6.4/docker-credential-pass-v0.6.4-amd64.tar.gz -o docker-credential-pass.tar.gz
|
||||
# tar xzvf docker-credential-pass.tar.gz
|
||||
# sudo mv docker-credential-pass /usr/local/bin/docker-credential-pass
|
||||
# sudo chmod +x /usr/local/bin/docker-credential-pass
|
||||
|
||||
# - name: Configure Docker to use Credential Helper
|
||||
# run: |
|
||||
# mkdir -p ~/.docker
|
||||
# echo '{"credsStore":"pass"}' > ~/.docker/config.json
|
||||
|
||||
# - name: Initialize Password Store
|
||||
# run: |
|
||||
# gpg --batch --gen-key <<EOF
|
||||
# %no-protection
|
||||
# Key-Type: default
|
||||
# Subkey-Type: default
|
||||
# Name-Real: Docker Credential Helper
|
||||
# Expire-Date: 0
|
||||
# %commit
|
||||
# EOF
|
||||
# pass init "$(gpg --list-keys --with-colons | grep '^pub' | cut -d: -f5)"
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
|
||||
|
||||
- name: Push Docker Image
|
||||
run: docker push ${{ env.image }}
|
||||
|
||||
# - name: Comment on Pull Request
|
||||
# if: github.event_name == 'pull_request'
|
||||
# uses: actions/github-script@v6
|
||||
# with:
|
||||
# github-token: ${{ secrets.PAT }}
|
||||
# script: |
|
||||
# const tag = process.env.TAG_NAME;
|
||||
# const commentBody = `The Docker image has been built and pushed to Docker Hub.\n\nYou can pull the image using the following command:\n\`\`\`\ndocker pull dbeaver/cloudbeaver:${tag}\n\`\`\``;
|
||||
# github.rest.issues.createComment({
|
||||
# owner: context.repo.owner,
|
||||
# repo: context.repo.repo,
|
||||
# issue_number: context.issue.number,
|
||||
# body: commentBody
|
||||
# });
|
||||
@@ -1,79 +0,0 @@
|
||||
name: Frontend Build
|
||||
|
||||
on:
|
||||
# Allows you to reuse workflows by referencing their YAML files
|
||||
workflow_call:
|
||||
outputs:
|
||||
build-status:
|
||||
description: "Build status"
|
||||
value: ${{ jobs.frontend-build.outputs.build-status }}
|
||||
test-status:
|
||||
description: "Test status"
|
||||
value: ${{ jobs.frontend-build.outputs.test-status }}
|
||||
inputs:
|
||||
clean-cache:
|
||||
required: false
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
frontend-build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
outputs:
|
||||
build-status: ${{ steps.build.outcome }}
|
||||
test-status: ${{ steps.test.outcome }}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./cloudbeaver/webapp
|
||||
|
||||
steps:
|
||||
- name: Checkout cloudbeaver
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: cloudbeaver
|
||||
|
||||
- name: Clone Deps Repositories
|
||||
uses: dbeaver/github-actions/clone-repositories@devel
|
||||
with:
|
||||
project_deps_path: "./cloudbeaver/project.deps"
|
||||
token: ${{ secrets.DEVOPS_ISSUE_RO_TOKEN }}
|
||||
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "lts/*"
|
||||
cache: "yarn"
|
||||
cache-dependency-path: |
|
||||
cloudbeaver/webapp/yarn.lock
|
||||
|
||||
- name: restore typescript cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
"cloudbeaver/webapp/common-*/**/*/lib"
|
||||
"cloudbeaver/webapp/**/packages/*/dist"
|
||||
key: ${{ runner.os }}-dist-${{ hashFiles('cloudbeaver/webapp/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-dist-
|
||||
|
||||
- if: inputs.clean-cache
|
||||
run: yarn clear
|
||||
|
||||
- run: yarn install --immutable
|
||||
|
||||
- run: yarn bundle
|
||||
working-directory: ./cloudbeaver/webapp/packages/product-default
|
||||
|
||||
- run: yarn test
|
||||
|
||||
# - name: Archive build artifacts
|
||||
# uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: frontend-build-artifacts
|
||||
# path: webapp/packages/product-default/lib
|
||||
# if-no-files-found: error
|
||||
@@ -0,0 +1,76 @@
|
||||
name: frontend-cache
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["devel"]
|
||||
paths:
|
||||
- "webapp/**"
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./webapp
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "18"
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: restore yarn cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: restore node_modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: "**/node_modules"
|
||||
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node_modules-
|
||||
|
||||
- name: restore typescript cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: "**/packages/*/dist"
|
||||
key: ${{ runner.os }}-dist-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-dist-
|
||||
|
||||
- name: yarn install
|
||||
uses: borales/actions-yarn@v4
|
||||
with:
|
||||
dir: webapp
|
||||
cmd: install
|
||||
|
||||
- name: yarn lerna bootstrap
|
||||
uses: borales/actions-yarn@v4
|
||||
with:
|
||||
dir: webapp
|
||||
cmd: lerna bootstrap
|
||||
|
||||
- name: build
|
||||
uses: borales/actions-yarn@v4
|
||||
with:
|
||||
dir: webapp/packages/product-default
|
||||
cmd: build # build tyescript source code
|
||||
|
||||
- name: test
|
||||
uses: borales/actions-yarn@v4
|
||||
with:
|
||||
dir: webapp
|
||||
cmd: lerna run test # build packages that have test script
|
||||
@@ -0,0 +1,29 @@
|
||||
name: cleanup caches by a branch
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- closed
|
||||
|
||||
jobs:
|
||||
cleanup:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Cleanup
|
||||
run: |
|
||||
gh extension install actions/gh-actions-cache
|
||||
|
||||
echo "Fetching list of cache key"
|
||||
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 )
|
||||
|
||||
## Setting this to not fail the workflow while deleting cache keys.
|
||||
set +e
|
||||
echo "Deleting caches..."
|
||||
for cacheKey in $cacheKeysForPR
|
||||
do
|
||||
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
|
||||
done
|
||||
echo "Done"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REPO: ${{ github.repository }}
|
||||
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
@@ -1,46 +0,0 @@
|
||||
name: Frontend Lint
|
||||
|
||||
on:
|
||||
# Allows you to reuse workflows by referencing their YAML files
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./cloudbeaver/webapp
|
||||
|
||||
steps:
|
||||
- name: Checkout cloudbeaver
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: cloudbeaver
|
||||
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "lts/*"
|
||||
cache: "yarn"
|
||||
cache-dependency-path: "./cloudbeaver/webapp/yarn.lock"
|
||||
|
||||
# - run: yarn install --immutable
|
||||
# working-directory: ./cloudbeaver/webapp/common-typescript
|
||||
|
||||
# - run: yarn install --immutable
|
||||
# working-directory: ./cloudbeaver/webapp/common-react
|
||||
|
||||
- run: |
|
||||
yarn install --immutable
|
||||
git fetch origin "${{ github.base_ref }}" --depth=1
|
||||
FILES=$(git diff --name-only 'origin/${{ github.base_ref }}' ${{ github.sha }} -- . | sed 's|^webapp/||')
|
||||
if [ -n "$FILES" ]; then
|
||||
yarn lint --pass-on-no-patterns --no-error-on-unmatched-pattern $FILES
|
||||
else
|
||||
echo "No files to lint"
|
||||
fi
|
||||
@@ -0,0 +1,80 @@
|
||||
name: frontend
|
||||
|
||||
on:
|
||||
# Triggers the workflow on push or pull request events but only for the "devel" branch
|
||||
pull_request:
|
||||
branches: ["devel"]
|
||||
paths:
|
||||
- "webapp/**" # monitor for the frontend changes
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# Allows you to reuse workflows by referencing their YAML files
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./webapp
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: restore yarn cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: restore node_modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: "**/node_modules"
|
||||
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node_modules-
|
||||
|
||||
- name: restore typescript cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: "**/packages/*/dist"
|
||||
key: ${{ runner.os }}-dist-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-dist-
|
||||
|
||||
- name: yarn install
|
||||
uses: borales/actions-yarn@v4
|
||||
with:
|
||||
dir: webapp
|
||||
cmd: install
|
||||
|
||||
- name: yarn lerna bootstrap
|
||||
uses: borales/actions-yarn@v4
|
||||
with:
|
||||
dir: webapp
|
||||
cmd: lerna bootstrap
|
||||
|
||||
- name: build
|
||||
uses: borales/actions-yarn@v4
|
||||
with:
|
||||
dir: webapp/packages/product-default
|
||||
cmd: bundle
|
||||
|
||||
- name: test
|
||||
uses: borales/actions-yarn@v4
|
||||
with:
|
||||
dir: webapp
|
||||
cmd: lerna run test
|
||||
@@ -1,64 +0,0 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
push:
|
||||
branches: [devel]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref_name }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-server:
|
||||
uses: dbeaver/dbeaver-common/.github/workflows/mvn-package.yml@devel
|
||||
name: Check
|
||||
secrets: inherit
|
||||
with:
|
||||
mvn-args: -Dplain-api-server -Dheadless-platform
|
||||
project-directory: ./cloudbeaver/server/product/aggregate
|
||||
project-deps: ./cloudbeaver/project.deps
|
||||
timeout-minutes: 5
|
||||
|
||||
# build-server:
|
||||
# name: Server
|
||||
# uses: ./.github/workflows/backend-build.yml
|
||||
# secrets: inherit
|
||||
|
||||
build-frontend:
|
||||
name: Frontend
|
||||
uses: ./.github/workflows/frontend-build.yml
|
||||
secrets: inherit
|
||||
|
||||
lint-server:
|
||||
name: Server
|
||||
uses: dbeaver/dbeaver-common/.github/workflows/java-checkstyle.yml@devel
|
||||
secrets: inherit
|
||||
|
||||
lint-frontend:
|
||||
name: Frontend
|
||||
uses: ./.github/workflows/frontend-lint.yml
|
||||
secrets: inherit
|
||||
|
||||
# call-frontend-tests:
|
||||
# name: Frontend Unit Tests
|
||||
# needs: call-frontend-build
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Check if tests passed
|
||||
# if: ${{ needs.call-frontend-build.outputs.test-status != 'success' }}
|
||||
# run: |
|
||||
# echo "Tests failed"
|
||||
# exit 1
|
||||
# - name: Continue if tests passed
|
||||
# if: ${{ needs.call-frontend-build.outputs.test-status == 'success' }}
|
||||
# run: echo "Tests passed"
|
||||
|
||||
# call-docker-build-and-push:
|
||||
# name: Run
|
||||
# needs: [call-backend-build, call-frontend-build]
|
||||
# uses: ./.github/workflows/docker-build-and-push.yml
|
||||
@@ -0,0 +1,17 @@
|
||||
name: validation
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- devel
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- edited
|
||||
- ready_for_review
|
||||
- labeled
|
||||
|
||||
jobs:
|
||||
commit-message:
|
||||
uses: dbeaver/dbeaver/.github/workflows/reused-commit-msgs-validator.yml@devel
|
||||
+2
-6
@@ -26,7 +26,7 @@ dist/
|
||||
|
||||
*.iml
|
||||
/idea/
|
||||
|
||||
.idea/
|
||||
|
||||
## Mac OS
|
||||
.DS_Store
|
||||
@@ -40,11 +40,7 @@ server/test/io.cloudbeaver.test.platform/workspace/.data/
|
||||
.classpath
|
||||
.settings/
|
||||
|
||||
## Eclipse PDE
|
||||
*.product.launch
|
||||
|
||||
workspace-dev-ce/
|
||||
deploy/cloudbeaver
|
||||
server/**/target
|
||||
apps/**/target
|
||||
osgi-cache/
|
||||
apps/**/target
|
||||
Vendored
+2
-2
@@ -15,11 +15,11 @@
|
||||
"streetsidesoftware.code-spell-checker",
|
||||
"streetsidesoftware.code-spell-checker-russian",
|
||||
"syler.sass-indented",
|
||||
"VisualStudioExptTeam.intellicode-api-usage-examples",
|
||||
"VisualStudioExptTeam.vscodeintellicode",
|
||||
"yzhang.markdown-all-in-one",
|
||||
"GraphQL.vscode-graphql-syntax",
|
||||
"mrmlnc.vscode-json5",
|
||||
"esbenp.prettier-vscode",
|
||||
"devnaumov.licensify"
|
||||
"esbenp.prettier-vscode"
|
||||
]
|
||||
}
|
||||
|
||||
Vendored
+70
-54
@@ -4,11 +4,11 @@
|
||||
{
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"name": "CloudBeaver CE",
|
||||
"name": "Chrome",
|
||||
"url": "http://localhost:8080",
|
||||
"webRoot": "${workspaceFolder}/..",
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/../cloudbeaver/webapp/packages/**/dist/**/*.{js,jsx}"
|
||||
"${workspaceFolder}/../cloudbeaver/packages/**/dist/**/*.{js,jsx}"
|
||||
],
|
||||
"smartStep": true,
|
||||
"sourceMaps": true,
|
||||
@@ -17,60 +17,76 @@
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "CloudBeaver CE Server",
|
||||
"cwd": "${workspaceFolder}/../dbeaver-workspace/app-workspace/cbce",
|
||||
"name": "CloudBeaver CE",
|
||||
"cwd": "${workspaceFolder}/workspace-dev-ce",
|
||||
"preLaunchTask": "Generate dev proprties for CBCE",
|
||||
"request": "launch",
|
||||
"mainClass": "org.jkiss.dbeaver.launcher.DBeaverLauncher",
|
||||
"args": [
|
||||
"-product",
|
||||
"io.cloudbeaver.product.ce.product",
|
||||
"-configuration",
|
||||
"file:${workspaceFolder}/../dbeaver-workspace/products/CloudbeaverServer.product/",
|
||||
"-dev",
|
||||
"file:${workspaceFolder}/../dbeaver-workspace/products/CloudbeaverServer.product/dev.properties",
|
||||
"-nl",
|
||||
"en",
|
||||
"-web-config",
|
||||
"conf/cloudbeaver.conf",
|
||||
"-registryMultiLanguage"
|
||||
],
|
||||
// "windows": {
|
||||
// "args": ["-os", "win32", "-ws", "win32", "-arch", "x86_64"]
|
||||
// },
|
||||
// "osx": {
|
||||
// "args": ["-os", "macosx", "-ws", "cocoa", "-arch", "aarch64"]
|
||||
// },
|
||||
|
||||
"vmArgs": [
|
||||
"-XX:+IgnoreUnrecognizedVMOptions",
|
||||
"-Xms64m",
|
||||
"-Xmx1024m",
|
||||
"-Declipse.pde.launch=true",
|
||||
"-XstartOnFirstThread",
|
||||
"-Dfile.encoding=UTF-8",
|
||||
"--add-modules=ALL-DEFAULT",
|
||||
"--add-opens=java.base/java.io=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.lang=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.lang.reflect=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.net=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.nio=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.nio.charset=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.text=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.time=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.util=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.util.concurrent=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED",
|
||||
"--add-opens=java.base/jdk.internal.vm=ALL-UNNAMED",
|
||||
"--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED",
|
||||
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
|
||||
"--add-opens=java.base/sun.security.ssl=ALL-UNNAMED",
|
||||
"--add-opens=java.base/sun.security.action=ALL-UNNAMED",
|
||||
"--add-opens=java.base/sun.security.util=ALL-UNNAMED",
|
||||
"--add-opens=java.security.jgss/sun.security.jgss=ALL-UNNAMED",
|
||||
"--add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED",
|
||||
"--add-opens=java.sql/java.sql=ALL-UNNAMED"
|
||||
]
|
||||
"windows": {
|
||||
"type": "java",
|
||||
"name": "CloudBeaver CE",
|
||||
"request": "launch",
|
||||
"mainClass": "org.jkiss.dbeaver.launcher.DBeaverLauncher",
|
||||
"args": [
|
||||
"-product",
|
||||
"io.cloudbeaver.product.ce.product",
|
||||
"-configuration",
|
||||
"file:${workspaceFolder}/../eclipse/workspace/.metadata/.plugins/org.eclipse.pde.core/CloudbeaverServer.product/",
|
||||
"-dev",
|
||||
"file:${workspaceFolder}/../eclipse/workspace/.metadata/.plugins/org.eclipse.pde.core/CloudbeaverServer.product/dev.properties",
|
||||
"-os",
|
||||
"win32",
|
||||
"-ws",
|
||||
"win32",
|
||||
"-arch",
|
||||
"x86_64",
|
||||
"-nl",
|
||||
"en",
|
||||
"-showsplash",
|
||||
"-web-config",
|
||||
"conf/cloudbeaver.conf"
|
||||
],
|
||||
"vmArgs": [
|
||||
"-XX:+IgnoreUnrecognizedVMOptions",
|
||||
"--add-modules=ALL-SYSTEM",
|
||||
"-Xms64m",
|
||||
"-Xmx1024m",
|
||||
"-Declipse.pde.launch=true"
|
||||
]
|
||||
},
|
||||
"osx": {
|
||||
"type": "java",
|
||||
"name": "CloudBeaver CE",
|
||||
"request": "launch",
|
||||
"mainClass": "org.jkiss.dbeaver.launcher.DBeaverLauncher",
|
||||
"args": [
|
||||
"-product",
|
||||
"io.cloudbeaver.product.ce.product",
|
||||
"-configuration",
|
||||
"file:${workspaceFolder}/../eclipse/workspace/.metadata/.plugins/org.eclipse.pde.core/CloudbeaverServer.product/",
|
||||
"-dev",
|
||||
"file:${workspaceFolder}/../eclipse/workspace/.metadata/.plugins/org.eclipse.pde.core/CloudbeaverServer.product/dev.properties",
|
||||
"-os",
|
||||
"macosx",
|
||||
"-ws",
|
||||
"cocoa",
|
||||
"-arch",
|
||||
"aarch64",
|
||||
"-nl",
|
||||
"en",
|
||||
"-showsplash",
|
||||
"-web-config",
|
||||
"conf/cloudbeaver.conf"
|
||||
],
|
||||
"vmArgs": [
|
||||
"-XX:+IgnoreUnrecognizedVMOptions",
|
||||
"--add-modules=ALL-SYSTEM",
|
||||
"-Xms64m",
|
||||
"-Xmx1024m",
|
||||
"-Declipse.pde.launch=true",
|
||||
"-XstartOnFirstThread"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"license": {
|
||||
"scope": "typescript,typescriptreact,javascript,javascriptreact,css,scss",
|
||||
"prefix": "license",
|
||||
"body": [
|
||||
"/*",
|
||||
" * 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.",
|
||||
" */",
|
||||
"",
|
||||
""
|
||||
]
|
||||
}
|
||||
}
|
||||
Vendored
+11
-9
@@ -2,18 +2,19 @@
|
||||
"editor.tabSize": 2,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.linkedEditing": true,
|
||||
|
||||
"task.autoDetect": "off",
|
||||
|
||||
"java.configuration.updateBuildConfiguration": "automatic",
|
||||
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx16G -Xms100m -Xlog:disable",
|
||||
"java.compile.nullAnalysis.mode": "automatic",
|
||||
|
||||
"typescript.preferences.useAliasesForRenames": false,
|
||||
"typescript.preferences.importModuleSpecifier": "relative",
|
||||
"typescript.preferences.includePackageJsonAutoImports": "on",
|
||||
"typescript.preferences.quoteStyle": "single",
|
||||
"typescript.tsdk": "webapp/.yarn/sdks/typescript/lib",
|
||||
"typescript.enablePromptUseWorkspaceTsdk": true,
|
||||
"prettier.prettierPath": "webapp/.yarn/sdks/prettier/index.cjs",
|
||||
"eslint.nodePath": "webapp/.yarn/sdks",
|
||||
"typescript.tsdk": "webapp/node_modules/typescript/lib",
|
||||
|
||||
"eslint.enable": true,
|
||||
"eslint.validate": [
|
||||
"javascript",
|
||||
@@ -21,9 +22,8 @@
|
||||
"typescript",
|
||||
"typescriptreact"
|
||||
],
|
||||
"eslint.workingDirectories": [
|
||||
"webapp"
|
||||
],
|
||||
"eslint.workingDirectories": ["webapp"],
|
||||
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"[javascript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
@@ -40,10 +40,12 @@
|
||||
"[java]": {
|
||||
"editor.defaultFormatter": "redhat.java"
|
||||
},
|
||||
|
||||
"files.eol": "\n",
|
||||
"files.associations": {
|
||||
"*.css": "postcss"
|
||||
},
|
||||
"java.checkstyle.configuration": "${workspaceFolder}/../dbeaver-common/.github/dbeaver-checkstyle-config.xml",
|
||||
|
||||
"java.checkstyle.configuration": "${workspaceFolder}/../dbeaver/dbeaver-checkstyle-config.xml",
|
||||
"java.checkstyle.version": "10.12.0"
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+21
-56
@@ -17,27 +17,7 @@
|
||||
"type": "shell",
|
||||
"command": "yarn",
|
||||
"group": "test",
|
||||
"args": ["test"]
|
||||
},
|
||||
{
|
||||
"label": "Run Tests Common Typescript",
|
||||
"type": "shell",
|
||||
"command": "yarn",
|
||||
"group": "test",
|
||||
"args": ["test"],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/webapp/common-typescript"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Run Tests Common React",
|
||||
"type": "shell",
|
||||
"command": "yarn",
|
||||
"group": "test",
|
||||
"args": ["test"],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/webapp/common-react"
|
||||
}
|
||||
"args": ["lerna", "run", "test", "--no-bail", "--stream", "--"]
|
||||
},
|
||||
{
|
||||
"label": "Run DevServer CE",
|
||||
@@ -54,16 +34,27 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Generate Eclipse PDE CloudBeaver",
|
||||
"label": "Generate dev proprties for CBCE",
|
||||
"type": "shell",
|
||||
"command": "mvn",
|
||||
"osx": {
|
||||
"command": "./generate_workspace.sh"
|
||||
"args": [
|
||||
"package",
|
||||
"-q",
|
||||
"exec:java",
|
||||
"-Dexec.args=-config ${workspaceFolder}/../idea-workspace-dbeaver/rcp-gen.properties -productFile ${workspaceFolder}/server/product/web-server/CloudbeaverServer.product -projectsFolder ${workspaceFolder}/../ -eclipse ${workspaceFolder}/../eclipse/Eclipse.app/Contents/Eclipse -output ${workspaceFolder}/../eclipse/workspace/.metadata/.plugins/org.eclipse.pde.core/CloudbeaverServer.product"
|
||||
]
|
||||
},
|
||||
"windows": {
|
||||
"command": "./generate_workspace.cmd"
|
||||
"args": [
|
||||
"package",
|
||||
"-q",
|
||||
"exec:java",
|
||||
"-Dexec.args=-config ${workspaceFolder}/../idea-workspace-dbeaver/rcp-gen.properties -productFile ${workspaceFolder}/server/product/web-server/CloudbeaverServer.product -projectsFolder ${workspaceFolder}/../ -eclipse ${workspaceFolder}/../eclipse/eclipse -output ${workspaceFolder}/../eclipse/workspace/.metadata/.plugins/org.eclipse.pde.core/CloudbeaverServer.product"
|
||||
]
|
||||
},
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/../cloudbeaver"
|
||||
"cwd": "${workspaceFolder}/../idea-rcp-launch-config-generator"
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "silent",
|
||||
@@ -75,10 +66,10 @@
|
||||
"label": "Build CE",
|
||||
"type": "shell",
|
||||
"windows": {
|
||||
"command": "./build.bat"
|
||||
"command": "./build-sqlite.bat"
|
||||
},
|
||||
"osx": {
|
||||
"command": "./build.sh"
|
||||
"command": "./build-sqlite.sh"
|
||||
},
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/deploy"
|
||||
@@ -104,7 +95,7 @@
|
||||
{
|
||||
"label": "Yarn Install",
|
||||
"type": "shell",
|
||||
"command": "yarn install",
|
||||
"command": "yarn install; yarn lerna bootstrap",
|
||||
"args": [],
|
||||
"presentation": {
|
||||
"reveal": "silent",
|
||||
@@ -113,38 +104,12 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Clean CE",
|
||||
"label": "Update TS references CE",
|
||||
"type": "shell",
|
||||
"command": "yarn clear",
|
||||
"command": "yarn lerna run update-ts-references --stream",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/webapp"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Add Custom Plugin",
|
||||
"type": "shell",
|
||||
"command": "yarn run add-plugin",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/webapp/packages"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Run Ui Kit Preview",
|
||||
"type": "shell",
|
||||
"command": "yarn",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/webapp/common-react/@dbeaver/ui-kit"
|
||||
},
|
||||
"args": ["docs"]
|
||||
},
|
||||
{
|
||||
"label": "Run Storybook",
|
||||
"type": "shell",
|
||||
"command": "yarn",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/webapp/packages/storybook"
|
||||
},
|
||||
"args": ["storybook"]
|
||||
}
|
||||
],
|
||||
"inputs": [
|
||||
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{js,json,yml}]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
@@ -1,4 +0,0 @@
|
||||
/.yarn/** linguist-vendored
|
||||
/.yarn/releases/* binary
|
||||
/.yarn/plugins/**/* binary
|
||||
/.pnp.* binary linguist-generated
|
||||
@@ -1,14 +0,0 @@
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
!.yarn/sdks/**
|
||||
|
||||
# Swap the comments on the following lines if you wish to use zero-installs
|
||||
# In that case, don't forget to run `yarn config set enableGlobalCache false`!
|
||||
# Documentation here: https://yarnpkg.com/features/caching#zero-installs
|
||||
|
||||
#!.yarn/cache
|
||||
.pnp.*
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"arcanis.vscode-zipfs"
|
||||
]
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"search.exclude": {
|
||||
"**/.yarn": true,
|
||||
"**/.pnp.*": true
|
||||
},
|
||||
"typescript.tsdk": ".yarn/sdks/typescript/lib",
|
||||
"typescript.enablePromptUseWorkspaceTsdk": true
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
# This file is automatically generated by @yarnpkg/sdks.
|
||||
# Manual changes might be lost!
|
||||
|
||||
integrations:
|
||||
- vscode
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const {existsSync} = require(`fs`);
|
||||
const {createRequire, register} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
const {pathToFileURL} = require(`url`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
|
||||
const absRequire = createRequire(absPnpApiPath);
|
||||
|
||||
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
|
||||
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
|
||||
|
||||
if (existsSync(absPnpApiPath)) {
|
||||
if (!process.versions.pnp) {
|
||||
// Setup the environment to be able to require typescript/bin/tsc
|
||||
require(absPnpApiPath).setup();
|
||||
if (isPnpLoaderEnabled && register) {
|
||||
register(pathToFileURL(absPnpLoaderPath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
|
||||
? exports => absRequire(absUserWrapperPath)(exports)
|
||||
: exports => exports;
|
||||
|
||||
// Defer to the real typescript/bin/tsc your application uses
|
||||
module.exports = wrapWithUserWrapper(absRequire(`typescript/bin/tsc`));
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const {existsSync} = require(`fs`);
|
||||
const {createRequire, register} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
const {pathToFileURL} = require(`url`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
|
||||
const absRequire = createRequire(absPnpApiPath);
|
||||
|
||||
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
|
||||
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
|
||||
|
||||
if (existsSync(absPnpApiPath)) {
|
||||
if (!process.versions.pnp) {
|
||||
// Setup the environment to be able to require typescript/bin/tsserver
|
||||
require(absPnpApiPath).setup();
|
||||
if (isPnpLoaderEnabled && register) {
|
||||
register(pathToFileURL(absPnpLoaderPath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
|
||||
? exports => absRequire(absUserWrapperPath)(exports)
|
||||
: exports => exports;
|
||||
|
||||
// Defer to the real typescript/bin/tsserver your application uses
|
||||
module.exports = wrapWithUserWrapper(absRequire(`typescript/bin/tsserver`));
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const {existsSync} = require(`fs`);
|
||||
const {createRequire, register} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
const {pathToFileURL} = require(`url`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
|
||||
const absRequire = createRequire(absPnpApiPath);
|
||||
|
||||
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
|
||||
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
|
||||
|
||||
if (existsSync(absPnpApiPath)) {
|
||||
if (!process.versions.pnp) {
|
||||
// Setup the environment to be able to require typescript/lib/tsc.js
|
||||
require(absPnpApiPath).setup();
|
||||
if (isPnpLoaderEnabled && register) {
|
||||
register(pathToFileURL(absPnpLoaderPath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
|
||||
? exports => absRequire(absUserWrapperPath)(exports)
|
||||
: exports => exports;
|
||||
|
||||
// Defer to the real typescript/lib/tsc.js your application uses
|
||||
module.exports = wrapWithUserWrapper(absRequire(`typescript/lib/tsc.js`));
|
||||
@@ -1,248 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const {existsSync} = require(`fs`);
|
||||
const {createRequire, register} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
const {pathToFileURL} = require(`url`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
|
||||
const absRequire = createRequire(absPnpApiPath);
|
||||
|
||||
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
|
||||
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
|
||||
|
||||
if (existsSync(absPnpApiPath)) {
|
||||
if (!process.versions.pnp) {
|
||||
// Setup the environment to be able to require typescript/lib/tsserver.js
|
||||
require(absPnpApiPath).setup();
|
||||
if (isPnpLoaderEnabled && register) {
|
||||
register(pathToFileURL(absPnpLoaderPath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
|
||||
? exports => absRequire(absUserWrapperPath)(exports)
|
||||
: exports => exports;
|
||||
|
||||
const moduleWrapper = exports => {
|
||||
return wrapWithUserWrapper(moduleWrapperFn(exports));
|
||||
};
|
||||
|
||||
const moduleWrapperFn = tsserver => {
|
||||
if (!process.versions.pnp) {
|
||||
return tsserver;
|
||||
}
|
||||
|
||||
const {isAbsolute} = require(`path`);
|
||||
const pnpApi = require(`pnpapi`);
|
||||
|
||||
const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
|
||||
const isPortal = str => str.startsWith("portal:/");
|
||||
const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
|
||||
|
||||
const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
|
||||
return `${locator.name}@${locator.reference}`;
|
||||
}));
|
||||
|
||||
// VSCode sends the zip paths to TS using the "zip://" prefix, that TS
|
||||
// doesn't understand. This layer makes sure to remove the protocol
|
||||
// before forwarding it to TS, and to add it back on all returned paths.
|
||||
|
||||
function toEditorPath(str) {
|
||||
// We add the `zip:` prefix to both `.zip/` paths and virtual paths
|
||||
if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) {
|
||||
// We also take the opportunity to turn virtual paths into physical ones;
|
||||
// this makes it much easier to work with workspaces that list peer
|
||||
// dependencies, since otherwise Ctrl+Click would bring us to the virtual
|
||||
// file instances instead of the real ones.
|
||||
//
|
||||
// We only do this to modules owned by the the dependency tree roots.
|
||||
// This avoids breaking the resolution when jumping inside a vendor
|
||||
// with peer dep (otherwise jumping into react-dom would show resolution
|
||||
// errors on react).
|
||||
//
|
||||
const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
|
||||
if (resolved) {
|
||||
const locator = pnpApi.findPackageLocator(resolved);
|
||||
if (locator && (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || isPortal(locator.reference))) {
|
||||
str = resolved;
|
||||
}
|
||||
}
|
||||
|
||||
str = normalize(str);
|
||||
|
||||
if (str.match(/\.zip\//)) {
|
||||
switch (hostInfo) {
|
||||
// Absolute VSCode `Uri.fsPath`s need to start with a slash.
|
||||
// VSCode only adds it automatically for supported schemes,
|
||||
// so we have to do it manually for the `zip` scheme.
|
||||
// The path needs to start with a caret otherwise VSCode doesn't handle the protocol
|
||||
//
|
||||
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
|
||||
//
|
||||
// 2021-10-08: VSCode changed the format in 1.61.
|
||||
// Before | ^zip:/c:/foo/bar.zip/package.json
|
||||
// After | ^/zip//c:/foo/bar.zip/package.json
|
||||
//
|
||||
// 2022-04-06: VSCode changed the format in 1.66.
|
||||
// Before | ^/zip//c:/foo/bar.zip/package.json
|
||||
// After | ^/zip/c:/foo/bar.zip/package.json
|
||||
//
|
||||
// 2022-05-06: VSCode changed the format in 1.68
|
||||
// Before | ^/zip/c:/foo/bar.zip/package.json
|
||||
// After | ^/zip//c:/foo/bar.zip/package.json
|
||||
//
|
||||
case `vscode <1.61`: {
|
||||
str = `^zip:${str}`;
|
||||
} break;
|
||||
|
||||
case `vscode <1.66`: {
|
||||
str = `^/zip/${str}`;
|
||||
} break;
|
||||
|
||||
case `vscode <1.68`: {
|
||||
str = `^/zip${str}`;
|
||||
} break;
|
||||
|
||||
case `vscode`: {
|
||||
str = `^/zip/${str}`;
|
||||
} break;
|
||||
|
||||
// To make "go to definition" work,
|
||||
// We have to resolve the actual file system path from virtual path
|
||||
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
|
||||
case `coc-nvim`: {
|
||||
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
|
||||
str = resolve(`zipfile:${str}`);
|
||||
} break;
|
||||
|
||||
// Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server)
|
||||
// We have to resolve the actual file system path from virtual path,
|
||||
// everything else is up to neovim
|
||||
case `neovim`: {
|
||||
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
|
||||
str = `zipfile://${str}`;
|
||||
} break;
|
||||
|
||||
default: {
|
||||
str = `zip:${str}`;
|
||||
} break;
|
||||
}
|
||||
} else {
|
||||
str = str.replace(/^\/?/, process.platform === `win32` ? `` : `/`);
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function fromEditorPath(str) {
|
||||
switch (hostInfo) {
|
||||
case `coc-nvim`: {
|
||||
str = str.replace(/\.zip::/, `.zip/`);
|
||||
// The path for coc-nvim is in format of /<pwd>/zipfile:/<pwd>/.yarn/...
|
||||
// So in order to convert it back, we use .* to match all the thing
|
||||
// before `zipfile:`
|
||||
return process.platform === `win32`
|
||||
? str.replace(/^.*zipfile:\//, ``)
|
||||
: str.replace(/^.*zipfile:/, ``);
|
||||
} break;
|
||||
|
||||
case `neovim`: {
|
||||
str = str.replace(/\.zip::/, `.zip/`);
|
||||
// The path for neovim is in format of zipfile:///<pwd>/.yarn/...
|
||||
return str.replace(/^zipfile:\/\//, ``);
|
||||
} break;
|
||||
|
||||
case `vscode`:
|
||||
default: {
|
||||
return str.replace(/^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, process.platform === `win32` ? `` : `/`)
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
// Force enable 'allowLocalPluginLoads'
|
||||
// TypeScript tries to resolve plugins using a path relative to itself
|
||||
// which doesn't work when using the global cache
|
||||
// https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238
|
||||
// VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but
|
||||
// TypeScript already does local loads and if this code is running the user trusts the workspace
|
||||
// https://github.com/microsoft/vscode/issues/45856
|
||||
const ConfiguredProject = tsserver.server.ConfiguredProject;
|
||||
const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype;
|
||||
ConfiguredProject.prototype.enablePluginsWithOptions = function() {
|
||||
this.projectService.allowLocalPluginLoads = true;
|
||||
return originalEnablePluginsWithOptions.apply(this, arguments);
|
||||
};
|
||||
|
||||
// And here is the point where we hijack the VSCode <-> TS communications
|
||||
// by adding ourselves in the middle. We locate everything that looks
|
||||
// like an absolute path of ours and normalize it.
|
||||
|
||||
const Session = tsserver.server.Session;
|
||||
const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
|
||||
let hostInfo = `unknown`;
|
||||
|
||||
Object.assign(Session.prototype, {
|
||||
onMessage(/** @type {string | object} */ message) {
|
||||
const isStringMessage = typeof message === 'string';
|
||||
const parsedMessage = isStringMessage ? JSON.parse(message) : message;
|
||||
|
||||
if (
|
||||
parsedMessage != null &&
|
||||
typeof parsedMessage === `object` &&
|
||||
parsedMessage.arguments &&
|
||||
typeof parsedMessage.arguments.hostInfo === `string`
|
||||
) {
|
||||
hostInfo = parsedMessage.arguments.hostInfo;
|
||||
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) {
|
||||
const [, major, minor] = (process.env.VSCODE_IPC_HOOK.match(
|
||||
// The RegExp from https://semver.org/ but without the caret at the start
|
||||
/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
|
||||
) ?? []).map(Number)
|
||||
|
||||
if (major === 1) {
|
||||
if (minor < 61) {
|
||||
hostInfo += ` <1.61`;
|
||||
} else if (minor < 66) {
|
||||
hostInfo += ` <1.66`;
|
||||
} else if (minor < 68) {
|
||||
hostInfo += ` <1.68`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => {
|
||||
return typeof value === 'string' ? fromEditorPath(value) : value;
|
||||
});
|
||||
|
||||
return originalOnMessage.call(
|
||||
this,
|
||||
isStringMessage ? processedMessageJSON : JSON.parse(processedMessageJSON)
|
||||
);
|
||||
},
|
||||
|
||||
send(/** @type {any} */ msg) {
|
||||
return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => {
|
||||
return typeof value === `string` ? toEditorPath(value) : value;
|
||||
})));
|
||||
}
|
||||
});
|
||||
|
||||
return tsserver;
|
||||
};
|
||||
|
||||
const [major, minor] = absRequire(`typescript/package.json`).version.split(`.`, 2).map(value => parseInt(value, 10));
|
||||
// In TypeScript@>=5.5 the tsserver uses the public TypeScript API so that needs to be patched as well.
|
||||
// Ref https://github.com/microsoft/TypeScript/pull/55326
|
||||
if (major > 5 || (major === 5 && minor >= 5)) {
|
||||
moduleWrapper(absRequire(`typescript`));
|
||||
}
|
||||
|
||||
// Defer to the real typescript/lib/tsserver.js your application uses
|
||||
module.exports = moduleWrapper(absRequire(`typescript/lib/tsserver.js`));
|
||||
@@ -1,248 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const {existsSync} = require(`fs`);
|
||||
const {createRequire, register} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
const {pathToFileURL} = require(`url`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
|
||||
const absRequire = createRequire(absPnpApiPath);
|
||||
|
||||
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
|
||||
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
|
||||
|
||||
if (existsSync(absPnpApiPath)) {
|
||||
if (!process.versions.pnp) {
|
||||
// Setup the environment to be able to require typescript/lib/tsserverlibrary.js
|
||||
require(absPnpApiPath).setup();
|
||||
if (isPnpLoaderEnabled && register) {
|
||||
register(pathToFileURL(absPnpLoaderPath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
|
||||
? exports => absRequire(absUserWrapperPath)(exports)
|
||||
: exports => exports;
|
||||
|
||||
const moduleWrapper = exports => {
|
||||
return wrapWithUserWrapper(moduleWrapperFn(exports));
|
||||
};
|
||||
|
||||
const moduleWrapperFn = tsserver => {
|
||||
if (!process.versions.pnp) {
|
||||
return tsserver;
|
||||
}
|
||||
|
||||
const {isAbsolute} = require(`path`);
|
||||
const pnpApi = require(`pnpapi`);
|
||||
|
||||
const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
|
||||
const isPortal = str => str.startsWith("portal:/");
|
||||
const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
|
||||
|
||||
const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
|
||||
return `${locator.name}@${locator.reference}`;
|
||||
}));
|
||||
|
||||
// VSCode sends the zip paths to TS using the "zip://" prefix, that TS
|
||||
// doesn't understand. This layer makes sure to remove the protocol
|
||||
// before forwarding it to TS, and to add it back on all returned paths.
|
||||
|
||||
function toEditorPath(str) {
|
||||
// We add the `zip:` prefix to both `.zip/` paths and virtual paths
|
||||
if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) {
|
||||
// We also take the opportunity to turn virtual paths into physical ones;
|
||||
// this makes it much easier to work with workspaces that list peer
|
||||
// dependencies, since otherwise Ctrl+Click would bring us to the virtual
|
||||
// file instances instead of the real ones.
|
||||
//
|
||||
// We only do this to modules owned by the the dependency tree roots.
|
||||
// This avoids breaking the resolution when jumping inside a vendor
|
||||
// with peer dep (otherwise jumping into react-dom would show resolution
|
||||
// errors on react).
|
||||
//
|
||||
const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
|
||||
if (resolved) {
|
||||
const locator = pnpApi.findPackageLocator(resolved);
|
||||
if (locator && (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || isPortal(locator.reference))) {
|
||||
str = resolved;
|
||||
}
|
||||
}
|
||||
|
||||
str = normalize(str);
|
||||
|
||||
if (str.match(/\.zip\//)) {
|
||||
switch (hostInfo) {
|
||||
// Absolute VSCode `Uri.fsPath`s need to start with a slash.
|
||||
// VSCode only adds it automatically for supported schemes,
|
||||
// so we have to do it manually for the `zip` scheme.
|
||||
// The path needs to start with a caret otherwise VSCode doesn't handle the protocol
|
||||
//
|
||||
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
|
||||
//
|
||||
// 2021-10-08: VSCode changed the format in 1.61.
|
||||
// Before | ^zip:/c:/foo/bar.zip/package.json
|
||||
// After | ^/zip//c:/foo/bar.zip/package.json
|
||||
//
|
||||
// 2022-04-06: VSCode changed the format in 1.66.
|
||||
// Before | ^/zip//c:/foo/bar.zip/package.json
|
||||
// After | ^/zip/c:/foo/bar.zip/package.json
|
||||
//
|
||||
// 2022-05-06: VSCode changed the format in 1.68
|
||||
// Before | ^/zip/c:/foo/bar.zip/package.json
|
||||
// After | ^/zip//c:/foo/bar.zip/package.json
|
||||
//
|
||||
case `vscode <1.61`: {
|
||||
str = `^zip:${str}`;
|
||||
} break;
|
||||
|
||||
case `vscode <1.66`: {
|
||||
str = `^/zip/${str}`;
|
||||
} break;
|
||||
|
||||
case `vscode <1.68`: {
|
||||
str = `^/zip${str}`;
|
||||
} break;
|
||||
|
||||
case `vscode`: {
|
||||
str = `^/zip/${str}`;
|
||||
} break;
|
||||
|
||||
// To make "go to definition" work,
|
||||
// We have to resolve the actual file system path from virtual path
|
||||
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
|
||||
case `coc-nvim`: {
|
||||
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
|
||||
str = resolve(`zipfile:${str}`);
|
||||
} break;
|
||||
|
||||
// Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server)
|
||||
// We have to resolve the actual file system path from virtual path,
|
||||
// everything else is up to neovim
|
||||
case `neovim`: {
|
||||
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
|
||||
str = `zipfile://${str}`;
|
||||
} break;
|
||||
|
||||
default: {
|
||||
str = `zip:${str}`;
|
||||
} break;
|
||||
}
|
||||
} else {
|
||||
str = str.replace(/^\/?/, process.platform === `win32` ? `` : `/`);
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function fromEditorPath(str) {
|
||||
switch (hostInfo) {
|
||||
case `coc-nvim`: {
|
||||
str = str.replace(/\.zip::/, `.zip/`);
|
||||
// The path for coc-nvim is in format of /<pwd>/zipfile:/<pwd>/.yarn/...
|
||||
// So in order to convert it back, we use .* to match all the thing
|
||||
// before `zipfile:`
|
||||
return process.platform === `win32`
|
||||
? str.replace(/^.*zipfile:\//, ``)
|
||||
: str.replace(/^.*zipfile:/, ``);
|
||||
} break;
|
||||
|
||||
case `neovim`: {
|
||||
str = str.replace(/\.zip::/, `.zip/`);
|
||||
// The path for neovim is in format of zipfile:///<pwd>/.yarn/...
|
||||
return str.replace(/^zipfile:\/\//, ``);
|
||||
} break;
|
||||
|
||||
case `vscode`:
|
||||
default: {
|
||||
return str.replace(/^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, process.platform === `win32` ? `` : `/`)
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
// Force enable 'allowLocalPluginLoads'
|
||||
// TypeScript tries to resolve plugins using a path relative to itself
|
||||
// which doesn't work when using the global cache
|
||||
// https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238
|
||||
// VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but
|
||||
// TypeScript already does local loads and if this code is running the user trusts the workspace
|
||||
// https://github.com/microsoft/vscode/issues/45856
|
||||
const ConfiguredProject = tsserver.server.ConfiguredProject;
|
||||
const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype;
|
||||
ConfiguredProject.prototype.enablePluginsWithOptions = function() {
|
||||
this.projectService.allowLocalPluginLoads = true;
|
||||
return originalEnablePluginsWithOptions.apply(this, arguments);
|
||||
};
|
||||
|
||||
// And here is the point where we hijack the VSCode <-> TS communications
|
||||
// by adding ourselves in the middle. We locate everything that looks
|
||||
// like an absolute path of ours and normalize it.
|
||||
|
||||
const Session = tsserver.server.Session;
|
||||
const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
|
||||
let hostInfo = `unknown`;
|
||||
|
||||
Object.assign(Session.prototype, {
|
||||
onMessage(/** @type {string | object} */ message) {
|
||||
const isStringMessage = typeof message === 'string';
|
||||
const parsedMessage = isStringMessage ? JSON.parse(message) : message;
|
||||
|
||||
if (
|
||||
parsedMessage != null &&
|
||||
typeof parsedMessage === `object` &&
|
||||
parsedMessage.arguments &&
|
||||
typeof parsedMessage.arguments.hostInfo === `string`
|
||||
) {
|
||||
hostInfo = parsedMessage.arguments.hostInfo;
|
||||
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) {
|
||||
const [, major, minor] = (process.env.VSCODE_IPC_HOOK.match(
|
||||
// The RegExp from https://semver.org/ but without the caret at the start
|
||||
/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
|
||||
) ?? []).map(Number)
|
||||
|
||||
if (major === 1) {
|
||||
if (minor < 61) {
|
||||
hostInfo += ` <1.61`;
|
||||
} else if (minor < 66) {
|
||||
hostInfo += ` <1.66`;
|
||||
} else if (minor < 68) {
|
||||
hostInfo += ` <1.68`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => {
|
||||
return typeof value === 'string' ? fromEditorPath(value) : value;
|
||||
});
|
||||
|
||||
return originalOnMessage.call(
|
||||
this,
|
||||
isStringMessage ? processedMessageJSON : JSON.parse(processedMessageJSON)
|
||||
);
|
||||
},
|
||||
|
||||
send(/** @type {any} */ msg) {
|
||||
return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => {
|
||||
return typeof value === `string` ? toEditorPath(value) : value;
|
||||
})));
|
||||
}
|
||||
});
|
||||
|
||||
return tsserver;
|
||||
};
|
||||
|
||||
const [major, minor] = absRequire(`typescript/package.json`).version.split(`.`, 2).map(value => parseInt(value, 10));
|
||||
// In TypeScript@>=5.5 the tsserver uses the public TypeScript API so that needs to be patched as well.
|
||||
// Ref https://github.com/microsoft/TypeScript/pull/55326
|
||||
if (major > 5 || (major === 5 && minor >= 5)) {
|
||||
moduleWrapper(absRequire(`typescript`));
|
||||
}
|
||||
|
||||
// Defer to the real typescript/lib/tsserverlibrary.js your application uses
|
||||
module.exports = moduleWrapper(absRequire(`typescript/lib/tsserverlibrary.js`));
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const {existsSync} = require(`fs`);
|
||||
const {createRequire, register} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
const {pathToFileURL} = require(`url`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
|
||||
const absRequire = createRequire(absPnpApiPath);
|
||||
|
||||
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
|
||||
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
|
||||
|
||||
if (existsSync(absPnpApiPath)) {
|
||||
if (!process.versions.pnp) {
|
||||
// Setup the environment to be able to require typescript
|
||||
require(absPnpApiPath).setup();
|
||||
if (isPnpLoaderEnabled && register) {
|
||||
register(pathToFileURL(absPnpLoaderPath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
|
||||
? exports => absRequire(absUserWrapperPath)(exports)
|
||||
: exports => exports;
|
||||
|
||||
// Defer to the real typescript your application uses
|
||||
module.exports = wrapWithUserWrapper(absRequire(`typescript`));
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"name": "typescript",
|
||||
"version": "5.8.3-sdk",
|
||||
"main": "./lib/typescript.js",
|
||||
"type": "commonjs",
|
||||
"bin": {
|
||||
"tsc": "./bin/tsc",
|
||||
"tsserver": "./bin/tsserver"
|
||||
}
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
# vscode-java-configs
|
||||
|
||||
|
||||
## FAQ
|
||||
|
||||
### Typescript Server crashed 5 times
|
||||
- Open `.pnp.cjs` and replace `bestCandidate.apiPaths.length === 1` with `bestCandidate.apiPaths.length > 0`
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"targetPlatform": "./org.jkiss.cloudbeaver.tp.target"
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?pde version="3.8"?>
|
||||
<target name="org.jkiss.cloudbeaver.tp">
|
||||
<locations>
|
||||
<location path="../../../dbeaver-workspace/dependencies/plugins" type="Directory"/>
|
||||
</locations>
|
||||
</target>
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"name": "vscode-java-configs",
|
||||
"packageManager": "yarn@4.9.2",
|
||||
"devDependencies": {
|
||||
"typescript": "^5.8.3"
|
||||
}
|
||||
}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
# This file is generated by running "yarn install" inside your project.
|
||||
# Manual changes might be lost - proceed with caution!
|
||||
|
||||
__metadata:
|
||||
version: 8
|
||||
cacheKey: 10c0
|
||||
|
||||
"typescript@npm:^5.8.3":
|
||||
version: 5.8.3
|
||||
resolution: "typescript@npm:5.8.3"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
checksum: 10c0/5f8bb01196e542e64d44db3d16ee0e4063ce4f3e3966df6005f2588e86d91c03e1fb131c2581baf0fb65ee79669eea6e161cd448178986587e9f6844446dbb48
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"typescript@patch:typescript@npm%3A^5.8.3#optional!builtin<compat/typescript>":
|
||||
version: 5.8.3
|
||||
resolution: "typescript@patch:typescript@npm%3A5.8.3#optional!builtin<compat/typescript>::version=5.8.3&hash=5786d5"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
checksum: 10c0/39117e346ff8ebd87ae1510b3a77d5d92dae5a89bde588c747d25da5c146603a99c8ee588c7ef80faaf123d89ed46f6dbd918d534d641083177d5fac38b8a1cb
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"vscode-java-configs@workspace:.":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "vscode-java-configs@workspace:."
|
||||
dependencies:
|
||||
typescript: "npm:^5.8.3"
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
@@ -1,66 +1,62 @@
|
||||
<img src="https://github.com/dbeaver/cloudbeaver/wiki/images/cloudbeaver-logo.png" align="right" width="250"/>
|
||||
|
||||
# CloudBeaver Community
|
||||
|
||||
Cloud Database Manager - Community Edition.
|
||||
CloudBeaver is a web server that provides a rich web interface. The server itself is a Java application, and the web part is written in TypeScript and React.
|
||||
It is free to use and open-source (licensed under [Apache 2](https://github.com/dbeaver/cloudbeaver/blob/devel/LICENSE) license).
|
||||
See our [WIKI](https://github.com/dbeaver/cloudbeaver/wiki) for more details.
|
||||
<img src="https://github.com/dbeaver/cloudbeaver/wiki/images/cloudbeaver-logo.png" width="250"/>
|
||||
|
||||
<a><img src="https://github.com/dbeaver/cloudbeaver/wiki/images/connection-creation-demo.png" width="400"/></a>
|
||||
<img src="https://github.com/dbeaver/cloudbeaver/wiki/images/gis-demo.png" width="400"/>
|
||||
<img src="https://github.com/dbeaver/cloudbeaver/wiki/images/data-transfer-demo.png" width="400"/>
|
||||
<img src="https://github.com/dbeaver/cloudbeaver/wiki/images/sql-editor-demo.png" width="400"/>
|
||||
Cloud Database Manager - Community Edition.
|
||||
CloudBeaver is a web server which provides rich web interface. Server itself is a Java application, web part is written on TypeScript and React.
|
||||
It is free to use and open-source (licensed under [Apache 2](https://github.com/dbeaver/cloudbeaver/blob/devel/LICENSE) license).
|
||||
See out [WIKI](https://github.com/dbeaver/cloudbeaver/wiki) for more details.
|
||||
|
||||

|
||||
|
||||
## Run in Docker
|
||||
|
||||
- [Official Docker repository](https://hub.docker.com/r/dbeaver/cloudbeaver)
|
||||
- [Deployment instructions](https://github.com/dbeaver/cloudbeaver/wiki/CloudBeaver-Deployment)
|
||||
- [Running instructions](https://github.com/dbeaver/cloudbeaver/wiki/Run-Docker-Container)
|
||||
|
||||
## Demo server
|
||||
|
||||
You can see a live demo of CloudBeaver here: https://demo.cloudbeaver.io
|
||||
You can see live demo of CloudBeaver here: https://demo.cloudbeaver.io
|
||||
|
||||
[Database access instructions](https://github.com/dbeaver/cloudbeaver/wiki/Demo-Server)
|
||||
|
||||
## Changelog
|
||||
|
||||
### 25.2.1 2025-09-22
|
||||
- Autocomplete values in SQL Editor are ordered alphabetically to simplify object search.
|
||||
- "Show all databases" setting was added on the connection page for MySQL and MariaDB.
|
||||
### 24.0.1. 2024-03-25
|
||||
- Added support for two modes for committing changes to the database:
|
||||
- Auto-commit transfers all changes that you make immediately to the database;
|
||||
- Manual commit requires your confirmation before committing a change to the database or rolling it back.
|
||||
- Different bug fixes and enhancements have been made.
|
||||
|
||||
### 24.0.0. 2024-03-04
|
||||
- Changes since 23.3.0:
|
||||
|
||||
### 25.2.0 2025-09-01
|
||||
### Changes since 25.1.0:
|
||||
- Main updates:
|
||||
- Have enhanced security for unauthorised access;
|
||||
- Have added a password policy for the local authorization. Password parameters can be set in the configuration file;
|
||||
- Have added validation for mandatory fields in all forms to create and edit entities;
|
||||
- Have added an ability to edit the default preferences of the following parts: interface, tools and data viewer in the settings panel in the administrative part;
|
||||
- Performance:
|
||||
- Have improved the performance of the server.
|
||||
- Administration:
|
||||
- Added support for multiple server URLs to accommodate different access policies for internal and external users, improving flexibility in network-restricted environments. To set it up, use the Allowed Server URLs field in the Server configuration within the Administration section;
|
||||
- Added the Force HTTPS mode setting in Server Configuration to enforce redirecting from HTTP to HTTPS. This setting helps avoid a potential man-in-the-middle attack. This setting is turned off by default. Please remember to configure your proxy before enabling;
|
||||
- Added the CLOUDBEAVER_BIND_SESSION_TO_IP option to improve session security by linking user sessions to their IP address. It is disabled by default. When enabled, this helps protect against certain types of session hijacking attacks, where an attacker could try to take over a user’s session. Note: Users will be logged out automatically on the IP address change (switching networks or using mobile data);
|
||||
- A password confirmation field has been added for administrators in the Easy Config section to prevent accidental misconfigurations.
|
||||
- SQL Editor:
|
||||
- Changed the default engine used for autocompletion in the SQL Editor. This Semantic engine offers improved suggestions for database objects, keywords, and functions. You can switch back to the Legacy engine in Preferences > SQL Editor;
|
||||
- A “Clear” button was added to the output panel.
|
||||
- Data Editor:
|
||||
- Column descriptions were added in the Data Editor under column names to provide more metadata context. You can disable this in Preferences > Data Viewer;
|
||||
- Added an ability to review the script before execution when users edit tables without primary keys.
|
||||
- General:
|
||||
- Added a new welcome screen for a freshly opened application. This screen contains shortcuts to create a new connection, open SQL Editor, or documentation;
|
||||
- Added a search panel for SQL Editor and Value panel: press Ctrl/Cmd + F to open a panel that allows searching and replacing by keyword or regular expression;
|
||||
- Changed the data transfer mechanism to avoid intermediate file creation. The parameter dataExportFileSizeLimit was removed from the server configuration as deprecated;
|
||||
- The CloudBeaver default theme matches the device theme by default now. You can change this behavior in user preferences under the Theme section;
|
||||
- Added the option to display tabs across multiple rows, allowing you to see all tabs without scrolling. You can enable this in Preferences > Interface;
|
||||
- Improved dark theme accessibility by enhancing color contrast across the app for better readability and compliance with accessibility standards;
|
||||
- The database navigator now automatically hides empty folders in shared projects, reducing visual clutter and speeding up the process of finding active connections.
|
||||
- Databases and drivers:
|
||||
- Clickhouse: fixed the presentation of tuples and map data types in the Data Editor;
|
||||
- Databend database support has been added (thanks to @hantmac);
|
||||
- DuckDB: driver has been updated to version 1.3;
|
||||
- MySQL: Improved performance when retrieving foreign keys metadata;
|
||||
- PostgreSQL: fixed misplaced comment for table DDL generation.
|
||||
|
||||
## Contribution
|
||||
As a community-driven open-source project, we warmly welcome contributions through GitHub pull requests.
|
||||
|
||||
[We are happy to reward](https://dbeaver.com/help-dbeaver/) our most active contributors every major sprint.
|
||||
The most significant contribution to our code for the major release 25.2.0 was made by:
|
||||
1. [hantmac](https://github.com/hantmac) - added support for Databend in CloudBeaver Community Edition.
|
||||
- Have added the ability to configure reverse proxy header name and redirect URL at logout. Now the administrator can configure all settings. The delimiter symbol for the reverse proxy team headers is configurable;
|
||||
- Preferences:
|
||||
- Have added the ability in the admin panel to customise copying in the Tables and Values panel for all users except the administrator;
|
||||
- Have added the ability to disable alias autocomplete for all users.
|
||||
- Access Management:
|
||||
- A default user group was added to the product. This group includes all users which could not be deleted.
|
||||
- Connections:
|
||||
- The 'Keep alive' option has been added to the connection settings to keep the connection active even in case of inactivity.
|
||||
- Data Editor:
|
||||
- Have added the ability to view decoded binary-type data in the Value panel;
|
||||
- Text wrap is activated by default for texts and BLOBs in the Values panel for better visibility. The user can switch to the one-line mode using a button on the toolbar;
|
||||
- Have added the ability to display full text for a string data type in the Value panel;
|
||||
- Have added the ability to display the OpenStreetMap layer with the coordinate system ESPG 4326.
|
||||
- Resource management:
|
||||
- Read-only scripts now have a padlock icon.
|
||||
- Databases:
|
||||
- The DuckDB driver has been added;
|
||||
- Updated PostgreSQL driver to 42.5.2;
|
||||
- ClickHouse Legacy driver has been removed to prevent potential vulnerability issues;
|
||||
- Updated MariaDB driver to version 3.3.2.
|
||||
- Different bug fixes and enhancements have been made.
|
||||
|
||||
+3
-4
@@ -9,10 +9,9 @@ currently being supported with security updates.
|
||||
| ------- | --------- |
|
||||
| 22.x | yes |
|
||||
| 23.x | yes |
|
||||
| 24.x | yes |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please report (suspected) security vulnerabilities to devops@dbeaver.com.
|
||||
You will receive a response from us within 48 hours.
|
||||
If the issue is confirmed, we will release a patch as soon as possible, depending on complexity, but historically, within a few days.
|
||||
Please report (suspected) security vulnerabilities to devops@dbeaver.com.
|
||||
You will receive a response from us within 48 hours.
|
||||
If the issue is confirmed, we will release a patch as soon as possible depending on complexity but historically within a few days.
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>2.1.214</version>
|
||||
<version>2.2.220</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"folders": {},
|
||||
"connections": {}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
{
|
||||
server: {
|
||||
serverPort: "${CLOUDBEAVER_WEB_SERVER_PORT:8978}",
|
||||
forceHttps: "${CLOUDBEAVER_FORCE_HTTPS:false}",
|
||||
|
||||
contentRoot: "web",
|
||||
driversLocation: "drivers",
|
||||
|
||||
sslConfigurationPath:"${CLOUDBEAVER_SSL_CONF_PATH:workspace/.data/ssl-config.xml}",
|
||||
|
||||
rootURI: "${CLOUDBEAVER_ROOT_URI:/}",
|
||||
serviceURI: "/api/",
|
||||
supportedHosts: [],
|
||||
|
||||
productSettings: {
|
||||
# Global properties
|
||||
core.theming.theme: "${CLOUDBEAVER_CORE_THEMING_THEME:system}",
|
||||
core.localization.language: "${CLOUDBEAVER_CORE_LOCALIZATION:en}",
|
||||
plugin.sql-editor.autoSave: "${CLOUDBEAVER_SQL_EDITOR_AUTOSAVE:true}",
|
||||
plugin.sql-editor.disabled: "${CLOUDBEAVER_SQL_EDITOR_DISABLED:false}",
|
||||
# max size of the file that can be uploaded to the editor (in kilobytes)
|
||||
plugin.sql-editor.maxFileSize: "${CLOUDBEAVER_SQL_EDITOR_MAX_FILE_SIZE:10240}",
|
||||
plugin.log-viewer.disabled: "${CLOUDBEAVER_LOG_VIEWER_DISABLED:false}",
|
||||
plugin.log-viewer.logBatchSize: "${CLOUDBEAVER_LOG_VIEWER_LOG_BATCH_SIZE:1000}",
|
||||
plugin.log-viewer.maxLogRecords: "${CLOUDBEAVER_LOG_VIEWER_MAX_LOG_RECORDS:2000}",
|
||||
sql.proposals.insert.table.alias: "${CLOUDBEAVER_SQL_PROPOSALS_INSERT_TABLE_ALIAS:PLAIN}",
|
||||
SQLEditor.ContentAssistant.experimental.mode: "${CLOUDBEAVER_SQL_EDITOR_CONTENT_ASSISTANT_EXPERIMENTAL_MODE:NEW}"
|
||||
},
|
||||
|
||||
expireSessionAfterPeriod: "${CLOUDBEAVER_EXPIRE_SESSION_AFTER_PERIOD:1800000}",
|
||||
bindSessionToIp: "${CLOUDBEAVER_BIND_SESSION_TO_IP:disable}",
|
||||
develMode: "${CLOUDBEAVER_DEVEL_MODE:false}",
|
||||
|
||||
enableSecurityManager: false,
|
||||
|
||||
sm: {
|
||||
enableBruteForceProtection: "${CLOUDBEAVER_BRUTE_FORCE_PROTECTION_ENABLED:true}",
|
||||
maxFailedLogin: "${CLOUDBEAVER_MAX_FAILED_LOGINS:10}",
|
||||
minimumLoginTimeout: "${CLOUDBEAVER_MINIMUM_LOGIN_TIMEOUT:1}",
|
||||
blockLoginPeriod: "${CLOUDBEAVER_BLOCK_PERIOD:300}",
|
||||
passwordPolicy: {
|
||||
minLength: "${CLOUDBEAVER_POLICY_MIN_LENGTH:8}",
|
||||
requireMixedCase: "${CLOUDBEAVER_POLICY_REQUIRE_MIXED_CASE:true}",
|
||||
minNumberCount: "${CLOUDBEAVER_POLICY_MIN_NUMBER_COUNT:1}",
|
||||
minSymbolCount: "${CLOUDBEAVER_POLICY_MIN_SYMBOL_COUNT:0}"
|
||||
}
|
||||
},
|
||||
|
||||
database: {
|
||||
driver: "${CLOUDBEAVER_DB_DRIVER:h2_embedded_v2}",
|
||||
url: "${CLOUDBEAVER_DB_URL:jdbc:h2:${workspace}/.data/cb.h2v2.dat}",
|
||||
schema: "${CLOUDBEAVER_DB_SCHEMA:''}",
|
||||
user: "${CLOUDBEAVER_DB_USER:''}",
|
||||
password: "${CLOUDBEAVER_DB_PASSWORD:''}",
|
||||
initialDataConfiguration: "${CLOUDBEAVER_DB_INITIAL_DATA:conf/initial-data.conf}",
|
||||
pool: {
|
||||
minIdleConnections: "${CLOUDBEAVER_DB_MIN_IDLE_CONNECTIONS:4}",
|
||||
maxIdleConnections: "${CLOUDBEAVER_DB_MAX_IDLE_CONNECTIONS:10}",
|
||||
maxConnections: "${CLOUDBEAVER_DB_MAX_CONNECTIONS:100}",
|
||||
validationQuery: "${CLOUDBEAVER_DB_VALIDATION_QUERY:SELECT 1}"
|
||||
},
|
||||
backupEnabled: "${CLOUDBEAVER_DB_BACKUP_ENABLED:true}"
|
||||
}
|
||||
|
||||
},
|
||||
app: {
|
||||
anonymousAccessEnabled: "${CLOUDBEAVER_APP_ANONYMOUS_ACCESS_ENABLED:true}",
|
||||
anonymousUserRole: user,
|
||||
defaultUserTeam: "${CLOUDBEAVER_APP_DEFAULT_USER_TEAM:user}",
|
||||
grantConnectionsAccessToAnonymousTeam: "${CLOUDBEAVER_APP_GRANT_CONNECTIONS_ACCESS_TO_ANONYMOUS_TEAM:false}",
|
||||
supportsCustomConnections: "${CLOUDBEAVER_APP_SUPPORTS_CUSTOM_CONNECTIONS:false}",
|
||||
showReadOnlyConnectionInfo: "${CLOUDBEAVER_APP_READ_ONLY_CONNECTION_INFO:false}",
|
||||
systemVariablesResolvingEnabled: "${CLOUDBEAVER_SYSTEM_VARIABLES_RESOLVING_ENABLED:false}",
|
||||
|
||||
forwardProxy: "${CLOUDBEAVER_APP_FORWARD_PROXY:false}",
|
||||
|
||||
publicCredentialsSaveEnabled: "${CLOUDBEAVER_APP_PUBLIC_CREDENTIALS_SAVE_ENABLED:true}",
|
||||
adminCredentialsSaveEnabled: "${CLOUDBEAVER_APP_ADMIN_CREDENTIALS_SAVE_ENABLED:true}",
|
||||
|
||||
resourceManagerEnabled: "${CLOUDBEAVER_APP_RESOURCE_MANAGER_ENABLED:true}",
|
||||
|
||||
resourceQuotas: {
|
||||
resourceManagerFileSizeLimit: "${CLOUDBEAVER_RESOURCE_QUOTA_RESOURCE_MANAGER_FILE_SIZE_LIMIT:500000}",
|
||||
sqlMaxRunningQueries: "${CLOUDBEAVER_RESOURCE_QUOTA_SQL_MAX_RUNNING_QUERIES:100}",
|
||||
sqlResultSetRowsLimit: "${CLOUDBEAVER_RESOURCE_QUOTA_SQL_RESULT_SET_ROWS_LIMIT:100000}",
|
||||
sqlTextPreviewMaxLength: "${CLOUDBEAVER_RESOURCE_QUOTA_SQL_TEXT_PREVIEW_MAX_LENGTH:4096}",
|
||||
sqlBinaryPreviewMaxLength: "${CLOUDBEAVER_RESOURCE_QUOTA_SQL_BINARY_PREVIEW_MAX_LENGTH:261120}"
|
||||
},
|
||||
enabledAuthProviders: [
|
||||
"local"
|
||||
],
|
||||
|
||||
disabledBetaFeatures: [
|
||||
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"folders": {},
|
||||
"connections": {
|
||||
"postgresql-template-1": {
|
||||
"provider": "postgresql",
|
||||
"driver": "postgres-jdbc",
|
||||
"name": "PostgreSQL (Template)",
|
||||
"save-password": false,
|
||||
"show-system-objects": false,
|
||||
"read-only": true,
|
||||
"template": true,
|
||||
"configuration": {
|
||||
"host": "localhost",
|
||||
"port": "5432",
|
||||
"database": "postgres",
|
||||
"url": "jdbc:postgresql://localhost:5432/postgres",
|
||||
"type": "dev",
|
||||
"provider-properties": {
|
||||
"@dbeaver-show-non-default-db@": "false"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
{
|
||||
server: {
|
||||
serverPort: 8978,
|
||||
|
||||
workspaceLocation: "workspace",
|
||||
contentRoot: "web",
|
||||
driversLocation: "drivers",
|
||||
|
||||
sslConfigurationPath:"${CLOUDBEAVER_SSL_CONF_PATH:workspace/.data/ssl-config.xml}",
|
||||
|
||||
rootURI: "/",
|
||||
serviceURI: "/api/",
|
||||
|
||||
productSettings: {
|
||||
# Global properties
|
||||
core.theming.theme: 'light',
|
||||
core.localization.localization: 'en',
|
||||
plugin.sql-editor.autoSave: true,
|
||||
plugin.sql-editor.disabled: false,
|
||||
# max size of the file that can be uploaded to the editor (in kilobytes)
|
||||
plugin.sql-editor.maxFileSize: 10240,
|
||||
plugin.log-viewer.disabled: false,
|
||||
plugin.log-viewer.logBatchSize: 1000,
|
||||
plugin.log-viewer.maxFailedRequests: 3,
|
||||
plugin.log-viewer.maxLogRecords: 2000,
|
||||
plugin.log-viewer.refreshTimeout: 3000,
|
||||
sql.proposals.insert.table.alias: PLAIN
|
||||
},
|
||||
|
||||
expireSessionAfterPeriod: 1800000,
|
||||
|
||||
develMode: false,
|
||||
|
||||
enableSecurityManager: false,
|
||||
|
||||
sm: {
|
||||
enableBruteForceProtection: "${CLOUDBEAVER_BRUTE_FORCE_PROTECTION_ENABLED:true}",
|
||||
maxFailedLogin: "${CLOUDBEAVER_MAX_FAILED_LOGINS:10}",
|
||||
minimumLoginTimeout: "${CLOUDBEAVER_MINIMUM_LOGIN_TIMEOUT:1}",
|
||||
blockLoginPeriod: "${CLOUDBEAVER_BLOCK_PERIOD:300}",
|
||||
passwordPolicy: {
|
||||
minLength: "${CLOUDBEAVER_POLICY_MIN_LENGTH:8}",
|
||||
requireMixedCase: "${CLOUDBEAVER_POLICY_REQUIRE_MIXED_CASE:true}",
|
||||
minNumberCount: "${CLOUDBEAVER_POLICY_MIN_NUMBER_COUNT:1}",
|
||||
minSymbolCount: "${CLOUDBEAVER_POLICY_MIN_SYMBOL_COUNT:0}"
|
||||
}
|
||||
},
|
||||
|
||||
database: {
|
||||
driver: "h2_embedded_v2",
|
||||
url: "jdbc:h2:${workspace}/.data/cb.h2v2.dat",
|
||||
initialDataConfiguration: "conf/initial-data.conf",
|
||||
pool: {
|
||||
minIdleConnections: 4,
|
||||
maxIdleConnections: 10,
|
||||
maxConnections: 100,
|
||||
validationQuery: "SELECT 1"
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
app: {
|
||||
anonymousAccessEnabled: true,
|
||||
anonymousUserRole: "user",
|
||||
defaultUserTeam: "user",
|
||||
grantConnectionsAccessToAnonymousTeam: false,
|
||||
supportsCustomConnections: false,
|
||||
showReadOnlyConnectionInfo: false,
|
||||
systemVariablesResolvingEnabled: "${CLOUDBEAVER_SYSTEM_VARIABLES_RESOLVING_ENABLED:false}",
|
||||
|
||||
forwardProxy: false,
|
||||
|
||||
publicCredentialsSaveEnabled: true,
|
||||
adminCredentialsSaveEnabled: true,
|
||||
|
||||
resourceManagerEnabled: true,
|
||||
|
||||
resourceQuotas: {
|
||||
dataExportFileSizeLimit: 10000000,
|
||||
resourceManagerFileSizeLimit: 500000,
|
||||
sqlMaxRunningQueries: 100,
|
||||
sqlResultSetRowsLimit: 100000,
|
||||
sqlResultSetMemoryLimit: 2000000,
|
||||
sqlTextPreviewMaxLength: 4096,
|
||||
sqlBinaryPreviewMaxLength: 261120
|
||||
},
|
||||
enabledAuthProviders: [
|
||||
"local"
|
||||
],
|
||||
|
||||
disabledDrivers: [
|
||||
"sqlite:sqlite_jdbc",
|
||||
"h2:h2_embedded",
|
||||
"h2:h2_embedded_v2",
|
||||
"clickhouse:yandex_clickhouse"
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
### Sample databases
|
||||
|
||||
Provides access to locally deployed SQLite sample database
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"folders": {},
|
||||
"connections": {
|
||||
"sqlite_xerial-sample-database": {
|
||||
"provider": "generic",
|
||||
"driver": "sqlite_jdbc",
|
||||
"name": "SQLite - Chinook (Sample)",
|
||||
"save-password": true,
|
||||
"navigator-show-only-entities": false,
|
||||
"navigator-hide-folders": false,
|
||||
"read-only": false,
|
||||
"template": false,
|
||||
"configuration": {
|
||||
"database": "${application.path}/../samples/db/Chinook.sqlitedb",
|
||||
"type": "dev",
|
||||
"auth-model": "native"
|
||||
}
|
||||
},
|
||||
"postgresql-template-1": {
|
||||
"provider": "postgresql",
|
||||
"driver": "postgres-jdbc",
|
||||
"name": "PostgreSQL (Template)",
|
||||
"save-password": false,
|
||||
"show-system-objects": false,
|
||||
"read-only": true,
|
||||
"template": true,
|
||||
"configuration": {
|
||||
"host": "localhost",
|
||||
"port": "5432",
|
||||
"database": "postgres",
|
||||
"url": "jdbc:postgresql://localhost:5432/postgres",
|
||||
"type": "dev",
|
||||
"provider-properties": {
|
||||
"@dbeaver-show-non-default-db@": "false"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"folders": {},
|
||||
"connections": {}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
{
|
||||
server: {
|
||||
serverPort: 8978,
|
||||
|
||||
workspaceLocation: "workspace",
|
||||
contentRoot: "web",
|
||||
driversLocation: "drivers",
|
||||
|
||||
rootURI: "/",
|
||||
serviceURI: "/api/",
|
||||
|
||||
productSettings: {
|
||||
# Global properties
|
||||
core.theming.theme: 'light',
|
||||
core.localization.localization: 'en',
|
||||
plugin.sql-editor.autoSave: true,
|
||||
plugin.sql-editor.disabled: false,
|
||||
# max size of the file that can be uploaded to the editor (in kilobytes)
|
||||
plugin.sql-editor.maxFileSize: 10240,
|
||||
plugin.log-viewer.disabled: false,
|
||||
plugin.log-viewer.logBatchSize: 1000,
|
||||
plugin.log-viewer.maxFailedRequests: 3,
|
||||
plugin.log-viewer.maxLogRecords: 2000,
|
||||
plugin.log-viewer.refreshTimeout: 3000,
|
||||
sql.proposals.insert.table.alias: PLAIN
|
||||
},
|
||||
|
||||
expireSessionAfterPeriod: 1800000,
|
||||
|
||||
develMode: false,
|
||||
|
||||
enableSecurityManager: false,
|
||||
|
||||
database: {
|
||||
driver:"h2_embedded_v2",
|
||||
url: "jdbc:h2:${workspace}/.data/cb.h2v2.dat",
|
||||
initialDataConfiguration: "conf/initial-data.conf",
|
||||
pool: {
|
||||
minIdleConnections: 4,
|
||||
maxIdleConnections: 10,
|
||||
maxConnections: 100,
|
||||
validationQuery: "SELECT 1"
|
||||
}
|
||||
},
|
||||
sm: {
|
||||
enableBruteForceProtection: "${CLOUDBEAVER_BRUTE_FORCE_PROTECTION_ENABLED:true}",
|
||||
maxFailedLogin: "${CLOUDBEAVER_MAX_FAILED_LOGINS:10}",
|
||||
minimumLoginTimeout: "${CLOUDBEAVER_MINIMUM_LOGIN_TIMEOUT:1}",
|
||||
blockLoginPeriod: "${CLOUDBEAVER_BLOCK_PERIOD:300}",
|
||||
passwordPolicy: {
|
||||
minLength: "${CLOUDBEAVER_POLICY_MIN_LENGTH:8}",
|
||||
requireMixedCase: "${CLOUDBEAVER_POLICY_REQUIRE_MIXED_CASE:true}",
|
||||
minNumberCount: "${CLOUDBEAVER_POLICY_MIN_NUMBER_COUNT:1}",
|
||||
minSymbolCount: "${CLOUDBEAVER_POLICY_MIN_SYMBOL_COUNT:0}"
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
app: {
|
||||
anonymousAccessEnabled: true,
|
||||
anonymousUserRole: "user",
|
||||
grantConnectionsAccessToAnonymousTeam: false,
|
||||
supportsCustomConnections: false,
|
||||
showReadOnlyConnectionInfo: false,
|
||||
systemVariablesResolvingEnabled: "${CLOUDBEAVER_SYSTEM_VARIABLES_RESOLVING_ENABLED:false}",
|
||||
|
||||
forwardProxy: false,
|
||||
|
||||
publicCredentialsSaveEnabled: true,
|
||||
adminCredentialsSaveEnabled: true,
|
||||
|
||||
resourceManagerEnabled: true,
|
||||
|
||||
resourceQuotas: {
|
||||
dataExportFileSizeLimit: 10000000,
|
||||
resourceManagerFileSizeLimit: 500000,
|
||||
sqlMaxRunningQueries: 100,
|
||||
sqlResultSetRowsLimit: 100000,
|
||||
sqlResultSetMemoryLimit: 2000000,
|
||||
sqlTextPreviewMaxLength: 4096,
|
||||
sqlBinaryPreviewMaxLength: 261120
|
||||
},
|
||||
enabledAuthProviders: [
|
||||
"local"
|
||||
],
|
||||
|
||||
disabledDrivers: [
|
||||
"h2:h2_embedded",
|
||||
"h2:h2_embedded_v2",
|
||||
"clickhouse:yandex_clickhouse"
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
Chinook Database - Version 1.3
|
||||
Script: Chinook_Sqlite.sql
|
||||
Description: Creates and populates the Chinook database.
|
||||
DB Server: Sqlite
|
||||
Author: Luis Rocha
|
||||
License: http://www.codeplex.com/ChinookDatabase/license
|
||||
+20
-2
@@ -2,6 +2,12 @@
|
||||
set -Eeo pipefail
|
||||
set +u
|
||||
|
||||
# #command line arguments
|
||||
# CONFIGURATION_PATH=${1-"../config/sample-databases/DefaultConfiguration"}
|
||||
# SAMPLE_DATABASE_PATH=${2-""}
|
||||
|
||||
# echo $CONFIGURATION_PATH
|
||||
# echo $SAMPLE_DATABASE_PATH
|
||||
echo "Clone and build Cloudbeaver"
|
||||
|
||||
rm -rf ./drivers
|
||||
@@ -10,6 +16,7 @@ mkdir ./cloudbeaver
|
||||
mkdir ./cloudbeaver/server
|
||||
mkdir ./cloudbeaver/conf
|
||||
mkdir ./cloudbeaver/workspace
|
||||
mkdir ./cloudbeaver/web
|
||||
|
||||
echo "Pull cloudbeaver platform"
|
||||
|
||||
@@ -18,7 +25,6 @@ cd ../..
|
||||
echo "Pull dbeaver platform"
|
||||
[ ! -d dbeaver ] && git clone --depth 1 https://github.com/dbeaver/dbeaver.git
|
||||
[ ! -d dbeaver-common ] && git clone --depth 1 https://github.com/dbeaver/dbeaver-common.git
|
||||
[ ! -d dbeaver-jdbc-libsql ] && git clone --depth 1 https://github.com/dbeaver/dbeaver-jdbc-libsql.git
|
||||
|
||||
|
||||
cd cloudbeaver/deploy
|
||||
@@ -38,8 +44,20 @@ cp -rp ../server/product/web-server/target/products/io.cloudbeaver.product/all/a
|
||||
cp -p ./scripts/* ./cloudbeaver
|
||||
mkdir cloudbeaver/samples
|
||||
|
||||
if [[ -z $SAMPLE_DATABASE_PATH ]]; then
|
||||
SAMPLE_DATABASE_PATH=""
|
||||
else
|
||||
mkdir cloudbeaver/samples/db
|
||||
cp -rp "${SAMPLE_DATABASE_PATH}" cloudbeaver/samples/
|
||||
fi
|
||||
|
||||
if [[ -z "$CONFIGURATION_PATH" ]]; then
|
||||
CONFIGURATION_PATH="../config/sample-databases/DefaultConfiguration"
|
||||
fi
|
||||
|
||||
cp -rp ../config/core/* cloudbeaver/conf
|
||||
cp -rp ../config/GlobalConfiguration/.dbeaver/data-sources.json cloudbeaver/conf/initial-data-sources.conf
|
||||
cp -rp "${CONFIGURATION_PATH}"/GlobalConfiguration/.dbeaver/data-sources.json cloudbeaver/conf/initial-data-sources.conf
|
||||
cp -p "${CONFIGURATION_PATH}"/*.conf cloudbeaver/conf/
|
||||
mv drivers cloudbeaver
|
||||
|
||||
echo "End of backend build"
|
||||
@@ -3,25 +3,15 @@ set -Eeuo pipefail
|
||||
|
||||
echo "Build static content"
|
||||
|
||||
mkdir -p ./cloudbeaver/web
|
||||
|
||||
cd ../../cloudbeaver/webapp
|
||||
|
||||
yarn install --immutable
|
||||
cd ./packages/product-default
|
||||
yarn run bundle
|
||||
|
||||
yarn
|
||||
yarn lerna run bootstrap
|
||||
yarn lerna run bundle --no-bail --stream --scope=@cloudbeaver/product-default #-- -- --env source-map
|
||||
if [[ "$?" -ne 0 ]] ; then
|
||||
echo 'Application build failed'; exit $rc
|
||||
fi
|
||||
|
||||
cd ../../
|
||||
yarn test
|
||||
|
||||
if [[ "$?" -ne 0 ]] ; then
|
||||
echo 'Frontend tests failed'; exit $rc
|
||||
fi
|
||||
|
||||
cd ../deploy
|
||||
|
||||
echo "Copy static content"
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
@call build.bat ..\config\sample-databases\SQLiteConfiguration ..\config\sample-databases\db
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
#command line arguments
|
||||
CONFIGURATION_PATH='../config/sample-databases/SQLiteConfiguration'
|
||||
SAMPLE_DATABASE_PATH='../config/sample-databases/db'
|
||||
|
||||
source build-backend.sh
|
||||
source build-frontend.sh
|
||||
+18
-24
@@ -1,6 +1,11 @@
|
||||
@echo off
|
||||
|
||||
rem command line arguments
|
||||
SET CONFIGURATION_PATH=%1
|
||||
SET SAMPLE_DATABASE_PATH=%2
|
||||
|
||||
IF "%CONFIGURATION_PATH%"=="" SET CONFIGURATION_PATH="..\config\sample-databases\DefaultConfiguration"
|
||||
echo "Configuration path=%CONFIGURATION_PATH%"
|
||||
|
||||
echo Clone and build Cloudbeaver
|
||||
|
||||
@@ -20,8 +25,6 @@ echo Pull dbeaver platform
|
||||
|
||||
IF NOT EXIST dbeaver git clone https://github.com/dbeaver/dbeaver.git
|
||||
IF NOT EXIST dbeaver-common git clone https://github.com/dbeaver/dbeaver-common.git
|
||||
IF NOT EXIST dbeaver-jdbc-libsql git clone https://github.com/dbeaver/dbeaver-jdbc-libsql.git
|
||||
|
||||
cd cloudbeaver\deploy
|
||||
|
||||
echo Build cloudbeaver server
|
||||
@@ -37,41 +40,32 @@ xcopy /E /Q ..\server\product\web-server\target\products\io.cloudbeaver.product\
|
||||
copy scripts\* cloudbeaver >NUL
|
||||
mkdir cloudbeaver\samples
|
||||
|
||||
|
||||
IF NOT "%SAMPLE_DATABASE_PATH%"=="" (
|
||||
mkdir cloudbeaver\samples\db
|
||||
xcopy /E /Q %SAMPLE_DATABASE_PATH% cloudbeaver\samples\db >NUL
|
||||
)
|
||||
copy ..\config\core\* cloudbeaver\conf >NUL
|
||||
copy ..\config\DefaultConfiguration\GlobalConfiguration\.dbeaver\data-sources.json cloudbeaver\conf\initial-data-sources.conf >NUL
|
||||
copy %CONFIGURATION_PATH%\GlobalConfiguration\.dbeaver\data-sources.json cloudbeaver\conf\initial-data-sources.conf >NUL
|
||||
copy %CONFIGURATION_PATH%\*.conf cloudbeaver\conf >NUL
|
||||
|
||||
move drivers cloudbeaver >NUL
|
||||
|
||||
echo "Build static content"
|
||||
echo Build static content
|
||||
|
||||
mkdir .\cloudbeaver\web
|
||||
cd ..\
|
||||
|
||||
cd ..\webapp
|
||||
cd ..\cloudbeaver\webapp
|
||||
|
||||
call yarn
|
||||
cd .\packages\product-default
|
||||
call yarn run bundle
|
||||
|
||||
if %ERRORLEVEL% neq 0 (
|
||||
echo 'Application build failed'
|
||||
exit /b %ERRORLEVEL%
|
||||
)
|
||||
|
||||
cd ..\..\
|
||||
call yarn test
|
||||
|
||||
if %ERRORLEVEL% neq 0 (
|
||||
echo 'Frontend tests failed'
|
||||
exit /b %ERRORLEVEL%
|
||||
)
|
||||
call yarn lerna bootstrap
|
||||
call yarn lerna run bundle --no-bail --stream --scope=@cloudbeaver/product-default &::-- -- --env source-map
|
||||
|
||||
cd ..\deploy
|
||||
|
||||
echo "Copy static content"
|
||||
echo Copy static content
|
||||
|
||||
xcopy /E /Q ..\webapp\packages\product-default\lib cloudbeaver\web >NUL
|
||||
|
||||
echo "Cloudbeaver is ready. Run run-server.bat in cloudbeaver folder to start the server."
|
||||
echo Cloudbeaver is ready. Run run-server.bat in cloudbeaver folder to start the server.
|
||||
|
||||
pause
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
#command line arguments
|
||||
CONFIGURATION_PATH="../config/sample-databases/DefaultConfiguration"
|
||||
SAMPLE_DATABASE_PATH=""
|
||||
|
||||
source build-backend.sh
|
||||
source build-frontend.sh
|
||||
@@ -0,0 +1,52 @@
|
||||
FROM ubuntu:23.10
|
||||
|
||||
MAINTAINER DBeaver Corp, devops@dbeaver.com
|
||||
|
||||
RUN set -eux; \
|
||||
apt-get update; \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
# curl required for historical reasons, see https://github.com/adoptium/containers/issues/255
|
||||
curl \
|
||||
wget \
|
||||
# java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory
|
||||
# java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager
|
||||
# https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077
|
||||
fontconfig \
|
||||
# utilities for keeping Ubuntu and OpenJDK CA certificates in sync
|
||||
# https://github.com/adoptium/containers/issues/293
|
||||
ca-certificates p11-kit \
|
||||
# jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351
|
||||
# Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory
|
||||
binutils \
|
||||
tzdata \
|
||||
# locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8
|
||||
locales \
|
||||
nano \
|
||||
; \
|
||||
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen; \
|
||||
locale-gen en_US.UTF-8; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV LANG=en_US.UTF-8
|
||||
|
||||
ENV JAVA_HOME=/opt/java/openjdk
|
||||
COPY --from=eclipse-temurin:17 $JAVA_HOME $JAVA_HOME
|
||||
ENV PATH="${JAVA_HOME}/bin:${PATH}"
|
||||
|
||||
RUN set -eux; \
|
||||
# https://github.com/docker-library/openjdk/issues/331#issuecomment-498834472
|
||||
find "$JAVA_HOME/lib" -name '*.so' -exec dirname '{}' ';' | sort -u > /etc/ld.so.conf.d/docker-openjdk.conf; \
|
||||
ldconfig; \
|
||||
# https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840
|
||||
# https://openjdk.java.net/jeps/341
|
||||
java -Xshare:dump;
|
||||
|
||||
### Patch java security
|
||||
COPY java.security* ${JAVA_HOME}/conf/security/java.security
|
||||
|
||||
COPY cloudbeaver /opt/cloudbeaver
|
||||
|
||||
EXPOSE 8978
|
||||
RUN find /opt/cloudbeaver -type d -exec chmod 775 {} \;
|
||||
WORKDIR /opt/cloudbeaver/
|
||||
ENTRYPOINT ["./run-server.sh"]
|
||||
@@ -1,46 +0,0 @@
|
||||
FROM ubuntu:24.04
|
||||
|
||||
MAINTAINER DBeaver Corp, devops@dbeaver.com
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN set -eux; \
|
||||
apt-get update && \
|
||||
apt-get dist-upgrade -y --no-install-recommends && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
# curl required for historical reasons, see https://github.com/adoptium/containers/issues/255
|
||||
curl \
|
||||
# java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory
|
||||
# java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager
|
||||
# https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077
|
||||
fontconfig \
|
||||
# utilities for keeping Ubuntu and OpenJDK CA certificates in sync
|
||||
# https://github.com/adoptium/containers/issues/293
|
||||
ca-certificates p11-kit \
|
||||
# jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351
|
||||
# Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory
|
||||
binutils \
|
||||
tzdata \
|
||||
# locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8
|
||||
locales \
|
||||
nano && \
|
||||
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen; \
|
||||
locale-gen en_US.UTF-8; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV LANG=en_US.UTF-8
|
||||
|
||||
ENV JAVA_HOME=/opt/java/openjdk
|
||||
COPY --from=eclipse-temurin:21 $JAVA_HOME $JAVA_HOME
|
||||
ENV PATH="${JAVA_HOME}/bin:${PATH}"
|
||||
|
||||
RUN set -eux; \
|
||||
# https://github.com/docker-library/openjdk/issues/331#issuecomment-498834472
|
||||
find "$JAVA_HOME/lib" -name '*.so' -exec dirname '{}' ';' | sort -u > /etc/ld.so.conf.d/docker-openjdk.conf; \
|
||||
ldconfig; \
|
||||
# https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840
|
||||
# https://openjdk.java.net/jeps/341
|
||||
java -Xshare:dump;
|
||||
|
||||
### Patch java security
|
||||
COPY java.security* ${JAVA_HOME}/conf/security/java.security
|
||||
@@ -1,21 +0,0 @@
|
||||
ARG BASE_JAVA_TAG="stable"
|
||||
FROM dbeaver/base-java:${BASE_JAVA_TAG}
|
||||
|
||||
MAINTAINER DBeaver Corp, devops@dbeaver.com
|
||||
|
||||
ENV DBEAVER_GID=8978
|
||||
ENV DBEAVER_UID=8978
|
||||
|
||||
RUN groupadd -g $DBEAVER_GID dbeaver && \
|
||||
useradd -g $DBEAVER_GID -m -u $DBEAVER_UID -s /bin/bash dbeaver
|
||||
|
||||
COPY cloudbeaver /opt/cloudbeaver
|
||||
COPY scripts/launch-product.sh /opt/cloudbeaver/launch-product.sh
|
||||
|
||||
EXPOSE 8978
|
||||
RUN find /opt/cloudbeaver -type d -exec chmod 775 {} \;
|
||||
WORKDIR /opt/cloudbeaver/
|
||||
|
||||
RUN chmod +x "run-server.sh" "/opt/cloudbeaver/launch-product.sh"
|
||||
|
||||
ENTRYPOINT ["./launch-product.sh"]
|
||||
@@ -1,3 +1,3 @@
|
||||
cd ..
|
||||
docker build -t dbeaver/cloudbeaver:dev . --file ./docker/cloudbeaver-ce/Dockerfile
|
||||
docker build -t dbeaver/cloudbeaver:dev . --file ./docker/Dockerfile
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script is needed to change ownership and run the application as user dbeaver during the upgrade from version 24.2.0
|
||||
|
||||
# Change ownership of the WORKDIR to the dbeaver user and group
|
||||
# Variables DBEAVER_<UID|GID> are defined in the Dockerfile and exported to the runtime environment
|
||||
# PWD equals WORKDIR value from product Dockerfile
|
||||
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
TARGET_USER=${TARGET_USER:-dbeaver}
|
||||
TARGET_UID=${TARGET_UID:-$DBEAVER_UID}
|
||||
TARGET_GID=${TARGET_GID:-$DBEAVER_GID}
|
||||
|
||||
chown -R $DBEAVER_UID:$DBEAVER_GID $PWD/workspace
|
||||
# Execute run-server.sh as the dbeaver user with the JAVA_HOME and PATH environment variables
|
||||
exec su "$TARGET_USER" -c "JAVA_HOME=$JAVA_HOME PATH=$PATH ./run-server.sh"
|
||||
else
|
||||
exec ./run-server.sh
|
||||
fi
|
||||
@@ -17,7 +17,7 @@ If Not Defined JAVA_OPTS (
|
||||
|
||||
java %JAVA_OPTS% ^
|
||||
-Dfile.encoding=UTF-8 ^
|
||||
--add-modules=ALL-DEFAULT ^
|
||||
--add-modules=ALL-SYSTEM ^
|
||||
--add-opens=java.base/java.io=ALL-UNNAMED ^
|
||||
--add-opens=java.base/java.lang=ALL-UNNAMED ^
|
||||
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED ^
|
||||
|
||||
@@ -9,9 +9,9 @@ echo "Starting Cloudbeaver Server"
|
||||
&& [ ! -f "workspace/GlobalConfiguration/.dbeaver/data-sources.json" ] \
|
||||
&& cp conf/initial-data-sources.conf workspace/GlobalConfiguration/.dbeaver/data-sources.json
|
||||
|
||||
exec java ${JAVA_OPTS} \
|
||||
java ${JAVA_OPTS} \
|
||||
-Dfile.encoding=UTF-8 \
|
||||
--add-modules=ALL-DEFAULT \
|
||||
--add-modules=ALL-SYSTEM \
|
||||
--add-opens=java.base/java.io=ALL-UNNAMED \
|
||||
--add-opens=java.base/java.lang=ALL-UNNAMED \
|
||||
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED \
|
||||
@@ -36,6 +36,5 @@ exec java ${JAVA_OPTS} \
|
||||
-jar ${launcherJar} \
|
||||
-product io.cloudbeaver.product.ce.product \
|
||||
-web-config conf/cloudbeaver.conf \
|
||||
"$@" \
|
||||
-nl en \
|
||||
-registryMultiLanguage
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -Eeo pipefail
|
||||
if [[ $# -eq 0 ]] ;
|
||||
then
|
||||
set -- "$@" -help
|
||||
fi
|
||||
set -- "$@" -cli-mode
|
||||
|
||||
source run-server.sh "$@"
|
||||
@@ -0,0 +1,10 @@
|
||||
[program:cloudbeaver]
|
||||
directory=/opt/cloudbeaver/
|
||||
command=/opt/cloudbeaver/run-server.sh
|
||||
stopasgroup=true
|
||||
killasgroup=true
|
||||
stopsignal=INT
|
||||
autostart=true
|
||||
autorestart=true
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/var/log/cloudbeaver-server.log
|
||||
@@ -1,2 +0,0 @@
|
||||
@echo off
|
||||
%~dp0\..\idea-rcp-launch-config-generator\runGenerator.cmd -f %~dp0
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
script_dir="$(realpath "$(dirname "$0")")"
|
||||
repositories_root_dir="$(realpath "$script_dir/..")"
|
||||
|
||||
"$repositories_root_dir"/idea-rcp-launch-config-generator/runGenerator.sh "$script_dir"
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"projects": ["../dbeaver-common", "../dbeaver", "../cloudbeaver/server"],
|
||||
"targetPlatform": "./org.jkiss.cloudbeaver.tp.target"
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
lefthook: |
|
||||
cd webapp
|
||||
yarn dlx --quiet lefthook
|
||||
output: false
|
||||
pre-commit:
|
||||
commands:
|
||||
check-license:
|
||||
skip:
|
||||
- merge
|
||||
- rebase
|
||||
root: webapp
|
||||
glob: "*.{ts,tsx}"
|
||||
exclude:
|
||||
- "**/locales/**"
|
||||
run: yarn core-cli-check-license {staged_files}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?pde version="3.8"?>
|
||||
<target name="org.jkiss.tp.cloudbeaver">
|
||||
<locations>
|
||||
<location path="../eclipse/Eclipse.app/Contents/Eclipse/plugins" type="Directory"/>
|
||||
<location path="../eclipse/eclipse/plugins" type="Directory"/>
|
||||
</locations>
|
||||
</target>
|
||||
@@ -1,37 +0,0 @@
|
||||
workspaceName=cloudbeaver-ce
|
||||
featuresPaths=\
|
||||
dbeaver/features;\
|
||||
cloudbeaver/server/features;
|
||||
bundlesPaths=\
|
||||
dbeaver-common/modules;\
|
||||
dbeaver/plugins;\
|
||||
cloudbeaver/server/bundles;\
|
||||
dbeaver-jdbc-libsql;\
|
||||
cloudbeaver/server/test
|
||||
testLibraries=\
|
||||
org.junit;\
|
||||
org.mockito.mockito-core;\
|
||||
junit-jupiter-api;\
|
||||
org.opentest4j;\
|
||||
org.hamcrest.core;\
|
||||
org.hamcrest
|
||||
repositories=\
|
||||
https://repo.dbeaver.net/p2/ce/latest/;\
|
||||
https://download.eclipse.org/releases/${eclipse-version}/;
|
||||
testBundles=\
|
||||
org.junit;\
|
||||
org.mockito.mockito-core;\
|
||||
junit-jupiter-api;\
|
||||
org.opentest4j
|
||||
productsPaths=\
|
||||
dbeaver/product/community/DBeaver.product;\
|
||||
cloudbeaver/server/product/web-server/CloudbeaverServer.product:../../opt/cloudbeaver;\
|
||||
cloudbeaver/server/product/web-server-test/CloudbeaverServerUnitTest.product:../../opt/cloudbeaver;
|
||||
ideaConfigurationFilesPaths=\
|
||||
dbeaver/.ide/.idea;
|
||||
additionalModuleRoots=\
|
||||
opt;
|
||||
optionalFeatureRepositories=\
|
||||
dbeaver/product/repositories
|
||||
excludeOutputs=\
|
||||
cloudbeaver/webapp/node_modules
|
||||
@@ -1,3 +1,2 @@
|
||||
dbeaver-common
|
||||
dbeaver-jdbc-libsql
|
||||
dbeaver
|
||||
@@ -3,37 +3,31 @@ Bundle-ManifestVersion: 2
|
||||
Bundle-Vendor: DBeaver Corp
|
||||
Bundle-Name: Cloudbeaver Web Model
|
||||
Bundle-SymbolicName: io.cloudbeaver.model;singleton:=true
|
||||
Bundle-Version: 1.0.86.qualifier
|
||||
Bundle-Release-Date: 20251006
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-21
|
||||
Bundle-Version: 1.0.50.qualifier
|
||||
Bundle-Release-Date: 20240408
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-17
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .
|
||||
Require-Bundle: org.jkiss.dbeaver.data.gis;visibility:=reexport,
|
||||
org.jkiss.dbeaver.model;visibility:=reexport,
|
||||
org.jkiss.dbeaver.model.cli;visibility:=reexport,
|
||||
org.jkiss.dbeaver.model.sm;visibility:=reexport,
|
||||
org.jkiss.dbeaver.model.event;visibility:=reexport,
|
||||
org.jkiss.dbeaver.model.nio;visibility:=reexport,
|
||||
org.jkiss.dbeaver.registry;visibility:=reexport,
|
||||
org.jkiss.dbeaver.net.ssh,
|
||||
org.jkiss.bundle.graphql;visibility:=reexport,
|
||||
org.jkiss.bundle.graphql.java;visibility:=reexport,
|
||||
org.jkiss.bundle.apache.dbcp,
|
||||
com.google.gson;visibility:=reexport,
|
||||
jakarta.servlet-api;bundle-version:="6.0.0";visibility:=reexport
|
||||
jakarta.servlet;visibility:=reexport
|
||||
Export-Package: io.cloudbeaver,
|
||||
io.cloudbeaver.auth,
|
||||
io.cloudbeaver.auth.provider,
|
||||
io.cloudbeaver.auth.provider.fa,
|
||||
io.cloudbeaver.auth.provider.local,
|
||||
io.cloudbeaver.auth.provisioning,
|
||||
io.cloudbeaver.websocket,
|
||||
io.cloudbeaver.model,
|
||||
io.cloudbeaver.model.app,
|
||||
io.cloudbeaver.model.config,
|
||||
io.cloudbeaver.model.apilog,
|
||||
io.cloudbeaver.model.cli,
|
||||
io.cloudbeaver.model.events,
|
||||
io.cloudbeaver.model.fs,
|
||||
io.cloudbeaver.model.log,
|
||||
io.cloudbeaver.model.rm,
|
||||
io.cloudbeaver.model.rm.local,
|
||||
io.cloudbeaver.model.rm.lock,
|
||||
@@ -42,12 +36,10 @@ Export-Package: io.cloudbeaver,
|
||||
io.cloudbeaver.model.utils,
|
||||
io.cloudbeaver.registry,
|
||||
io.cloudbeaver.server,
|
||||
io.cloudbeaver.server.filters,
|
||||
io.cloudbeaver.service,
|
||||
io.cloudbeaver.service.admin,
|
||||
io.cloudbeaver.service.security,
|
||||
io.cloudbeaver.service.sql,
|
||||
io.cloudbeaver.test,
|
||||
io.cloudbeaver.utils,
|
||||
io.cloudbeaver.utils.file
|
||||
Automatic-Module-Name: io.cloudbeaver.model
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.osInfo.name=OS
|
||||
meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.memoryAvailable.name=Memory available
|
||||
meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.javaVersion.name=Java version
|
||||
meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.javaParameters.name=JVM parameters
|
||||
meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.productName.name=Product name
|
||||
meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.productVersion.name=Product version
|
||||
meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.workspacePath.name=Workspace path
|
||||
meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.installPath.name=Install path
|
||||
meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.deploymentType.name=Deployment type
|
||||
meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.smDbUrl.name=Security manager database URL
|
||||
meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.smDbDriverName.name=Security manager database driver name
|
||||
meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.smDbProductName.name=Security manager database product name
|
||||
meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.smDbProductVersion.name=Security manager database product version
|
||||
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.readOnly.name = Read-only connection
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.autoCommit.name = Auto-commit
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.name = Keep-alive interval (seconds)
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.defaultSchema.name = Default schema
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.defaultCatalog.name = Default catalog
|
||||
@@ -1,2 +0,0 @@
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.name = Garder actif (en secondes)
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.description = Pas de déconnexion automatique
|
||||
@@ -1,5 +0,0 @@
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.readOnly.name = Только для чтения
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.autoCommit.name = Авто-коммит
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.name = Интервал Keep-alive (в секундах)
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.defaultSchema.name = Схема по умолчанию
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.defaultCatalog.name = Каталог по умолчанию
|
||||
@@ -1,4 +0,0 @@
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.readOnly.name = Kết nối chỉ đọc
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.autoCommit.name = Tự động commit
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.name = Giữ kết nối (tính bằng giây)
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.description = Không tự động ngắt kết nối
|
||||
@@ -1,3 +0,0 @@
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.autoCommit.name = 自动提交
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.name = 保持连接 (秒)
|
||||
meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.description = 无自动断开连接
|
||||
@@ -2,6 +2,5 @@ source.. = src/
|
||||
output.. = target/classes/
|
||||
bin.includes = .,\
|
||||
META-INF/,\
|
||||
OSGI-INF/,\
|
||||
plugin.xml,\
|
||||
schema/
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<plugin>
|
||||
<extension-point id="io.cloudbeaver.service" name="Web services" schema="schema/io.cloudbeaver.service.exsd"/>
|
||||
<extension-point id="io.cloudbeaver.feature" name="Web features" schema="schema/io.cloudbeaver.feature.exsd"/>
|
||||
<extension-point id="io.cloudbeaver.server.feature" name="Web server features" schema="schema/io.cloudbeaver.server.feature.exsd"/>
|
||||
<extension-point id="io.cloudbeaver.valueSerializer" name="Web value serializers" schema="schema/io.cloudbeaver.valueSerializer.exsd"/>
|
||||
<extension-point id="org.jkiss.dbeaver.auth.provider" name="%extension-point.org.jkiss.dbeaver.authProvider.name" schema="schema/org.jkiss.dbeaver.authProvider.exsd"/>
|
||||
<extension-point id="io.cloudbeaver.metaParameters" name="Meta parameters" schema="schema/io.cloudbeaver.metaParameters.exsd"/>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
<artifactId>io.cloudbeaver.model</artifactId>
|
||||
<version>1.0.86-SNAPSHOT</version>
|
||||
<version>1.0.50-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<schema targetNamespace="org.jkiss.dbeaver.core" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.schema plugin="io.cloudbeaver.model" id="io.cloudbeaver.server.feature" name="Web features"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
Web feature
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.element />
|
||||
</appInfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<sequence>
|
||||
<element ref="feature"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="feature">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Web service description
|
||||
</documentation>
|
||||
</annotation>
|
||||
</element>
|
||||
|
||||
|
||||
</schema>
|
||||
@@ -16,21 +16,23 @@
|
||||
*/
|
||||
package io.cloudbeaver;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.jkiss.code.NotNull;
|
||||
import org.jkiss.code.Nullable;
|
||||
import org.jkiss.dbeaver.model.app.DBPWorkspace;
|
||||
import org.jkiss.dbeaver.model.auth.SMSessionContext;
|
||||
import org.jkiss.dbeaver.model.impl.app.BaseProjectImpl;
|
||||
import org.jkiss.dbeaver.model.rm.RMController;
|
||||
import org.jkiss.dbeaver.model.rm.RMControllerProvider;
|
||||
import org.jkiss.dbeaver.model.rm.RMProject;
|
||||
import org.jkiss.dbeaver.model.rm.RMProjectType;
|
||||
import org.jkiss.dbeaver.model.rm.RMUtils;
|
||||
import org.jkiss.dbeaver.registry.BaseProjectImpl;
|
||||
import org.jkiss.utils.CommonUtils;
|
||||
import org.jkiss.utils.Pair;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collection;
|
||||
|
||||
public abstract class BaseWebProjectImpl extends BaseProjectImpl implements RMControllerProvider {
|
||||
public class BaseWebProjectImpl extends BaseProjectImpl implements RMControllerProvider {
|
||||
|
||||
@NotNull
|
||||
private final RMProject project;
|
||||
@@ -38,6 +40,7 @@ public abstract class BaseWebProjectImpl extends BaseProjectImpl implements RMCo
|
||||
@NotNull
|
||||
private final Path path;
|
||||
@NotNull
|
||||
protected final DataSourceFilter dataSourceFilter;
|
||||
private final RMController resourceController;
|
||||
|
||||
public BaseWebProjectImpl(
|
||||
@@ -45,12 +48,13 @@ public abstract class BaseWebProjectImpl extends BaseProjectImpl implements RMCo
|
||||
@NotNull RMController resourceController,
|
||||
@NotNull SMSessionContext sessionContext,
|
||||
@NotNull RMProject project,
|
||||
@NotNull Path path
|
||||
@NotNull DataSourceFilter dataSourceFilter
|
||||
) {
|
||||
super(workspace, sessionContext);
|
||||
this.resourceController = resourceController;
|
||||
this.path = path;
|
||||
this.path = RMUtils.getProjectPath(project);
|
||||
this.project = project;
|
||||
this.dataSourceFilter = dataSourceFilter;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -87,6 +91,12 @@ public abstract class BaseWebProjectImpl extends BaseProjectImpl implements RMCo
|
||||
return path;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IProject getEclipseProject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpen() {
|
||||
return true;
|
||||
@@ -102,6 +112,11 @@ public abstract class BaseWebProjectImpl extends BaseProjectImpl implements RMCo
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public RMProject getRmProject() {
|
||||
return this.project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for Bulk Update of resources properties paths
|
||||
*
|
||||
@@ -145,9 +160,4 @@ public abstract class BaseWebProjectImpl extends BaseProjectImpl implements RMCo
|
||||
public Path getMetadataFilePath() {
|
||||
return getMetadataPath().resolve(METADATA_STORAGE_FILE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrivateProject() {
|
||||
return RMProjectType.USER.equals(getRMProject().getType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* DBeaver - Universal Database Manager
|
||||
* Copyright (C) 2010-2025 DBeaver Corp and others
|
||||
* Copyright (C) 2010-2024 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,24 +29,18 @@ public interface DBWConstants {
|
||||
String PERMISSION_CONFIGURATION_MANAGER = RMConstants.PERMISSION_CONFIGURATION_MANAGER;
|
||||
String PERMISSION_PRIVATE_PROJECT_ACCESS = "private-project-access";
|
||||
String PERMISSION_SECRET_MANAGER = "secret-manager";
|
||||
String PERMISSION_SQL_RESULT_UPDATE = "sql-result-update";
|
||||
String PERMISSION_SQL_EXECUTE_QUERY = "sql-execute-query";
|
||||
|
||||
String GLOBAL_PERMISSION_SCRIPT_EXECUTE = "permission.sql.script.execution";
|
||||
String GLOBAL_PERMISSION_DATA_EDITOR_IMPORT = "permission.data-editor.import";
|
||||
String GLOBAL_PERMISSION_DATA_EDITOR_EDITING = "permission.data-editor.editing";
|
||||
|
||||
String PERMISSION_EDIT_STRUCTURE = "edit-meta";
|
||||
String PERMISSION_EDIT_DATA = "edit-data";
|
||||
|
||||
String STATE_ATTR_SIGN_IN_STATE = "state.signin";
|
||||
String WORK_DATA_FOLDER_NAME = ".work-data";
|
||||
|
||||
enum SignInState {
|
||||
GLOBAL,
|
||||
EMBEDDED
|
||||
}
|
||||
String TASK_STATUS_FINISHED = "Finished";
|
||||
|
||||
//public static final String PERMISSION_USER = "user";
|
||||
|
||||
}
|
||||
|
||||
@@ -36,6 +36,4 @@ public interface DBWFeatureSet {
|
||||
|
||||
boolean isEnabled();
|
||||
|
||||
boolean isEnabledByDefault();
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@ import graphql.ErrorType;
|
||||
import graphql.GraphQLError;
|
||||
import graphql.language.SourceLocation;
|
||||
import org.jkiss.dbeaver.DBException;
|
||||
import org.jkiss.dbeaver.model.sql.SQLState;
|
||||
import org.jkiss.dbeaver.model.DBPDataSource;
|
||||
import org.jkiss.dbeaver.utils.GeneralUtils;
|
||||
import org.jkiss.utils.CommonUtils;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
@@ -37,7 +38,6 @@ public class DBWebException extends DBException implements GraphQLError {
|
||||
|
||||
public static final String ERROR_CODE_SESSION_EXPIRED = "sessionExpired";
|
||||
public static final String ERROR_CODE_ACCESS_DENIED = "accessDenied";
|
||||
public static final String ERROR_CODE_SERVER_NOT_INITIALIZED = "serverNotInitialized";
|
||||
public static final String ERROR_CODE_LICENSE_DENIED = "licenseRequired";
|
||||
public static final String ERROR_CODE_IDENT_REQUIRED = "identRequired";
|
||||
public static final String ERROR_CODE_AUTH_REQUIRED = "authRequired";
|
||||
@@ -65,8 +65,12 @@ public class DBWebException extends DBException implements GraphQLError {
|
||||
this.webErrorCode = errorCode;
|
||||
}
|
||||
|
||||
public DBWebException(Throwable cause) {
|
||||
super(null, cause);
|
||||
public DBWebException(Throwable cause, DBPDataSource dataSource) {
|
||||
super(cause, dataSource);
|
||||
}
|
||||
|
||||
public DBWebException(String message, Throwable cause, DBPDataSource dataSource) {
|
||||
super(makeMessage(message, cause), cause, dataSource);
|
||||
}
|
||||
|
||||
public String getWebErrorCode() {
|
||||
@@ -99,7 +103,7 @@ public class DBWebException extends DBException implements GraphQLError {
|
||||
@Override
|
||||
public Map<String, Object> getExtensions() {
|
||||
StringWriter buf = new StringWriter();
|
||||
CommonUtils.getRootCause(this).printStackTrace(new PrintWriter(buf, true));
|
||||
GeneralUtils.getRootCause(this).printStackTrace(new PrintWriter(buf, true));
|
||||
|
||||
Map<String, Object> extensions = new LinkedHashMap<>();
|
||||
String stString = buf.toString();
|
||||
@@ -124,14 +128,14 @@ public class DBWebException extends DBException implements GraphQLError {
|
||||
//stString = stString.substring(divPos + 1).trim();
|
||||
}
|
||||
extensions.put("stackTrace", stString.trim());
|
||||
int errorCode = SQLState.getCodeFromException(this);
|
||||
int errorCode = getErrorCode();
|
||||
if (errorCode != ERROR_CODE_NONE) {
|
||||
extensions.put("errorCode", errorCode);
|
||||
}
|
||||
if (!CommonUtils.isEmpty(webErrorCode)) {
|
||||
extensions.put("webErrorCode", webErrorCode);
|
||||
}
|
||||
String databaseState = SQLState.getStateFromException(this);
|
||||
String databaseState = getDatabaseState();
|
||||
if (databaseState != null) {
|
||||
extensions.put("databaseState", databaseState);
|
||||
}
|
||||
|
||||
-55
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* DBeaver - Universal Database Manager
|
||||
* Copyright (C) 2010-2025 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.cloudbeaver;
|
||||
|
||||
import io.cloudbeaver.model.session.WebSession;
|
||||
import org.jkiss.code.NotNull;
|
||||
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
|
||||
import org.jkiss.dbeaver.model.DBPEvent;
|
||||
import org.jkiss.dbeaver.model.DBPEventListener;
|
||||
import org.jkiss.dbeaver.model.websocket.event.datasource.WSDataSourceConnectEvent;
|
||||
|
||||
/**
|
||||
* Sends a WebSocket event when a data source is connected.
|
||||
*/
|
||||
public class WebDataSourceConnectEventListener implements DBPEventListener {
|
||||
|
||||
@NotNull
|
||||
private final WebSession webSession;
|
||||
|
||||
public WebDataSourceConnectEventListener(@NotNull WebSession webSession) {
|
||||
this.webSession = webSession;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleDataSourceEvent(DBPEvent event) {
|
||||
if (!(event.getObject() instanceof DBPDataSourceContainer container)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getAction() == DBPEvent.Action.AFTER_CONNECT && event.getEnabled()) {
|
||||
webSession.addSessionEvent(
|
||||
new WSDataSourceConnectEvent(
|
||||
container.getProject().getId(),
|
||||
container.getId(),
|
||||
webSession.getSessionId(),
|
||||
webSession.getUserId()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
+363
@@ -0,0 +1,363 @@
|
||||
/*
|
||||
* DBeaver - Universal Database Manager
|
||||
* Copyright (C) 2010-2024 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.cloudbeaver;
|
||||
|
||||
import org.jkiss.code.NotNull;
|
||||
import org.jkiss.code.Nullable;
|
||||
import org.jkiss.dbeaver.DBException;
|
||||
import org.jkiss.dbeaver.model.*;
|
||||
import org.jkiss.dbeaver.model.access.DBAAuthProfile;
|
||||
import org.jkiss.dbeaver.model.access.DBACredentialsProvider;
|
||||
import org.jkiss.dbeaver.model.app.DBPDataSourceRegistry;
|
||||
import org.jkiss.dbeaver.model.app.DBPDataSourceRegistryCache;
|
||||
import org.jkiss.dbeaver.model.app.DBPProject;
|
||||
import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration;
|
||||
import org.jkiss.dbeaver.model.connection.DBPDriver;
|
||||
import org.jkiss.dbeaver.model.net.DBWNetworkProfile;
|
||||
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
|
||||
import org.jkiss.dbeaver.model.secret.DBSSecretController;
|
||||
import org.jkiss.dbeaver.model.struct.DBSObjectFilter;
|
||||
import org.jkiss.dbeaver.registry.DataSourceConfigurationManager;
|
||||
import org.jkiss.dbeaver.registry.DataSourcePersistentRegistry;
|
||||
import org.jkiss.dbeaver.registry.DataSourceRegistry;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSourcePersistentRegistry, DBPDataSourceRegistryCache {
|
||||
private final DataSourceFilter dataSourceFilter;
|
||||
private final DataSourceRegistry dataSourceRegistry;
|
||||
|
||||
public WebDataSourceRegistryProxy(DataSourceRegistry dataSourceRegistry, DataSourceFilter filter) {
|
||||
this.dataSourceRegistry = dataSourceRegistry;
|
||||
this.dataSourceFilter = filter;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public DBPProject getProject() {
|
||||
return dataSourceRegistry.getProject();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DBPDataSourceContainer getDataSource(@NotNull String id) {
|
||||
DBPDataSourceContainer dataSource = dataSourceRegistry.getDataSource(id);
|
||||
if (dataSource == null || dataSourceFilter != null && !dataSourceFilter.filter(dataSource)) {
|
||||
return null;
|
||||
}
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DBPDataSourceContainer getDataSource(@NotNull DBPDataSource dataSource) {
|
||||
if (dataSourceFilter != null && !dataSourceFilter.filter(dataSource.getContainer())) {
|
||||
return null;
|
||||
}
|
||||
return dataSourceRegistry.getDataSource(dataSource);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DBPDataSourceContainer findDataSourceByName(String name) {
|
||||
var dataSource = dataSourceRegistry.findDataSourceByName(name);
|
||||
if (dataSource != null) {
|
||||
if (dataSourceFilter == null || dataSourceFilter.filter(dataSource)) {
|
||||
return dataSource;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<? extends DBPDataSourceContainer> getDataSourcesByProfile(@NotNull DBWNetworkProfile profile) {
|
||||
return dataSourceRegistry.getDataSourcesByProfile(profile)
|
||||
.stream()
|
||||
.filter(dataSourceFilter::filter)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<DBPDataSourceContainer> getDataSources() {
|
||||
return dataSourceRegistry.getDataSources()
|
||||
.stream()
|
||||
.filter(dataSourceFilter::filter)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public DBPDataSourceContainer createDataSource(@NotNull DBPDriver driver, @NotNull DBPConnectionConfiguration connConfig) {
|
||||
return dataSourceRegistry.createDataSource(driver, connConfig);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public DBPDataSourceContainer createDataSource(@NotNull DBPDataSourceContainer source) {
|
||||
return dataSourceRegistry.createDataSource(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDataSourceListener(@NotNull DBPEventListener listener) {
|
||||
dataSourceRegistry.addDataSourceListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeDataSourceListener(@NotNull DBPEventListener listener) {
|
||||
return dataSourceRegistry.removeDataSourceListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDataSource(@NotNull DBPDataSourceContainer dataSource) throws DBException {
|
||||
dataSourceRegistry.addDataSource(dataSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDataSource(@NotNull DBPDataSourceContainer dataSource) {
|
||||
dataSourceRegistry.removeDataSource(dataSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDataSourceToList(@NotNull DBPDataSourceContainer dataSource) {
|
||||
dataSourceRegistry.addDataSourceToList(dataSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDataSourceFromList(@NotNull DBPDataSourceContainer dataSource) {
|
||||
dataSourceRegistry.removeDataSourceFromList(dataSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDataSource(@NotNull DBPDataSourceContainer dataSource) throws DBException {
|
||||
dataSourceRegistry.updateDataSource(dataSource);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<? extends DBPDataSourceFolder> getAllFolders() {
|
||||
return dataSourceRegistry.getAllFolders();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<? extends DBPDataSourceFolder> getRootFolders() {
|
||||
return dataSourceRegistry.getRootFolders();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DBPDataSourceFolder getFolder(@NotNull String path) {
|
||||
return dataSourceRegistry.getFolder(path);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public DBPDataSourceFolder addFolder(@Nullable DBPDataSourceFolder parent, @NotNull String name) {
|
||||
return dataSourceRegistry.addFolder(parent, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFolder(@NotNull DBPDataSourceFolder folder, boolean dropContents) {
|
||||
dataSourceRegistry.removeFolder(folder, dropContents);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveFolder(@NotNull String oldPath, @NotNull String newPath) {
|
||||
dataSourceRegistry.moveFolder(oldPath, newPath);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DBSObjectFilter getSavedFilter(String name) {
|
||||
return dataSourceRegistry.getSavedFilter(name);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<DBSObjectFilter> getSavedFilters() {
|
||||
return dataSourceRegistry.getSavedFilters();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSavedFilter(@NotNull DBSObjectFilter filter) {
|
||||
dataSourceRegistry.updateSavedFilter(filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSavedFilter(@NotNull String filterName) {
|
||||
dataSourceRegistry.removeSavedFilter(filterName);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DBWNetworkProfile getNetworkProfile(@Nullable String source, @NotNull String name) {
|
||||
return dataSourceRegistry.getNetworkProfile(source, name);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<DBWNetworkProfile> getNetworkProfiles() {
|
||||
return dataSourceRegistry.getNetworkProfiles();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateNetworkProfile(@NotNull DBWNetworkProfile profile) {
|
||||
dataSourceRegistry.updateNetworkProfile(profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeNetworkProfile(@NotNull DBWNetworkProfile profile) {
|
||||
dataSourceRegistry.removeNetworkProfile(profile);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DBAAuthProfile getAuthProfile(@NotNull String id) {
|
||||
return dataSourceRegistry.getAuthProfile(id);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<DBAAuthProfile> getAllAuthProfiles() {
|
||||
return dataSourceRegistry.getAllAuthProfiles();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<DBAAuthProfile> getApplicableAuthProfiles(@Nullable DBPDriver driver) {
|
||||
return dataSourceRegistry.getApplicableAuthProfiles(driver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAuthProfile(@NotNull DBAAuthProfile profile) {
|
||||
dataSourceRegistry.updateAuthProfile(profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAuthProfiles(@NotNull Collection<DBAAuthProfile> profiles) {
|
||||
dataSourceRegistry.setAuthProfiles(profiles);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAuthProfile(DBAAuthProfile profile) {
|
||||
dataSourceRegistry.removeAuthProfile(profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushConfig() {
|
||||
dataSourceRegistry.flushConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshConfig() {
|
||||
dataSourceRegistry.refreshConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshConfig(@Nullable Collection<String> dataSourceIds) {
|
||||
dataSourceRegistry.refreshConfig(dataSourceIds);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Throwable getLastError() {
|
||||
return dataSourceRegistry.getLastError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasError() {
|
||||
return dataSourceRegistry.hasError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkForErrors() throws DBException {
|
||||
dataSourceRegistry.checkForErrors();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyDataSourceListeners(@NotNull DBPEvent event) {
|
||||
dataSourceRegistry.notifyDataSourceListeners(event);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DBACredentialsProvider getAuthCredentialsProvider() {
|
||||
return dataSourceRegistry.getAuthCredentialsProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
dataSourceRegistry.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAuthCredentialsProvider(DBACredentialsProvider authCredentialsProvider) {
|
||||
dataSourceRegistry.setAuthCredentialsProvider(authCredentialsProvider);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<DBPDataSourceFolder> getTemporaryFolders() {
|
||||
return dataSourceRegistry.getTemporaryFolders();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadDataSources(
|
||||
@NotNull List<DBPDataSourceConfigurationStorage> storages,
|
||||
@NotNull DataSourceConfigurationManager manager,
|
||||
@Nullable Collection<String> dataSourceIds, boolean refresh,
|
||||
boolean purgeUntouched
|
||||
) {
|
||||
return dataSourceRegistry.loadDataSources(storages, manager, dataSourceIds, refresh, purgeUntouched);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDataSources() {
|
||||
dataSourceRegistry.saveDataSources();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceConfigurationManager getConfigurationManager() {
|
||||
return dataSourceRegistry.getConfigurationManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveConfigurationToManager(
|
||||
@NotNull DBRProgressMonitor monitor,
|
||||
@NotNull DataSourceConfigurationManager configurationManager,
|
||||
@Nullable Predicate<DBPDataSourceContainer> filter
|
||||
) {
|
||||
dataSourceRegistry.saveConfigurationToManager(monitor, configurationManager, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void persistSecrets(DBSSecretController secretController) throws DBException {
|
||||
dataSourceRegistry.persistSecrets(secretController);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resolveSecrets(DBSSecretController secretController) throws DBException {
|
||||
dataSourceRegistry.resolveSecrets(secretController);
|
||||
}
|
||||
}
|
||||
-443
@@ -1,443 +0,0 @@
|
||||
/*
|
||||
* DBeaver - Universal Database Manager
|
||||
* Copyright (C) 2010-2025 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.cloudbeaver;
|
||||
|
||||
import io.cloudbeaver.model.session.WebSession;
|
||||
import org.jkiss.code.NotNull;
|
||||
import org.jkiss.code.Nullable;
|
||||
import org.jkiss.dbeaver.DBException;
|
||||
import org.jkiss.dbeaver.model.*;
|
||||
import org.jkiss.dbeaver.model.access.DBAAuthProfile;
|
||||
import org.jkiss.dbeaver.model.access.DBACredentialsProvider;
|
||||
import org.jkiss.dbeaver.model.app.DBPDataSourceRegistry;
|
||||
import org.jkiss.dbeaver.model.app.DBPDataSourceRegistryCache;
|
||||
import org.jkiss.dbeaver.model.app.DBPProject;
|
||||
import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration;
|
||||
import org.jkiss.dbeaver.model.connection.DBPDriver;
|
||||
import org.jkiss.dbeaver.model.net.DBWNetworkProfile;
|
||||
import org.jkiss.dbeaver.model.preferences.DBPPreferenceStore;
|
||||
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
|
||||
import org.jkiss.dbeaver.model.secret.DBSSecretController;
|
||||
import org.jkiss.dbeaver.model.struct.DBSObjectFilter;
|
||||
import org.jkiss.dbeaver.registry.DataSourceConfigurationManager;
|
||||
import org.jkiss.dbeaver.registry.DataSourceParseResults;
|
||||
import org.jkiss.dbeaver.registry.DataSourcePersistentRegistry;
|
||||
import org.jkiss.dbeaver.registry.DataSourceRegistry;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Proxy for a global project data source registry.
|
||||
* We need to filter some data sources in case of inaccessibility (not enough permissions).
|
||||
*/
|
||||
public class WebGlobalProjectRegistryProxy implements DBPDataSourceRegistry, DataSourcePersistentRegistry, DBPDataSourceRegistryCache {
|
||||
@NotNull
|
||||
private final WebSession webSession;
|
||||
@NotNull
|
||||
private final DataSourceFilter dataSourceFilter;
|
||||
@NotNull
|
||||
private final DataSourceRegistry<?> dataSourceRegistry;
|
||||
|
||||
public WebGlobalProjectRegistryProxy(
|
||||
@NotNull WebSession webSession,
|
||||
@NotNull DataSourceRegistry<?> dataSourceRegistry,
|
||||
@NotNull DataSourceFilter filter
|
||||
) {
|
||||
this.webSession = webSession;
|
||||
this.dataSourceRegistry = dataSourceRegistry;
|
||||
this.dataSourceFilter = filter;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public DBPProject getProject() {
|
||||
return dataSourceRegistry.getProject();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DBPDataSourceContainer getDataSource(@NotNull String id) {
|
||||
DBPDataSourceContainer dataSource = dataSourceRegistry.getDataSource(id);
|
||||
if (dataSource == null || !dataSourceFilter.filter(dataSource)) {
|
||||
return null;
|
||||
}
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DBPDataSourceContainer getDataSource(@NotNull DBPDataSource dataSource) {
|
||||
if (!dataSourceFilter.filter(dataSource.getContainer())) {
|
||||
return null;
|
||||
}
|
||||
return dataSourceRegistry.getDataSource(dataSource);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DBPDataSourceContainer findDataSourceByName(String name) {
|
||||
var dataSource = dataSourceRegistry.findDataSourceByName(name);
|
||||
if (dataSource != null && dataSourceFilter.filter(dataSource)) {
|
||||
return dataSource;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<? extends DBPDataSourceContainer> getDataSourcesByProfile(@NotNull DBWNetworkProfile profile) {
|
||||
return dataSourceRegistry.getDataSourcesByProfile(profile)
|
||||
.stream()
|
||||
.filter(dataSourceFilter::filter)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<DBPDataSourceContainer> getDataSources() {
|
||||
return dataSourceRegistry.getDataSources()
|
||||
.stream()
|
||||
.filter(dataSourceFilter::filter)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public DBPDataSourceContainer createDataSource(@NotNull DBPDriver driver, @NotNull DBPConnectionConfiguration connConfig) {
|
||||
return dataSourceRegistry.createDataSource(driver, connConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DBPDataSourceContainer createDataSource(
|
||||
@NotNull String id,
|
||||
@NotNull DBPDriver driver,
|
||||
@NotNull DBPConnectionConfiguration connConfig
|
||||
) {
|
||||
return dataSourceRegistry.createDataSource(id, driver, connConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DBPDataSourceContainer createDataSource(
|
||||
@NotNull DBPDataSourceConfigurationStorage dataSourceStorage,
|
||||
@NotNull DBPDataSourceOrigin origin,
|
||||
@NotNull String id,
|
||||
@NotNull DBPDriver driver,
|
||||
@NotNull DBPConnectionConfiguration configuration
|
||||
) {
|
||||
return dataSourceRegistry.createDataSource(dataSourceStorage, origin, id, driver, configuration);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public DBPDataSourceContainer createDataSource(@NotNull DBPDataSourceContainer source) {
|
||||
return dataSourceRegistry.createDataSource(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDataSourceListener(@NotNull DBPEventListener listener) {
|
||||
dataSourceRegistry.addDataSourceListener(new WebDBPEventListenerProxy(listener));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeDataSourceListener(@NotNull DBPEventListener listener) {
|
||||
return dataSourceRegistry.removeDataSourceListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDataSource(@NotNull DBPDataSourceContainer dataSource) throws DBException {
|
||||
dataSourceRegistry.addDataSource(dataSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDataSource(@NotNull DBPDataSourceContainer dataSource) {
|
||||
dataSourceRegistry.removeDataSource(dataSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDataSourceToList(@NotNull DBPDataSourceContainer dataSource) {
|
||||
dataSourceRegistry.addDataSourceToList(dataSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDataSourceFromList(@NotNull DBPDataSourceContainer dataSource) {
|
||||
dataSourceRegistry.removeDataSourceFromList(dataSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDataSource(@NotNull DBPDataSourceContainer dataSource) throws DBException {
|
||||
dataSourceRegistry.updateDataSource(dataSource);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<? extends DBPDataSourceFolder> getAllFolders() {
|
||||
if (webSession.hasPermission(DBWConstants.PERMISSION_ADMIN)) {
|
||||
return dataSourceRegistry.getAllFolders();
|
||||
}
|
||||
Set<DBPDataSourceFolder> set = new LinkedHashSet<>();
|
||||
for (DBPDataSourceContainer container : getDataSources()) {
|
||||
DBPDataSourceFolder folder = container.getFolder();
|
||||
while (folder != null) {
|
||||
set.add(folder);
|
||||
folder = folder.getParent();
|
||||
}
|
||||
}
|
||||
return new ArrayList<>(set);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<? extends DBPDataSourceFolder> getRootFolders() {
|
||||
if (webSession.hasPermission(DBWConstants.PERMISSION_ADMIN)) {
|
||||
return dataSourceRegistry.getRootFolders();
|
||||
}
|
||||
return getDataSources().stream()
|
||||
.map(DBPDataSourceContainer::getFolder)
|
||||
.filter(folder -> folder != null && folder.getParent() == null)
|
||||
.toList();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public DBPDataSourceFolder getFolder(@NotNull String path) {
|
||||
return dataSourceRegistry.getFolder(path);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public DBPDataSourceFolder addFolder(@Nullable DBPDataSourceFolder parent, @NotNull String name) {
|
||||
return dataSourceRegistry.addFolder(parent, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFolder(@NotNull DBPDataSourceFolder folder, boolean dropContents) {
|
||||
dataSourceRegistry.removeFolder(folder, dropContents);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveFolder(@NotNull String oldPath, @NotNull String newPath) throws DBException {
|
||||
dataSourceRegistry.moveFolder(oldPath, newPath);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DBSObjectFilter getSavedFilter(String name) {
|
||||
return dataSourceRegistry.getSavedFilter(name);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<DBSObjectFilter> getSavedFilters() {
|
||||
return dataSourceRegistry.getSavedFilters();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSavedFilter(@NotNull DBSObjectFilter filter) {
|
||||
dataSourceRegistry.updateSavedFilter(filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSavedFilter(@NotNull String filterName) {
|
||||
dataSourceRegistry.removeSavedFilter(filterName);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DBWNetworkProfile getNetworkProfile(@Nullable String source, @NotNull String name) {
|
||||
return dataSourceRegistry.getNetworkProfile(source, name);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<DBWNetworkProfile> getNetworkProfiles() {
|
||||
return dataSourceRegistry.getNetworkProfiles();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateNetworkProfile(@NotNull DBWNetworkProfile profile) {
|
||||
dataSourceRegistry.updateNetworkProfile(profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeNetworkProfile(@NotNull DBWNetworkProfile profile) {
|
||||
dataSourceRegistry.removeNetworkProfile(profile);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DBAAuthProfile getAuthProfile(@NotNull String id) {
|
||||
return dataSourceRegistry.getAuthProfile(id);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<DBAAuthProfile> getAllAuthProfiles() {
|
||||
return dataSourceRegistry.getAllAuthProfiles();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<DBAAuthProfile> getApplicableAuthProfiles(@Nullable DBPDriver driver) {
|
||||
return dataSourceRegistry.getApplicableAuthProfiles(driver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAuthProfile(@NotNull DBAAuthProfile profile) {
|
||||
dataSourceRegistry.updateAuthProfile(profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAuthProfiles(@NotNull Collection<DBAAuthProfile> profiles) {
|
||||
dataSourceRegistry.setAuthProfiles(profiles);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAuthProfile(@NotNull DBAAuthProfile profile) {
|
||||
dataSourceRegistry.removeAuthProfile(profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushConfig() {
|
||||
dataSourceRegistry.flushConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshConfig() {
|
||||
dataSourceRegistry.refreshConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshConfig(@Nullable Collection<String> dataSourceIds) {
|
||||
dataSourceRegistry.refreshConfig(dataSourceIds);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Throwable getLastError() {
|
||||
return dataSourceRegistry.getLastError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasError() {
|
||||
return dataSourceRegistry.hasError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkForErrors() throws DBException {
|
||||
dataSourceRegistry.checkForErrors();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyDataSourceListeners(@NotNull DBPEvent event) {
|
||||
dataSourceRegistry.notifyDataSourceListeners(event);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DBACredentialsProvider getAuthCredentialsProvider() {
|
||||
return dataSourceRegistry.getAuthCredentialsProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
dataSourceRegistry.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAuthCredentialsProvider(DBACredentialsProvider authCredentialsProvider) {
|
||||
dataSourceRegistry.setAuthCredentialsProvider(authCredentialsProvider);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<DBPDataSourceFolder> getTemporaryFolders() {
|
||||
return dataSourceRegistry.getTemporaryFolders();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public DBPPreferenceStore getPreferenceStore() {
|
||||
return dataSourceRegistry.getPreferenceStore();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceParseResults loadDataSources(
|
||||
@NotNull List<DBPDataSourceConfigurationStorage> storages,
|
||||
@NotNull DataSourceConfigurationManager manager,
|
||||
@Nullable Collection<String> dataSourceIds, boolean refresh,
|
||||
boolean purgeUntouched
|
||||
) {
|
||||
return dataSourceRegistry.loadDataSources(storages, manager, dataSourceIds, refresh, purgeUntouched);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDataSources() {
|
||||
dataSourceRegistry.saveDataSources();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceConfigurationManager getConfigurationManager() {
|
||||
return dataSourceRegistry.getConfigurationManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveConfigurationToManager(
|
||||
@NotNull DBRProgressMonitor monitor,
|
||||
@NotNull DataSourceConfigurationManager configurationManager,
|
||||
@Nullable Predicate<DBPDataSourceContainer> filter
|
||||
) {
|
||||
dataSourceRegistry.saveConfigurationToManager(monitor, configurationManager, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void persistSecrets(DBSSecretController secretController) throws DBException {
|
||||
dataSourceRegistry.persistSecrets(secretController);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resolveSecrets(DBSSecretController secretController) throws DBException {
|
||||
dataSourceRegistry.resolveSecrets(secretController);
|
||||
}
|
||||
|
||||
/**
|
||||
* Event listener proxy.
|
||||
* For some cases (like creating data source) we should not send event because of accessibility of connection.
|
||||
*/
|
||||
private class WebDBPEventListenerProxy implements DBPEventListener {
|
||||
@NotNull
|
||||
private final DBPEventListener eventListener;
|
||||
|
||||
public WebDBPEventListenerProxy(@NotNull DBPEventListener eventListener) {
|
||||
this.eventListener = eventListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleDataSourceEvent(@NotNull DBPEvent event) {
|
||||
if (event.getAction() == DBPEvent.Action.OBJECT_ADD &&
|
||||
event.getObject() instanceof DBPDataSourceContainer container &&
|
||||
!dataSourceFilter.filter(container)
|
||||
) {
|
||||
// we cannot send event of creating data source connection because it is not accessible for user
|
||||
return;
|
||||
}
|
||||
eventListener.handleDataSourceEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* DBeaver - Universal Database Manager
|
||||
* Copyright (C) 2010-2024 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.cloudbeaver;
|
||||
|
||||
import io.cloudbeaver.model.session.WebHeadlessSession;
|
||||
import org.jkiss.code.NotNull;
|
||||
import org.jkiss.dbeaver.model.rm.RMProject;
|
||||
import org.jkiss.dbeaver.model.rm.RMUtils;
|
||||
|
||||
public class WebHeadlessSessionProjectImpl extends WebProjectImpl {
|
||||
public WebHeadlessSessionProjectImpl(
|
||||
@NotNull WebHeadlessSession session,
|
||||
@NotNull RMProject project
|
||||
) {
|
||||
super(
|
||||
session.getWorkspace(),
|
||||
session.getUserContext().getRmController(),
|
||||
session.getSessionContext(),
|
||||
project,
|
||||
session.getUserContext().getPreferenceStore(),
|
||||
RMUtils.getProjectPath(project)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -23,31 +23,22 @@ import org.jkiss.dbeaver.Log;
|
||||
import org.jkiss.dbeaver.model.app.DBPDataSourceRegistry;
|
||||
import org.jkiss.dbeaver.model.app.DBPWorkspace;
|
||||
import org.jkiss.dbeaver.model.auth.SMSessionContext;
|
||||
import org.jkiss.dbeaver.model.preferences.DBPPreferenceStore;
|
||||
import org.jkiss.dbeaver.model.rm.RMController;
|
||||
import org.jkiss.dbeaver.model.rm.RMProject;
|
||||
import org.jkiss.dbeaver.model.task.DBTTaskManager;
|
||||
import org.jkiss.dbeaver.registry.DataSourceRegistry;
|
||||
import org.jkiss.dbeaver.registry.rm.DataSourceRegistryRM;
|
||||
import org.jkiss.dbeaver.runtime.DBWorkbench;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
public abstract class WebProjectImpl extends BaseWebProjectImpl {
|
||||
private static final Log log = Log.getLog(WebProjectImpl.class);
|
||||
@NotNull
|
||||
protected final DBPPreferenceStore preferenceStore;
|
||||
|
||||
public WebProjectImpl(
|
||||
@NotNull DBPWorkspace workspace,
|
||||
@NotNull RMController resourceController,
|
||||
@NotNull SMSessionContext sessionContext,
|
||||
@NotNull RMProject project,
|
||||
@NotNull DBPPreferenceStore preferenceStore,
|
||||
@NotNull Path path
|
||||
@NotNull DataSourceFilter dataSourceFilter
|
||||
) {
|
||||
super(workspace, resourceController, sessionContext, project, path);
|
||||
this.preferenceStore = preferenceStore;
|
||||
super(workspace, resourceController, sessionContext, project, dataSourceFilter);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -75,21 +66,13 @@ public abstract class WebProjectImpl extends BaseWebProjectImpl {
|
||||
return DBWorkbench.isDistributed();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public DBTTaskManager getTaskManager() {
|
||||
throw new IllegalStateException("Task manager not supported");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected DBPDataSourceRegistry createDataSourceRegistry() {
|
||||
return createRMRegistry();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected DataSourceRegistry<?> createRMRegistry() {
|
||||
return new DataSourceRegistryRM<>(this, getResourceController(), preferenceStore);
|
||||
return new WebDataSourceRegistryProxy(
|
||||
new DataSourceRegistryRM(this, getResourceController()),
|
||||
dataSourceFilter
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-122
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* DBeaver - Universal Database Manager
|
||||
* Copyright (C) 2010-2024 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.cloudbeaver;
|
||||
|
||||
import io.cloudbeaver.model.session.WebSession;
|
||||
import org.jkiss.code.NotNull;
|
||||
import org.jkiss.dbeaver.DBException;
|
||||
import org.jkiss.dbeaver.Log;
|
||||
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
|
||||
import org.jkiss.dbeaver.model.DBPEvent;
|
||||
import org.jkiss.dbeaver.model.app.DBPDataSourceRegistry;
|
||||
import org.jkiss.dbeaver.model.rm.RMProject;
|
||||
import org.jkiss.dbeaver.model.security.SMObjectType;
|
||||
import org.jkiss.dbeaver.model.security.user.SMObjectPermissions;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
/**
|
||||
* Global project.
|
||||
* Connections there can be not accessible.
|
||||
*/
|
||||
public class WebSessionGlobalProjectImpl extends WebSessionProjectImpl {
|
||||
private static final Log log = Log.getLog(WebSessionGlobalProjectImpl.class);
|
||||
|
||||
private final Set<String> accessibleConnectionIds = new CopyOnWriteArraySet<>();
|
||||
|
||||
public WebSessionGlobalProjectImpl(@NotNull WebSession webSession, @NotNull RMProject project) {
|
||||
super(webSession, project);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates data source registry that can filter data sources that are not accessible for user.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
protected DBPDataSourceRegistry createDataSourceRegistry() {
|
||||
return new WebGlobalProjectRegistryProxy(
|
||||
webSession,
|
||||
createRegistryWithCredentialsProvider(),
|
||||
this::isDataSourceAccessible
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update info about accessible connections from a database.
|
||||
*/
|
||||
public void refreshAccessibleConnectionIds() {
|
||||
this.accessibleConnectionIds.clear();
|
||||
try {
|
||||
for (SMObjectPermissions smObjectPermissions : webSession.getSecurityController()
|
||||
.getAllAvailableObjectsPermissions(SMObjectType.datasource)) {
|
||||
String objectId = smObjectPermissions.getObjectId();
|
||||
this.accessibleConnectionIds.add(objectId);
|
||||
}
|
||||
} catch (DBException e) {
|
||||
webSession.addSessionError(e);
|
||||
log.error("Error reading connection grants", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if connection is accessible for current user.
|
||||
*/
|
||||
public boolean isDataSourceAccessible(@NotNull DBPDataSourceContainer dataSource) {
|
||||
return dataSource.isExternallyProvided() ||
|
||||
dataSource.isTemporary() ||
|
||||
webSession.hasPermission(DBWConstants.PERMISSION_ADMIN) ||
|
||||
accessibleConnectionIds.contains(dataSource.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a connection if it became accessible.
|
||||
* The method is processed when connection permissions were updated.
|
||||
*/
|
||||
public synchronized void addAccessibleConnectionToCache(@NotNull String dsId) {
|
||||
if (!getRMProject().isGlobal()) {
|
||||
return;
|
||||
}
|
||||
this.accessibleConnectionIds.add(dsId);
|
||||
var registry = getDataSourceRegistry();
|
||||
var dataSource = registry.getDataSource(dsId);
|
||||
if (dataSource != null) {
|
||||
addConnection(dataSource);
|
||||
// reflect changes is navigator model
|
||||
registry.notifyDataSourceListeners(new DBPEvent(DBPEvent.Action.OBJECT_ADD, dataSource, true));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a connection if it became not accessible.
|
||||
* The method is processed when connection permissions were updated.
|
||||
*/
|
||||
public synchronized void removeAccessibleConnectionFromCache(@NotNull String dsId) {
|
||||
if (!getRMProject().isGlobal()) {
|
||||
return;
|
||||
}
|
||||
var registry = getDataSourceRegistry();
|
||||
var dataSource = registry.getDataSource(dsId);
|
||||
if (dataSource != null) {
|
||||
this.accessibleConnectionIds.remove(dsId);
|
||||
removeConnection(dataSource);
|
||||
// reflect changes is navigator model
|
||||
registry.notifyDataSourceListeners(new DBPEvent(DBPEvent.Action.OBJECT_REMOVE, dataSource));
|
||||
dataSource.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* DBeaver - Universal Database Manager
|
||||
* Copyright (C) 2010-2025 DBeaver Corp and others
|
||||
* Copyright (C) 2010-2024 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,64 +16,18 @@
|
||||
*/
|
||||
package io.cloudbeaver;
|
||||
|
||||
import io.cloudbeaver.model.WebConnectionInfo;
|
||||
import io.cloudbeaver.model.session.WebSession;
|
||||
import io.cloudbeaver.utils.WebDataSourceUtils;
|
||||
import org.jkiss.code.NotNull;
|
||||
import org.jkiss.code.Nullable;
|
||||
import org.jkiss.dbeaver.Log;
|
||||
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
|
||||
import org.jkiss.dbeaver.model.app.DBPDataSourceRegistry;
|
||||
import org.jkiss.dbeaver.model.app.DBPDataSourceRegistryCache;
|
||||
import org.jkiss.dbeaver.model.navigator.DBNModel;
|
||||
import org.jkiss.dbeaver.model.rm.RMProject;
|
||||
import org.jkiss.dbeaver.model.rm.RMUtils;
|
||||
import org.jkiss.dbeaver.model.websocket.event.datasource.WSDataSourceEvent;
|
||||
import org.jkiss.dbeaver.model.websocket.event.datasource.WSDataSourceProperty;
|
||||
import org.jkiss.dbeaver.registry.DataSourceDescriptor;
|
||||
import org.jkiss.dbeaver.registry.DataSourceRegistry;
|
||||
import org.jkiss.dbeaver.runtime.jobs.DisconnectJob;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class WebSessionProjectImpl extends WebProjectImpl {
|
||||
private static final Log log = Log.getLog(WebSessionProjectImpl.class);
|
||||
protected final WebSession webSession;
|
||||
private final Map<String, WebConnectionInfo> connections = new HashMap<>();
|
||||
private boolean registryIsLoaded = false;
|
||||
|
||||
public WebSessionProjectImpl(
|
||||
@NotNull WebSession webSession,
|
||||
@NotNull RMProject project
|
||||
) {
|
||||
super(
|
||||
webSession.getWorkspace(),
|
||||
webSession.getRmController(),
|
||||
webSession.getSessionContext(),
|
||||
project,
|
||||
webSession.getUserPreferenceStore(),
|
||||
RMUtils.getProjectPath(project)
|
||||
);
|
||||
this.webSession = webSession;
|
||||
}
|
||||
private final WebSession webSession;
|
||||
|
||||
public WebSessionProjectImpl(
|
||||
@NotNull WebSession webSession,
|
||||
@NotNull RMProject project,
|
||||
@NotNull Path path
|
||||
) {
|
||||
super(
|
||||
webSession.getWorkspace(),
|
||||
webSession.getRmController(),
|
||||
webSession.getSessionContext(),
|
||||
project,
|
||||
webSession.getUserPreferenceStore(),
|
||||
path
|
||||
);
|
||||
public WebSessionProjectImpl(@NotNull WebSession webSession, @NotNull RMProject project, @NotNull DataSourceFilter dataSourceFilter) {
|
||||
super(webSession.getWorkspace(), webSession.getRmController(), webSession.getSessionContext(), project, dataSourceFilter);
|
||||
this.webSession = webSession;
|
||||
}
|
||||
|
||||
@@ -82,159 +36,4 @@ public class WebSessionProjectImpl extends WebProjectImpl {
|
||||
public DBNModel getNavigatorModel() {
|
||||
return webSession.getNavigatorModel();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected DBPDataSourceRegistry createDataSourceRegistry() {
|
||||
return createRegistryWithCredentialsProvider();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected DataSourceRegistry<?> createRegistryWithCredentialsProvider() {
|
||||
DataSourceRegistry<?> dataSourceRegistry = createRMRegistry();
|
||||
dataSourceRegistry.setAuthCredentialsProvider(webSession);
|
||||
dataSourceRegistry.addDataSourceListener(webSession.getDataSourceConnectListener());
|
||||
return dataSourceRegistry;
|
||||
}
|
||||
|
||||
private synchronized void addDataSourcesToCache() {
|
||||
if (registryIsLoaded) {
|
||||
return;
|
||||
}
|
||||
getDataSourceRegistry().getDataSources().forEach(this::addConnection);
|
||||
Throwable lastError = getDataSourceRegistry().getLastError();
|
||||
if (lastError != null) {
|
||||
webSession.addSessionError(lastError);
|
||||
log.error("Error refreshing connections from project '" + getId() + "'", lastError);
|
||||
}
|
||||
registryIsLoaded = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
super.dispose();
|
||||
Map<String, WebConnectionInfo> conCopy;
|
||||
synchronized (this.connections) {
|
||||
conCopy = new HashMap<>(this.connections);
|
||||
this.connections.clear();
|
||||
}
|
||||
|
||||
for (WebConnectionInfo connectionInfo : conCopy.values()) {
|
||||
if (connectionInfo.isConnected()) {
|
||||
new DisconnectJob(connectionInfo.getDataSourceContainer()).schedule();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns web connection info from cache (if exists).
|
||||
*/
|
||||
@Nullable
|
||||
public WebConnectionInfo findWebConnectionInfo(@NotNull String connectionId) {
|
||||
synchronized (connections) {
|
||||
return connections.get(connectionId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns web connection info from cache, adds it to cache if not present.
|
||||
* Throws exception if connection is not found.
|
||||
*/
|
||||
@NotNull
|
||||
public WebConnectionInfo getWebConnectionInfo(@NotNull String connectionId) throws DBWebException {
|
||||
WebConnectionInfo connectionInfo = findWebConnectionInfo(connectionId);
|
||||
if (connectionInfo != null) {
|
||||
return connectionInfo;
|
||||
}
|
||||
DBPDataSourceContainer dataSource = getDataSourceRegistry().getDataSource(connectionId);
|
||||
if (dataSource != null) {
|
||||
return addConnection(dataSource);
|
||||
}
|
||||
throw new DBWebException("Connection '%s' not found".formatted(connectionId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds connection to project cache.
|
||||
*/
|
||||
@NotNull
|
||||
public synchronized WebConnectionInfo addConnection(@NotNull DBPDataSourceContainer dataSourceContainer) {
|
||||
WebConnectionInfo connection = new WebConnectionInfo(webSession, dataSourceContainer);
|
||||
synchronized (connections) {
|
||||
connections.put(dataSourceContainer.getId(), connection);
|
||||
}
|
||||
return connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes connection from project cache.
|
||||
*/
|
||||
public void removeConnection(@NotNull DBPDataSourceContainer dataSourceContainer) {
|
||||
WebConnectionInfo webConnectionInfo = connections.get(dataSourceContainer.getId());
|
||||
if (webConnectionInfo != null) {
|
||||
webConnectionInfo.clearCache();
|
||||
synchronized (connections) {
|
||||
connections.remove(dataSourceContainer.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads connection from registry if they are not loaded.
|
||||
*
|
||||
* @return connections from cache.
|
||||
*/
|
||||
public List<WebConnectionInfo> getConnections() {
|
||||
if (!registryIsLoaded) {
|
||||
addDataSourcesToCache();
|
||||
registryIsLoaded = true;
|
||||
}
|
||||
synchronized (connections) {
|
||||
return new ArrayList<>(connections.values());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* updates data sources based on event in web session
|
||||
*
|
||||
* @param event data source updated event
|
||||
*/
|
||||
public synchronized boolean updateProjectDataSources(@NotNull WSDataSourceEvent event) {
|
||||
var sendDataSourceUpdatedEvent = false;
|
||||
DBPDataSourceRegistry registry = getDataSourceRegistry();
|
||||
if (WSDataSourceEvent.CREATED.equals(event.getId()) || WSDataSourceEvent.UPDATED.equals(event.getId())) {
|
||||
registry.refreshConfig(event.getDataSourceIds());
|
||||
}
|
||||
for (String dsId : event.getDataSourceIds()) {
|
||||
DataSourceDescriptor ds = (DataSourceDescriptor) registry.getDataSource(dsId);
|
||||
if (ds == null) {
|
||||
continue;
|
||||
}
|
||||
switch (event.getId()) {
|
||||
case WSDataSourceEvent.CREATED -> {
|
||||
addConnection(ds);
|
||||
sendDataSourceUpdatedEvent = true;
|
||||
}
|
||||
case WSDataSourceEvent.UPDATED -> {
|
||||
if (event.getProperty() == WSDataSourceProperty.CONFIGURATION) {
|
||||
WebDataSourceUtils.disconnectDataSource(webSession, ds);
|
||||
}
|
||||
if (event.getProperty() != WSDataSourceProperty.INTERNAL) {
|
||||
sendDataSourceUpdatedEvent = true;
|
||||
}
|
||||
}
|
||||
case WSDataSourceEvent.DELETED -> {
|
||||
WebDataSourceUtils.disconnectDataSource(webSession, ds);
|
||||
if (registry instanceof DBPDataSourceRegistryCache dsrc) {
|
||||
dsrc.removeDataSourceFromList(ds);
|
||||
}
|
||||
removeConnection(ds);
|
||||
sendDataSourceUpdatedEvent = true;
|
||||
}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
}
|
||||
return sendDataSourceUpdatedEvent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ public interface CBAuthConstants {
|
||||
String CB_AUTH_ID_REQUEST_PARAM = "authId";
|
||||
String CB_AUTO_LOGIN_REQUEST_PARAM = "autoLogin";
|
||||
String CB_REDIRECT_URL_REQUEST_PARAM = "redirectUrl";
|
||||
String CB_FORCE_SESSIONS_LOGOUT = "forceSessionsLogout";
|
||||
|
||||
// Default max idle time (10 minutes)
|
||||
long MAX_SESSION_IDLE_TIME = 10 * 60 * 1000;
|
||||
|
||||
+1
-3
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* DBeaver - Universal Database Manager
|
||||
* Copyright (C) 2010-2025 DBeaver Corp and others
|
||||
* Copyright (C) 2010-2024 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,6 @@
|
||||
package io.cloudbeaver.auth;
|
||||
|
||||
import org.jkiss.code.NotNull;
|
||||
import org.jkiss.code.Nullable;
|
||||
import org.jkiss.dbeaver.DBException;
|
||||
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
|
||||
import org.jkiss.dbeaver.model.security.SMAuthProviderCustomConfiguration;
|
||||
@@ -37,7 +36,6 @@ public interface SMAuthProviderAssigner {
|
||||
@NotNull Map<String, Object> authParameters
|
||||
) throws DBException;
|
||||
|
||||
@Nullable
|
||||
String getExternalTeamIdMetadataFieldName();
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user