-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathConfigEditor.tsx
35 lines (28 loc) · 1.06 KB
/
ConfigEditor.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import React, { PureComponent, ChangeEvent } from 'react';
import { DataSourcePluginOptionsEditorProps, DataSourceSettings, FormField } from '@grafana/ui';
import { MyDataSourceOptions } from './types';
type Settings = DataSourceSettings<MyDataSourceOptions>;
interface Props extends DataSourcePluginOptionsEditorProps<Settings> {}
interface State {}
export class ConfigEditor extends PureComponent<Props, State> {
componentDidMount() {}
onURLChange = (event: ChangeEvent<HTMLInputElement>) => {
const { onOptionsChange, options } = this.props;
// const jsonData = {
// ...options.jsonData,
// apiKey: event.target.value,
// };
onOptionsChange({ ...options, url: event.target.value, access: 'direct' });
};
render() {
const { options } = this.props;
const url = options.url || '';
return (
<div className="gf-form-group">
<div className="gf-form">
<FormField label="Web Socket URL" labelWidth={10} onChange={this.onURLChange} value={url} placeholder="Websocket URL" />
</div>
</div>
);
}
}