Skip to content

Commit

Permalink
Migrate ConfigEditor and QueryEditor to the new form styling (#211)
Browse files Browse the repository at this point in the history
* Migrate query editor and config editor
* Prepare 2.8.0
  • Loading branch information
idastambuk authored Oct 31, 2023
1 parent f047b44 commit 0a0ba70
Show file tree
Hide file tree
Showing 14 changed files with 838 additions and 382 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

All notable changes to this project will be documented in this file.

## 2.8.0

- Migrate ConfigEditor and QueryEditor to the new form styling [#211](https://github.com/grafana/x-ray-datasource/pull/211)

- Bump google.golang.org/grpc from 1.54.0 to 1.56.3 in [#210](https://github.com/grafana/x-ray-datasource/pull/210)

- Support Node 18 in [201](https://github.com/grafana/x-ray-datasource/pull/201)

## 2.7.2

- Fix X-Ray Service Map filter trace list query by @jamesrwhite in https://github.com/grafana/x-ray-datasource/pull/203
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "grafana-x-ray-datasource",
"version": "2.7.2",
"version": "2.8.0",
"description": "AWS X-Ray data source",
"scripts": {
"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",
Expand All @@ -22,7 +22,7 @@
"devDependencies": {
"@babel/core": "^7.16.7",
"@emotion/css": "^11.1.3",
"@grafana/aws-sdk": "0.1.2",
"@grafana/aws-sdk": "0.3.0",
"@grafana/data": "9.3.2",
"@grafana/e2e": "9.3.2",
"@grafana/e2e-selectors": "9.3.2",
Expand Down Expand Up @@ -76,6 +76,7 @@
"webpack-livereload-plugin": "^3.0.2"
},
"dependencies": {
"@grafana/experimental": "1.7.3",
"react-use": "^15.3.4",
"tslib": "^2.2.0"
}
Expand Down
20 changes: 10 additions & 10 deletions src/components/ConfigEditor/ConfigEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData, ConnectionConfig } from '@grafana/aws-sdk';
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
import React, { PureComponent } from 'react';
import React from 'react';
import { standardRegions } from './regions';
import { config } from '@grafana/runtime';

export type Props = DataSourcePluginOptionsEditorProps<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData>;

export class ConfigEditor extends PureComponent<Props> {
render() {
return (
<div>
<ConnectionConfig {...this.props} standardRegions={standardRegions} />
{/* can add x-ray specific things here */}
</div>
);
}
export function ConfigEditor(props: Props) {
const newFormStylingEnabled = config.featureToggles.awsDatasourcesNewFormStyling;

return (
<div className="width-30">
<ConnectionConfig {...props} standardRegions={standardRegions} newFormStylingEnabled={newFormStylingEnabled} />
</div>
);
}
18 changes: 16 additions & 2 deletions src/components/QueryEditor/AccountIdDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { TimeRange } from '@grafana/data';
import { config } from '@grafana/runtime';
import React from 'react';
import { InlineFormLabel, MultiSelect } from '@grafana/ui';

import { EditorField } from '@grafana/experimental';
type Props = {
datasource: XrayDataSource;
query: XrayQuery;
newFormStylingEnabled?: boolean;
range?: TimeRange;
onChange: (items: string[]) => void;
};
Expand All @@ -22,7 +23,20 @@ export const AccountIdDropdown = (props: Props) => {
return null;
}

return (
return props.newFormStylingEnabled ? (
<EditorField label="AccountId" className="query-keyword" htmlFor="accountId">
<MultiSelect
id="accountId"
options={(accountIds || []).map((accountId: string) => ({
value: accountId,
label: accountId,
}))}
value={props.query.accountIds}
onChange={(items) => props.onChange(items.map((item) => item.value || ''))}
placeholder={'All'}
/>
</EditorField>
) : (
<div className="gf-form">
<InlineFormLabel className="query-keyword" width="auto">
AccountId
Expand Down
Loading

0 comments on commit 0a0ba70

Please sign in to comment.