e2e: add tests for translations (#114390)

e2e: add tests for translations
This commit is contained in:
Hugo Häggmark
2025-12-08 10:19:44 +01:00
committed by GitHub
parent 8bf3ac9710
commit 3490c3b0fd
46 changed files with 678 additions and 20 deletions
@@ -1,6 +1,7 @@
import { ChangeEvent } from 'react';
import { Checkbox, InlineField, InlineSwitch, Input, SecretInput, Select } from '@grafana/ui';
import { DataSourcePluginOptionsEditorProps, SelectableValue, toOption } from '@grafana/data';
import { t } from '@grafana/i18n';
import { MyDataSourceOptions, MySecureJsonData } from '../types';
interface Props extends DataSourcePluginOptionsEditorProps<MyDataSourceOptions, MySecureJsonData> {}
@@ -45,36 +46,46 @@ export function ConfigEditor(props: Props) {
return (
<>
<InlineField label="Path" labelWidth={14} interactive tooltip={'Json field returned to frontend'}>
<InlineField
label={t('config-editor.path.label', 'Path')}
labelWidth={14}
interactive
tooltip={t('config-editor.path.tooltip', 'Json field returned to frontend')}
>
<Input
id="config-editor-path"
onChange={(e: ChangeEvent<HTMLInputElement>) => onJsonDataChange('path', e.target.value)}
value={jsonData.path}
placeholder="Enter the path, e.g. /api/v1"
placeholder={t('config-editor.path.placeholder', 'Enter the path, e.g. /api/v1')}
width={40}
/>
</InlineField>
<InlineField label="API Key" labelWidth={14} interactive tooltip={'Secure json field (backend only)'}>
<InlineField
label={t('config-editor.api-key.label', 'API Key')}
labelWidth={14}
interactive
tooltip={t('config-editor.api-key.tooltip', 'Secure json field (backend only)')}
>
<SecretInput
required
id="config-editor-api-key"
isConfigured={secureJsonFields.apiKey}
value={secureJsonData?.apiKey}
placeholder="Enter your API key"
placeholder={t('config-editor.api-key.placeholder', 'Enter your API key')}
width={40}
onReset={onResetAPIKey}
onChange={(e: ChangeEvent<HTMLInputElement>) => onSecureJsonDataChange('path', e.target.value)}
/>
</InlineField>
<InlineField label="Switch Enabled">
<InlineField label={t('config-editor.switch-enabled.label', 'Switch Enabled')}>
<InlineSwitch
width={40}
label="Switch Enabled"
label={t('config-editor.switch-enabled.label', 'Switch Enabled')}
value={jsonData.switchEnabled ?? false}
onChange={(e: ChangeEvent<HTMLInputElement>) => onJsonDataChange('switchEnabled', e.target.checked)}
/>
</InlineField>
<InlineField label="Checkbox Enabled">
<InlineField label={t('config-editor.checkbox-enabled.label', 'Checkbox Enabled')}>
<Checkbox
width={40}
id="config-checkbox-enabled"
@@ -82,7 +93,7 @@ export function ConfigEditor(props: Props) {
onChange={(e: ChangeEvent<HTMLInputElement>) => onJsonDataChange('checkboxEnabled', e.target.checked)}
/>
</InlineField>
<InlineField label="Auth type">
<InlineField label={t('config-editor.auth-type.label', 'Auth type')}>
<Select
width={40}
inputId="config-auth-type"