11import { DataSourcePluginOptionsEditorProps , SelectableValue } from '@grafana/data' ;
2- import { FieldSet , InlineField , LegacyForms , Select } from '@grafana/ui' ;
2+ /* Select is deprecated, but Combobox is still alpha, so no changes for now */
3+ import { FieldSet , InlineField , Input , SecretInput , Select } from '@grafana/ui' ;
34import { EditionFamilyLabel } from 'edition' ;
45import React , { ChangeEvent , useCallback } from 'react' ;
56
67import { Settings } from '../settings' ;
78import { DataSourceOptions , Edition , SecureJsonData } from '../types' ;
89
9- const { SecretFormField, FormField } = LegacyForms ;
10-
1110// eslint-disable-next-line @typescript-eslint/no-empty-interface
1211interface Props extends DataSourcePluginOptionsEditorProps < DataSourceOptions , SecureJsonData > { }
1312
@@ -96,19 +95,23 @@ export const ConfigEditor = (props: Props) => {
9695 < >
9796 < FieldSet label = "Monitoring Site" >
9897 < div className = "gf-form" >
99- < FormField
98+ < InlineField
10099 label = "URL"
101- labelWidth = { 6 }
102- inputWidth = { 20 }
103- onChange = { onUrlChange }
104- value = { settings . url || '' }
100+ labelWidth = { 12 }
105101 tooltip = "Which Checkmk Server to connect to. (Example: https://checkmk.server/site)"
106- data-test-id = "checkmk-url"
107- />
102+ >
103+ < Input
104+ label = "URL"
105+ width = { 40 }
106+ onChange = { onUrlChange }
107+ value = { settings . url || '' }
108+ data-test-id = "checkmk-url"
109+ />
110+ </ InlineField >
108111 </ div >
109112 < InlineField label = "Edition" labelWidth = { 12 } >
110113 < Select
111- width = { 32 }
114+ width = { 40 }
112115 options = { cmkEditions }
113116 onChange = { onEditionChange }
114117 value = { settings . edition }
@@ -120,29 +123,37 @@ export const ConfigEditor = (props: Props) => {
120123 </ FieldSet >
121124 < FieldSet label = "Authentication" >
122125 < div className = "gf-form" >
123- < FormField
126+ < InlineField
124127 label = "Username"
125- labelWidth = { 6 }
126- inputWidth = { 20 }
127- onChange = { onUsernameChange }
128- value = { settings . username }
128+ labelWidth = { 12 }
129129 tooltip = "A checkmk monitoring user. Don't use 'automation' user, because it has admin rights."
130- data-test-id = "checkmk-username"
131- />
130+ >
131+ < Input
132+ label = "Username"
133+ width = { 40 }
134+ onChange = { onUsernameChange }
135+ value = { settings . username }
136+ data-test-id = "checkmk-username"
137+ />
138+ </ InlineField >
132139 </ div >
133140 < div className = "gf-form" >
134- < SecretFormField
135- isConfigured = { ( secureJsonFields && secureJsonFields . secret ) as boolean }
136- value = { secureJsonData . secret || '' }
141+ < InlineField
137142 label = "Secret"
138- placeholder = ""
139- labelWidth = { 6 }
140- inputWidth = { 20 }
141- onReset = { onResetSecret }
142- onChange = { onSecretChange }
143+ labelWidth = { 12 }
143144 tooltip = "You can find the secret for your user in your checkmk server under Users."
144- data-test-id = "checkmk-password"
145- />
145+ >
146+ < SecretInput
147+ isConfigured = { ( secureJsonFields && secureJsonFields . secret ) as boolean }
148+ value = { secureJsonData . secret || '' }
149+ label = "Secret"
150+ placeholder = ""
151+ width = { 40 }
152+ onReset = { onResetSecret }
153+ onChange = { onSecretChange }
154+ data-test-id = "checkmk-password"
155+ />
156+ </ InlineField >
146157 </ div >
147158 </ FieldSet >
148159 </ >
0 commit comments