Improvements to the add-on page (#1932)

- Hide author line if author not present
- Hide documentation line if documentation line not present
- Add correct provisioning information for jar file add-on service
- Properly handle description in add-on details page

Signed-off-by: Jan N. Klug <github@klug.nrw>
pull/1934/head
J-N-K 2023-06-18 19:55:54 +02:00 committed by GitHub
parent 49de601b58
commit d4acf720cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 12 deletions

View File

@ -55,12 +55,14 @@ export default {
value: sourceName
})
info.push({
id: 'author',
title: 'Provided By',
value: this.addon.author,
afterIcon: (this.addon.verifiedAuthor) ? 'checkmark_seal_fill' : ''
})
if (this.addon.author) {
info.push({
id: 'author',
title: 'Provided By',
value: this.addon.author,
afterIcon: (this.addon.verifiedAuthor) ? 'checkmark_seal_fill' : ''
})
}
if (this.addon.version) {
info.push({
@ -85,7 +87,7 @@ export default {
let format
if (source === 'eclipse') {
format = Formats.eclipse
} else if (source === 'karaf') {
} else if (source === 'karaf' || source === 'jar') {
format = Formats.karaf
} else if (Object.keys(this.addon.properties).length > 0) {
for (const property in this.addon.properties) {
@ -157,7 +159,7 @@ export default {
afterIcon: 'chat_bubble_2_fill',
linkUrl: 'https://community.openhab.org/search?q=' + this.addon.id
})
} else {
} else if (this.addon.link) {
info.push({
id: 'documentationLink',
title: 'Documentation',

View File

@ -226,7 +226,7 @@ export default {
addonDescription () {
if (!this.descriptionReady) return null
if (!this.addon) return null
if (this.addon.description && this.addon.link.indexOf('openhab.org/addons') < 0) return this.addon.description
if (this.addon.description && (!this.addon.link || this.addon.link.indexOf('openhab.org/addons') < 0)) return this.addon.description
if (this.parsedDescription) {
const firstHeading = this.parsedDescription.match(/<h\d/m)
if (firstHeading && firstHeading.index > 0) return this.parsedDescription.substring(0, firstHeading.index)
@ -236,7 +236,7 @@ export default {
},
docLinkUrl () {
if (!this.addon) return ''
if (this.serviceId && this.serviceId !== 'karaf' && this.addon.link) return this.addon.link
if (this.serviceId && this.serviceId !== 'karaf') return this.addon.link ? this.addon.link : ''
let url = `https://${this.$store.state.runtimeInfo.buildString === 'Release Build' ? 'www' : 'next'}.openhab.org` +
`/addons/${this.addon.type.replace('misc', 'integrations').replace('binding', 'bindings').replace('transformation', 'transformations')}` +
`/${this.addon.id}`
@ -329,8 +329,7 @@ export default {
})
} else {
// perform a few replaces for Discourse "cooked" HTML
let body = this.addon.detailedDescription
if (!body) return
let body = this.addon.detailedDescription ? this.addon.detailedDescription : ''
body = body.replace(/<pre>/gm, '<div class="block block-strong no-padding"><pre class="padding-half">')
body = body.replace(/<\/pre>/gm, '</pre></div>')
body = body.replace(/<table>/gm, '<div class="data-table"><table>')