From cf8e6deaeb5d9d538ca04a4dc3c60db33052bf43 Mon Sep 17 00:00:00 2001 From: tuannn2 Date: Mon, 28 Aug 2023 16:59:27 +0700 Subject: [PATCH 1/4] feat(release): Add release - Add search Moderators dialog Signed-off-by: tuannn2 --- .../ReleaseSummary/ReleaseSummary.tsx | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/components/ReleaseSummary/ReleaseSummary.tsx b/src/components/ReleaseSummary/ReleaseSummary.tsx index aab63a92..55050a58 100644 --- a/src/components/ReleaseSummary/ReleaseSummary.tsx +++ b/src/components/ReleaseSummary/ReleaseSummary.tsx @@ -84,6 +84,8 @@ const ReleaseSummary = ({ const handleClickSearchVendor = useCallback(() => setDialogOpenVendor(true), []) const [dialogOpenContributors, setDialogOpenContributors] = useState(false) const handleClickSearchContributors = useCallback(() => setDialogOpenContributors(true), []) + const [dialogOpenModerators, setDialogOpenModerators] = useState(false) + const handleClickSearchModerators = useCallback(() => setDialogOpenModerators(true), []) const setMainLicenses = (licenseResponse: Licenses) => { const mainLicenses: Licenses = { @@ -152,6 +154,18 @@ const ReleaseSummary = ({ }) } + const setModerators = (moderatorsResponse: Moderators) => { + const moderators: Moderators = { + emails: moderatorsResponse.emails, + fullName: moderatorsResponse.fullName, + } + setModerator(moderators) + setReleasePayload({ + ...releasePayload, + moderators: moderators.emails, + }) + } + return ( <>
@@ -477,8 +491,15 @@ const ReleaseSummary = ({ aria-describedby='Moderators' readOnly={true} name='moderators' + onClick={handleClickSearchModerators} value={moderator.fullName ?? ''} /> +

From 7b6dab106fbf947acba61d8abac08a95635050cb Mon Sep 17 00:00:00 2001 From: tuannn2 Date: Mon, 28 Aug 2023 17:03:20 +0700 Subject: [PATCH 2/4] feat(release): Add release - Get data Additional Roles Signed-off-by: tuannn2 --- .../add/releases/ReleaseAddSummary.tsx | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/app/[locale]/components/edit/[id]/release/add/releases/ReleaseAddSummary.tsx b/src/app/[locale]/components/edit/[id]/release/add/releases/ReleaseAddSummary.tsx index c03ee06e..5b0b133b 100644 --- a/src/app/[locale]/components/edit/[id]/release/add/releases/ReleaseAddSummary.tsx +++ b/src/app/[locale]/components/edit/[id]/release/add/releases/ReleaseAddSummary.tsx @@ -60,7 +60,36 @@ export default function ReleaseAddSummary({ setReleaseRepository, }: Props) { const t = useTranslations(COMMON_NAMESPACE) + const [roles, setRoles] = useState([]) + const setDataRoles = (roles: Input[]) => { + const roleDatas = convertRoles(roles) + setReleasePayload({ + ...releasePayload, + roles: roleDatas, + }) + } + + const convertRoles = (datas: any[]) => { + const contributors: string[] = [] + const commiters: string[] = [] + const expecters: string[] = [] + datas.forEach((data) => { + if (data.key === 'Contributor') { + contributors.push(data.value) + } else if (data.key === 'Committer') { + commiters.push(data.value) + } else if (data.key === 'Expert') { + expecters.push(data.value) + } + }) + const roles = { + Contributor: contributors, + Committer: commiters, + Expert: expecters, + } + return roles + } return ( <>
- +
From 5e8630417d9c69ee3efda085347298ca3a73a87d Mon Sep 17 00:00:00 2001 From: tuannn2 Date: Mon, 28 Aug 2023 17:06:13 +0700 Subject: [PATCH 3/4] feat(release): Add release - Get data External ids, Additional Data Signed-off-by: tuannn2 --- .../add/releases/ReleaseAddSummary.tsx | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/app/[locale]/components/edit/[id]/release/add/releases/ReleaseAddSummary.tsx b/src/app/[locale]/components/edit/[id]/release/add/releases/ReleaseAddSummary.tsx index 5b0b133b..fd7cc4ce 100644 --- a/src/app/[locale]/components/edit/[id]/release/add/releases/ReleaseAddSummary.tsx +++ b/src/app/[locale]/components/edit/[id]/release/add/releases/ReleaseAddSummary.tsx @@ -61,6 +61,8 @@ export default function ReleaseAddSummary({ }: Props) { const t = useTranslations(COMMON_NAMESPACE) const [roles, setRoles] = useState([]) + const [externalIds, setExternalIds] = useState([]) + const [addtionalData, setAddtionalData] = useState([]) const setDataRoles = (roles: Input[]) => { const roleDatas = convertRoles(roles) @@ -90,6 +92,22 @@ export default function ReleaseAddSummary({ } return roles } + + const setDataAddtionalData = (additionalDatas: Map) => { + const obj = Object.fromEntries(additionalDatas) + setReleasePayload({ + ...releasePayload, + additionalData: obj, + }) + } + + const setDataExternalIds = (externalIds: Map) => { + const obj = Object.fromEntries(externalIds) + setReleasePayload({ + ...releasePayload, + externalIds: obj, + }) + } return ( <>
- +
- +
From 366d8dd08aa4a6faa1aaf1e255b263e2a5051405 Mon Sep 17 00:00:00 2001 From: tuannn2 Date: Mon, 28 Aug 2023 17:13:57 +0700 Subject: [PATCH 4/4] feat(release): Add release - Get data Release Repository Signed-off-by: tuannn2 --- messages/en.json | 2 + messages/ja.json | 2 + messages/vi.json | 2 + messages/zh.json | 2 + .../add/releases/ReleaseAddSummary.tsx | 7 ++- .../LinkedReleases/LinkedRelesaes.tsx | 4 +- .../ReleaseRepository/ReleaseRepository.tsx | 45 +++++++++++++++++-- .../ReleaseSummary/ReleaseSummary.tsx | 8 ++-- .../RolesInformation.tsx | 4 +- ...torsDiaglog.tsx => ContributorsDialog.tsx} | 4 +- ...esDiaglog.tsx => LinkedReleasesDialog.tsx} | 4 +- ...ratorsDiaglog.tsx => ModeratorsDialog.tsx} | 4 +- 12 files changed, 70 insertions(+), 18 deletions(-) rename src/components/sw360/SearchContributors/{ContributorsDiaglog.tsx => ContributorsDialog.tsx} (97%) rename src/components/sw360/SearchLinkedReleases/{LinkedReleasesDiaglog.tsx => LinkedReleasesDialog.tsx} (97%) rename src/components/sw360/SearchModerators/{ModeratorsDiaglog.tsx => ModeratorsDialog.tsx} (97%) diff --git a/messages/en.json b/messages/en.json index b07aeaa8..0404c3b3 100644 --- a/messages/en.json +++ b/messages/en.json @@ -270,6 +270,7 @@ "Learn more about the CPE ID format": "Learn more about the CPE ID format", "Learn more about mainline states": "Learn more about mainline states", "Learn more about component types": "Learn more about component types", + "Learn more about repository types": "Learn more about repository types", "Languages": "Languages", "Legal evaluation report": "Legal evaluation report", "Licenses": "Licenses", @@ -400,6 +401,7 @@ "Responsible": "Responsible", "Reload Report": "Reload Report", "Requirement document": "Requirement document", + "REPOSITORY_TYPE": "Repository Type", "SAP Design Time Repository (DTR)": "SAP Design Time Repository (DTR)", "SBOM": "SBOM", "Stakeholder": "Stakeholder", diff --git a/messages/ja.json b/messages/ja.json index 6469999b..d85314e0 100644 --- a/messages/ja.json +++ b/messages/ja.json @@ -259,6 +259,7 @@ "Lead Architect": "NOT TRANSLATED", "Learn more about project visibilities": "NOT TRANSLATED", "Learn more about project types": "NOT TRANSLATED", + "Learn more about repository types": "Learn more about repository types", "Languages": "言語", "Legal evaluation report": "法的評価報告書", "License Agreement": "ライセンス契約書", @@ -384,6 +385,7 @@ "Requirement document": "要件文書", "Release name": "リリース名", "Release version": "リリースバージョン", + "REPOSITORY_TYPE": "Repository Type", "SAP Design Time Repository (DTR)": "SAP デザインタイム リポジトリ (DTR)", "SBOM": "SBOM", "Stakeholder": "NOT TRANSLATED", diff --git a/messages/vi.json b/messages/vi.json index 1caba0a5..b7cff874 100644 --- a/messages/vi.json +++ b/messages/vi.json @@ -260,6 +260,7 @@ "Last Name": "NOT TRANSLATED", "Learn more about project visibilities": "NOT TRANSLATED", "Learn more about project types": "NOT TRANSLATED", + "Learn more about repository types": "Learn more about repository types", "Languages": "Ngôn ngữ", "Legal evaluation report": "Báo cáo thẩm định pháp lý", "learn_more_components": "Tìm hiểu thêm về các loại thành phần.", @@ -384,6 +385,7 @@ "Release version": "Phiên bản phát hành", "Revision Control System (RCS)": "Hệ thống kiểm soát sửa đổi (RCS)", "Rational Team Concert": "Buổi hòa nhạc hợp lý của nhóm", + "REPOSITORY_TYPE": "Repository Type", "SBOM": "SBOM", "Stakeholder": "NOT TRANSLATED", "System": "NOT TRANSLATED", diff --git a/messages/zh.json b/messages/zh.json index b82e0c83..a5ac51ca 100644 --- a/messages/zh.json +++ b/messages/zh.json @@ -258,6 +258,7 @@ "Lead Architect": "NOT TRANSLATED", "Learn more about project types": "NOT TRANSLATED", "Learn more about project visibilities": "NOT TRANSLATED", + "Learn more about repository types": "Learn more about repository types", "Languages": "语言", "Legal evaluation report": "法律评估报告", "License Agreement": "许可协议", @@ -381,6 +382,7 @@ "Rational Team Concert": "Rational 团队音乐会", "Release name": "发布名称", "Release version": "發布版本", + "REPOSITORY_TYPE": "Repository Type", "SBOM": "SBOM", "Stakeholder": "NOT TRANSLATED", "System": "NOT TRANSLATED", diff --git a/src/app/[locale]/components/edit/[id]/release/add/releases/ReleaseAddSummary.tsx b/src/app/[locale]/components/edit/[id]/release/add/releases/ReleaseAddSummary.tsx index fd7cc4ce..2e431076 100644 --- a/src/app/[locale]/components/edit/[id]/release/add/releases/ReleaseAddSummary.tsx +++ b/src/app/[locale]/components/edit/[id]/release/add/releases/ReleaseAddSummary.tsx @@ -160,7 +160,12 @@ export default function ReleaseAddSummary({ setMap={setDataAddtionalData} /> - + diff --git a/src/components/LinkedReleases/LinkedRelesaes.tsx b/src/components/LinkedReleases/LinkedRelesaes.tsx index 13f808f4..616b8e1a 100644 --- a/src/components/LinkedReleases/LinkedRelesaes.tsx +++ b/src/components/LinkedReleases/LinkedRelesaes.tsx @@ -18,7 +18,7 @@ import { COMMON_NAMESPACE } from '@/object-types/Constants' import { useCallback, useState } from 'react' import { Session } from '@/object-types/Session' import LinkedRelease from '@/object-types/LinkedRelease' -import LinkedReleasesDiaglog from '../sw360/SearchLinkedReleases/LinkedReleasesDiaglog' +import LinkedReleasesDialog from '../sw360/SearchLinkedReleases/LinkedReleasesDialog' interface Props { session?: Session @@ -42,7 +42,7 @@ const LinkedReleases = ({ session}: Props) => { return ( <>
- { +interface Props { + releasePayload?: ReleasePayload + setReleasePayload?: React.Dispatch> + setReleaseRepository?: React.Dispatch> + releaseRepository?: Repository +} + +const ShowInfoOnHover = ({ text }: { text: string }) => { + return ( + <> + {text}}> + + + + + + ); +}; + +const ReleaseRepository = ({releaseRepository, setReleaseRepository, releasePayload, setReleasePayload }: Props) => { const t = useTranslations(COMMON_NAMESPACE) + const handleInputChange = (e: React.ChangeEvent) => { + setReleaseRepository({ + ...releaseRepository, + [e.target.name]: e.target.value, + }) + setReleasePayload({ + ...releasePayload, + repository: releaseRepository, + }) + } + return ( <>
@@ -34,6 +68,8 @@ const ReleaseRepository = () => { id='repository_type' required name='repositorytype' + value={releaseRepository.repositorytype ?? ''} + onChange={(e) => handleInputChange(e)} > @@ -57,8 +93,9 @@ const ReleaseRepository = () => { -
- (i)Learn more about repository types. +
+ + {t('Learn more about repository types')}.
@@ -73,6 +110,8 @@ const ReleaseRepository = () => { aria-describedby='version' required name='url' + value={releaseRepository.url ?? ''} + onChange={(e) => handleInputChange(e)} />
diff --git a/src/components/ReleaseSummary/ReleaseSummary.tsx b/src/components/ReleaseSummary/ReleaseSummary.tsx index 55050a58..429b2e79 100644 --- a/src/components/ReleaseSummary/ReleaseSummary.tsx +++ b/src/components/ReleaseSummary/ReleaseSummary.tsx @@ -18,13 +18,13 @@ import { BiInfoCircle } from 'react-icons/bi' import { Session } from '@/object-types/Session' import Vendor from '@/object-types/Vendor' import Licenses from '@/object-types/Licenses' -import ModeratorsDiaglog from '../sw360/SearchModerators/ModeratorsDiaglog' import Moderators from '@/object-types/Moderators' import ReleasePayload from '@/object-types/ReleasePayload' import MainLicensesDiaglog from '../sw360/SearchMainLicenses/MainLicensesDialog' import { VendorDialog } from '../sw360' import { GiCancel } from 'react-icons/gi' -import ContributorsDiaglog from '../sw360/SearchContributors/ContributorsDiaglog' +import ContributorsDialog from '../sw360/SearchContributors/ContributorsDialog' +import ModeratorsDialog from '../sw360/SearchModerators/ModeratorsDialog' interface Props { session?: Session releasePayload: ReleasePayload @@ -470,7 +470,7 @@ const ReleaseSummary = ({ onClick={handleClickSearchContributors} value={contributor.fullName ?? ''} /> - - - { +const ContributorsDialog = ({ show, setShow, session, selectModerators }: Props) => { const t = useTranslations(COMMON_NAMESPACE) const [data, setData] = useState() const [moderators, setModerators] = useState([]) @@ -135,4 +135,4 @@ const ContributorsDiaglog = ({ show, setShow, session, selectModerators }: Props ) } -export default ContributorsDiaglog +export default ContributorsDialog diff --git a/src/components/sw360/SearchLinkedReleases/LinkedReleasesDiaglog.tsx b/src/components/sw360/SearchLinkedReleases/LinkedReleasesDialog.tsx similarity index 97% rename from src/components/sw360/SearchLinkedReleases/LinkedReleasesDiaglog.tsx rename to src/components/sw360/SearchLinkedReleases/LinkedReleasesDialog.tsx index a689d996..97043dd8 100644 --- a/src/components/sw360/SearchLinkedReleases/LinkedReleasesDiaglog.tsx +++ b/src/components/sw360/SearchLinkedReleases/LinkedReleasesDialog.tsx @@ -30,7 +30,7 @@ interface Props { onReRender: () => void } -const LinkedReleasesDiaglog = ({ show, setShow, session, selectLinkedReleases, onReRender }: Props) => { +const LinkedReleasesDialog = ({ show, setShow, session, selectLinkedReleases, onReRender }: Props) => { const t = useTranslations(COMMON_NAMESPACE) const [data, setData] = useState() const [linkedReleases, setLinkedReleases] = useState([]) @@ -134,4 +134,4 @@ const LinkedReleasesDiaglog = ({ show, setShow, session, selectLinkedReleases, o ) } -export default LinkedReleasesDiaglog \ No newline at end of file +export default LinkedReleasesDialog \ No newline at end of file diff --git a/src/components/sw360/SearchModerators/ModeratorsDiaglog.tsx b/src/components/sw360/SearchModerators/ModeratorsDialog.tsx similarity index 97% rename from src/components/sw360/SearchModerators/ModeratorsDiaglog.tsx rename to src/components/sw360/SearchModerators/ModeratorsDialog.tsx index ce1820d6..adeb4ef3 100644 --- a/src/components/sw360/SearchModerators/ModeratorsDiaglog.tsx +++ b/src/components/sw360/SearchModerators/ModeratorsDialog.tsx @@ -30,7 +30,7 @@ interface Props { selectModerators: ModeratorsType } -const ModeratorsDiaglog = ({ show, setShow, session, selectModerators }: Props) => { +const ModeratorsDialog = ({ show, setShow, session, selectModerators }: Props) => { const t = useTranslations(COMMON_NAMESPACE) const [data, setData] = useState() const [moderators, setModerators] = useState([]) @@ -138,4 +138,4 @@ const ModeratorsDiaglog = ({ show, setShow, session, selectModerators }: Props) ) } -export default ModeratorsDiaglog +export default ModeratorsDialog