mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-03 20:19:31 +00:00
* fix(#10500): When the tier is removed all tags are also removed. * chore: warp TagsViewer component with AntD Space component * test: add cypress test * update test * test: fix test for feed message check
This commit is contained in:
parent
385a2e87d2
commit
5d2f0bfaaf
@ -24,6 +24,8 @@ import {
|
|||||||
} from '../../common/common';
|
} from '../../common/common';
|
||||||
import { DELETE_ENTITY, DELETE_TERM } from '../../constants/constants';
|
import { DELETE_ENTITY, DELETE_TERM } from '../../constants/constants';
|
||||||
|
|
||||||
|
const entityTag = 'PersonalData.Personal';
|
||||||
|
|
||||||
describe('Entity Details Page', () => {
|
describe('Entity Details Page', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login();
|
cy.login();
|
||||||
@ -105,7 +107,7 @@ describe('Entity Details Page', () => {
|
|||||||
cy.clickOnLogo();
|
cy.clickOnLogo();
|
||||||
};
|
};
|
||||||
|
|
||||||
const addOwnerAndTier = (value) => {
|
const addOwnerTierAndTag = (value) => {
|
||||||
visitEntityDetailsPage(value.term, value.serviceName, value.entity);
|
visitEntityDetailsPage(value.term, value.serviceName, value.entity);
|
||||||
|
|
||||||
interceptURL(
|
interceptURL(
|
||||||
@ -161,27 +163,52 @@ describe('Entity Details Page', () => {
|
|||||||
|
|
||||||
cy.get('[data-testid="entity-tags"]').should('contain', 'Tier1');
|
cy.get('[data-testid="entity-tags"]').should('contain', 'Tier1');
|
||||||
|
|
||||||
|
// add tag to the entity
|
||||||
|
interceptURL('GET', '/api/v1/tags?limit=1000', 'tagsRequest');
|
||||||
|
interceptURL(
|
||||||
|
'GET',
|
||||||
|
'/api/v1/search/query?q=*&from=0&size=1000&index=glossary_search_index',
|
||||||
|
'glossaryRequest'
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get('[data-testid="edit-button"]').should('be.visible').click();
|
||||||
|
|
||||||
|
cy.get('[data-testid="tag-selector"]')
|
||||||
|
.scrollIntoView()
|
||||||
|
.should('be.visible')
|
||||||
|
.type(entityTag);
|
||||||
|
|
||||||
|
verifyResponseStatusCode('@tagsRequest', 200);
|
||||||
|
verifyResponseStatusCode('@glossaryRequest', 200);
|
||||||
|
|
||||||
|
cy.get('.ant-select-item-option-content')
|
||||||
|
.first()
|
||||||
|
.should('be.visible')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.get('[data-testid="saveAssociatedTag"]').should('be.visible').click();
|
||||||
|
|
||||||
// Test out the activity feed and task tab
|
// Test out the activity feed and task tab
|
||||||
cy.get('[data-testid="Activity Feeds & Tasks"]')
|
cy.get('[data-testid="Activity Feeds & Tasks"]')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.click();
|
.click();
|
||||||
// Check for tab count
|
// Check for tab count
|
||||||
cy.get('[data-testid=filter-count').should('be.visible').contains('2');
|
cy.get('[data-testid=filter-count').should('be.visible').contains('3');
|
||||||
|
|
||||||
// Check for activity feeds - count should be 2
|
// Check for activity feeds - count should be 3
|
||||||
// 1 for tier change and 1 for owner change
|
// 1 for tier change , 1 for owner change, 1 for entity tag
|
||||||
cy.get('[data-testid="message-container"]').its('length').should('eq', 2);
|
cy.get('[data-testid="message-container"]').its('length').should('eq', 3);
|
||||||
|
|
||||||
cy.clickOnLogo();
|
cy.clickOnLogo();
|
||||||
|
|
||||||
// checks newly generated feed for follow and setting owner
|
// checks newly generated feed for follow and setting owner
|
||||||
cy.get('[data-testid="message-container"]')
|
cy.get('[data-testid="message-container"]')
|
||||||
.eq(1)
|
.eq(2)
|
||||||
.contains('Added owner: admin')
|
.contains('Added owner: admin')
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
|
|
||||||
cy.get('[data-testid="message-container"]')
|
cy.get('[data-testid="message-container"]')
|
||||||
.eq(0)
|
.eq(1)
|
||||||
.scrollIntoView()
|
.scrollIntoView()
|
||||||
.contains('Added tags: Tier.Tier1')
|
.contains('Added tags: Tier.Tier1')
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
@ -235,6 +262,9 @@ describe('Entity Details Page', () => {
|
|||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
|
// after removing the tier entity tag should exists
|
||||||
|
cy.get('[data-testid="entity-tags"]').should('contain', entityTag);
|
||||||
|
|
||||||
cy.clickOnLogo();
|
cy.clickOnLogo();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -282,8 +312,8 @@ describe('Entity Details Page', () => {
|
|||||||
cy.clickOnLogo();
|
cy.clickOnLogo();
|
||||||
};
|
};
|
||||||
|
|
||||||
it('Add Owner and Tier for entity', () => {
|
it('Add Owner, Tier and tags for entity', () => {
|
||||||
addOwnerAndTier(DELETE_ENTITY.table);
|
addOwnerTierAndTag(DELETE_ENTITY.table);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Remove Owner and Tier for entity', () => {
|
it('Remove Owner and Tier for entity', () => {
|
||||||
|
|||||||
@ -153,9 +153,7 @@ const ContainerDataModel: FC<ContainerDataModelProps> = ({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isReadOnly ? (
|
{isReadOnly ? (
|
||||||
<Space wrap>
|
<TagsViewer sizeCap={-1} tags={tags || []} />
|
||||||
<TagsViewer sizeCap={-1} tags={tags || []} />
|
|
||||||
</Space>
|
|
||||||
) : (
|
) : (
|
||||||
<Space
|
<Space
|
||||||
align={isUpdatingTags ? 'start' : 'center'}
|
align={isUpdatingTags ? 'start' : 'center'}
|
||||||
|
|||||||
@ -316,7 +316,7 @@ const DashboardDetails = ({
|
|||||||
if (dashboardDetails) {
|
if (dashboardDetails) {
|
||||||
const updatedDashboardDetails = {
|
const updatedDashboardDetails = {
|
||||||
...dashboardDetails,
|
...dashboardDetails,
|
||||||
tags: undefined,
|
tags: getTagsWithoutTier(dashboardDetails.tags ?? []),
|
||||||
};
|
};
|
||||||
settingsUpdateHandler(updatedDashboardDetails);
|
settingsUpdateHandler(updatedDashboardDetails);
|
||||||
}
|
}
|
||||||
@ -616,9 +616,7 @@ const DashboardDetails = ({
|
|||||||
data-testid="tags-wrapper"
|
data-testid="tags-wrapper"
|
||||||
onClick={() => handleTagContainerClick(record, index)}>
|
onClick={() => handleTagContainerClick(record, index)}>
|
||||||
{deleted ? (
|
{deleted ? (
|
||||||
<Space>
|
<TagsViewer sizeCap={-1} tags={tags || []} />
|
||||||
<TagsViewer sizeCap={-1} tags={tags || []} />
|
|
||||||
</Space>
|
|
||||||
) : (
|
) : (
|
||||||
<TagsContainer
|
<TagsContainer
|
||||||
editable={editChartTags?.index === index}
|
editable={editChartTags?.index === index}
|
||||||
|
|||||||
@ -533,7 +533,7 @@ const DatasetDetails: React.FC<DatasetDetailsProps> = ({
|
|||||||
if (tableDetails) {
|
if (tableDetails) {
|
||||||
const updatedTableDetails = {
|
const updatedTableDetails = {
|
||||||
...tableDetails,
|
...tableDetails,
|
||||||
tags: undefined,
|
tags: getTagsWithoutTier(tableDetails.tags ?? []),
|
||||||
};
|
};
|
||||||
settingsUpdateHandler(updatedTableDetails);
|
settingsUpdateHandler(updatedTableDetails);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -522,9 +522,7 @@ const EntityTable = ({
|
|||||||
return (
|
return (
|
||||||
<div className="hover-icon-group">
|
<div className="hover-icon-group">
|
||||||
{isReadOnly ? (
|
{isReadOnly ? (
|
||||||
<div className="tw-flex tw-flex-wrap">
|
<TagsViewer sizeCap={-1} tags={tags || []} />
|
||||||
<TagsViewer sizeCap={-1} tags={tags || []} />
|
|
||||||
</div>
|
|
||||||
) : (
|
) : (
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
|
|||||||
@ -91,14 +91,12 @@ function SummaryListItem({
|
|||||||
className="w-12 h-12"
|
className="w-12 h-12"
|
||||||
data-testid="tag-grey-icon"
|
data-testid="tag-grey-icon"
|
||||||
/>
|
/>
|
||||||
<Row wrap>
|
<TagsViewer
|
||||||
<TagsViewer
|
sizeCap={-1}
|
||||||
sizeCap={-1}
|
tags={(entityDetails.tags || []).map((tag) =>
|
||||||
tags={(entityDetails.tags || []).map((tag) =>
|
getTagValue(tag)
|
||||||
getTagValue(tag)
|
)}
|
||||||
)}
|
/>
|
||||||
/>
|
|
||||||
</Row>
|
|
||||||
</Space>
|
</Space>
|
||||||
</Col>
|
</Col>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -355,7 +355,7 @@ const MlModelDetail: FC<MlModelDetailProp> = ({
|
|||||||
if (mlModelDetail) {
|
if (mlModelDetail) {
|
||||||
const updatedMlModelDetails = {
|
const updatedMlModelDetails = {
|
||||||
...mlModelDetail,
|
...mlModelDetail,
|
||||||
tags: undefined,
|
tags: getTagsWithoutTier(mlModelDetail.tags ?? []),
|
||||||
};
|
};
|
||||||
settingsUpdateHandler(updatedMlModelDetails);
|
settingsUpdateHandler(updatedMlModelDetails);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -304,7 +304,7 @@ const PipelineDetails = ({
|
|||||||
if (pipelineDetails) {
|
if (pipelineDetails) {
|
||||||
const updatedPipelineDetails = {
|
const updatedPipelineDetails = {
|
||||||
...pipelineDetails,
|
...pipelineDetails,
|
||||||
tags: undefined,
|
tags: getTagsWithoutTier(pipelineDetails.tags ?? []),
|
||||||
};
|
};
|
||||||
settingsUpdateHandler(updatedPipelineDetails);
|
settingsUpdateHandler(updatedPipelineDetails);
|
||||||
}
|
}
|
||||||
@ -531,9 +531,7 @@ const PipelineDetails = ({
|
|||||||
data-testid="tags-wrapper"
|
data-testid="tags-wrapper"
|
||||||
onClick={() => handleEditTaskTag(record, index)}>
|
onClick={() => handleEditTaskTag(record, index)}>
|
||||||
{deleted ? (
|
{deleted ? (
|
||||||
<div className="tw-flex tw-flex-wrap">
|
<TagsViewer sizeCap={-1} tags={text || []} />
|
||||||
<TagsViewer sizeCap={-1} tags={text || []} />
|
|
||||||
</div>
|
|
||||||
) : (
|
) : (
|
||||||
<TagsContainer
|
<TagsContainer
|
||||||
editable={editTaskTags?.index === index}
|
editable={editTaskTags?.index === index}
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Popover } from 'antd';
|
import { Popover, Space } from 'antd';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import Tags from 'components/Tag/Tags/tags';
|
import Tags from 'components/Tag/Tags/tags';
|
||||||
import { sortBy, uniqBy } from 'lodash';
|
import { sortBy, uniqBy } from 'lodash';
|
||||||
@ -56,33 +56,39 @@ const TagsViewer: FunctionComponent<TagsViewerProps> = ({
|
|||||||
[tags]
|
[tags]
|
||||||
);
|
);
|
||||||
|
|
||||||
return sizeCap > -1 ? (
|
return (
|
||||||
<>
|
<Space wrap>
|
||||||
{sortedTagsBySource
|
{sizeCap > -1 ? (
|
||||||
.slice(0, sizeCap)
|
<>
|
||||||
.map((tag, index) => getTagsElement(tag, index))}
|
{sortedTagsBySource
|
||||||
|
.slice(0, sizeCap)
|
||||||
|
.map((tag, index) => getTagsElement(tag, index))}
|
||||||
|
|
||||||
{sortedTagsBySource.slice(sizeCap).length > 0 && (
|
{sortedTagsBySource.slice(sizeCap).length > 0 && (
|
||||||
<Popover
|
<Popover
|
||||||
content={
|
content={
|
||||||
<>
|
<>
|
||||||
{sortedTagsBySource.slice(sizeCap).map((tag, index) => (
|
{sortedTagsBySource.slice(sizeCap).map((tag, index) => (
|
||||||
<p className="text-left" key={index}>
|
<p className="text-left" key={index}>
|
||||||
{getTagsElement(tag, index)}
|
{getTagsElement(tag, index)}
|
||||||
</p>
|
</p>
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
trigger="click">
|
trigger="click">
|
||||||
<span className="cursor-pointer text-xs link-text v-align-sub">
|
<span className="cursor-pointer text-xs link-text v-align-sub">
|
||||||
{ELLIPSES}
|
{ELLIPSES}
|
||||||
</span>
|
</span>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
{sortedTagsBySource.map((tag, index) => getTagsElement(tag, index))}
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</>
|
</Space>
|
||||||
) : (
|
|
||||||
<>{sortedTagsBySource.map((tag, index) => getTagsElement(tag, index))}</>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -314,7 +314,7 @@ const TopicDetails: React.FC<TopicDetailsProps> = ({
|
|||||||
if (topicDetails) {
|
if (topicDetails) {
|
||||||
const updatedTopicDetails = {
|
const updatedTopicDetails = {
|
||||||
...topicDetails,
|
...topicDetails,
|
||||||
tags: undefined,
|
tags: getTagsWithoutTier(topicDetails.tags ?? []),
|
||||||
};
|
};
|
||||||
settingsUpdateHandler(updatedTopicDetails);
|
settingsUpdateHandler(updatedTopicDetails);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -183,9 +183,7 @@ const TopicSchemaFields: FC<TopicSchemaFieldsProps> = ({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isReadOnly ? (
|
{isReadOnly ? (
|
||||||
<Space wrap>
|
<TagsViewer sizeCap={-1} tags={tags || []} />
|
||||||
<TagsViewer sizeCap={-1} tags={tags || []} />
|
|
||||||
</Space>
|
|
||||||
) : (
|
) : (
|
||||||
<Space
|
<Space
|
||||||
align={styleFlag ? 'start' : 'center'}
|
align={styleFlag ? 'start' : 'center'}
|
||||||
|
|||||||
@ -92,9 +92,7 @@ const VersionTable = ({ columnName, columns, joins }: VersionTableProps) => {
|
|||||||
accessor: 'tags',
|
accessor: 'tags',
|
||||||
width: 272,
|
width: 272,
|
||||||
render: (tags: Column['tags']) => (
|
render: (tags: Column['tags']) => (
|
||||||
<div className="d-flex flex-wrap">
|
<TagsViewer sizeCap={-1} tags={tags || []} />
|
||||||
<TagsViewer sizeCap={-1} tags={tags || []} />
|
|
||||||
</div>
|
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user