minor: improve the custom property table in settings page (#16937)

* minor: improve the custom property table in settings page

* chore: adjust width of actions column in CustomPropertyTable

* test: update cypress test
This commit is contained in:
Sachin Chaurasiya 2024-07-05 21:16:30 +05:30 committed by GitHub
parent 74573ee4fa
commit 57785c08bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 3 deletions

View File

@ -389,6 +389,8 @@ export const addCustomPropertiesForEntity = ({
formatConfig?: string;
entityReferenceConfig?: string[];
}) => {
// eslint-disable-next-line max-len
const longDescription = `Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolore neque fuga reprehenderit placeat, sint doloremque quo expedita consequatur fugiat maxime maiores voluptate eum quis quas dignissimos cumque perspiciatis optio dolorem blanditiis iure natus commodi dolor quam. Voluptatem excepturi aut, at ullam aliquid repudiandae distinctio ipsam voluptates tenetur a. Sit, illum.`;
// Add Custom property for selected entity
cy.get('[data-testid="add-field-button"]').click();
@ -473,7 +475,9 @@ export const addCustomPropertiesForEntity = ({
cy.get('#root\\/formatConfig').clear().type(formatConfig);
}
cy.get(descriptionBox).clear().type(customPropertyData.description);
cy.get(descriptionBox)
.clear()
.type(`${customPropertyData.description} ${longDescription}`);
// Check if the property got added
cy.intercept('/api/v1/metadata/types/name/*?fields=customProperties').as(

View File

@ -19,6 +19,7 @@ import { ReactComponent as IconEdit } from '../../../assets/svg/edit-new.svg';
import { ReactComponent as IconDelete } from '../../../assets/svg/ic-delete.svg';
import { ADD_CUSTOM_PROPERTIES_DOCS } from '../../../constants/docs.constants';
import { NO_PERMISSION_FOR_ACTION } from '../../../constants/HelperTextUtil';
import { TABLE_SCROLL_VALUE } from '../../../constants/Table.constants';
import { ERROR_PLACEHOLDER_TYPE, OPERATION } from '../../../enums/common.enum';
import { CustomProperty } from '../../../generated/type/customProperty';
import { columnSorter, getEntityName } from '../../../utils/EntityUtils';
@ -140,7 +141,9 @@ export const CustomPropertyTable: FC<CustomPropertyTableProp> = ({
// If config is an object, then it is a enum config
if (!isString(config) && !isArray(config)) {
return (
<Space data-testid="enum-config" direction="vertical" size={4}>
<div
className="w-full d-flex gap-2 flex-column"
data-testid="enum-config">
<Typography.Text>
{JSON.stringify(config?.values ?? [])}
</Typography.Text>
@ -148,7 +151,7 @@ export const CustomPropertyTable: FC<CustomPropertyTableProp> = ({
{t('label.multi-select')}:{' '}
{config?.multiSelect ? t('label.yes') : t('label.no')}
</Typography.Text>
</Space>
</div>
);
}
@ -160,6 +163,7 @@ export const CustomPropertyTable: FC<CustomPropertyTableProp> = ({
title: t('label.description'),
dataIndex: 'description',
key: 'description',
width: 300,
render: (text) =>
text ? (
<RichTextEditorPreviewer markdown={text || ''} />
@ -175,6 +179,8 @@ export const CustomPropertyTable: FC<CustomPropertyTableProp> = ({
title: t('label.action-plural'),
dataIndex: 'actions',
key: 'actions',
width: 80,
fixed: 'right',
render: (_, record) => (
<Space align="center" size={14}>
<Tooltip
@ -247,6 +253,7 @@ export const CustomPropertyTable: FC<CustomPropertyTableProp> = ({
}}
pagination={false}
rowKey="name"
scroll={TABLE_SCROLL_VALUE}
size="small"
/>
<ConfirmationModal