forked from eclipse-sw360/sw360-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request eclipse-sw360#104 from toshiba/release/create_edit…
…_release_summary feat(release): Create structure folder Edit Release
- Loading branch information
Showing
12 changed files
with
324 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
132
src/app/[locale]/components/editRelease/[id]/releases/EditRelease.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
84 changes: 84 additions & 0 deletions
84
src/app/[locale]/components/editRelease/[id]/releases/ReleaseEditSummary.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
</> | ||
) | ||
} |
69 changes: 69 additions & 0 deletions
69
src/app/[locale]/components/editRelease/[id]/releases/ReleaseEditTabs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters