-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c63548
commit c21771c
Showing
22 changed files
with
221 additions
and
225 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
24 changes: 0 additions & 24 deletions
24
projects/aas-lib/src/lib/library-table/library-table.component.ts
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
64 changes: 64 additions & 0 deletions
64
projects/aas-lib/src/lib/license-info/license-info.component.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,64 @@ | ||
/****************************************************************************** | ||
* | ||
* Copyright (c) 2019-2024 Fraunhofer IOSB-INA Lemgo, | ||
* eine rechtlich nicht selbstaendige Einrichtung der Fraunhofer-Gesellschaft | ||
* zur Foerderung der angewandten Forschung e.V. | ||
* | ||
*****************************************************************************/ | ||
|
||
import { ChangeDetectionStrategy, Component, computed, input, signal } from '@angular/core'; | ||
import { NgbCollapseModule, NgbPagination } from '@ng-bootstrap/ng-bootstrap'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { Library } from 'aas-core'; | ||
|
||
@Component({ | ||
selector: 'fhg-license-info', | ||
templateUrl: './license-info.component.html', | ||
styleUrls: ['./license-info.component.scss'], | ||
standalone: true, | ||
imports: [NgbPagination, NgbCollapseModule, TranslateModule], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class LicenseInfoComponent { | ||
public readonly libraries = input<Library[]>([]); | ||
|
||
public readonly isCollapsed = signal(true); | ||
|
||
public readonly text = computed(() => { | ||
return this.generateLicensesText(this.libraries()); | ||
}); | ||
|
||
private generateLicensesText(libraries: Library[]): string { | ||
const licenses = new Map<string, Library[]>(); | ||
for (const library of libraries) { | ||
let value = licenses.get(library.licenseText); | ||
if (!value) { | ||
value = [library]; | ||
licenses.set(library.licenseText, value); | ||
} else { | ||
value.push(library); | ||
} | ||
} | ||
|
||
let text = ''; | ||
for (const [key, value] of licenses) { | ||
if (value.length === 1) { | ||
text += 'The following npm package may be included in this product:\n\n'; | ||
text += ` - ${value[0].name}@${value[0].version}\n\n`; | ||
text += 'This package contains the following license and notice below:\n\n'; | ||
} else if (value.length > 1) { | ||
text += 'The following npm packages may be included in this product:\n\n'; | ||
for (const item of value) { | ||
text += ` - ${item.name}@${value[0].version}\n`; | ||
} | ||
|
||
text += '\nThese packages each contain the following license and notice below:\n\n'; | ||
} | ||
|
||
text += key; | ||
text += '\n-----------\n\n'; | ||
} | ||
|
||
return text; | ||
} | ||
} |
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
125 changes: 0 additions & 125 deletions
125
projects/aas-lib/src/test/library-table/library-table.component.spec.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.