mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[ML] Improves display for long descriptions in transforms (#165149)
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 https://github.com/elastic/kibana/issues/163147
This commit is contained in:
parent
d797846108
commit
788dae973a
6 changed files with 90 additions and 7 deletions
|
@ -22,6 +22,7 @@ import {
|
|||
EuiSpacer,
|
||||
EuiCallOut,
|
||||
EuiText,
|
||||
EuiTextArea,
|
||||
} from '@elastic/eui';
|
||||
|
||||
import { KBN_FIELD_TYPES } from '@kbn/field-types';
|
||||
|
@ -421,7 +422,7 @@ export const StepDetailsForm: FC<StepDetailsFormProps> = React.memo(
|
|||
defaultMessage: 'Transform description',
|
||||
})}
|
||||
>
|
||||
<EuiFieldText
|
||||
<EuiTextArea
|
||||
placeholder={i18n.translate(
|
||||
'xpack.transform.stepDetailsForm.transformDescriptionPlaceholderText',
|
||||
{ defaultMessage: 'Description (optional)' }
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -12,12 +12,13 @@ import { EuiAccordion, EuiForm, EuiSpacer } from '@elastic/eui';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { EditTransformFlyoutFormTextInput } from './edit_transform_flyout_form_text_input';
|
||||
import { EditTransformFlyoutFormTextArea } from './edit_transform_flyout_form_text_area';
|
||||
import { EditTransformRetentionPolicy } from './edit_transform_retention_policy';
|
||||
import { EditTransformIngestPipeline } from './edit_transform_ingest_pipeline';
|
||||
|
||||
export const EditTransformFlyoutForm: FC = () => (
|
||||
<EuiForm>
|
||||
<EditTransformFlyoutFormTextInput
|
||||
<EditTransformFlyoutFormTextArea
|
||||
field="description"
|
||||
label={i18n.translate('xpack.transform.transformList.editFlyoutFormDescriptionLabel', {
|
||||
defaultMessage: 'Description',
|
||||
|
|
|
@ -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>
|
||||
);
|
||||
};
|
|
@ -15,10 +15,7 @@ import {
|
|||
useEditTransformFlyout,
|
||||
type EditTransformHookTextInputSelectors,
|
||||
} from './use_edit_transform_flyout';
|
||||
|
||||
function capitalizeFirstLetter(str: string) {
|
||||
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||
}
|
||||
import { capitalizeFirstLetter } from './capitalize_first_letter';
|
||||
|
||||
interface EditTransformFlyoutFormTextInputProps {
|
||||
field: EditTransformHookTextInputSelectors;
|
||||
|
|
|
@ -222,7 +222,20 @@ export const useColumns = (
|
|||
'data-test-subj': 'transformListColumnDescription',
|
||||
name: i18n.translate('xpack.transform.description', { defaultMessage: 'Description' }),
|
||||
sortable: true,
|
||||
truncateText: true,
|
||||
render(text: string) {
|
||||
return (
|
||||
<EuiText
|
||||
style={{
|
||||
display: '-webkit-box',
|
||||
WebkitBoxOrient: 'vertical',
|
||||
WebkitLineClamp: 3,
|
||||
overflow: 'hidden',
|
||||
}}
|
||||
>
|
||||
{text}
|
||||
</EuiText>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: i18n.translate('xpack.transform.type', { defaultMessage: 'Type' }),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue