diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/Entities/EntityClass.ts b/openmetadata-ui/src/main/resources/ui/cypress/common/Entities/EntityClass.ts
index 241d71380fc..12e25b3a254 100644
--- a/openmetadata-ui/src/main/resources/ui/cypress/common/Entities/EntityClass.ts
+++ b/openmetadata-ui/src/main/resources/ui/cypress/common/Entities/EntityClass.ts
@@ -57,6 +57,7 @@ import {
} from '../Utils/Owner';
import { assignTags, removeTags, udpateTags } from '../Utils/Tags';
import { addTier, removeTier, updateTier } from '../Utils/Tier';
+import { validateDomain } from '../Utils/Versions';
import { downVoteEntity, upVoteEntity } from '../Utils/Voting';
const description =
@@ -366,6 +367,7 @@ class EntityClass {
assignDomain() {
addDomainToEntity(domainDetails1.displayName);
+ validateDomain(domainDetails1.displayName, this.endPoint);
}
updateDomain() {
diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Versions.ts b/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Versions.ts
new file mode 100644
index 00000000000..e3c53097665
--- /dev/null
+++ b/openmetadata-ui/src/main/resources/ui/cypress/common/Utils/Versions.ts
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2024 Collate.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { EntityType } from '../../constants/Entity.interface';
+import { interceptURL, verifyResponseStatusCode } from '../common';
+
+export const validateDomain = (domain: string, entityType: EntityType) => {
+ interceptURL('GET', `/api/v1/${entityType}/*/versions/0.2`, 'getVersion');
+ cy.get('[data-testid="version-button"]').should('contain', '0.2').click();
+ verifyResponseStatusCode('@getVersion', 200);
+};
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Domain/DomainVersion/DomainVersion.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Domain/DomainVersion/DomainVersion.test.tsx
index 26f5a10d59f..148f1dd33e1 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/Domain/DomainVersion/DomainVersion.test.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/Domain/DomainVersion/DomainVersion.test.tsx
@@ -108,6 +108,10 @@ jest.mock('../../../components/PageLayoutV1/PageLayoutV1', () => {
return jest.fn().mockImplementation(({ children }) =>
- );
- }, [versionList, currentVersion, versionHandler, versionType]);
+ }),
+ [versionList, currentVersion, versionHandler]
+ );
return (
void;
+ onBack: () => void;
+};
+
+export type EntityVersionButtonProps = {
+ version: {
+ updatedBy: string;
+ version: string;
+ changeDescription: ChangeDescription;
+ updatedAt: number;
+ glossary: string;
+ };
+ onVersionSelect: (v: string) => void;
+ selected: boolean;
+ isMajorVersion: boolean;
+};
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityVersionTimeLine/EntityVersionTimeline.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityVersionTimeLine/EntityVersionTimeline.test.tsx
new file mode 100644
index 00000000000..e4e2fea8757
--- /dev/null
+++ b/openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityVersionTimeLine/EntityVersionTimeline.test.tsx
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2024 Collate.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { fireEvent, render, screen } from '@testing-library/react';
+import React from 'react';
+import { ChangeDescription } from '../../../generated/entity/type';
+import { VersionButton } from './EntityVersionTimeLine';
+
+jest.mock('../../common/PopOverCard/UserPopOverCard', () => ({
+ __esModule: true,
+ default: ({ userName }: { userName: string }) =>
{userName}
,
+}));
+
+const user = {
+ name: 'John Doe displayName',
+ displayName: 'John Doe displayName',
+};
+
+jest.mock('../../../hooks/user-profile/useUserProfile', () => ({
+ useUserProfile: jest.fn().mockImplementation(() => [false, false, user]),
+}));
+
+jest.mock('../../../utils/EntityVersionUtils', () => ({
+ __esModule: true,
+ getSummary: jest.fn().mockReturnValue('Some change description'),
+ isMajorVersion: jest.fn().mockReturnValue(false),
+}));
+
+describe('VersionButton', () => {
+ const version = {
+ updatedBy: 'John Doe',
+ version: '1.0',
+ changeDescription: {} as ChangeDescription,
+ updatedAt: 123,
+ glossary: '',
+ };
+
+ const onVersionSelect = jest.fn();
+ const selected = false;
+ const isMajorVersion = false;
+
+ it('renders version number', () => {
+ render(
+
+ );
+ const versionNumber = screen.getByText('v1.0');
+
+ expect(versionNumber).toBeInTheDocument();
+ });
+
+ it('renders change description', () => {
+ render(
+
+ );
+ const changeDescription = screen.getByText('Some change description');
+
+ expect(changeDescription).toBeInTheDocument();
+ });
+
+ it('should render updatedBy with UserPopoverCard', async () => {
+ render(
+
+ );
+
+ const ownerDisplayName = await screen.findByText('John Doe');
+
+ expect(ownerDisplayName).toBeInTheDocument();
+ });
+
+ it('calls onVersionSelect when clicked', () => {
+ render(
+
+ );
+ const versionButton = screen.getByTestId('version-selector-v1.0');
+ fireEvent.click(versionButton);
+
+ expect(onVersionSelect).toHaveBeenCalledWith('1.0');
+ });
+});
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityVersionTimeLine/entity-version-timeline.less b/openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityVersionTimeLine/entity-version-timeline.less
new file mode 100644
index 00000000000..cf9614ce5a7
--- /dev/null
+++ b/openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityVersionTimeLine/entity-version-timeline.less
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2024 Collate.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+.version-timestamp::before {
+ content: '\2022';
+ margin-right: 6px;
+ margin-left: 4px;
+}
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryVersion/GlossaryVersion.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryVersion/GlossaryVersion.test.tsx
index a0ee405936b..aaba3a92b6d 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryVersion/GlossaryVersion.test.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryVersion/GlossaryVersion.test.tsx
@@ -64,6 +64,10 @@ jest.mock('../../PageLayoutV1/PageLayoutV1', () => {
return jest.fn().mockImplementation(({ children }) =>