-
-
Notifications
You must be signed in to change notification settings - Fork 728
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: display basic list of project events (#8291)
- Loading branch information
Showing
30 changed files
with
286 additions
and
140 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
frontend/src/component/personalDashboard/LatestProjectEvents.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { FC } from 'react'; | ||
import type { PersonalDashboardProjectDetailsSchema } from '../../openapi'; | ||
import { Markdown } from '../common/Markdown/Markdown'; | ||
|
||
export const LatestProjectEvents: FC<{ | ||
latestEvents: PersonalDashboardProjectDetailsSchema['latestEvents']; | ||
}> = ({ latestEvents }) => { | ||
return ( | ||
<ul> | ||
{latestEvents.map((event) => { | ||
return ( | ||
<li key={event.summary}> | ||
<Markdown> | ||
{event.summary || | ||
'No preview available for this event'} | ||
</Markdown> | ||
</li> | ||
); | ||
})} | ||
</ul> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
frontend/src/hooks/api/getters/usePersonalDashboard/usePersonalDashboardProjectDetails.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import useSWR from 'swr'; | ||
import { formatApiPath } from 'utils/formatPath'; | ||
import handleErrorResponses from '../httpErrorResponseHandler'; | ||
import type { PersonalDashboardProjectDetailsSchema } from 'openapi'; | ||
|
||
export interface IPersonalDashboardProjectDetailsOutput { | ||
personalDashboardProjectDetails?: PersonalDashboardProjectDetailsSchema; | ||
refetch: () => void; | ||
loading: boolean; | ||
error?: Error; | ||
} | ||
|
||
export const usePersonalDashboardProjectDetails = ( | ||
project: string, | ||
): IPersonalDashboardProjectDetailsOutput => { | ||
const { data, error, mutate } = useSWR( | ||
formatApiPath(`api/admin/personal-dashboard/${project}`), | ||
fetcher, | ||
); | ||
|
||
return { | ||
personalDashboardProjectDetails: data, | ||
loading: !error && !data, | ||
refetch: () => mutate(), | ||
error, | ||
}; | ||
}; | ||
|
||
const fetcher = (path: string) => { | ||
return fetch(path) | ||
.then(handleErrorResponses('Personal Dashboard Project Details')) | ||
.then((res) => res.json()); | ||
}; |
14 changes: 14 additions & 0 deletions
14
frontend/src/openapi/models/getPersonalDashboardProjectDetails401.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Generated by Orval | ||
* Do not edit manually. | ||
* See `gen:api` script in package.json | ||
*/ | ||
|
||
export type GetPersonalDashboardProjectDetails401 = { | ||
/** The ID of the error instance */ | ||
id?: string; | ||
/** A description of what went wrong. */ | ||
message?: string; | ||
/** The name of the error kind */ | ||
name?: string; | ||
}; |
14 changes: 14 additions & 0 deletions
14
frontend/src/openapi/models/getPersonalDashboardProjectDetails403.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Generated by Orval | ||
* Do not edit manually. | ||
* See `gen:api` script in package.json | ||
*/ | ||
|
||
export type GetPersonalDashboardProjectDetails403 = { | ||
/** The ID of the error instance */ | ||
id?: string; | ||
/** A description of what went wrong. */ | ||
message?: string; | ||
/** The name of the error kind */ | ||
name?: string; | ||
}; |
14 changes: 14 additions & 0 deletions
14
frontend/src/openapi/models/getPersonalDashboardProjectDetails404.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Generated by Orval | ||
* Do not edit manually. | ||
* See `gen:api` script in package.json | ||
*/ | ||
|
||
export type GetPersonalDashboardProjectDetails404 = { | ||
/** The ID of the error instance */ | ||
id?: string; | ||
/** A description of what went wrong. */ | ||
message?: string; | ||
/** The name of the error kind */ | ||
name?: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
frontend/src/openapi/models/personalDashboardProjectDetailsSchema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Generated by Orval | ||
* Do not edit manually. | ||
* See `gen:api` script in package.json | ||
*/ | ||
import type { PersonalDashboardProjectDetailsSchemaLatestEventsItem } from './personalDashboardProjectDetailsSchemaLatestEventsItem'; | ||
import type { PersonalDashboardProjectDetailsSchemaOwners } from './personalDashboardProjectDetailsSchemaOwners'; | ||
import type { PersonalDashboardProjectDetailsSchemaRolesItem } from './personalDashboardProjectDetailsSchemaRolesItem'; | ||
|
||
/** | ||
* Project details in personal dashboard | ||
*/ | ||
export interface PersonalDashboardProjectDetailsSchema { | ||
/** The latest events for the project. */ | ||
latestEvents: PersonalDashboardProjectDetailsSchemaLatestEventsItem[]; | ||
/** The users and/or groups that have the "owner" role in this project. If no such users or groups exist, the list will contain the "system" owner instead. */ | ||
owners: PersonalDashboardProjectDetailsSchemaOwners; | ||
/** | ||
* The list of roles that the user has in this project. | ||
* @minItems 1 | ||
*/ | ||
roles: PersonalDashboardProjectDetailsSchemaRolesItem[]; | ||
} |
18 changes: 18 additions & 0 deletions
18
frontend/src/openapi/models/personalDashboardProjectDetailsSchemaLatestEventsItem.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Generated by Orval | ||
* Do not edit manually. | ||
* See `gen:api` script in package.json | ||
*/ | ||
|
||
/** | ||
* An event summary | ||
*/ | ||
export type PersonalDashboardProjectDetailsSchemaLatestEventsItem = { | ||
/** Which user created this event */ | ||
createdBy: string; | ||
/** | ||
* **[Experimental]** A markdown-formatted summary of the event. | ||
* @nullable | ||
*/ | ||
summary: string | null; | ||
}; |
14 changes: 14 additions & 0 deletions
14
frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwners.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Generated by Orval | ||
* Do not edit manually. | ||
* See `gen:api` script in package.json | ||
*/ | ||
import type { PersonalDashboardProjectDetailsSchemaOwnersOneOfItem } from './personalDashboardProjectDetailsSchemaOwnersOneOfItem'; | ||
import type { PersonalDashboardProjectDetailsSchemaOwnersOneOfSixItem } from './personalDashboardProjectDetailsSchemaOwnersOneOfSixItem'; | ||
|
||
/** | ||
* The users and/or groups that have the "owner" role in this project. If no such users or groups exist, the list will contain the "system" owner instead. | ||
*/ | ||
export type PersonalDashboardProjectDetailsSchemaOwners = | ||
| PersonalDashboardProjectDetailsSchemaOwnersOneOfItem[] | ||
| PersonalDashboardProjectDetailsSchemaOwnersOneOfSixItem[]; |
11 changes: 11 additions & 0 deletions
11
frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItem.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Generated by Orval | ||
* Do not edit manually. | ||
* See `gen:api` script in package.json | ||
*/ | ||
import type { PersonalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOf } from './personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOf'; | ||
import type { PersonalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThree } from './personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThree'; | ||
|
||
export type PersonalDashboardProjectDetailsSchemaOwnersOneOfItem = | ||
| PersonalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOf | ||
| PersonalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThree; |
15 changes: 15 additions & 0 deletions
15
frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOf.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Generated by Orval | ||
* Do not edit manually. | ||
* See `gen:api` script in package.json | ||
*/ | ||
import type { PersonalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfOwnerType } from './personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfOwnerType'; | ||
|
||
export type PersonalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOf = { | ||
/** @nullable */ | ||
email?: string | null; | ||
/** @nullable */ | ||
imageUrl?: string | null; | ||
name: string; | ||
ownerType: PersonalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfOwnerType; | ||
}; |
14 changes: 14 additions & 0 deletions
14
.../src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfOwnerType.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Generated by Orval | ||
* Do not edit manually. | ||
* See `gen:api` script in package.json | ||
*/ | ||
|
||
export type PersonalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfOwnerType = | ||
(typeof PersonalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfOwnerType)[keyof typeof PersonalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfOwnerType]; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-redeclare | ||
export const PersonalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfOwnerType = | ||
{ | ||
user: 'user', | ||
} as const; |
11 changes: 11 additions & 0 deletions
11
...tend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThree.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Generated by Orval | ||
* Do not edit manually. | ||
* See `gen:api` script in package.json | ||
*/ | ||
import type { PersonalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThreeOwnerType } from './personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThreeOwnerType'; | ||
|
||
export type PersonalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThree = { | ||
name: string; | ||
ownerType: PersonalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThreeOwnerType; | ||
}; |
14 changes: 14 additions & 0 deletions
14
...openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThreeOwnerType.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Generated by Orval | ||
* Do not edit manually. | ||
* See `gen:api` script in package.json | ||
*/ | ||
|
||
export type PersonalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThreeOwnerType = | ||
(typeof PersonalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThreeOwnerType)[keyof typeof PersonalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThreeOwnerType]; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-redeclare | ||
export const PersonalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThreeOwnerType = | ||
{ | ||
group: 'group', | ||
} as const; |
10 changes: 10 additions & 0 deletions
10
frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfSixItem.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* Generated by Orval | ||
* Do not edit manually. | ||
* See `gen:api` script in package.json | ||
*/ | ||
import type { PersonalDashboardProjectDetailsSchemaOwnersOneOfSixItemOwnerType } from './personalDashboardProjectDetailsSchemaOwnersOneOfSixItemOwnerType'; | ||
|
||
export type PersonalDashboardProjectDetailsSchemaOwnersOneOfSixItem = { | ||
ownerType: PersonalDashboardProjectDetailsSchemaOwnersOneOfSixItemOwnerType; | ||
}; |
14 changes: 14 additions & 0 deletions
14
...nd/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfSixItemOwnerType.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Generated by Orval | ||
* Do not edit manually. | ||
* See `gen:api` script in package.json | ||
*/ | ||
|
||
export type PersonalDashboardProjectDetailsSchemaOwnersOneOfSixItemOwnerType = | ||
(typeof PersonalDashboardProjectDetailsSchemaOwnersOneOfSixItemOwnerType)[keyof typeof PersonalDashboardProjectDetailsSchemaOwnersOneOfSixItemOwnerType]; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-redeclare | ||
export const PersonalDashboardProjectDetailsSchemaOwnersOneOfSixItemOwnerType = | ||
{ | ||
system: 'system', | ||
} as const; |
Oops, something went wrong.