Skip to content

Commit

Permalink
feat(edit_page): Added administration tab under edit project page
Browse files Browse the repository at this point in the history
  • Loading branch information
amritkv committed Feb 19, 2024
1 parent 0be3e81 commit f1d5698
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 16 deletions.
36 changes: 33 additions & 3 deletions src/app/[locale]/projects/edit/[id]/components/EditProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import Administration from '@/components/ProjectAddSummary/Administration'
import LinkedReleasesAndProjects from '@/components/ProjectAddSummary/LinkedReleasesAndProjects'
import Summary from '@/components/ProjectAddSummary/Summary'
import { HttpStatus, InputKeyValue, Project, ToastData, Vendor, ProjectSummaryPayload } from '@/object-types'
import { HttpStatus, InputKeyValue, Project, ToastData, Vendor, ProjectPayload } from '@/object-types'
import { ApiUtils, CommonUtils } from '@/utils'
import { signOut, useSession } from 'next-auth/react'
import { useTranslations } from 'next-intl'
Expand Down Expand Up @@ -48,7 +48,7 @@ function EditProject({ projectId }: { projectId: string }) {

const [additionalRoles, setAdditionalRoles] = useState<InputKeyValue[]>([])

const [projectPayload, setProjectPayload] = useState<ProjectSummaryPayload>({
const [projectPayload, setProjectPayload] = useState<ProjectPayload>({
name: '',
version: '',
visibility: 'EVERYONE',
Expand All @@ -64,6 +64,21 @@ function EditProject({ projectId }: { projectId: string }) {
additionalData: {},
externalIds: null,
roles: null,
clearingState : '',
businessUnit : '',
preevaluationDeadline : '',
clearingSummary : '',
specialRisksOSS : '',
generalRisks3rdParty : '',
specialRisks3rdParty : '',
deliveryChannels : '',
remarksAdditionalRequirements : '',
state : '',
systemTestStart : '',
systemTestEnd : '',
deliveryStart : '',
phaseOutSince : '',
licenseInfoHeaderText : '',
})

const [toastData, setToastData] = useState<ToastData>({
Expand Down Expand Up @@ -146,7 +161,7 @@ function EditProject({ projectId }: { projectId: string }) {
setAdditionalRoles(CommonUtils.convertObjectToMapRoles(project.roles))
}

const projectPayloadData: ProjectSummaryPayload = {
const projectPayloadData: ProjectPayload = {
name: project.name,
version: project.version,
visibility: project.visibility,
Expand All @@ -161,6 +176,21 @@ function EditProject({ projectId }: { projectId: string }) {
externalUrls:project.externalUrls,
additionalData: project.additionalData,
roles: CommonUtils.convertRoles(CommonUtils.convertObjectToMapRoles(project.roles)),
clearingState: project.clearingState,
businessUnit: project.businessUnit,
preevaluationDeadline: project.preevaluationDeadline,
clearingSummary: project.clearingSummary,
specialRisksOSS: project.specialRisksOSS,
generalRisks3rdParty: project.generalRisks3rdParty,
specialRisks3rdParty: project.specialRisks3rdParty,
deliveryChannels: project.deliveryChannels,
remarksAdditionalRequirements: project.remarksAdditionalRequirements,
state: project.state,
systemTestStart: project.systemTestStart,
systemTestEnd: project.systemTestEnd,
deliveryStart: project.deliveryStart,
phaseOutSince: project.phaseOutSince,
licenseInfoHeaderText: project.licenseInfoHeaderText
}
setProjectPayload(projectPayloadData)
})
Expand Down
6 changes: 3 additions & 3 deletions src/components/ProjectAddSummary/Administration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

'use client'

import { Project } from '@/object-types'
import { ProjectPayload } from '@/object-types'
import Clearing from './component/Administration/Clearing'
import LicenseInfoHeader from './component/Administration/LicenseInfoHeader'
import Lifecycle from './component/Administration/LifeCycle'

interface Props {
projectPayload: Project
setProjectPayload: React.Dispatch<React.SetStateAction<Project>>
projectPayload: ProjectPayload
setProjectPayload: React.Dispatch<React.SetStateAction<ProjectPayload>>
}

export default function Administration({ projectPayload, setProjectPayload }: Props) {
Expand Down
6 changes: 3 additions & 3 deletions src/components/ProjectAddSummary/Summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import { useTranslations } from 'next-intl'

import { AddtionalDataType, DocumentTypes, InputKeyValue, ProjectSummaryPayload, RolesType, Vendor } from '@/object-types'
import { AddtionalDataType, DocumentTypes, InputKeyValue, ProjectPayload, RolesType, Vendor } from '@/object-types'
import { AddAdditionalRoles, AddKeyValue } from 'next-sw360'
import Roles from './Roles/Roles'
import GeneralInformation from './component/Summary/GeneralInformation'
Expand All @@ -22,15 +22,15 @@ interface Props {
externalIds: InputKeyValue[]
additionalData: InputKeyValue[]
additionalRoles?: InputKeyValue[]
projectPayload: ProjectSummaryPayload
projectPayload: ProjectPayload
setVendor: React.Dispatch<React.SetStateAction<Vendor>>
setExternalUrls: React.Dispatch<React.SetStateAction<InputKeyValue[]>>
setExternalUrlsData: AddtionalDataType
setExternalIds: React.Dispatch<React.SetStateAction<InputKeyValue[]>>
setExternalIdsData: AddtionalDataType
setAdditionalData: React.Dispatch<React.SetStateAction<InputKeyValue[]>>
setAdditionalDataObject: AddtionalDataType
setProjectPayload: React.Dispatch<React.SetStateAction<ProjectSummaryPayload>>
setProjectPayload: React.Dispatch<React.SetStateAction<ProjectPayload>>
setAdditionalRoles?: React.Dispatch<React.SetStateAction<InputKeyValue[]>>
setDataAdditionalRoles?: RolesType
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import { useTranslations } from 'next-intl'
import { Dispatch, SetStateAction, useCallback, useState } from 'react'
import { GiCancel } from 'react-icons/gi'

import { ProjectSummaryPayload, Vendor } from '@/object-types'
import { ProjectPayload, Vendor } from '@/object-types'
import { ShowInfoOnHover, VendorDialog } from 'next-sw360'

interface Param {
vendor: Vendor
setVendor: Dispatch<SetStateAction<Vendor>>
projectPayload: ProjectSummaryPayload
setProjectPayload: Dispatch<SetStateAction<ProjectSummaryPayload>>
projectPayload: ProjectPayload
setProjectPayload: Dispatch<SetStateAction<ProjectPayload>>
}

export default function GeneralInformation({ vendor, setVendor, projectPayload, setProjectPayload }: Param) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// SPDX-License-Identifier: EPL-2.0
// License-Filename: LICENSE

interface ProjectSummaryPayload {
interface ProjectPayload {
name: string
version?: string
visibility?: string
Expand All @@ -23,6 +23,21 @@ interface ProjectSummaryPayload {
externalUrls?: { [k: string]: string }
additionalData?: { [k: string]: string }
externalIds?: { [k: string]: string }
clearingState?: string
businessUnit?: string
preevaluationDeadline?: string
clearingSummary?: string
specialRisksOSS?: string
generalRisks3rdParty?: string
specialRisks3rdParty?: string
deliveryChannels?: string
remarksAdditionalRequirements?: string
state?: string
systemTestStart?: string
systemTestEnd?: string
deliveryStart?: string
phaseOutSince?: string
licenseInfoHeaderText?: string
}

export default ProjectSummaryPayload
export default ProjectPayload
5 changes: 3 additions & 2 deletions src/object-types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) Helio Chissini de Castro, 2023. Part of the SW360 Frontend Project.
// Copyright (C) Siemens AG, 2023. Part of the SW360 Frontend Project.

// This program and the accompanying materials are made
// available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -40,7 +41,7 @@ import OAuthClient from './OAuthClient'
import Package from './Package'
import Preferences from './Preferences'
import Project from './Project'
import ProjectSummaryPayload from './ProjectSummaryPayload'
import ProjectPayload from './ProjectPayload'
import ProjectReleaseEcc from './ProjectReleaseEcc'
import { ProjectData, ProjectVulnerability } from './ProjectVulnerabilityTypes'
import Release from './Release'
Expand Down Expand Up @@ -95,7 +96,7 @@ export type {
Package,
Project,
ProjectData,
ProjectSummaryPayload,
ProjectPayload,
ProjectReleaseEcc,
ProjectVulnerability,
Release,
Expand Down

0 comments on commit f1d5698

Please sign in to comment.