Skip to content

Commit

Permalink
[cleanup] Improve the code of EditProjectView
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Bégaudeau <[email protected]>
  • Loading branch information
sbegaudeau committed Jun 16, 2024
1 parent fb222e2 commit b6b1069
Show file tree
Hide file tree
Showing 15 changed files with 413 additions and 370 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*******************************************************************************
* 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
*******************************************************************************/
package org.eclipse.sirius.web.application.project.dto;

import jakarta.validation.constraints.NotNull;

/**
* DTO used to represent the nature of a project.
*
* @author sbegaudeau
*/
public record NatureDTO(@NotNull String name) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*******************************************************************************/
package org.eclipse.sirius.web.application.project.dto;

import java.util.List;
import java.util.UUID;

import jakarta.validation.constraints.NotNull;
Expand All @@ -23,5 +24,6 @@
*/
public record ProjectDTO(
@NotNull UUID id,
@NotNull String name) {
@NotNull String name,
@NotNull List<NatureDTO> natures) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*******************************************************************************/
package org.eclipse.sirius.web.application.project.services;

import org.eclipse.sirius.web.application.project.dto.NatureDTO;
import org.eclipse.sirius.web.application.project.services.api.IProjectMapper;
import org.eclipse.sirius.web.domain.boundedcontexts.project.Project;
import org.eclipse.sirius.web.application.project.dto.ProjectDTO;
Expand All @@ -26,6 +27,9 @@
public class ProjectMapper implements IProjectMapper {
@Override
public ProjectDTO toDTO(Project project) {
return new ProjectDTO(project.getId(), project.getName());
var natures = project.getNatures().stream()
.map(nature -> new NatureDTO(nature.name()))
.toList();
return new ProjectDTO(project.getId(), project.getName(), natures);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ type Project {
id: ID!
name: String!
currentEditingContext: EditingContext!
natures: [Nature!]!
}

type Nature {
name: String!
}

type ViewerProjectTemplatesConnection {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export {
export { routerExtensionPoint } from './router/RouterExtensionPoints';
export { type EditProjectNavbarSubtitleProps } from './views/edit-project/EditProjectNavbar/EditProjectNavbar.types';
export { editProjectNavbarSubtitleExtensionPoint } from './views/edit-project/EditProjectNavbar/EditProjectNavbarExtensionPoints';
export { useCurrentProject } from './views/edit-project/useCurrentProject';
export type { UseCurrentProjectValue } from './views/edit-project/useCurrentProject.types';
export type { GQLProject } from './views/edit-project/useProjectAndRepresentationMetadata.types';
export { projectActionButtonMenuItemExtensionPoint } from './views/project-browser/list-projects-area/ProjectActionButtonExtensionPoints';
export { type ProjectRowProps } from './views/project-browser/list-projects-area/ProjectRow.types';
export { projectsTableRowExtensionPoint } from './views/project-browser/list-projects-area/ProjectsTableExtensionPoints';
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -10,11 +10,10 @@
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/

import { Project } from '../EditProjectView.types';
import { GQLProject } from '../useProjectAndRepresentationMetadata.types';

export interface EditProjectNavbarProps {
project: Project;
project: GQLProject;
}

export interface EditProjectNavbarSubtitleProps {}
Expand Down
Loading

0 comments on commit b6b1069

Please sign in to comment.