Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace grafana/experimental with grafana/plugin-ui #305

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"dependencies": {
"@emotion/css": "11.10.6",
"@grafana/data": "10.4.2",
"@grafana/experimental": "1.7.3",
"@grafana/google-sdk": "0.1.2",
"@grafana/plugin-ui": "^0.9.2",
"@grafana/runtime": "10.4.2",
"@grafana/schema": "10.4.2",
"@grafana/ui": "10.4.2",
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConfigEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React from 'react';
import { PROCESSING_LOCATIONS } from '../constants';
import { BigQueryOptions, BigQuerySecureJsonData } from '../types';
import { ConfigurationHelp } from './/ConfigurationHelp';
import { ConfigSection, DataSourceDescription } from '@grafana/experimental';
import { ConfigSection, DataSourceDescription } from '@grafana/plugin-ui';
import { Divider } from './Divider';

export type BigQueryConfigEditorProps = DataSourcePluginOptionsEditorProps<BigQueryOptions, BigQuerySecureJsonData>;
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProjectSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SelectableValue } from '@grafana/data';
import { EditorField } from '@grafana/experimental';
import { EditorField } from '@grafana/plugin-ui';
import { Select, useTheme2 } from '@grafana/ui';
import React, { useEffect } from 'react';
import { css } from '@emotion/css';
Expand Down
2 changes: 1 addition & 1 deletion src/components/QueryEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { QueryEditorProps } from '@grafana/data';
import { EditorMode, Space } from '@grafana/experimental';
import { EditorMode, Space } from '@grafana/plugin-ui';
import { RawEditor } from 'components/query-editor-raw/RawEditor';
import React, { useCallback, useEffect, useState } from 'react';
import { useAsync } from 'react-use';
Expand Down
2 changes: 1 addition & 1 deletion src/components/QueryHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SelectableValue } from '@grafana/data';
import { EditorField, EditorHeader, EditorMode, EditorRow, FlexItem, InlineSelect, Space } from '@grafana/experimental';
import { EditorHeader, EditorMode, EditorRow, FlexItem, InlineSelect, Space, EditorField } from '@grafana/plugin-ui';
import { Button, InlineSwitch, RadioButtonGroup, Tooltip } from '@grafana/ui';
import { BigQueryAPI } from 'api';
import React, { useCallback, useId, useState } from 'react';
Expand Down
2 changes: 1 addition & 1 deletion src/components/query-editor-raw/QueryEditorRaw.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ColumnDefinition, SQLEditor, TableDefinition } from '@grafana/experimental';
import { ColumnDefinition, SQLEditor, TableDefinition } from '@grafana/plugin-ui';
import { TableSchema } from 'api';
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
import { BigQueryQueryNG } from '../../types';
Expand Down
2 changes: 1 addition & 1 deletion src/components/query-editor-raw/bigQueryOperators.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OperatorType } from '@grafana/experimental';
import { OperatorType } from '@grafana/plugin-ui';

export const BQ_OPERATORS = [
{ type: OperatorType.Comparison, id: 'LESS_THAN', operator: '<', description: 'Returns TRUE if X is less than Y.' },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SQLEditorTestUtils } from '@grafana/experimental';
import { SQLEditorTestUtils } from '@grafana/plugin-ui';
import { CustomStatementPlacement, customStatementPlacement, getTablePath } from './bigqueryCompletionProvider';
import { simpleBigQueryQuery } from './testData/simpleBigQueryQuery';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
TableDefinition,
TableIdentifier,
TokenType,
} from '@grafana/experimental';
} from '@grafana/plugin-ui';
import { PartitioningType, TableSchema } from 'api';
import { BQ_AGGREGATE_FNS } from './bigQueryFunctions';
import { BQ_OPERATORS } from './bigQueryOperators';
Expand Down
2 changes: 1 addition & 1 deletion src/components/query-editor-raw/macros.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MacroType } from '@grafana/experimental';
import { MacroType } from '@grafana/plugin-ui';

export const MACROS = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TestQueryModel } from '@grafana/experimental';
import { TestQueryModel } from '@grafana/plugin-ui';

export const simpleBigQueryQuery: TestQueryModel = {
query: 'SELECT block_id FROM raintank-dev.bitcoin_blockchain.blocks LIMIT 10;',
Expand Down
2 changes: 1 addition & 1 deletion src/components/visual-query-builder/SQLGroupByRow.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SelectableValue } from '@grafana/data';
import { AccessoryButton, EditorList, InputGroup } from '@grafana/experimental';
import { AccessoryButton, EditorList, InputGroup } from '@grafana/plugin-ui';
import { Select } from '@grafana/ui';
import { QueryEditorExpressionType, QueryEditorGroupByExpression } from 'expressions';
import React, { useCallback } from 'react';
Expand Down
2 changes: 1 addition & 1 deletion src/components/visual-query-builder/SQLOrderByRow.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SelectableValue } from '@grafana/data';
import { EditorField, InputGroup, Space } from '@grafana/experimental';
import { InputGroup, Space, EditorField } from '@grafana/plugin-ui';
import { Select, Input, RadioButtonGroup } from '@grafana/ui';
import { uniqueId } from 'lodash';
import React, { useCallback } from 'react';
Expand Down
6 changes: 3 additions & 3 deletions src/components/visual-query-builder/SQLSelectRow.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { css } from '@emotion/css';
import { SelectableValue } from '@grafana/data';
import { EditorField, Stack } from '@grafana/experimental';
import { useStyles2, Select, Button } from '@grafana/ui';
import { EditorField } from '@grafana/plugin-ui';
import { useStyles2, Select, Button, Stack } from '@grafana/ui';
import { QueryEditorExpressionType, QueryEditorFunctionExpression } from 'expressions';
import { uniqueId } from 'lodash';
import React, { useCallback } from 'react';
Expand Down Expand Up @@ -78,7 +78,7 @@ export function SQLSelectRow({ sql, columns, onSqlChange }: SQLSelectRowProps) {
}, [onSqlChange, sql]);

return (
<Stack gap={2} alignItems="end" wrap direction="column">
<Stack gap={2} alignItems="end" wrap="wrap" direction="column">
{sql.columns?.map((item, index) => (
<div key={index}>
<Stack gap={2} alignItems="end">
Expand Down
2 changes: 1 addition & 1 deletion src/components/visual-query-builder/VisualEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BQWhereRow } from './BQWhereRow';
import { Preview } from './Preview';
import { BQGroupByRow } from './BQGroupByRow';
import { QueryToolbox } from 'components/query-editor-raw/QueryToolbox';
import { EditorRows, EditorRow, EditorField } from '@grafana/experimental';
import { EditorRows, EditorRow, EditorField } from '@grafana/plugin-ui';

interface VisualEditorProps extends QueryEditorProps {
queryRowFilter: QueryRowFilter;
Expand Down
2 changes: 1 addition & 1 deletion src/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ScopedVars,
VariableSupportType,
} from '@grafana/data';
import { EditorMode } from '@grafana/experimental';
import { EditorMode } from '@grafana/plugin-ui';
import { GoogleAuthType } from '@grafana/google-sdk';
import { DataSourceWithBackend, getTemplateSrv } from '@grafana/runtime';
import { getApiClient } from 'api';
Expand Down Expand Up @@ -46,7 +46,7 @@
return true;
}

async importQueries(queries: DataQuery[]) {

Check warning on line 49 in src/datasource.ts

View workflow job for this annotation

GitHub Actions / Build, lint and unit tests

'DataQuery' is deprecated. use the type from
const importedQueries = [];

for (let i = 0; i < queries.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DataQuery, TimeRange } from '@grafana/data';
import { EditorMode } from '@grafana/experimental';
import { EditorMode } from '@grafana/plugin-ui';
import { DataSourceOptions, DataSourceSecureJsonData } from '@grafana/google-sdk';
import { JsonTree } from '@react-awesome-query-builder/ui';
import { BigQueryAPI } from 'api';
Expand Down Expand Up @@ -43,7 +43,7 @@
Table = 1,
}

export interface QueryModel extends DataQuery {

Check warning on line 46 in src/types.ts

View workflow job for this annotation

GitHub Actions / Build, lint and unit tests

'DataQuery' is deprecated. use the type from
rawSql: string;
format: QueryFormat;
connectionArgs: {
Expand Down Expand Up @@ -72,7 +72,7 @@
className?: string;
applyDefault?: boolean;
}
export interface BigQueryQueryNG extends DataQuery {

Check warning on line 75 in src/types.ts

View workflow job for this annotation

GitHub Actions / Build, lint and unit tests

'DataQuery' is deprecated. use the type from
dataset?: string;
table?: string;
project?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EditorMode } from '@grafana/experimental';
import { EditorMode } from '@grafana/plugin-ui';
import { QueryFormat } from 'types';
import { applyQueryDefaults, extractFromClause, findTimeField, formatBigqueryError, getShiftPeriod } from 'utils';

Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// SOFTWARE.

import { DataQueryRequest, dateTime, DurationUnit } from '@grafana/data';
import { EditorMode } from '@grafana/experimental';
import { EditorMode } from '@grafana/plugin-ui';
import { BigQueryAPI } from 'api';
import { BigQueryDatasource } from 'datasource';
import SqlParser from 'sql_parser';
Expand Down Expand Up @@ -50,7 +50,7 @@

export function getShiftPeriod(strInterval: string): [DurationUnit, string] {
const shift = strInterval.match(/\d+/)![0];
strInterval = strInterval.substr(shift.length, strInterval.length);

Check warning on line 53 in src/utils.ts

View workflow job for this annotation

GitHub Actions / Build, lint and unit tests

'substr' is deprecated. A legacy feature for browser compatibility

if (strInterval.trim() === 'min') {
strInterval = 'm';
Expand Down Expand Up @@ -156,11 +156,11 @@
if (q.indexOf('AND _PARTITIONTIME <') < 1) {
return q;
}
const from = q.substr(q.indexOf('AND _PARTITIONTIME >= ') + 22, 21);

Check warning on line 159 in src/utils.ts

View workflow job for this annotation

GitHub Actions / Build, lint and unit tests

'substr' is deprecated. A legacy feature for browser compatibility

const newFrom = "'" + formatDateToString(options.range.from.toDate(), '-', true) + "'";
q = q.replace(from, newFrom);
const to = q.substr(q.indexOf('AND _PARTITIONTIME < ') + 21, 21);

Check warning on line 163 in src/utils.ts

View workflow job for this annotation

GitHub Actions / Build, lint and unit tests

'substr' is deprecated. A legacy feature for browser compatibility
const newTo = "'" + formatDateToString(options.range.to.toDate(), '-', true) + "'";

q = q.replace(to, newTo) + '\n ';
Expand All @@ -172,11 +172,11 @@
if (ind < 1) {
return q;
}
const from = q.substr(ind + 28, 8);

Check warning on line 175 in src/utils.ts

View workflow job for this annotation

GitHub Actions / Build, lint and unit tests

'substr' is deprecated. A legacy feature for browser compatibility

const newFrom = formatDateToString(options.range.from.toDate());
q = q.replace(from, newFrom);
const to = q.substr(ind + 43, 8);

Check warning on line 179 in src/utils.ts

View workflow job for this annotation

GitHub Actions / Build, lint and unit tests

'substr' is deprecated. A legacy feature for browser compatibility
const newTo = formatDateToString(options.range.to.toDate());
q = q.replace(to, newTo) + '\n ';
return q;
Expand Down Expand Up @@ -215,7 +215,7 @@
// create the format you want
let dateStr = YYYY + separator + MM + separator + DD;
if (addTime === true) {
dateStr += ' ' + date.toTimeString().substr(0, 8);

Check warning on line 218 in src/utils.ts

View workflow job for this annotation

GitHub Actions / Build, lint and unit tests

'substr' is deprecated. A legacy feature for browser compatibility
}
return dateStr;
}
Expand Down
Loading
Loading