diff --git a/frontend/app/components/modules/project/components/overview/about-section.vue b/frontend/app/components/modules/project/components/overview/about-section.vue index de8352fb..75447305 100644 --- a/frontend/app/components/modules/project/components/overview/about-section.vue +++ b/frontend/app/components/modules/project/components/overview/about-section.vue @@ -11,6 +11,9 @@ SPDX-License-Identifier: MIT + + + @@ -23,6 +26,7 @@ SPDX-License-Identifier: MIT import { storeToRefs } from 'pinia'; import LfxProjectAboutSoftwareValue from './about-section/about-software-value.vue'; import LfxTagsAndLanguages from './about-section/tags-ang-languages.vue'; +import LfxLicenses from './about-section/licenses.vue'; import LfxLinks from './about-section/links.vue'; import LfxProjectAboutSectionLoading from './about-section/about-section-loading.vue'; import LfxProjectAboutSectionConnectedPlatforms from '~/components/modules/project/components/overview/about-section/connected-platforms.vue'; diff --git a/frontend/app/components/modules/project/components/overview/about-section/licenses.vue b/frontend/app/components/modules/project/components/overview/about-section/licenses.vue new file mode 100644 index 00000000..05c9bf83 --- /dev/null +++ b/frontend/app/components/modules/project/components/overview/about-section/licenses.vue @@ -0,0 +1,150 @@ + + + + License(s) + + + + + + {{ formatLicense(license) }} + + + + + {{ formatLicense(license) }} + + + + + + {{ formatLicense(license) }} + + + + + + {{ normalizeRepoName(repo) }} + + + + + + + + {{ isExpanded ? 'Show less' : 'Show more' }} + + + + + + + + diff --git a/frontend/server/api/project/[slug]/index.ts b/frontend/server/api/project/[slug]/index.ts index 9f202180..6db433e9 100644 --- a/frontend/server/api/project/[slug]/index.ts +++ b/frontend/server/api/project/[slug]/index.ts @@ -65,6 +65,12 @@ export default defineEventHandler(async (event): Promise => { {} as Record>, ); + const licensesByUrl: Record = {}; + for (const [url, license] of project.repoLicenses || []) { + if (!licensesByUrl[url]) licensesByUrl[url] = []; + licensesByUrl[url].push(license); + } + const repositories = project.repositories.map((repoUrl) => { const name = getRepoNameFromUrl(repoUrl); const slug = getRepoSlugFromName(name); @@ -75,6 +81,7 @@ export default defineEventHandler(async (event): Promise => { slug, score: details.score || 0, rank: details.rank || 0, + licenses: licensesByUrl[repoUrl] || [], }; }); const projectLinks = [ diff --git a/frontend/types/project.ts b/frontend/types/project.ts index 6641c277..fbc8ed36 100644 --- a/frontend/types/project.ts +++ b/frontend/types/project.ts @@ -6,6 +6,7 @@ export interface ProjectRepository { slug: string; score: number; rank: number; + licenses: string[]; } export interface ProjectRepositoryGroup { @@ -94,6 +95,7 @@ export interface ProjectTinybird { firstCommitUrl?: string; connectedPlatforms: string[]; repoData: ProjectRepoData[]; + repoLicenses: [string, string][]; status: string; lastVulnerabilityScanStatus: string; maturity?: string;