diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0267fe2..27e7716 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,14 +14,20 @@ You need: ### Building +### All the stack + +```shell +./build_and_start.sh +``` + #### Frontend ```bash -$ yarn install -$ yarn build +$ npm install +$ npm run build ``` -When developing the front, use `yarn dev`. +When developing the front, use `npm run dev`. #### Backend @@ -49,7 +55,6 @@ $ npm run test $ go test -v ./pkg/... ``` - ## Release TODO diff --git a/build_and_start.sh b/build_and_start.sh new file mode 100755 index 0000000..efbdaf6 --- /dev/null +++ b/build_and_start.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +npm install +npm run build +mage -v +docker-compose up --build --force-recreate diff --git a/docker-compose.yaml b/docker-compose.yaml index 5061f7d..75a87ab 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -12,7 +12,9 @@ services: volumes: - ./:/var/lib/grafana/plugins/grafana-quickwit-datasource - ./provisioning:/etc/grafana/provisioning - # - ./grafana/storage:/var/lib/grafana - # - ./grafana/grafana.ini:/etc/grafana/grafana.ini + - gquickwit:/var/lib/grafana extra_hosts: - "host.docker.internal:host-gateway" + +volumes: + gquickwit: diff --git a/src/datasource.ts b/src/datasource.ts index 2a9f91e..2e0193e 100644 --- a/src/datasource.ts +++ b/src/datasource.ts @@ -2,7 +2,6 @@ import { cloneDeep, first as _first, map as _map, groupBy } from 'lodash'; import { Observable, lastValueFrom, from, isObservable, of } from 'rxjs'; import { catchError, mergeMap, map } from 'rxjs/operators'; import { intervalMap } from './IntervalMap'; -import { Interval } from './types'; import { AbstractQuery, @@ -33,7 +32,7 @@ import { SupplementaryQueryType, TimeRange, } from '@grafana/data'; -import { BucketAggregation, DataLinkConfig, ElasticsearchQuery, Field, FieldMapping, IndexMetadata, Logs, TermsQuery } from './types'; +import { BucketAggregation, DataLinkConfig, ElasticsearchQuery, Field, FieldMapping, IndexMetadata, Logs, TermsQuery, Interval } from './types'; import { DataSourceWithBackend, getTemplateSrv, TemplateSrv } from '@grafana/runtime'; import { LogRowContextOptions, LogRowContextQueryDirection, QuickwitOptions } from 'quickwit'; import { ElasticQueryBuilder } from 'QueryBuilder'; @@ -437,6 +436,7 @@ export class QuickwitDataSource private makeLogContextDataRequest = (row: LogRowModel, options?: LogRowContextOptions) => { const direction = options?.direction || LogRowContextQueryDirection.Backward; + const logQuery: Logs = { type: 'logs', id: '1', @@ -445,7 +445,7 @@ export class QuickwitDataSource // Sorting of results in the context query sortDirection: direction === LogRowContextQueryDirection.Backward ? 'desc' : 'asc', // Used to get the next log lines before/after the current log line using sort field of selected log line - searchAfter: row.dataFrame.fields.find((f) => f.name === 'sort')?.values[row.rowIndex] ?? [row.timeEpochMs], + searchAfter: row.dataFrame.fields.find((f) => f.name === 'sort')?.values.get(row.rowIndex) ?? [row.timeEpochMs], }, }; @@ -501,7 +501,7 @@ export class QuickwitDataSource } getLogRowContextUi?(row: LogRowModel, runContextQuery?: (() => void) | undefined): ReactNode { - throw new Error('Method not implemented.'); + return true; } /**