forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Improves display for long descriptions in transforms (elastic#16…
…5149) Improves the display of long descriptions of transforms in the Transform management page and when editing the description in the transform wizard or edit flyout. Previously If there was a long description, the text would not be wrapped in the table on the management page, and it would not be possible to view the full text in the text input when editing. This PR adds line wrapping for the description column, and uses a text area for editing the text. Part of elastic#163147
- Loading branch information
Showing
6 changed files
with
90 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...sections/transform_management/components/edit_transform_flyout/capitalize_first_letter.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export function capitalizeFirstLetter(str: string) { | ||
return str.charAt(0).toUpperCase() + str.slice(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...form_management/components/edit_transform_flyout/edit_transform_flyout_form_text_area.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React, { FC } from 'react'; | ||
|
||
import { EuiFormRow, EuiTextArea } from '@elastic/eui'; | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
import { | ||
useEditTransformFlyout, | ||
type EditTransformHookTextInputSelectors, | ||
} from './use_edit_transform_flyout'; | ||
import { capitalizeFirstLetter } from './capitalize_first_letter'; | ||
|
||
interface EditTransformFlyoutFormTextInputProps { | ||
field: EditTransformHookTextInputSelectors; | ||
label: string; | ||
helpText?: string; | ||
placeHolder?: boolean; | ||
} | ||
|
||
export const EditTransformFlyoutFormTextArea: FC<EditTransformFlyoutFormTextInputProps> = ({ | ||
field, | ||
label, | ||
helpText, | ||
placeHolder = false, | ||
}) => { | ||
const { defaultValue, errorMessages, value } = useEditTransformFlyout(field); | ||
const { formField } = useEditTransformFlyout('actions'); | ||
const upperCaseField = capitalizeFirstLetter(field); | ||
|
||
return ( | ||
<EuiFormRow | ||
label={label} | ||
helpText={helpText} | ||
isInvalid={errorMessages.length > 0} | ||
error={errorMessages} | ||
> | ||
<EuiTextArea | ||
data-test-subj={`transformEditFlyout${upperCaseField}Input`} | ||
placeholder={ | ||
placeHolder | ||
? i18n.translate('xpack.transform.transformList.editFlyoutFormPlaceholderText', { | ||
defaultMessage: 'Default: {defaultValue}', | ||
values: { defaultValue }, | ||
}) | ||
: undefined | ||
} | ||
isInvalid={errorMessages.length > 0} | ||
value={value} | ||
onChange={(e) => formField({ field, value: e.target.value })} | ||
aria-label={label} | ||
/> | ||
</EuiFormRow> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters