From 7a8b23b887f765eb3b89c516c44bafd502026fda Mon Sep 17 00:00:00 2001 From: idastambuk Date: Fri, 2 Aug 2024 11:41:14 +0200 Subject: [PATCH 1/2] Rename datasource file --- ...rce.test.ts => SitewiseDataSource.test.ts} | 2 +- src/{DataSource.ts => SitewiseDataSource.ts} | 0 src/components/MetaInspector.tsx | 2 +- src/components/browser/AssetBrowser.tsx | 2 +- src/components/query/QueryEditor.test.tsx | 2 +- src/components/query/QueryEditor.tsx | 6 ++--- src/components/query/types.ts | 2 +- src/module.ts | 2 +- src/sitewiseCache.ts | 7 ++--- src/variables.ts | 26 +++++++++---------- 10 files changed, 24 insertions(+), 27 deletions(-) rename src/{DataSource.test.ts => SitewiseDataSource.test.ts} (99%) rename src/{DataSource.ts => SitewiseDataSource.ts} (100%) diff --git a/src/DataSource.test.ts b/src/SitewiseDataSource.test.ts similarity index 99% rename from src/DataSource.test.ts rename to src/SitewiseDataSource.test.ts index a77e69cb..49dc4313 100644 --- a/src/DataSource.test.ts +++ b/src/SitewiseDataSource.test.ts @@ -1,4 +1,4 @@ -import { DataSource } from './DataSource'; +import { DataSource } from './SitewiseDataSource'; import { DataSourceInstanceSettings, PluginMeta, ScopedVar, ScopedVars } from '@grafana/data'; import { QueryType, SitewiseOptions, SitewiseQuery } from './types'; diff --git a/src/DataSource.ts b/src/SitewiseDataSource.ts similarity index 100% rename from src/DataSource.ts rename to src/SitewiseDataSource.ts diff --git a/src/components/MetaInspector.tsx b/src/components/MetaInspector.tsx index 30919139..8d54e881 100644 --- a/src/components/MetaInspector.tsx +++ b/src/components/MetaInspector.tsx @@ -1,6 +1,6 @@ import React, { PureComponent } from 'react'; import { MetadataInspectorProps, DataFrame } from '@grafana/data'; -import { DataSource } from '../DataSource'; +import { DataSource } from '../SitewiseDataSource'; import { SitewiseQuery, SitewiseOptions, SitewiseCustomMeta } from '../types'; import { Tag } from '@grafana/ui'; diff --git a/src/components/browser/AssetBrowser.tsx b/src/components/browser/AssetBrowser.tsx index b6b432b6..c45d497c 100644 --- a/src/components/browser/AssetBrowser.tsx +++ b/src/components/browser/AssetBrowser.tsx @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { Button, Icon, Modal, Spinner, Tab, TabContent, TabsBar } from '@grafana/ui'; import { AssetInfo } from '../../types'; -import { DataSource } from 'DataSource'; +import { DataSource } from 'SitewiseDataSource'; import { SitewiseCache } from 'sitewiseCache'; import { BrowseModels } from './BrowseModels'; import { BrowseHierarchy } from './BrowseHierarchy'; diff --git a/src/components/query/QueryEditor.test.tsx b/src/components/query/QueryEditor.test.tsx index ccdcc398..f8808291 100644 --- a/src/components/query/QueryEditor.test.tsx +++ b/src/components/query/QueryEditor.test.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { render, screen, waitFor } from '@testing-library/react'; import { DataQueryRequest, DataSourceInstanceSettings, QueryEditorProps } from '@grafana/data'; -import { DataSource } from 'DataSource'; +import { DataSource } from 'SitewiseDataSource'; import { QueryType, SitewiseOptions, SitewiseQuery } from 'types'; import { QueryEditor } from './QueryEditor'; import { of } from 'rxjs'; diff --git a/src/components/query/QueryEditor.tsx b/src/components/query/QueryEditor.tsx index fc24b47b..d7b6d77c 100644 --- a/src/components/query/QueryEditor.tsx +++ b/src/components/query/QueryEditor.tsx @@ -1,7 +1,7 @@ import defaults from 'lodash/defaults'; import React from 'react'; import { QueryEditorProps, SelectableValue } from '@grafana/data'; -import { DataSource } from 'DataSource'; +import { DataSource } from 'SitewiseDataSource'; import { SitewiseQuery, SitewiseOptions, QueryType, ListAssetsQuery, ListTimeSeriesQuery } from 'types'; import { Icon, LinkButton, Select } from '@grafana/ui'; import { QueryTypeInfo, siteWiseQueryTypes, changeQueryType } from 'queryInfo'; @@ -60,8 +60,8 @@ export function QueryEditor(props: Props) { return null; // nothing required case QueryType.ListAssets: return ; - case QueryType.ListTimeSeries: - return + case QueryType.ListTimeSeries: + return ; case QueryType.ListAssociatedAssets: case QueryType.PropertyValue: case QueryType.PropertyInterpolated: diff --git a/src/components/query/types.ts b/src/components/query/types.ts index ab1b9c98..4e34cdd2 100644 --- a/src/components/query/types.ts +++ b/src/components/query/types.ts @@ -1,4 +1,4 @@ -import { DataSource } from 'DataSource'; +import { DataSource } from 'SitewiseDataSource'; import { SitewiseQuery } from 'types'; export interface SitewiseQueryEditorProps { diff --git a/src/module.ts b/src/module.ts index 70227ef4..4329a1c1 100644 --- a/src/module.ts +++ b/src/module.ts @@ -1,5 +1,5 @@ import { DataSourcePlugin } from '@grafana/data'; -import { DataSource } from './DataSource'; +import { DataSource } from './SitewiseDataSource'; import { SitewiseQuery, SitewiseOptions } from './types'; import { MetaInspector } from 'components/MetaInspector'; import { ConfigEditor } from 'components/ConfigEditor'; diff --git a/src/sitewiseCache.ts b/src/sitewiseCache.ts index 5ffc0143..449a9090 100644 --- a/src/sitewiseCache.ts +++ b/src/sitewiseCache.ts @@ -1,5 +1,5 @@ import { DataFrameView, SelectableValue } from '@grafana/data'; -import { DataSource } from 'DataSource'; +import { DataSource } from 'SitewiseDataSource'; import { ListAssetsQuery, ListAssociatedAssetsQuery, QueryType } from 'types'; import { AssetModelSummary, AssetSummary, DescribeAssetResult } from './queryResponseTypes'; import { AssetInfo, AssetPropertyInfo } from './types'; @@ -15,10 +15,7 @@ export class SitewiseCache { private topLevelAssets?: DataFrameView; private assetPropertiesByAssetId = new Map>(); - constructor( - private ds: DataSource, - private region: string - ) {} + constructor(private ds: DataSource, private region: string) {} async getAssetInfo(id: string): Promise { const v = this.assetsById.get(id); diff --git a/src/variables.ts b/src/variables.ts index 8400ad9e..6240f7dc 100644 --- a/src/variables.ts +++ b/src/variables.ts @@ -2,7 +2,7 @@ import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { assign } from 'lodash'; import { QueryType, SitewiseQuery } from './types'; -import { DataSource } from './DataSource'; +import { DataSource } from './SitewiseDataSource'; import { DataQueryRequest, DataQueryResponse, CustomVariableSupport, DataFrameView } from '@grafana/data'; import { QueryEditor } from './components/query/QueryEditor'; import { AssetModelSummary } from 'queryResponseTypes'; @@ -25,28 +25,28 @@ export class SitewiseVariableSupport extends CustomVariableSupport ): Observable { + parseOptions(response: Observable): Observable { return response.pipe( map((res) => { - let data = [] + let data = []; if (res.data.length) { - data = res.data[0] + data = res.data[0]; } - return {data: new DataFrameView(data)}; + return { data: new DataFrameView(data) }; }), map((res) => { - const newData = res.data.map((m)=>{ + const newData = res.data.map((m) => { return { - value: m.id, - text: m.name, - }}) - return {data:newData} + value: m.id, + text: m.name, + }; + }); + return { data: newData }; }) - ) + ); } - } From c07c493927a7884a6cc9e09a8d4032ec79821321 Mon Sep 17 00:00:00 2001 From: idastambuk Date: Fri, 2 Aug 2024 16:02:16 +0200 Subject: [PATCH 2/2] Update docker-compose --- .github/workflows/e2e.yml | 4 ++-- cspell.config.json | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index a016b2e8..1dd97396 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -57,8 +57,8 @@ jobs: - name: Start Grafana run: | - docker-compose pull - GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker-compose up -d + docker compose pull + GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker compose up -d - name: Wait for Grafana to start uses: nev7n/wait_for_response@v1 diff --git a/cspell.config.json b/cspell.config.json index f03521f0..27887b38 100644 --- a/cspell.config.json +++ b/cspell.config.json @@ -70,6 +70,7 @@ "eslintcache", "lefthook", "ssjagad", - "jackspeak" + "jackspeak", + "nvmrc" ] }