Skip to content

Commit

Permalink
Merge pull request eclipse-sw360#104 from toshiba/release/create_edit…
Browse files Browse the repository at this point in the history
…_release_summary

feat(release): Create structure folder Edit Release
  • Loading branch information
heliocastro authored Sep 5, 2023
2 parents d609355 + 7e18e42 commit fc224ee
Show file tree
Hide file tree
Showing 12 changed files with 324 additions and 4 deletions.
1 change: 1 addition & 0 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@
"Upload the sources to FOSSology": "Upload the sources to FOSSology",
"Upload SBOM": "Upload SBOM",
"Upload BOM document as": "Upload BOM document as",
"Update Release": "Update Release",
"Usage": "Usage",
"UsageRestrictionsFound": "Usage Restrictions Found",
"User": "User",
Expand Down
1 change: 1 addition & 0 deletions messages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@
"Upload the sources to FOSSology": "ソースをFOSSologyにアップロード",
"Upload SBOM": "Upload SBOM",
"Upload BOM document as": "Upload BOM document as",
"Update Release": "Update Release",
"Usage": "使い方",
"UsageRestrictionsFound": "Usage Restrictions Found",
"Usage Right Available": "利用権あり",
Expand Down
1 change: 1 addition & 0 deletions messages/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@
"Upload the sources to FOSSology": "Tải các nguồn lên FOSSology",
"Upload SBOM": "Upload SBOM",
"Upload BOM document as": "Upload BOM document as",
"Update Release": "Update Release",
"Usage": "Sử dụng",
"UsageRestrictionsFound": "Usage Restrictions Found",
"Usage Right Available": "Quyền sử dụng Có sẵn",
Expand Down
1 change: 1 addition & 0 deletions messages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@
"Uploaded On": "上传时间",
"Upload": "上傳",
"Upload Attachment": "上傳附件",
"Update Release": "Update Release",
"Upload the sources to FOSSology": "上传源到FOSSology",
"Upload SBOM": "Upload SBOM",
"Upload BOM document as": "Upload BOM document as",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const ReleaseOverview = ({ session, componentId }: Props) => {
alt='Fossology'
onClick={() => handleFossologyClearing(id)}
/>
<Link href={'/releases/edit/' + id}>
<Link href={`/components/editRelease/${id}`}>
<FaPencilAlt className={styles['icon-btn']}/>
</Link>
<HiOutlineLink className={styles['icon-btn']} onClick={() => handleLinkToProject(id)} />
Expand Down
26 changes: 26 additions & 0 deletions src/app/[locale]/components/editRelease/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (C) TOSHIBA CORPORATION, 2023. Part of the SW360 Frontend Project.
// Copyright (C) Toshiba Software Development (Vietnam) Co., Ltd., 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
// which is available at https://www.eclipse.org/legal/epl-2.0/

// SPDX-License-Identifier: EPL-2.0
// License-Filename: LICENSE

import { authOptions } from '@/app/api/auth/[...nextauth]/route'
import { getServerSession } from "next-auth/next"
import { Session } from '@/object-types/Session'
import EditRelease from './releases/EditRelease'
interface Context {
params: { id: string }
}

const ReleaseEditPage = async ({ params }: Context) => {
const session: Session = await getServerSession(authOptions);
const releaseId = params.id;

return <EditRelease session={session} releaseId={releaseId} />
}

export default ReleaseEditPage
132 changes: 132 additions & 0 deletions src/app/[locale]/components/editRelease/[id]/releases/EditRelease.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
// Copyright (C) TOSHIBA CORPORATION, 2023. Part of the SW360 Frontend Project.
// Copyright (C) Toshiba Software Development (Vietnam) Co., Ltd., 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
// which is available at https://www.eclipse.org/legal/epl-2.0/

// SPDX-License-Identifier: EPL-2.0
// License-Filename: LICENSE

'use client'
import { PageButtonHeader, SideBar } from '@/components/sw360'
import { Session } from '@/object-types/Session'
import CommonTabIds from '@/object-types/enums/CommonTabsIds'
import { useState } from 'react'
import ReleaseEditTabs from './ReleaseEditTabs'
import ReleaseEditSummary from './ReleaseEditSummary'
import Vendor from '@/object-types/Vendor'
import Licenses from '@/object-types/Licenses'
import Moderators from '@/object-types/Moderators'
import ReleasePayload from '@/object-types/ReleasePayload'

interface Props {
session?: Session
releaseId?: string
}

const EditRelease = ({ session, releaseId }: Props) => {
const [selectedTab, setSelectedTab] = useState<string>(CommonTabIds.SUMMARY)
const [tabList, setTabList] = useState(ReleaseEditTabs.WITH_COMMERCIAL_DETAILS)

const [releasePayload, setReleasePayload] = useState<ReleasePayload>({
name: '',
cpeid: '',
version: '',
componentId: '',
releaseDate: '',
externalIds: null,
additionalData: null,
mainlineState: 'OPEN',
contributors: null,
createdOn: '',
createBy: '',
modifiedBy: '',
modifiedOn: '',
moderators: null,
roles: null,
mainLicenseIds: null,
otherLicenseIds: null,
vendorId: '',
languages: null,
operatingSystems: null,
softwarePlatforms: null,
sourceCodeDownloadurl: '',
binaryDownloadurl: '',
repository: null,
releaseIdToRelationship: null,
cotsDetails: null,
})

const [vendor, setVendor] = useState<Vendor>({
id: '',
fullName: '',
})

const [mainLicensesId, setMainLicensesId] = useState<Licenses>({
id: null,
fullName: '',
})

const [otherLicensesId, setOtherLicensesId] = useState<Licenses>({
id: null,
fullName: '',
})

const [contributor, setContributor] = useState<Moderators>({
emails: null,
fullName: '',
})

const [moderator, setModerator] = useState<Moderators>({
emails: null,
fullName: '',
})

const headerButtons = {
'Update Release': { link: '', type: 'primary' },
'Delete Release': {
link: '/releases/detail/' + releaseId,
type: 'danger',
},
Cancel: { link: '/releases/detail/' + releaseId, type: 'secondary' },
}

return (
<>
{' '}
<div className='container' style={{ maxWidth: '98vw', marginTop: '10px' }}>
<div className='row'>
<div className='col-2 sidebar'>
<SideBar selectedTab={selectedTab} setSelectedTab={setSelectedTab} tabList={tabList} />
</div>
<div className='col'>
<div className='row' style={{ marginBottom: '20px' }}>
<PageButtonHeader buttons={headerButtons} title='releaseName'></PageButtonHeader>
</div>
<div className='row' hidden={selectedTab !== CommonTabIds.SUMMARY ? true : false}>
<ReleaseEditSummary
session={session}
releaseId={releaseId}
releasePayload={releasePayload}
setReleasePayload={setReleasePayload}
vendor={vendor}
setVendor={setVendor}
mainLicensesId={mainLicensesId}
setMainLicensesId={setMainLicensesId}
otherLicensesId={otherLicensesId}
setOtherLicensesId={setOtherLicensesId}
contributor={contributor}
setContributor={setContributor}
moderator={moderator}
setModerator={setModerator}
/>
</div>
</div>
</div>
</div>
</>
)
}

export default EditRelease
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Copyright (C) TOSHIBA CORPORATION, 2023. Part of the SW360 Frontend Project.
// Copyright (C) Toshiba Software Development (Vietnam) Co., Ltd., 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
// which is available at https://www.eclipse.org/legal/epl-2.0/

// SPDX-License-Identifier: EPL-2.0
// License-Filename: LICENSE

'use client'

import ReleaseSummary from '@/components/ReleaseSummary/ReleaseSummary'
import Licenses from '@/object-types/Licenses'
import Moderators from '@/object-types/Moderators'
import ReleasePayload from '@/object-types/ReleasePayload'
import { Session } from '@/object-types/Session'
import Vendor from '@/object-types/Vendor'

interface Props {
session?: Session
release?: any
releaseId?: string
releasePayload?: ReleasePayload
setReleasePayload?: React.Dispatch<React.SetStateAction<ReleasePayload>>
vendor?: Vendor
setVendor?: React.Dispatch<React.SetStateAction<Vendor>>
mainLicensesId?: Licenses
setMainLicensesId?: React.Dispatch<React.SetStateAction<Licenses>>
otherLicensesId?: Licenses
setOtherLicensesId?: React.Dispatch<React.SetStateAction<Licenses>>
contributor?: Moderators
setContributor?: React.Dispatch<React.SetStateAction<Moderators>>
moderator?: Moderators
setModerator?: React.Dispatch<React.SetStateAction<Moderators>>
}

export default function ReleaseEditSummary({
session,
releaseId,
releasePayload,
setReleasePayload,
vendor,
setVendor,
mainLicensesId,
setMainLicensesId,
otherLicensesId,
setOtherLicensesId,
contributor,
setContributor,
moderator,
setModerator,
}: Props) {
return (
<>
<form
action=''
id='form_submit'
method='post'
onSubmit={(e) => {
e.preventDefault()
}}
>
<div className='col' style={{ fontSize: '0.875rem' }}>
<ReleaseSummary
session={session}
releasePayload={releasePayload}
setReleasePayload={setReleasePayload}
vendor={vendor}
setVendor={setVendor}
mainLicensesId={mainLicensesId}
setMainLicensesId={setMainLicensesId}
otherLicensesId={otherLicensesId}
setOtherLicensesId={setOtherLicensesId}
contributor={contributor}
setContributor={setContributor}
moderator={moderator}
setModerator={setModerator}
/>
</div>
</form>
</>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright (C) TOSHIBA CORPORATION, 2023. Part of the SW360 Frontend Project.
// Copyright (C) Toshiba Software Development (Vietnam) Co., Ltd., 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
// which is available at https://www.eclipse.org/legal/epl-2.0/

// SPDX-License-Identifier: EPL-2.0
// License-Filename: LICENSE

import CommonTabIds from '@/object-types/enums/CommonTabsIds'
import ReleaseTabIds from '@/object-types/enums/ReleaseTabIds'

const WITHOUT_COMMERCIAL_DETAILS = [
{
id: CommonTabIds.SUMMARY,
name: 'Summary',
},
{
id: ReleaseTabIds.LINKED_RELEASES,
name: 'Linked Releases',
},
{
id: ReleaseTabIds.CLEARING_DETAILS,
name: 'Clearing Details',
},
{
id: ReleaseTabIds.ECC_DETAILS,
name: 'ECC Details',
},
{
id: CommonTabIds.ATTACHMENTS,
name: 'Attachments',
}
]

const WITH_COMMERCIAL_DETAILS = [
{
id: CommonTabIds.SUMMARY,
name: 'Summary',
},
{
id: ReleaseTabIds.LINKED_RELEASES,
name: 'Linked Releases',
},
{
id: ReleaseTabIds.CLEARING_DETAILS,
name: 'Clearing Details',
},
{
id: ReleaseTabIds.ECC_DETAILS,
name: 'ECC Details',
},
{
id: CommonTabIds.ATTACHMENTS,
name: 'Attachments',
},
{
id: ReleaseTabIds.COMMERCIAL_DETAILS,
name: 'Commercial Details',
}
]

const ReleaseEditTabs = {
WITHOUT_COMMERCIAL_DETAILS,
WITH_COMMERCIAL_DETAILS
}

export default ReleaseEditTabs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const DetailOverview = ({ session, releaseId }: Props) => {
}

const headerButtons = {
'Edit release': { link: '', type: 'primary' },
'Edit release': { link: `/components/editRelease/${releaseId}`, type: 'primary' },
'Link To Project': { link: '', type: 'secondary', onClick: () => { setLinkProjectModalShow(true) } },
Merge: { link: '', type: 'secondary' },
Subscribe: { link: '', type: 'outline-success' },
Expand Down
4 changes: 2 additions & 2 deletions src/components/ReleaseSummary/ReleaseSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import ModeratorsDialog from '../sw360/SearchModerators/ModeratorsDialog'
import OtherLicensesDialog from '../sw360/SearchOtherLicenses/OtherLicensesDialog'
interface Props {
session?: Session
releasePayload: ReleasePayload
setReleasePayload: React.Dispatch<React.SetStateAction<ReleasePayload>>
releasePayload?: ReleasePayload
setReleasePayload?: React.Dispatch<React.SetStateAction<ReleasePayload>>
vendor?: Vendor
setVendor?: React.Dispatch<React.SetStateAction<Vendor>>
mainLicensesId?: Licenses
Expand Down
5 changes: 5 additions & 0 deletions src/object-types/ReleasePayload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ export default interface ReleasePayload {
releaseDate?: string
externalIds?: any
additionalData?: any
clearingState?:string
createdOn?: string
createBy?: string
modifiedBy?: string
modifiedOn?: string
mainlineState?: string
contributors?: string[]
moderators?: string[]
Expand Down

0 comments on commit fc224ee

Please sign in to comment.