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

Migrate ConfigEditor and QueryEditor to the new form styling #211

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
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
@@ -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
@@ -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">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious if this div is still necessary with the new components

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, since the new components adjust to the width of the container which we have to define at the top here. I don't think we have a fixed width requirement for our datasources (as long as it's not more that 578px, but that looks way too wide)

<ConnectionConfig {...props} standardRegions={standardRegions} newFormStylingEnabled={newFormStylingEnabled} />
</div>
);
}
18 changes: 16 additions & 2 deletions src/components/QueryEditor/AccountIdDropdown.tsx
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