Skip to content

Commit

Permalink
Handle proprietary licenses
Browse files Browse the repository at this point in the history
  • Loading branch information
mojodna committed Jan 26, 2019
1 parent e333767 commit 4573b55
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
22 changes: 20 additions & 2 deletions src/components/Catalog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,7 @@ export default {
// recommended
identifier: this.catalog.id,
keywords: this._keywords,
license:
this._license && `https://spdx.org/licenses/${this._license}.html`,
license: this.licenseUrl,
isBasedOn: this.url,
version: this.version,
url: this.path,
Expand Down Expand Up @@ -429,8 +428,27 @@ export default {
);
},
license() {
if (this._license === "proprietary") {
if (this.licenseUrl != null) {
return `<a href="${this.licenseUrl}">${this._license}</a>`;
}
return this._license;
}
return spdxToHTML(this._license);
},
licenseUrl() {
if (this._license === "proprietary") {
return this.links
.concat((this.rootCatalog && this.rootCatalog.links) || [])
.filter(x => x.rel === "license")
.map(x => x.href)
.pop();
}
return `https://spdx.org/licenses/${this._license}.html`;
},
links() {
// REQUIRED
return this.catalog.links;
Expand Down
26 changes: 24 additions & 2 deletions src/components/Item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@ export default {
// recommended
identifier: this.item.id,
keywords: this.keywords,
license:
this._license && `https://spdx.org/licenses/${this._license}.html`,
license: this.licenseUrl,
isBasedOn: this.url,
url: this.path,
includedInDataCatalog: [this.collectionLink, this.parentLink].filter(x => !!x).map(
Expand Down Expand Up @@ -396,8 +395,31 @@ export default {
);
},
license() {
if (this._license === "proprietary") {
if (this.licenseUrl != null) {
return `<a href="${this.licenseUrl}">${this._license}</a>`;
}
return this._license;
}
return spdxToHTML(this._license);
},
licenseUrl() {
if (this._license === "proprietary") {
return this.links
.concat(
((this.collection && this.collection.links) || []).concat(
(this.rootCatalog && this.rootCatalog.links) || []
)
)
.filter(x => x.rel === "license")
.map(x => x.href)
.pop();
}
return `https://spdx.org/licenses/${this._license}.html`;
},
licensor() {
return this.providers
.filter(x => x.roles.includes("licensor"))
Expand Down

0 comments on commit 4573b55

Please sign in to comment.