From 94de3c19ba3f29ebfdce8c0fba27d6742e6cc2b8 Mon Sep 17 00:00:00 2001 From: William Piers Date: Wed, 5 Jun 2024 16:49:50 +0200 Subject: [PATCH] [3591] Add EditProject subtitle extension point Bug: https://github.com/eclipse-sirius/sirius-web/issues/3591 Signed-off-by: William Piers --- CHANGELOG.adoc | 1 + .../sirius-web-application/src/index.ts | 2 + .../EditProjectNavbar/EditProjectNavbar.tsx | 44 ++++++++++++------- .../EditProjectNavbar.types.ts | 4 +- .../EditProjectNavbarExtensionPoints.tsx | 20 +++++++++ scripts/download-issues-and-pr.mjs | 36 +++++++++++++++ 6 files changed, 90 insertions(+), 17 deletions(-) create mode 100644 packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/EditProjectNavbar/EditProjectNavbarExtensionPoints.tsx create mode 100644 scripts/download-issues-and-pr.mjs diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 19e89226d1..ffd2f553d8 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -82,6 +82,7 @@ This dialog presents diagram elements in a tree and allows to select them and up image:doc/screenshots/diagramFilterView.png[Diagram Filter View, 70%] - https://github.com/eclipse-sirius/sirius-web/issues/3523[#3523] [gantt] Support rounding dates when changing dates from gantt - https://github.com/eclipse-sirius/sirius-web/issues/3655[#3655] [gantt] Support "Delete Task Dependency" tool in gantt +- https://github.com/eclipse-sirius/sirius-web/issues/3591[#3591] [sirius-web] Add EditProject subtitle extension point === Improvements diff --git a/packages/sirius-web/frontend/sirius-web-application/src/index.ts b/packages/sirius-web/frontend/sirius-web-application/src/index.ts index 2a4ec0a630..b3d2389eaf 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/index.ts +++ b/packages/sirius-web/frontend/sirius-web-application/src/index.ts @@ -40,6 +40,8 @@ export { navigationBarRightContributionExtensionPoint, } from './navigationBar/NavigationBarExtensionPoints'; export { routerExtensionPoint } from './router/RouterExtensionPoints'; +export { type EditProjectNavbarSubtitleProps } from './views/edit-project/EditProjectNavbar/EditProjectNavbar.types'; +export { editProjectNavbarSubtitleExtensionPoint } from './views/edit-project/EditProjectNavbar/EditProjectNavbarExtensionPoints'; export { type CreateProjectAreaCardProps } from './views/project-browser/create-projects-area/CreateProjectArea.types'; export { createProjectAreaCardExtensionPoint } from './views/project-browser/create-projects-area/CreateProjectAreaExtensionPoints'; export { projectActionButtonMenuItemExtensionPoint } from './views/project-browser/list-projects-area/ProjectActionButtonExtensionPoints'; diff --git a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/EditProjectNavbar/EditProjectNavbar.tsx b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/EditProjectNavbar/EditProjectNavbar.tsx index a8d3a7936d..0bc5293354 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/EditProjectNavbar/EditProjectNavbar.tsx +++ b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/EditProjectNavbar/EditProjectNavbar.tsx @@ -11,7 +11,7 @@ * Obeo - initial API and implementation *******************************************************************************/ import { gql, useSubscription } from '@apollo/client'; -import { ServerContext, ServerContextValue, Toast } from '@eclipse-sirius/sirius-components-core'; +import { ServerContext, ServerContextValue, Toast, useComponent } from '@eclipse-sirius/sirius-components-core'; import IconButton from '@material-ui/core/IconButton'; import ListItemIcon from '@material-ui/core/ListItemIcon'; import ListItemText from '@material-ui/core/ListItemText'; @@ -32,6 +32,7 @@ import { RenameProjectModal } from '../../../modals/rename-project/RenameProject import { NavigationBar } from '../../../navigationBar/NavigationBar'; import { EditProjectNavbarProps, GQLProjectEventSubscription } from './EditProjectNavbar.types'; +import { editProjectNavbarSubtitleExtensionPoint } from './EditProjectNavbarExtensionPoints'; import { EditProjectNavbarContext, EditProjectNavbarEvent, @@ -63,10 +64,15 @@ const projectEventSubscription = gql` const useEditProjectViewNavbarStyles = makeStyles((theme) => ({ center: { display: 'flex', - flexDirection: 'row', + flexDirection: 'column', alignItems: 'center', }, title: { + display: 'flex', + flexDirection: 'row', + alignItems: 'center', + }, + titleLabel: { marginRight: theme.spacing(2), overflow: 'hidden', textOverflow: 'ellipsis', @@ -163,24 +169,30 @@ export const EditProjectNavbar = ({ project }: EditProjectNavbarProps) => { modal = ; } } + + const { Component: ProjectSubtitle } = useComponent(editProjectNavbarSubtitleExtensionPoint); return ( <>
- - {projectName} - - - - +
+ + {projectName} + + + + +
+
diff --git a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/EditProjectNavbar/EditProjectNavbar.types.ts b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/EditProjectNavbar/EditProjectNavbar.types.ts index b5613dc9e5..9a3e540b21 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/EditProjectNavbar/EditProjectNavbar.types.ts +++ b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/EditProjectNavbar/EditProjectNavbar.types.ts @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2023 Obeo. + * Copyright (c) 2021, 2024 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -17,6 +17,8 @@ export interface EditProjectNavbarProps { project: Project; } +export interface EditProjectNavbarSubtitleProps {} + export interface GQLProjectEventSubscription { projectEvent: GQLProjectEventPayload; } diff --git a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/EditProjectNavbar/EditProjectNavbarExtensionPoints.tsx b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/EditProjectNavbar/EditProjectNavbarExtensionPoints.tsx new file mode 100644 index 0000000000..bfa2278802 --- /dev/null +++ b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/EditProjectNavbar/EditProjectNavbarExtensionPoints.tsx @@ -0,0 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2021, 2024 Obeo. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ + +import { ComponentExtensionPoint } from '@eclipse-sirius/sirius-components-core'; +import { EditProjectNavbarSubtitleProps } from './EditProjectNavbar.types'; + +export const editProjectNavbarSubtitleExtensionPoint: ComponentExtensionPoint = { + identifier: 'editProjectNavbar#subtitle', + FallbackComponent: () => null, +}; diff --git a/scripts/download-issues-and-pr.mjs b/scripts/download-issues-and-pr.mjs new file mode 100644 index 0000000000..eb98001ddc --- /dev/null +++ b/scripts/download-issues-and-pr.mjs @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2024 Obeo. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +const fetch = require("node-fetch"); + +const accessToken = process.env.GITHUB_TOKEN; +const query = ` + query { + repository(owner: "eclipse-sirius", name:"sirius-web") { + issues(states:CLOSED) { + totalCount + } + } + }`; +const variables = {}; + +const response = await fetch("https://api.github.com/graphql", { + method: "POST", + body: JSON.stringify({ query, variables }), + headers: { + Authorization: `Bearer ${accessToken}`, + "Content-type": "application/json; charset=UTF-8", + }, +}); + +const body = await response.json(); +console.log(body);