Skip to content

Commit

Permalink
[Fleet]: Add row button is available instead of Add another URL u…
Browse files Browse the repository at this point in the history
…nder Edit Fleet Server flyout. (elastic#148164)

Add row button is available instead of Add another URL under Edit Fleet
Server flyout.

Resolves elastic#146769

### Before & After

![image](https://user-images.githubusercontent.com/50892465/211575153-b9b3e142-e03c-4c75-b8d0-64905e08b257.png)

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
2 people authored and jennypavlova committed Jan 13, 2023
1 parent ed27c97 commit 77d0e67
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export const AddFleetServerHostStepContent = ({
defaultMessage: 'Specify host URL',
}
)}
isUrl
/>
{error && <EuiFormErrorText>{error}</EuiFormErrorText>}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ const GettingStartedStepContent: React.FunctionComponent<QuickStartCreateForm> =
defaultMessage: 'Specify host URL',
}
)}
isUrl
/>
{status === 'error' && <EuiFormErrorText>{error}</EuiFormErrorText>}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ export const EditOutputFlyout: React.FunctionComponent<EditOutputFlyoutProps> =
}
)}
{...inputs.elasticsearchUrlInput.props}
isUrl
/>
)}
{isLogstashOutput && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export const FleetServerHostsFlyout: React.FunctionComponent<FleetServerHostsFly
defaultMessage: 'Specify host URL',
}
)}
isUrl
/>
</>
</EuiFormRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,27 @@ HostsInputDisabled.argTypes = {
control: { type: 'object' },
},
};

export const HostsInputUrl = () => {
const [value, setValue] = useState<string[]>([]);
return (
<div style={{ maxWidth: '350px' }}>
<Component
id="test-host-input"
helpText={'Host input help text'}
value={value}
onChange={setValue}
label={'Host input label'}
disabled={false}
isUrl={true}
/>
</div>
);
};

HostsInputUrl.args = { value: ['https://test1.com', 'https://test2.com', 'https://test3.com'] };
HostsInputUrl.argTypes = {
value: {
control: { type: 'object' },
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface MultiRowInputProps {
placeholder?: string;
multiline?: boolean;
sortable?: boolean;
isUrl?: boolean;
}

interface SortableTextFieldProps {
Expand Down Expand Up @@ -256,6 +257,7 @@ export const MultiRowInput: FunctionComponent<MultiRowInputProps> = ({
placeholder,
multiline = false,
sortable = true,
isUrl,
}) => {
const [autoFocus, setAutoFocus] = useState(false);
const value = useMemo(() => {
Expand Down Expand Up @@ -380,7 +382,14 @@ export const MultiRowInput: FunctionComponent<MultiRowInputProps> = ({
iconType="plusInCircle"
onClick={addRowHandler}
>
<FormattedMessage id="xpack.fleet.multiRowInput.addRow" defaultMessage="Add row" />
{isUrl ? (
<FormattedMessage
id="xpack.fleet.multiRowInput.addAnotherUrl"
defaultMessage="Add another URL"
/>
) : (
<FormattedMessage id="xpack.fleet.multiRowInput.addRow" defaultMessage="Add row" />
)}
</EuiButtonEmpty>
</>
</EuiFormRow>
Expand Down

0 comments on commit 77d0e67

Please sign in to comment.