diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..41cf459c --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,43 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node +{ + "name": "Datasource", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm", + "features": { + "ghcr.io/devcontainers/features/docker-in-docker:2": {}, + "ghcr.io/devcontainers/features/go:1": {}, + "ghcr.io/guiyomh/features/mage": {} + }, + "customizations": { + "vscode": { + "extensions": [ + "golang.go", + "dbaeumer.vscode-eslint" + ] + } + }, + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + "portsAttributes": { + "3000": { + "label": "Grafana", + "onAutoForward": "silent" + } + }, + + "updateContentCommand": "bash ${containerWorkspaceFolder}/.devcontainer/init.sh" + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "yarn install", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} \ No newline at end of file diff --git a/.devcontainer/init.sh b/.devcontainer/init.sh new file mode 100644 index 00000000..6c246be8 --- /dev/null +++ b/.devcontainer/init.sh @@ -0,0 +1,2 @@ +mage -v build:linux +yarn install \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 2389aa21..46baff08 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -30,6 +30,18 @@ "console": "integratedTerminal", "internalConsoleOptions": "neverOpen", "port": 9229 + }, + { + "name": "Debug: Frontend", + "request": "launch", + "type": "chrome", + "url": "http://localhost:3000/explore", + "webRoot": "${workspaceFolder}", + "preLaunchTask": "run grafana", + "cwd": "${workspaceFolder}", + "sourceMapPathOverrides": { + "webpack://grafana-clickhouse-datasource/*": "${workspaceRoot}/src/*" + }, } ] } diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..5722b3fb --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,70 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "shell", + "command": "yarn install", + "label": "frontend: yarn install", + "detail": "install frontend dependencies" + }, + { + "type": "shell", + "command": "yarn dev", + "label": "frontend: yarn dev", + "dependsOn": [ + "frontend: yarn install" + ], + "isBackground": true, + "problemMatcher": [ + { + "pattern": [ + { + "regexp": ".", + "file": 1, + "location": 2, + "message": 3 + } + ], + "background": { + "activeOnStart": true, + "beginsPattern": ".", + "endsPattern": ".", + } + } + ] + }, + { + "type": "shell", + "command": "mage -v build:linux", + "label": "backend: marge build", + "detail": "build clickhouse plugin backend", + }, + { + "type": "shell", + "command": "docker compose up", + "label": "run grafana", + "detail": "run test environment", + "dependsOn": [ + "frontend: yarn dev" + ], + "isBackground": true, + "problemMatcher": [ + { + "pattern": [ + { + "regexp": ".", + "file": 1, + "location": 2, + "message": 3 + } + ], + "background": { + "activeOnStart": true, + "beginsPattern": ".", + "endsPattern": ".", + } + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/property-prices.sql b/tests/fixtures/property-prices.sql index e9216c84..b6b1dc53 100644 --- a/tests/fixtures/property-prices.sql +++ b/tests/fixtures/property-prices.sql @@ -2,7 +2,7 @@ -- example dataset from the ClickHouse documentation: -- https://clickhouse.com/docs/en/getting-started/example-datasets/uk-price-paid -CREATE TABLE uk_price_paid +CREATE TABLE IF NOT EXISTS uk_price_paid ( price UInt32, date Date,