grafana / timestream-datasource

Amazon Timestream in Grafana
https://grafana.com/grafana/plugins/grafana-timestream-datasource
Apache License 2.0
24 stars 19 forks source link

Build issue #48

Closed squalou closed 3 years ago

squalou commented 3 years ago

Hi, before submitting an issue (or rather a suggestion) , I'm trying a local tweak in the plugin. I manage to build the 'go' part and make it work.

On the other hand, the ts sources does not compile. (at 7da9b30 which is master head at the moment of writing)

Here are the compile errors I face, note that I'm a beginner with the node ecosystem.

Would look like I dont build against right api definition something like that, or with wrong tool version.

For instance here what is apparently extencted :

export interface MetadataInspectorProps<DSType extends DataSourceApi<TQuery, TOptions>, TQuery extends DataQuery = DataQuery, TOptions extends DataSourceJsonData = DataSourceJsonData> {
    datasource: DSType;
    data: DataFrame[];
}

but MetaInspector.tsx reads

export type Props = MetadataInspectorProps<DataSource, TimestreamQuery, TimestreamOptions>;

causing error Type 'DataSource' does not satisfy the constraint 'DataSourceApi

Any clue will be welcome !

  ERROR in /home/myhome/go/src/timestream-datasource/src/components/ConfigEditor.tsx
  ERROR in /home/myhome/go/src/timestream-datasource/src/components/ConfigEditor.tsx(26,16):
  TS2352: Conversion of type 'DataSourceApi<DataQuery, DataSourceJsonData>' to type 'DataSource' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
    Type 'DataSourceApi<DataQuery, DataSourceJsonData>' is missing the following properties from type 'DataSource': options, annotations, filterQuery, applyTemplateVariables, and 7 more.

  ERROR in /home/myhome/go/src/timestream-datasource/src/components/MetaInspector.tsx
  ERROR in /home/myhome/go/src/timestream-datasource/src/components/MetaInspector.tsx(6,44):
  TS2344: Type 'DataSource' does not satisfy the constraint 'DataSourceApi<TimestreamQuery, TimestreamOptions>'.

  ERROR in /home/myhome/go/src/timestream-datasource/src/components/QueryEditor.tsx
  ERROR in /home/myhome/go/src/timestream-datasource/src/components/QueryEditor.tsx(12,31):
  TS2344: Type 'DataSource' does not satisfy the constraint 'DataSourceApi<Times

  ERROR in /home/myhome/go/src/timestream-datasource/src/module.ts
  ERROR in /home/myhome/go/src/timestream-datasource/src/module.ts(7,44):
  TS2344: Type 'DataSource' does not satisfy the constraint 'DataSourceApi<TimestreamQuery, TimestreamOptions>'.
    The types returned by 'query(...)' are incompatible between these types.
      Type 'Observable<DataQueryResponse>' is not assignable to type 'Promise<DataQueryResponse> | Observable<DataQueryResponse>'.

  ERROR in /home/myhome/go/src/timestream-datasource/src/module.ts
  ERROR in /home/myhome/go/src/timestream-datasource/src/module.ts(8,20):
  TS2345: Argument of type 'typeof ConfigEditor' is not assignable to parameter of type 'ComponentType<DataSourcePluginOptionsEditorProps<TimestreamOptions, unknown>>'.
squalou commented 3 years ago

Ok, I may have found something ... in the circleci file

            # hack for rxjs issue
            rm -rf ./node_modules/@grafana/data/node_modules/rxjs
            ./node_modules/.bin/grafana-toolkit plugin:ci-build
            ./node_modules/.bin/grafana-toolkit plugin:ci-build --finish

and it works !

I think I will manage from here.

a 'BUILD.md' would be nice in case other special operations are required for a tinkerer ;-)

closing