[Ingest Manager] Remove default namespace toggle (#66298)
* Remove default namespace toggle * Fix i18n * Add namespace validation Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
43c5466801
commit
168e0e25ba
3 changed files with 31 additions and 46 deletions
|
@ -50,6 +50,15 @@ export const agentConfigFormValidation = (
|
|||
];
|
||||
}
|
||||
|
||||
if (!agentConfig.namespace?.trim()) {
|
||||
errors.namespace = [
|
||||
<FormattedMessage
|
||||
id="xpack.ingestManager.agentConfigForm.namespaceRequiredErrorMessage"
|
||||
defaultMessage="A namespace is required"
|
||||
/>,
|
||||
];
|
||||
}
|
||||
|
||||
return errors;
|
||||
};
|
||||
|
||||
|
@ -73,7 +82,6 @@ export const AgentConfigForm: React.FunctionComponent<Props> = ({
|
|||
onDelete = () => {},
|
||||
}) => {
|
||||
const [touchedFields, setTouchedFields] = useState<{ [key: string]: boolean }>({});
|
||||
const [showNamespace, setShowNamespace] = useState<boolean>(!!agentConfig.namespace);
|
||||
const fields: Array<{
|
||||
name: 'name' | 'description' | 'namespace';
|
||||
label: JSX.Element;
|
||||
|
@ -170,49 +178,28 @@ export const AgentConfigForm: React.FunctionComponent<Props> = ({
|
|||
/>
|
||||
}
|
||||
>
|
||||
<EuiSwitch
|
||||
showLabel={true}
|
||||
label={
|
||||
<FormattedMessage
|
||||
id="xpack.ingestManager.agentConfigForm.namespaceUseDefaultsFieldLabel"
|
||||
defaultMessage="Use default namespace"
|
||||
/>
|
||||
}
|
||||
checked={showNamespace}
|
||||
onChange={() => {
|
||||
setShowNamespace(!showNamespace);
|
||||
if (showNamespace) {
|
||||
updateAgentConfig({ namespace: '' });
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{showNamespace && (
|
||||
<>
|
||||
<EuiSpacer size="m" />
|
||||
<EuiFormRow
|
||||
fullWidth
|
||||
error={touchedFields.namespace && validation.namespace ? validation.namespace : null}
|
||||
isInvalid={Boolean(touchedFields.namespace && validation.namespace)}
|
||||
>
|
||||
<EuiComboBox
|
||||
fullWidth
|
||||
singleSelection
|
||||
noSuggestions
|
||||
selectedOptions={agentConfig.namespace ? [{ label: agentConfig.namespace }] : []}
|
||||
onCreateOption={(value: string) => {
|
||||
updateAgentConfig({ namespace: value });
|
||||
}}
|
||||
onChange={(selectedOptions) => {
|
||||
updateAgentConfig({
|
||||
namespace: (selectedOptions.length ? selectedOptions[0] : '') as string,
|
||||
});
|
||||
}}
|
||||
isInvalid={Boolean(touchedFields.namespace && validation.namespace)}
|
||||
onBlur={() => setTouchedFields({ ...touchedFields, namespace: true })}
|
||||
/>
|
||||
</EuiFormRow>
|
||||
</>
|
||||
)}
|
||||
<EuiFormRow
|
||||
fullWidth
|
||||
error={touchedFields.namespace && validation.namespace ? validation.namespace : null}
|
||||
isInvalid={Boolean(touchedFields.namespace && validation.namespace)}
|
||||
>
|
||||
<EuiComboBox
|
||||
fullWidth
|
||||
singleSelection
|
||||
noSuggestions
|
||||
selectedOptions={agentConfig.namespace ? [{ label: agentConfig.namespace }] : []}
|
||||
onCreateOption={(value: string) => {
|
||||
updateAgentConfig({ namespace: value });
|
||||
}}
|
||||
onChange={(selectedOptions) => {
|
||||
updateAgentConfig({
|
||||
namespace: (selectedOptions.length ? selectedOptions[0] : '') as string,
|
||||
});
|
||||
}}
|
||||
isInvalid={Boolean(touchedFields.namespace && validation.namespace)}
|
||||
onBlur={() => setTouchedFields({ ...touchedFields, namespace: true })}
|
||||
/>
|
||||
</EuiFormRow>
|
||||
</EuiDescribedFormGroup>
|
||||
<EuiDescribedFormGroup
|
||||
title={
|
||||
|
|
|
@ -8112,7 +8112,6 @@
|
|||
"xpack.ingestManager.agentConfigForm.nameRequiredErrorMessage": "エージェント構成名が必要です",
|
||||
"xpack.ingestManager.agentConfigForm.namespaceFieldDescription": "この構成を使用するデータソースにデフォルトの名前空間を適用します。データソースはその独自の名前空間を指定できます。",
|
||||
"xpack.ingestManager.agentConfigForm.namespaceFieldLabel": "デフォルト名前空間",
|
||||
"xpack.ingestManager.agentConfigForm.namespaceUseDefaultsFieldLabel": "デフォルト名前空間を使用する",
|
||||
"xpack.ingestManager.agentConfigForm.systemMonitoringFieldLabel": "オプション",
|
||||
"xpack.ingestManager.agentConfigForm.systemMonitoringText": "システムメトリックを収集",
|
||||
"xpack.ingestManager.agentConfigForm.systemMonitoringTooltipText": "このオプションを有効にすると、システムメトリックと情報を収集するデータソースで構成をブートストラップできます。",
|
||||
|
|
|
@ -8116,7 +8116,6 @@
|
|||
"xpack.ingestManager.agentConfigForm.nameRequiredErrorMessage": "“代理配置名称”必填",
|
||||
"xpack.ingestManager.agentConfigForm.namespaceFieldDescription": "将默认命名空间应用于使用此配置的数据源。数据源可以指定自己的命名空间。",
|
||||
"xpack.ingestManager.agentConfigForm.namespaceFieldLabel": "默认命名空间",
|
||||
"xpack.ingestManager.agentConfigForm.namespaceUseDefaultsFieldLabel": "使用默认命名空间",
|
||||
"xpack.ingestManager.agentConfigForm.systemMonitoringFieldLabel": "可选",
|
||||
"xpack.ingestManager.agentConfigForm.systemMonitoringText": "收集系统指标",
|
||||
"xpack.ingestManager.agentConfigForm.systemMonitoringTooltipText": "启用此选项可使用收集系统指标和信息的数据源启动您的配置。",
|
||||
|
|
Loading…
Reference in a new issue