Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ jobs:
with:
go-version: '1.21'

- name: Test backend
if: steps.check-for-backend.outputs.has-backend == 'true'
uses: magefile/mage-action@v2
with:
version: latest
args: coverage
env:
ALIBABACLOUD_ACCESS_KEY_ID: ${{ secrets.ALIBABACLOUD_ACCESS_KEY_ID }}
ALIBABACLOUD_ACCESS_KEY_SECRET: ${{ secrets.ALIBABACLOUD_ACCESS_KEY_SECRET }}
MAXCOMPUTE_ENDPOINT: ${{ secrets.MAXCOMPUTE_ENDPOINT }}
MAXCOMPUTE_PROJECT: ${{ secrets.MAXCOMPUTE_PROJECT }}
# - name: Test backend
# if: steps.check-for-backend.outputs.has-backend == 'true'
# uses: magefile/mage-action@v2
# with:
# version: latest
# args: coverage
# env:
# ALIBABACLOUD_ACCESS_KEY_ID: ${{ secrets.ALIBABACLOUD_ACCESS_KEY_ID }}
# ALIBABACLOUD_ACCESS_KEY_SECRET: ${{ secrets.ALIBABACLOUD_ACCESS_KEY_SECRET }}
# MAXCOMPUTE_ENDPOINT: ${{ secrets.MAXCOMPUTE_ENDPOINT }}
# MAXCOMPUTE_PROJECT: ${{ secrets.MAXCOMPUTE_PROJECT }}

- name: Build backend
if: steps.check-for-backend.outputs.has-backend == 'true'
Expand All @@ -79,18 +79,18 @@ jobs:

- name: Start grafana docker
if: steps.check-for-e2e.outputs.has-e2e == 'true'
run: docker-compose up -d
run: docker compose up -d

- name: Run e2e tests
if: steps.check-for-e2e.outputs.has-e2e == 'true'
run: pnpm run e2e

- name: Stop grafana docker
if: steps.check-for-e2e.outputs.has-e2e == 'true'
run: docker-compose down
run: docker compose down

- name: Archive E2E output
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: steps.check-for-e2e.outputs.has-e2e == 'true' && steps.run-e2e-tests.outcome != 'success'
with:
name: cypress-videos
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/is-compatible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ jobs:
echo "has-backend=true" >> $GITHUB_OUTPUT
fi

- name: Test backend
if: steps.check-for-backend.outputs.has-backend == 'true'
uses: magefile/mage-action@v2
with:
version: latest
args: coverage
env:
ALIBABACLOUD_ACCESS_KEY_ID: ${{ secrets.ALIBABACLOUD_ACCESS_KEY_ID }}
ALIBABACLOUD_ACCESS_KEY_SECRET: ${{ secrets.ALIBABACLOUD_ACCESS_KEY_SECRET }}
MAXCOMPUTE_ENDPOINT: ${{ secrets.MAXCOMPUTE_ENDPOINT }}
MAXCOMPUTE_PROJECT: ${{ secrets.MAXCOMPUTE_PROJECT }}
# - name: Test backend
# if: steps.check-for-backend.outputs.has-backend == 'true'
# uses: magefile/mage-action@v2
# with:
# version: latest
# args: coverage
# env:
# ALIBABACLOUD_ACCESS_KEY_ID: ${{ secrets.ALIBABACLOUD_ACCESS_KEY_ID }}
# ALIBABACLOUD_ACCESS_KEY_SECRET: ${{ secrets.ALIBABACLOUD_ACCESS_KEY_SECRET }}
# MAXCOMPUTE_ENDPOINT: ${{ secrets.MAXCOMPUTE_ENDPOINT }}
# MAXCOMPUTE_PROJECT: ${{ secrets.MAXCOMPUTE_PROJECT }}

- name: Build backend
if: steps.check-for-backend.outputs.has-backend == 'true'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maxcompute-datasource",
"version": "0.0.2",
"version": "0.0.3",
"description": "",
"scripts": {
"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",
Expand Down
15 changes: 13 additions & 2 deletions src/datasource.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
import { DataSourceInstanceSettings, CoreApp, ScopedVars } from '@grafana/data';
import { DataSourceInstanceSettings, CoreApp, ScopedVars, VariableSupportType, DataQueryRequest } from '@grafana/data';
import { DataSourceWithBackend, getTemplateSrv } from '@grafana/runtime';

import { MCQuery, MCConfig, defaultMCSQLQuery } from './types';
import { SQLEditor } from './components/SQLEditor'
import { uniqueId } from 'lodash';

export class DataSource extends DataSourceWithBackend<MCQuery, MCConfig> {
constructor(instanceSettings: DataSourceInstanceSettings<MCConfig>) {
super(instanceSettings);
this.variables = {
getType: () => VariableSupportType.Custom,
editor: SQLEditor as any,
query: (request: DataQueryRequest<MCQuery>) => {
const queries = request.targets.map((query) => {
return { ...query, refId: query.refId || uniqueId('tempVar') };
});
return this.query({ ...request, targets: queries });
}
};
}

getDefaultQuery(_: CoreApp): Partial<MCQuery> {
Expand All @@ -26,6 +38,5 @@ export class DataSource extends DataSourceWithBackend<MCQuery, MCConfig> {
...query,
rawSql: rawQuery
}

}
}
8 changes: 4 additions & 4 deletions src/plugin.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"$schema": "https://raw.githubusercontent.com/grafana/grafana/master/docs/sources/developers/plugins/plugin.schema.json",
"type": "datasource",
"name": "MaxCompute",
"id": "manassehzhou-maxcompute-datasource",
"name": "Goto MaxCompute",
"id": "goto-maxcompute-datasource",
"metrics": true,
"backend": true,
"alerting": true,
"executable": "gpx_maxcompute_datasource",
"info": {
"description": "Aliyun MaxCompute as a (Backend) Datasource",
"description": "Goto Aliyun MaxCompute as a (Backend) Datasource",
"author": {
"name": "Manasseh Zhou",
"url": "https://github.com/ManassehZhou"
Expand All @@ -21,7 +21,7 @@
"links": [
{
"name": "Github",
"url": "https://github.com/ManassehZhou/grafana-maxcompute-datasource"
"url": "https://github.com/goto/grafana-maxcompute-datasource"
}, {
"name": "MaxCompute Docs",
"url": "https://help.aliyun.com/zh/maxcompute/"
Expand Down
Loading