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

[Ingest Manager] Remove default namespace toggle #66298

Merged
merged 4 commits into from
Jun 3, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand All @@ -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;
Expand Down Expand Up @@ -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={
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "このオプションを有効にすると、システムメトリックと情報を収集するデータソースで構成をブートストラップできます。",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -8120,7 +8120,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": "启用此选项可使用收集系统指标和信息的数据源启动您的配置。",
Expand Down