Disable updation of mutually exclusive in classification and minor other fixes (#15361)

* fix minor issues of classification and glossary assets

* add mutually exclusive label

* fix cypress
This commit is contained in:
Karan Hotchandani 2024-02-27 17:26:01 +05:30 committed by GitHub
parent d2879ae232
commit da926d1f2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 66 additions and 101 deletions

View File

@ -114,14 +114,6 @@ describe(
'mutuallyExclusiveContainer'
);
cy.get(
'[data-testid="mutually-exclusive-container"] [data-testid="diff-removed"]'
).should('be.visible');
cy.get(
'[data-testid="mutually-exclusive-container"] [data-testid="diff-added"]'
).should('be.visible');
cy.get('[data-testid="version-button"]').click();
cy.get('[data-testid="manage-button"]').click({

View File

@ -11,7 +11,7 @@
* limitations under the License.
*/
import Icon from '@ant-design/icons/lib/components/Icon';
import { Button, Col, Row, Space, Switch, Tooltip, Typography } from 'antd';
import { Button, Col, Row, Space, Tooltip, Typography } from 'antd';
import ButtonGroup from 'antd/lib/button/button-group';
import { ColumnsType } from 'antd/lib/table';
import { AxiosError } from 'axios';
@ -30,7 +30,7 @@ import { useHistory } from 'react-router-dom';
import { ReactComponent as IconTag } from '../../../assets/svg/classification.svg';
import { ReactComponent as LockIcon } from '../../../assets/svg/closed-lock.svg';
import { ReactComponent as VersionIcon } from '../../../assets/svg/ic-version.svg';
import { DE_ACTIVE_COLOR } from '../../../constants/constants';
import { DE_ACTIVE_COLOR, PRIMERY_COLOR } from '../../../constants/constants';
import { EntityField } from '../../../constants/Feeds.constants';
import { usePermissionProvider } from '../../../context/PermissionProvider/PermissionProvider';
import { ResourceEntity } from '../../../context/PermissionProvider/PermissionProvider.interface';
@ -48,10 +48,7 @@ import {
getTagsTableColumn,
} from '../../../utils/ClassificationUtils';
import { getEntityName } from '../../../utils/EntityUtils';
import {
getEntityVersionByField,
getMutuallyExclusiveDiff,
} from '../../../utils/EntityVersionUtils';
import { getEntityVersionByField } from '../../../utils/EntityVersionUtils';
import { checkPermission } from '../../../utils/PermissionsUtils';
import {
getClassificationDetailsPath,
@ -65,7 +62,6 @@ import ManageButton from '../../common/EntityPageInfos/ManageButton/ManageButton
import ErrorPlaceHolder from '../../common/ErrorWithPlaceholder/ErrorPlaceHolder';
import NextPrevious from '../../common/NextPrevious/NextPrevious';
import { NextPreviousProps } from '../../common/NextPrevious/NextPrevious.interface';
import RichTextEditorPreviewer from '../../common/RichTextEditor/RichTextEditorPreviewer';
import Table from '../../common/Table/Table';
import EntityHeaderTitle from '../../Entity/EntityHeaderTitle/EntityHeaderTitle.component';
import { ClassificationDetailsProps } from './ClassificationDetails.interface';
@ -238,18 +234,6 @@ const ClassificationDetails = forwardRef(
isClassificationDisabled,
]);
const handleUpdateMutuallyExclusive = async (value: boolean) => {
if (
!isUndefined(currentClassification) &&
!isUndefined(handleUpdateClassification)
) {
handleUpdateClassification({
...currentClassification,
mutuallyExclusive: value,
});
}
};
const editDescriptionPermission = useMemo(
() =>
!isVersionView &&
@ -388,16 +372,6 @@ const ClassificationDetails = forwardRef(
: currentClassification?.description;
}, [currentClassification, changeDescription]);
const mutuallyExclusive = useMemo(() => {
return isVersionView
? getMutuallyExclusiveDiff(
changeDescription,
EntityField.MUTUALLY_EXCLUSIVE,
toString(currentClassification?.mutuallyExclusive)
)
: '';
}, [currentClassification, changeDescription]);
useEffect(() => {
if (currentClassification?.fullyQualifiedName && !isAddingTag) {
fetchClassificationChildren(currentClassification.fullyQualifiedName);
@ -418,7 +392,19 @@ const ClassificationDetails = forwardRef(
<Row data-testid="header" wrap={false}>
<Col flex="auto">
<EntityHeaderTitle
badge={headerBadge}
badge={
<div className="d-flex gap-1">
{headerBadge}
{currentClassification?.mutuallyExclusive && (
<div data-testid="mutually-exclusive-container">
<AppBadge
bgColor={PRIMERY_COLOR}
label={t('label.mutually-exclusive')}
/>
</div>
)}
</div>
}
className={classNames({
'opacity-60': isClassificationDisabled,
})}
@ -508,37 +494,6 @@ const ClassificationDetails = forwardRef(
/>
</div>
<div
className="m-b-md m-t-xs d-flex justify-end"
data-testid="mutually-exclusive-container">
<Space align="center" size="small">
<Typography.Text
className="text-grey-muted"
data-testid="mutually-exclusive-classification-label">
{t('label.mutually-exclusive')}
</Typography.Text>
{isVersionView ? (
<>
<Typography.Text>:</Typography.Text>
<RichTextEditorPreviewer
className={classNames('font-medium', {
'opacity-60': isClassificationDisabled,
})}
markdown={mutuallyExclusive}
/>
</>
) : (
<Switch
checked={currentClassification?.mutuallyExclusive}
data-testid="mutually-exclusive-classification-button"
disabled={isClassificationDisabled}
onChange={handleUpdateMutuallyExclusive}
/>
)}
</Space>
</div>
<Space className="w-full m-b-md" direction="vertical" size="large">
<Table
bordered

View File

@ -14,7 +14,6 @@ import {
CheckOutlined,
CloseOutlined,
ExclamationCircleOutlined,
PlusOutlined,
} from '@ant-design/icons';
import {
Alert,
@ -41,6 +40,7 @@ import {
useState,
} from 'react';
import { useTranslation } from 'react-i18next';
import { ReactComponent as FilterIcon } from '../../../assets/svg/ic-feeds-filter.svg';
import { ERROR_COLOR, PAGE_SIZE_MEDIUM } from '../../../constants/constants';
import { SearchIndex } from '../../../enums/search.enum';
import { GlossaryTerm } from '../../../generated/entity/data/glossaryTerm';
@ -508,7 +508,7 @@ export const AssetSelectionModal = ({
selectedKeys: selectedFilter,
}}
trigger={['click']}>
<Button icon={<PlusOutlined />} size="small" type="primary" />
<Button className="flex-center" icon={<FilterIcon height={16} />} />
</Dropdown>
<div className="flex-1">
<Searchbar

View File

@ -42,6 +42,7 @@ import React, {
} from 'react';
import { ReactComponent as AddPlaceHolderIcon } from '../../../../assets/svg/add-placeholder.svg';
import { ReactComponent as DeleteIcon } from '../../../../assets/svg/ic-delete.svg';
import { ReactComponent as FilterIcon } from '../../../../assets/svg/ic-feeds-filter.svg';
import { ReactComponent as IconDropdown } from '../../../../assets/svg/menu.svg';
import {
AssetsFilterOptions,
@ -845,9 +846,8 @@ const AssetsTabs = forwardRef(
}}
trigger={['click']}>
<Button
icon={<PlusOutlined />}
size="small"
type="primary"
className="flex-center"
icon={<FilterIcon height={16} />}
/>
</Dropdown>
<div className="flex-1">

View File

@ -24,6 +24,6 @@ export enum UpdateState {
INITIAL,
VALIDATING,
FAILED,
UPDATATING,
SUCESS,
UPDATING,
SUCCESS,
}

View File

@ -57,10 +57,10 @@ export const GlossaryUpdateConfirmationModal = ({
);
if (res.status === Status.Success) {
setUpdateState(UpdateState.UPDATATING);
setUpdateState(UpdateState.UPDATING);
try {
await onValidationSuccess();
setUpdateState(UpdateState.SUCESS);
setUpdateState(UpdateState.SUCCESS);
} catch (err) {
// Error
} finally {
@ -108,7 +108,7 @@ export const GlossaryUpdateConfirmationModal = ({
const progress =
updateState === UpdateState.VALIDATING
? 10
: updateState === UpdateState.UPDATATING
: updateState === UpdateState.UPDATING
? 60
: 100;
@ -205,12 +205,12 @@ export const GlossaryUpdateConfirmationModal = ({
</div>
),
};
case UpdateState.UPDATATING:
case UpdateState.UPDATING:
return {
content: progressBar,
footer: <Button onClick={onCancel}>{t('label.cancel')}</Button>,
};
case UpdateState.SUCESS:
case UpdateState.SUCCESS:
return {
content: progressBar,
footer: <Button onClick={onCancel}>{t('label.cancel')}</Button>,
@ -218,6 +218,19 @@ export const GlossaryUpdateConfirmationModal = ({
}
}, [updateState, failedStatus]);
const modalTitle = useMemo(() => {
switch (updateState) {
case UpdateState.VALIDATING:
case UpdateState.UPDATING:
case UpdateState.SUCCESS:
return t('message.glossary-tag-update-modal-title-validating');
case UpdateState.FAILED:
return t('message.glossary-tag-update-modal-title-failed');
default:
return undefined;
}
}, [updateState]);
return (
<Modal
centered
@ -225,16 +238,7 @@ export const GlossaryUpdateConfirmationModal = ({
closable={false}
closeIcon={null}
footer={data.footer}
title={
[
UpdateState.VALIDATING,
UpdateState.FAILED,
UpdateState.UPDATATING,
UpdateState.SUCESS,
].includes(updateState)
? t('message.glossary-tag-update-modal-title')
: undefined
}
title={modalTitle}
width={updateState === UpdateState.FAILED ? 750 : undefined}
onCancel={onCancel}>
{data.content}

View File

@ -38,6 +38,10 @@ import { ModalWithMarkdownEditor } from '../../Modals/ModalWithMarkdownEditor/Mo
import RichTextEditorPreviewer from '../RichTextEditor/RichTextEditorPreviewer';
import { DescriptionProps } from './Description.interface';
/**
* @deprecated will be removed
* Use DescriptionV1 instead
*/
const Description: FC<DescriptionProps> = ({
className,
header,

View File

@ -1437,7 +1437,8 @@
"get-started-with-open-metadata": "Erste Schritte mit OpenMetadata",
"glossary-tag-assignment-help-message": "You can either remove these assets or remove the conflicting tags from the assets, and try adding the tags again.",
"glossary-tag-update-description": "This action will apply the tag to all Assets linked to the Glossary Term",
"glossary-tag-update-modal-title": "Validation failed for the following data assets",
"glossary-tag-update-modal-title-failed": "Validation failed for the following data assets",
"glossary-tag-update-modal-title-validating": "Validating data assets",
"glossary-term-description": "Jeder Begriff im Glossar hat eine eindeutige Definition. Neben der Definition des Standardbegriffs für ein Konzept können auch Synonyme sowie verwandte Begriffe (z. B. übergeordnete und untergeordnete Begriffe) angegeben werden. Es können Referenzen zu den Assets hinzugefügt werden, die sich auf die Begriffe beziehen. Neue Begriffe können dem Glossar hinzugefügt oder aktualisiert werden. Die Glossarbegriffe können von bestimmten Benutzern überprüft werden, die die Begriffe akzeptieren oder ablehnen können.",
"glossary-term-status": "Glossary Term was {{status}}.",
"go-back-to-login-page": "Zurück zur Anmeldeseite",

View File

@ -1437,7 +1437,8 @@
"get-started-with-open-metadata": "Get started with OpenMetadata",
"glossary-tag-assignment-help-message": "You can either remove these assets or remove the conflicting tags from the assets, and try adding the tags again.",
"glossary-tag-update-description": "This action will apply the tag to all Assets linked to the Glossary Term",
"glossary-tag-update-modal-title": "Validation failed for the following data assets",
"glossary-tag-update-modal-title-failed": "Validation failed for the following data assets",
"glossary-tag-update-modal-title-validating": "Validating data assets",
"glossary-term-description": "Every term in the glossary has a unique definition. Along with defining the standard term for a concept, the synonyms as well as related terms (for e.g., parent and child terms) can be specified. References can be added to the assets related to the terms. New terms can be added or updated to the Glossary. The glossary terms can be reviewed by certain users, who can accept or reject the terms.",
"glossary-term-status": "Glossary Term was {{status}}.",
"go-back-to-login-page": "Go back to Login page",

View File

@ -1437,7 +1437,8 @@
"get-started-with-open-metadata": "Empezar con OpenMetadata",
"glossary-tag-assignment-help-message": "You can either remove these assets or remove the conflicting tags from the assets, and try adding the tags again.",
"glossary-tag-update-description": "This action will apply the tag to all Assets linked to the Glossary Term",
"glossary-tag-update-modal-title": "Validation failed for the following data assets",
"glossary-tag-update-modal-title-failed": "Validation failed for the following data assets",
"glossary-tag-update-modal-title-validating": "Validating data assets",
"glossary-term-description": "Cada término en el glosario tiene una definición única. Además de definir el término estándar para un concepto, se pueden especificar sinónimos y términos relacionados (por ejemplo, términos padre e hijo). Se pueden agregar referencias a los activos relacionados con los términos. Se pueden agregar o actualizar nuevos términos al glosario. Los términos del glosario pueden ser revisados por ciertos usuarios, quienes pueden aceptar o rechazar los términos.",
"glossary-term-status": "Glossary Term was {{status}}.",
"go-back-to-login-page": "Volver a la página de inicio de sesión",

View File

@ -1437,7 +1437,8 @@
"get-started-with-open-metadata": "Commencez votre Journée avec OpenMetadata",
"glossary-tag-assignment-help-message": "You can either remove these assets or remove the conflicting tags from the assets, and try adding the tags again.",
"glossary-tag-update-description": "This action will apply the tag to all Assets linked to the Glossary Term",
"glossary-tag-update-modal-title": "Validation failed for the following data assets",
"glossary-tag-update-modal-title-failed": "Validation failed for the following data assets",
"glossary-tag-update-modal-title-validating": "Validating data assets",
"glossary-term-description": "Chaque terme du glossaire a une définition unique. En plus de définir le terme standard pour un concept, les synonymes ainsi que les termes associés (par exemple, les termes parent et enfant) peuvent être spécifiés. Des références peuvent être ajoutées aux actifs liés aux termes. De nouveaux termes peuvent être ajoutés ou mis à jour dans le glossaire. Les termes du glossaire peuvent être examinés par certains utilisateurs, qui peuvent accepter ou rejeter les termes.",
"glossary-term-status": "Glossary Term was {{status}}.",
"go-back-to-login-page": "Retour à la page d'accueil",

View File

@ -1437,7 +1437,8 @@
"get-started-with-open-metadata": "התחל עם OpenMetadata",
"glossary-tag-assignment-help-message": "You can either remove these assets or remove the conflicting tags from the assets, and try adding the tags again.",
"glossary-tag-update-description": "This action will apply the tag to all Assets linked to the Glossary Term",
"glossary-tag-update-modal-title": "Validation failed for the following data assets",
"glossary-tag-update-modal-title-failed": "Validation failed for the following data assets",
"glossary-tag-update-modal-title-validating": "Validating data assets",
"glossary-term-description": "כל מונח במילון מסביר כיצד הוא מזהה את עצמו. בנוסף להגדרת המונח התקנית עבור קונספט, ניתן לציין נרדפים ומונחים קשורים (לדוגמה, מונחים הורה וילד). יש להוסיף הפניות לנכסים הקשורים למונחים. ניתן להוסיף מונחים חדשים או לעדכן את המילון. ניתן לבדוק את המונחים במילון על ידי משתמשים מסויימים, שיכולים לקבל או לדחות את המונחים.",
"glossary-term-status": "מצב המונח הוא {{status}}.",
"go-back-to-login-page": "חזור לדף התחברות",

View File

@ -1437,7 +1437,8 @@
"get-started-with-open-metadata": "Get started with OpenMetadata",
"glossary-tag-assignment-help-message": "You can either remove these assets or remove the conflicting tags from the assets, and try adding the tags again.",
"glossary-tag-update-description": "This action will apply the tag to all Assets linked to the Glossary Term",
"glossary-tag-update-modal-title": "Validation failed for the following data assets",
"glossary-tag-update-modal-title-failed": "Validation failed for the following data assets",
"glossary-tag-update-modal-title-validating": "Validating data assets",
"glossary-term-description": "Every term in the glossary has a unique definition. Along with defining the standard term for a concept, the synonyms as well as related terms (for e.g., parent and child terms) can be specified. References can be added to the assets related to the terms. New terms can be added or updated to the Glossary. The glossary terms can be reviewed by certain users, who can accept or reject the terms.",
"glossary-term-status": "Glossary Term was {{status}}.",
"go-back-to-login-page": "ログインページに戻る",

View File

@ -1437,7 +1437,8 @@
"get-started-with-open-metadata": "Aan de slag met OpenMetadata",
"glossary-tag-assignment-help-message": "Je kunt deze assets verwijderen of de conflicterende tags van de assets verwijderen en vervolgens proberen de tags opnieuw toe te voegen.",
"glossary-tag-update-description": "Deze actie zal de tag toepassen op alle assets die zijn gekoppeld aan de term in het woordenboek",
"glossary-tag-update-modal-title": "Validatie is mislukt voor de volgende data-assets",
"glossary-tag-update-modal-title-failed": "Validatie is mislukt voor de volgende data-assets",
"glossary-tag-update-modal-title-validating": "Validating data assets",
"glossary-term-description": "Elke term in het woordenboek heeft een unieke definitie. Naast het definiëren van de standaardterm voor een concept, kunnen ook synoniemen en gerelateerde termen (bijv. ouder- en kindtermen) worden gespecificeerd. Referenties kunnen worden toegevoegd aan de assets die verband houden met de termen. Nieuwe termen kunnen worden toegevoegd of bijgewerkt naar het woordenboek. De woordenboektermen kunnen worden beoordeeld door bepaalde gebruikers, die de termen kunnen accepteren of afwijzen.",
"glossary-term-status": "Woordenboekterm was {{status}}.",
"go-back-to-login-page": "Ga terug naar de inlogpagina",

View File

@ -1437,7 +1437,8 @@
"get-started-with-open-metadata": "Comece com o OpenMetadata",
"glossary-tag-assignment-help-message": "Você pode remover esses ativos ou retirar as tags conflitantes dos ativos e tentar adicionar as tags novamente.",
"glossary-tag-update-description": "Esta ação aplicará a tag a todos os Ativos vinculados ao Termo de Glossário",
"glossary-tag-update-modal-title": "A validação falhou para os seguintes ativos de dados",
"glossary-tag-update-modal-title-failed": "A validação falhou para os seguintes ativos de dados",
"glossary-tag-update-modal-title-validating": "Validating data assets",
"glossary-term-description": "Cada termo no glossário tem uma definição única. Além de definir o termo padrão para um conceito, os sinônimos e termos relacionados (por exemplo, termos pai e filho) podem ser especificados. Referências podem ser adicionadas aos ativos relacionados aos termos. Novos termos podem ser adicionados ou atualizados no Glossário. Os termos do glossário podem ser revisados por certos usuários, que podem aceitar ou rejeitar os termos.",
"glossary-term-status": "Termo do Glossário foi {{status}}.",
"go-back-to-login-page": "Voltar para a página de Login",

View File

@ -1437,7 +1437,8 @@
"get-started-with-open-metadata": "Начните работу с OpenMetadata",
"glossary-tag-assignment-help-message": "You can either remove these assets or remove the conflicting tags from the assets, and try adding the tags again.",
"glossary-tag-update-description": "This action will apply the tag to all Assets linked to the Glossary Term",
"glossary-tag-update-modal-title": "Validation failed for the following data assets",
"glossary-tag-update-modal-title-failed": "Validation failed for the following data assets",
"glossary-tag-update-modal-title-validating": "Validating data assets",
"glossary-term-description": "Каждый термин в глоссарии имеет уникальное определение. Наряду с определением стандартного термина для понятия можно указать синонимы, а также связанные термины (например, родительские и дочерние термины). Ссылки могут быть добавлены к объектам данных, связанным с терминами. Новые термины могут быть добавлены или обновлены в Глоссарий. Термины глоссария могут быть просмотрены определенными пользователями, которые могут принять или отклонить термины.",
"glossary-term-status": "Glossary Term was {{status}}.",
"go-back-to-login-page": "Вернуться на страницу входа",

View File

@ -1437,7 +1437,8 @@
"get-started-with-open-metadata": "开始使用 OpenMetadata",
"glossary-tag-assignment-help-message": "You can either remove these assets or remove the conflicting tags from the assets, and try adding the tags again.",
"glossary-tag-update-description": "This action will apply the tag to all Assets linked to the Glossary Term",
"glossary-tag-update-modal-title": "Validation failed for the following data assets",
"glossary-tag-update-modal-title-failed": "Validation failed for the following data assets",
"glossary-tag-update-modal-title-validating": "Validating data assets",
"glossary-term-description": "术语库中的每个术语都有一个唯一的定义。除了为概念定义标准术语之外,还可以指定同义词以及相关术语(例如,父项和子项)。可以向与术语相关的资产添加引用。可以向术语库添加或更新新术语。某些用户可以审查术语,并接受或拒绝这些术语。",
"glossary-term-status": "Glossary Term was {{status}}.",
"go-back-to-login-page": "返回登录页面",