From e5af07487cc2ff41e6bcaf00c52220c92c3e674d Mon Sep 17 00:00:00 2001 From: kwasniew Date: Fri, 27 Sep 2024 13:44:56 +0200 Subject: [PATCH] feat: display basic list of project events --- .../personalDashboard/LatestProjectEvents.tsx | 22 ++++++++++++ .../personalDashboard/PersonalDashboard.tsx | 34 ++++++++++++------- .../usePersonalDashboardProjectDetails.ts | 33 ++++++++++++++++++ .../getPersonalDashboardProjectDetails401.ts | 14 ++++++++ .../getPersonalDashboardProjectDetails403.ts | 14 ++++++++ .../getPersonalDashboardProjectDetails404.ts | 14 ++++++++ frontend/src/openapi/models/index.ts | 25 ++++++++------ .../personalDashboardProjectDetailsSchema.ts | 23 +++++++++++++ ...ardProjectDetailsSchemaLatestEventsItem.ts | 18 ++++++++++ ...onalDashboardProjectDetailsSchemaOwners.ts | 14 ++++++++ ...oardProjectDetailsSchemaOwnersOneOfItem.ts | 11 ++++++ ...rojectDetailsSchemaOwnersOneOfItemAnyOf.ts | 15 ++++++++ ...ailsSchemaOwnersOneOfItemAnyOfOwnerType.ts | 14 ++++++++ ...tDetailsSchemaOwnersOneOfItemAnyOfThree.ts | 11 ++++++ ...chemaOwnersOneOfItemAnyOfThreeOwnerType.ts | 14 ++++++++ ...dProjectDetailsSchemaOwnersOneOfSixItem.ts | 10 ++++++ ...etailsSchemaOwnersOneOfSixItemOwnerType.ts | 14 ++++++++ ...DashboardProjectDetailsSchemaRolesItem.ts} | 6 ++-- ...boardProjectDetailsSchemaRolesItemType.ts} | 6 ++-- .../personalDashboardSchemaProjectsItem.ts | 9 ----- ...rsonalDashboardSchemaProjectsItemOwners.ts | 14 -------- ...hboardSchemaProjectsItemOwnersOneOfItem.ts | 11 ------ ...dSchemaProjectsItemOwnersOneOfItemAnyOf.ts | 15 -------- ...ojectsItemOwnersOneOfItemAnyOfOwnerType.ts | 14 -------- ...maProjectsItemOwnersOneOfItemAnyOfThree.ts | 11 ------ ...sItemOwnersOneOfItemAnyOfThreeOwnerType.ts | 14 -------- ...ardSchemaProjectsItemOwnersOneOfSixItem.ts | 10 ------ ...ProjectsItemOwnersOneOfSixItemOwnerType.ts | 13 ------- .../personal-dashboard-service.ts | 1 + ...rsonal-dashboard-project-details-schema.ts | 2 +- 30 files changed, 286 insertions(+), 140 deletions(-) create mode 100644 frontend/src/component/personalDashboard/LatestProjectEvents.tsx create mode 100644 frontend/src/hooks/api/getters/usePersonalDashboard/usePersonalDashboardProjectDetails.ts create mode 100644 frontend/src/openapi/models/getPersonalDashboardProjectDetails401.ts create mode 100644 frontend/src/openapi/models/getPersonalDashboardProjectDetails403.ts create mode 100644 frontend/src/openapi/models/getPersonalDashboardProjectDetails404.ts create mode 100644 frontend/src/openapi/models/personalDashboardProjectDetailsSchema.ts create mode 100644 frontend/src/openapi/models/personalDashboardProjectDetailsSchemaLatestEventsItem.ts create mode 100644 frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwners.ts create mode 100644 frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItem.ts create mode 100644 frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOf.ts create mode 100644 frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfOwnerType.ts create mode 100644 frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThree.ts create mode 100644 frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThreeOwnerType.ts create mode 100644 frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfSixItem.ts create mode 100644 frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfSixItemOwnerType.ts rename frontend/src/openapi/models/{personalDashboardSchemaProjectsItemRolesItem.ts => personalDashboardProjectDetailsSchemaRolesItem.ts} (50%) rename frontend/src/openapi/models/{personalDashboardSchemaProjectsItemRolesItemType.ts => personalDashboardProjectDetailsSchemaRolesItemType.ts} (53%) delete mode 100644 frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwners.ts delete mode 100644 frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItem.ts delete mode 100644 frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOf.ts delete mode 100644 frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfOwnerType.ts delete mode 100644 frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThree.ts delete mode 100644 frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThreeOwnerType.ts delete mode 100644 frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfSixItem.ts delete mode 100644 frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfSixItemOwnerType.ts diff --git a/frontend/src/component/personalDashboard/LatestProjectEvents.tsx b/frontend/src/component/personalDashboard/LatestProjectEvents.tsx new file mode 100644 index 000000000000..858259807e0c --- /dev/null +++ b/frontend/src/component/personalDashboard/LatestProjectEvents.tsx @@ -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 ( + + ); +}; diff --git a/frontend/src/component/personalDashboard/PersonalDashboard.tsx b/frontend/src/component/personalDashboard/PersonalDashboard.tsx index 6be71d281cfd..48d802937fc0 100644 --- a/frontend/src/component/personalDashboard/PersonalDashboard.tsx +++ b/frontend/src/component/personalDashboard/PersonalDashboard.tsx @@ -29,6 +29,8 @@ import type { import { FlagExposure } from 'component/feature/FeatureView/FeatureOverview/FeatureLifecycle/FlagExposure'; import { RoleAndOwnerInfo } from './RoleAndOwnerInfo'; import { ContentGridNoProjects } from './ContentGridNoProjects'; +import { LatestProjectEvents } from './LatestProjectEvents'; +import { usePersonalDashboardProjectDetails } from 'hooks/api/getters/usePersonalDashboard/usePersonalDashboardProjectDetails'; const ScreenExplanation = styled(Typography)(({ theme }) => ({ marginTop: theme.spacing(1), @@ -122,11 +124,11 @@ const SpacedGridItem = styled(Grid)(({ theme }) => ({ })); const useProjects = (projects: PersonalDashboardSchemaProjectsItem[]) => { - const [activeProject, setActiveProject] = useState(projects[0]?.name); + const [activeProject, setActiveProject] = useState(projects[0]?.id); useEffect(() => { if (!activeProject && projects.length > 0) { - setActiveProject(projects[0].name); + setActiveProject(projects[0].id); } }, [JSON.stringify(projects)]); @@ -185,14 +187,13 @@ export const PersonalDashboard = () => { personalDashboard?.projects || [], ); + // TODO: since we use this one only for the onboarding status, we can add th eonboarding status to the personal dashboard project details API const { project: activeProjectOverview, loading } = useProjectOverview(activeProject); + const { personalDashboardProjectDetails, loading: loadingDetails } = + usePersonalDashboardProjectDetails(activeProject); - const onboardingCompleted = Boolean( - !loading && - activeProject && - activeProjectOverview?.onboardingStatus.status === 'onboarded', - ); + const stage = activeProjectOverview?.onboardingStatus.status ?? 'loading'; const [welcomeDialog, setWelcomeDialog] = useLocalStorageState< 'seen' | 'not_seen' @@ -250,10 +251,10 @@ export const PersonalDashboard = () => { - setActiveProject(project.name) + setActiveProject(project.id) } > @@ -272,7 +273,7 @@ export const PersonalDashboard = () => { /> - {project.name === activeProject ? ( + {project.id === activeProject ? ( @@ -284,14 +285,23 @@ export const PersonalDashboard = () => { - {onboardingCompleted ? ( + {stage === 'onboarded' ? ( ) : activeProject ? ( ) : null} - {activeProject ? ( + {stage === 'onboarded' && + personalDashboardProjectDetails ? ( + + ) : null} + {stage === 'onboarding-started' || + stage === 'first-flag-created' ? ( ) : null} diff --git a/frontend/src/hooks/api/getters/usePersonalDashboard/usePersonalDashboardProjectDetails.ts b/frontend/src/hooks/api/getters/usePersonalDashboard/usePersonalDashboardProjectDetails.ts new file mode 100644 index 000000000000..7de664d2ce81 --- /dev/null +++ b/frontend/src/hooks/api/getters/usePersonalDashboard/usePersonalDashboardProjectDetails.ts @@ -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()); +}; diff --git a/frontend/src/openapi/models/getPersonalDashboardProjectDetails401.ts b/frontend/src/openapi/models/getPersonalDashboardProjectDetails401.ts new file mode 100644 index 000000000000..edd1365c60fb --- /dev/null +++ b/frontend/src/openapi/models/getPersonalDashboardProjectDetails401.ts @@ -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; +}; diff --git a/frontend/src/openapi/models/getPersonalDashboardProjectDetails403.ts b/frontend/src/openapi/models/getPersonalDashboardProjectDetails403.ts new file mode 100644 index 000000000000..e8bf0c521efa --- /dev/null +++ b/frontend/src/openapi/models/getPersonalDashboardProjectDetails403.ts @@ -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; +}; diff --git a/frontend/src/openapi/models/getPersonalDashboardProjectDetails404.ts b/frontend/src/openapi/models/getPersonalDashboardProjectDetails404.ts new file mode 100644 index 000000000000..be62f6061302 --- /dev/null +++ b/frontend/src/openapi/models/getPersonalDashboardProjectDetails404.ts @@ -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; +}; diff --git a/frontend/src/openapi/models/index.ts b/frontend/src/openapi/models/index.ts index b7ced9f91d61..534da4873270 100644 --- a/frontend/src/openapi/models/index.ts +++ b/frontend/src/openapi/models/index.ts @@ -693,6 +693,9 @@ export * from './getPats404'; export * from './getPersonalDashboard401'; export * from './getPersonalDashboard403'; export * from './getPersonalDashboard404'; +export * from './getPersonalDashboardProjectDetails401'; +export * from './getPersonalDashboardProjectDetails403'; +export * from './getPersonalDashboardProjectDetails404'; export * from './getPlayground400'; export * from './getPlayground401'; export * from './getProfile401'; @@ -900,19 +903,21 @@ export * from './patchSchemaOp'; export * from './patchesSchema'; export * from './patsSchema'; export * from './permissionSchema'; +export * from './personalDashboardProjectDetailsSchema'; +export * from './personalDashboardProjectDetailsSchemaLatestEventsItem'; +export * from './personalDashboardProjectDetailsSchemaOwners'; +export * from './personalDashboardProjectDetailsSchemaOwnersOneOfItem'; +export * from './personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOf'; +export * from './personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfOwnerType'; +export * from './personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThree'; +export * from './personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThreeOwnerType'; +export * from './personalDashboardProjectDetailsSchemaOwnersOneOfSixItem'; +export * from './personalDashboardProjectDetailsSchemaOwnersOneOfSixItemOwnerType'; +export * from './personalDashboardProjectDetailsSchemaRolesItem'; +export * from './personalDashboardProjectDetailsSchemaRolesItemType'; export * from './personalDashboardSchema'; export * from './personalDashboardSchemaFlagsItem'; export * from './personalDashboardSchemaProjectsItem'; -export * from './personalDashboardSchemaProjectsItemOwners'; -export * from './personalDashboardSchemaProjectsItemOwnersOneOfItem'; -export * from './personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOf'; -export * from './personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfOwnerType'; -export * from './personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThree'; -export * from './personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThreeOwnerType'; -export * from './personalDashboardSchemaProjectsItemOwnersOneOfSixItem'; -export * from './personalDashboardSchemaProjectsItemOwnersOneOfSixItemOwnerType'; -export * from './personalDashboardSchemaProjectsItemRolesItem'; -export * from './personalDashboardSchemaProjectsItemRolesItemType'; export * from './playgroundConstraintSchema'; export * from './playgroundConstraintSchemaOperator'; export * from './playgroundFeatureSchema'; diff --git a/frontend/src/openapi/models/personalDashboardProjectDetailsSchema.ts b/frontend/src/openapi/models/personalDashboardProjectDetailsSchema.ts new file mode 100644 index 000000000000..f41797a47c96 --- /dev/null +++ b/frontend/src/openapi/models/personalDashboardProjectDetailsSchema.ts @@ -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[]; +} diff --git a/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaLatestEventsItem.ts b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaLatestEventsItem.ts new file mode 100644 index 000000000000..20fb888b6807 --- /dev/null +++ b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaLatestEventsItem.ts @@ -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; +}; diff --git a/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwners.ts b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwners.ts new file mode 100644 index 000000000000..6a7b861a9842 --- /dev/null +++ b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwners.ts @@ -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[]; diff --git a/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItem.ts b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItem.ts new file mode 100644 index 000000000000..7450bb7fd2a5 --- /dev/null +++ b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItem.ts @@ -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; diff --git a/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOf.ts b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOf.ts new file mode 100644 index 000000000000..cd4a1860fb97 --- /dev/null +++ b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOf.ts @@ -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; +}; diff --git a/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfOwnerType.ts b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfOwnerType.ts new file mode 100644 index 000000000000..8c8339261d03 --- /dev/null +++ b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfOwnerType.ts @@ -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; diff --git a/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThree.ts b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThree.ts new file mode 100644 index 000000000000..4efe72e9a95e --- /dev/null +++ b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThree.ts @@ -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; +}; diff --git a/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThreeOwnerType.ts b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThreeOwnerType.ts new file mode 100644 index 000000000000..090510d6a228 --- /dev/null +++ b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOfThreeOwnerType.ts @@ -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; diff --git a/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfSixItem.ts b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfSixItem.ts new file mode 100644 index 000000000000..602742bf8861 --- /dev/null +++ b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfSixItem.ts @@ -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; +}; diff --git a/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfSixItemOwnerType.ts b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfSixItemOwnerType.ts new file mode 100644 index 000000000000..9a6f21dffa01 --- /dev/null +++ b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaOwnersOneOfSixItemOwnerType.ts @@ -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; diff --git a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemRolesItem.ts b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaRolesItem.ts similarity index 50% rename from frontend/src/openapi/models/personalDashboardSchemaProjectsItemRolesItem.ts rename to frontend/src/openapi/models/personalDashboardProjectDetailsSchemaRolesItem.ts index 2a2971cc2134..05256f0b3ab0 100644 --- a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemRolesItem.ts +++ b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaRolesItem.ts @@ -3,16 +3,16 @@ * Do not edit manually. * See `gen:api` script in package.json */ -import type { PersonalDashboardSchemaProjectsItemRolesItemType } from './personalDashboardSchemaProjectsItemRolesItemType'; +import type { PersonalDashboardProjectDetailsSchemaRolesItemType } from './personalDashboardProjectDetailsSchemaRolesItemType'; /** * An Unleash role. */ -export type PersonalDashboardSchemaProjectsItemRolesItem = { +export type PersonalDashboardProjectDetailsSchemaRolesItem = { /** The id of the role */ id: number; /** The name of the role */ name: string; /** The type of the role */ - type: PersonalDashboardSchemaProjectsItemRolesItemType; + type: PersonalDashboardProjectDetailsSchemaRolesItemType; }; diff --git a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemRolesItemType.ts b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaRolesItemType.ts similarity index 53% rename from frontend/src/openapi/models/personalDashboardSchemaProjectsItemRolesItemType.ts rename to frontend/src/openapi/models/personalDashboardProjectDetailsSchemaRolesItemType.ts index 18fbb2e80693..16931c421637 100644 --- a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemRolesItemType.ts +++ b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaRolesItemType.ts @@ -7,11 +7,11 @@ /** * The type of the role */ -export type PersonalDashboardSchemaProjectsItemRolesItemType = - (typeof PersonalDashboardSchemaProjectsItemRolesItemType)[keyof typeof PersonalDashboardSchemaProjectsItemRolesItemType]; +export type PersonalDashboardProjectDetailsSchemaRolesItemType = + (typeof PersonalDashboardProjectDetailsSchemaRolesItemType)[keyof typeof PersonalDashboardProjectDetailsSchemaRolesItemType]; // eslint-disable-next-line @typescript-eslint/no-redeclare -export const PersonalDashboardSchemaProjectsItemRolesItemType = { +export const PersonalDashboardProjectDetailsSchemaRolesItemType = { custom: 'custom', project: 'project', root: 'root', diff --git a/frontend/src/openapi/models/personalDashboardSchemaProjectsItem.ts b/frontend/src/openapi/models/personalDashboardSchemaProjectsItem.ts index 6505a9fdfa2e..47672a5b7a56 100644 --- a/frontend/src/openapi/models/personalDashboardSchemaProjectsItem.ts +++ b/frontend/src/openapi/models/personalDashboardSchemaProjectsItem.ts @@ -3,8 +3,6 @@ * Do not edit manually. * See `gen:api` script in package.json */ -import type { PersonalDashboardSchemaProjectsItemOwners } from './personalDashboardSchemaProjectsItemOwners'; -import type { PersonalDashboardSchemaProjectsItemRolesItem } from './personalDashboardSchemaProjectsItemRolesItem'; export type PersonalDashboardSchemaProjectsItem = { /** The number of features this project has */ @@ -17,11 +15,4 @@ export type PersonalDashboardSchemaProjectsItem = { memberCount: number; /** The name of the project */ name: string; - /** 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?: PersonalDashboardSchemaProjectsItemOwners; - /** - * The list of roles that the user has in this project. - * @minItems 1 - */ - roles?: PersonalDashboardSchemaProjectsItemRolesItem[]; }; diff --git a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwners.ts b/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwners.ts deleted file mode 100644 index 86021277765c..000000000000 --- a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwners.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Generated by Orval - * Do not edit manually. - * See `gen:api` script in package.json - */ -import type { PersonalDashboardSchemaProjectsItemOwnersOneOfItem } from './personalDashboardSchemaProjectsItemOwnersOneOfItem'; -import type { PersonalDashboardSchemaProjectsItemOwnersOneOfSixItem } from './personalDashboardSchemaProjectsItemOwnersOneOfSixItem'; - -/** - * 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 PersonalDashboardSchemaProjectsItemOwners = - | PersonalDashboardSchemaProjectsItemOwnersOneOfItem[] - | PersonalDashboardSchemaProjectsItemOwnersOneOfSixItem[]; diff --git a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItem.ts b/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItem.ts deleted file mode 100644 index 8bc21085733b..000000000000 --- a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItem.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Generated by Orval - * Do not edit manually. - * See `gen:api` script in package.json - */ -import type { PersonalDashboardSchemaProjectsItemOwnersOneOfItemAnyOf } from './personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOf'; -import type { PersonalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThree } from './personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThree'; - -export type PersonalDashboardSchemaProjectsItemOwnersOneOfItem = - | PersonalDashboardSchemaProjectsItemOwnersOneOfItemAnyOf - | PersonalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThree; diff --git a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOf.ts b/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOf.ts deleted file mode 100644 index a1b699323d20..000000000000 --- a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOf.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Generated by Orval - * Do not edit manually. - * See `gen:api` script in package.json - */ -import type { PersonalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfOwnerType } from './personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfOwnerType'; - -export type PersonalDashboardSchemaProjectsItemOwnersOneOfItemAnyOf = { - /** @nullable */ - email?: string | null; - /** @nullable */ - imageUrl?: string | null; - name: string; - ownerType: PersonalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfOwnerType; -}; diff --git a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfOwnerType.ts b/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfOwnerType.ts deleted file mode 100644 index 054ec6a7c21c..000000000000 --- a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfOwnerType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Generated by Orval - * Do not edit manually. - * See `gen:api` script in package.json - */ - -export type PersonalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfOwnerType = - (typeof PersonalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfOwnerType)[keyof typeof PersonalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfOwnerType]; - -// eslint-disable-next-line @typescript-eslint/no-redeclare -export const PersonalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfOwnerType = - { - user: 'user', - } as const; diff --git a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThree.ts b/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThree.ts deleted file mode 100644 index 98d09242d1b9..000000000000 --- a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThree.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Generated by Orval - * Do not edit manually. - * See `gen:api` script in package.json - */ -import type { PersonalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThreeOwnerType } from './personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThreeOwnerType'; - -export type PersonalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThree = { - name: string; - ownerType: PersonalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThreeOwnerType; -}; diff --git a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThreeOwnerType.ts b/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThreeOwnerType.ts deleted file mode 100644 index 62cbe0ce7b98..000000000000 --- a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThreeOwnerType.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Generated by Orval - * Do not edit manually. - * See `gen:api` script in package.json - */ - -export type PersonalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThreeOwnerType = - (typeof PersonalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThreeOwnerType)[keyof typeof PersonalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThreeOwnerType]; - -// eslint-disable-next-line @typescript-eslint/no-redeclare -export const PersonalDashboardSchemaProjectsItemOwnersOneOfItemAnyOfThreeOwnerType = - { - group: 'group', - } as const; diff --git a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfSixItem.ts b/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfSixItem.ts deleted file mode 100644 index d856200e4deb..000000000000 --- a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfSixItem.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Generated by Orval - * Do not edit manually. - * See `gen:api` script in package.json - */ -import type { PersonalDashboardSchemaProjectsItemOwnersOneOfSixItemOwnerType } from './personalDashboardSchemaProjectsItemOwnersOneOfSixItemOwnerType'; - -export type PersonalDashboardSchemaProjectsItemOwnersOneOfSixItem = { - ownerType: PersonalDashboardSchemaProjectsItemOwnersOneOfSixItemOwnerType; -}; diff --git a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfSixItemOwnerType.ts b/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfSixItemOwnerType.ts deleted file mode 100644 index 94fc2ab65a92..000000000000 --- a/frontend/src/openapi/models/personalDashboardSchemaProjectsItemOwnersOneOfSixItemOwnerType.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Generated by Orval - * Do not edit manually. - * See `gen:api` script in package.json - */ - -export type PersonalDashboardSchemaProjectsItemOwnersOneOfSixItemOwnerType = - (typeof PersonalDashboardSchemaProjectsItemOwnersOneOfSixItemOwnerType)[keyof typeof PersonalDashboardSchemaProjectsItemOwnersOneOfSixItemOwnerType]; - -// eslint-disable-next-line @typescript-eslint/no-redeclare -export const PersonalDashboardSchemaProjectsItemOwnersOneOfSixItemOwnerType = { - system: 'system', -} as const; diff --git a/src/lib/features/personal-dashboard/personal-dashboard-service.ts b/src/lib/features/personal-dashboard/personal-dashboard-service.ts index 993424a9adb5..a14045a2a065 100644 --- a/src/lib/features/personal-dashboard/personal-dashboard-service.ts +++ b/src/lib/features/personal-dashboard/personal-dashboard-service.ts @@ -48,6 +48,7 @@ export class PersonalDashboardService { const projects = await this.projectReadModel.getProjectsForAdminUi({ ids: userProjectIds, + archived: false, }); const normalizedProjects = projects.map((project) => ({ diff --git a/src/lib/openapi/spec/personal-dashboard-project-details-schema.ts b/src/lib/openapi/spec/personal-dashboard-project-details-schema.ts index f8fc503dbc67..0aa94d146f27 100644 --- a/src/lib/openapi/spec/personal-dashboard-project-details-schema.ts +++ b/src/lib/openapi/spec/personal-dashboard-project-details-schema.ts @@ -6,7 +6,7 @@ export const personalDashboardProjectDetailsSchema = { type: 'object', description: 'Project details in personal dashboard', additionalProperties: false, - required: ['owners', 'roles'], + required: ['owners', 'roles', 'latestEvents'], properties: { latestEvents: { type: 'array',