Skip to content

Commit e8e660b

Browse files
Dashboard links UUID (#553)
* Removing the old dashboard code * one last line to clean * commit for review and collab * people enabled * updating recently updated engagements dashboard item to utilize uuid instead of client/project combo for url * updating tests Co-authored-by: Spencer Stolworthy <[email protected]>
1 parent cfafd24 commit e8e660b

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

src/components/dashboard/widgets/dw_last_updated_engagement.spec.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import React from 'react';
21
import { fireEvent, render } from '@testing-library/react';
2+
33
import { DwLastUpdated } from './dw_last_updated_engagements';
44
import { Engagement } from '../../../schemas/engagement';
5+
import React from 'react';
56

67
describe('Dashboard Last Updated Engagements Widget', () => {
78
test('is defined', () => {
@@ -29,8 +30,7 @@ describe('Dashboard Last Updated Engagements Widget', () => {
2930
);
3031
fireEvent.click(component.getByText(engagement.project_name));
3132
expect(spy).toHaveBeenCalledWith(
32-
engagement.customer_name,
33-
engagement.project_name
33+
engagement.uuid
3434
);
3535
});
3636
});

src/components/dashboard/widgets/dw_last_updated_engagements.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,30 @@ import {
99
TextContent,
1010
TextVariants,
1111
} from '@patternfly/react-core';
12-
import {ReactComponent as HandshakeIcon} from '../../../assets/images/handshake-alt.svg';
1312
import { Table, TableBody, TableHeader } from '@patternfly/react-table';
14-
import { formatRelative } from 'date-fns';
15-
import React from 'react';
16-
import { Engagement } from '../../../schemas/engagement';
13+
1714
import CustomRowWrapper from '../../../components/custom_row_wrapper/custom_row_wrapper';
15+
import { Engagement } from '../../../schemas/engagement';
16+
import {ReactComponent as HandshakeIcon} from '../../../assets/images/handshake-alt.svg';
17+
import React from 'react';
18+
import { formatRelative } from 'date-fns';
1819

1920
export interface DwLastUpdatedProps {
2021
engagements: Partial<Engagement>[];
21-
onClick?(customerName: string, projectName: string): void;
22+
onClick?(uuid: string): void;
2223
}
2324
const columns = ['Customer Name', 'Name', 'Last Update'];
2425
export const DwLastUpdated = (props: DwLastUpdatedProps) => {
2526
const rows = props.engagements.map(e => {
27+
console.log(e);
2628
let relativeDate = formatRelative(e.last_update, new Date());
2729
relativeDate = relativeDate.charAt(0).toUpperCase() + relativeDate.slice(1);
2830
return [
2931
e.customer_name,
3032
{
3133
title: (
3234
<Button
33-
onClick={() => props.onClick?.(e.customer_name, e.project_name)}
35+
onClick={() => props.onClick?.(e.uuid)}
3436
isInline
3537
variant={ButtonVariant.link}
3638
>

src/routes/dashboard/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,9 @@ export function Dashboard() {
290290
component={props => (
291291
<DwLastUpdated
292292
{...props}
293-
onClick={(customerName, projectName) => {
293+
onClick={(uuid) => {
294294
history.push(
295-
`/app/engagements/${customerName}/${projectName}/`
295+
`/app/engagements/${uuid}`
296296
);
297297
}}
298298
/>

0 commit comments

Comments
 (0)