- );
- }, [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 }) =>