Skip to content

Commit

Permalink
feat(softwareCenter): add release note URLs for GitHub code repositor…
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl authored Feb 3, 2025
1 parent 99e9796 commit e1ec23d
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 10 deletions.
4 changes: 4 additions & 0 deletions core/imageroot/usr/local/agent/pypkg/cluster/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ def _get_available_modules(rdb):
continue # skip duplicated images from lower priority modules
modules[rmod["source"]] = rmod
rmod['versions'].sort(key=lambda v: _parse_version_object(v["tag"]), reverse=True)
# Set the general release note URL if the code URL is a GitHub repository
if rmod['docs']['code_url'].startswith("https://github.com/") and 'relnotes_url' not in rmod['docs']:
rmod['docs']['relnotes_url'] = f"{rmod['docs']['code_url']}/releases"

# Integrate the available set with instances that do not belong to any
# repository. They can be found in the "installed" dict:
for module_source, module_instances in list_installed(rdb).items():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,23 @@
"type": "object",
"parameters": {
"terms_url": {
"type": "uri",
"type": "string",
"format": "uri",
"description": "Optional link to the application Terms & Conditions document"
},
"documentation_url": {
"type": "uri",
"type": "string",
"format": "uri",
"description": "Link to the package documentation"
},
"bug_url": {
"type": "uri",
"type": "string",
"format": "uri",
"description": "Link to the package issue tracker"
},
"code_url": {
"type": "uri",
"type": "string",
"format": "uri",
"description": "Link to the source code repository"
}
},
Expand Down
20 changes: 15 additions & 5 deletions core/imageroot/var/lib/nethserver/cluster/repodata-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"docs": {
"documentation_url": "https://docs.nethserver.org",
"bug_url": "https://github.com/NethServer/dev",
"code_url": "https://github.com/NethServer/"
"code_url": "https://github.com/NethServer/",
"relnotes_url": "https://github.com/NethServer/ns8-kickstart/releases"
},
"source": "ghcr.io/nethserver/dokuwiki",
"versions": [
Expand Down Expand Up @@ -116,20 +117,29 @@
"type": "object",
"parameters": {
"terms_url": {
"type": "uri",
"type": "string",
"format": "uri",
"description": "Optional link to the application Terms & Conditions document"
},
"documentation_url": {
"type": "uri",
"type": "string",
"format": "uri",
"description": "Link to the package documentation"
},
"bug_url": {
"type": "uri",
"type": "string",
"format": "uri",
"description": "Link to the package issue tracker"
},
"code_url": {
"type": "uri",
"type": "string",
"format": "uri",
"description": "Link to the source code repository"
},
"relnotes_url": {
"type": "string",
"format": "uri",
"description": "Optional link to the application release notes"
}
},
"required": [
Expand Down
3 changes: 2 additions & 1 deletion core/ui/public/i18n/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
"configure": "Configure",
"terms_and_conditions": "Terms and Conditions",
"terms_required": "Please read and agree to @:common.terms_and_conditions",
"not_available": "Not available"
"not_available": "Not available",
"release_notes": "Release notes"
},
"error": {
"error": "Error",
Expand Down
8 changes: 8 additions & 0 deletions core/ui/src/components/software-center/AppInfoModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,14 @@
</cv-link>
</span>
</template>
<template v-if="app.docs.relnotes_url">
&bull;
<span>
<cv-link :href="app.docs.relnotes_url" target="_blank">
{{ $t("common.release_notes") }}
</cv-link>
</span>
</template>
</div>
</div>
</template>
Expand Down
17 changes: 17 additions & 0 deletions core/ui/src/views/SoftwareCenterAppInstances.vue
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,23 @@
})
}}
</div>
<div
v-if="
app.docs.relnotes_url &&
isStableUpdateAvailable(app, instance)
"
class="row"
>
<cv-link
class="row icon-and-text"
:href="app.docs.relnotes_url"
target="_blank"
>
<NsButton kind="ghost" :icon="Launch20">
{{ $t("common.release_notes") }}
</NsButton>
</cv-link>
</div>
<div class="row actions">
<!-- app is installed and can be updated -->
<template v-if="isStableUpdateAvailable(app, instance)">
Expand Down
9 changes: 9 additions & 0 deletions core/ui/src/views/SoftwareCenterCoreApps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@
<cv-data-table-cell>{{ row.version }}</cv-data-table-cell>
<cv-data-table-cell v-if="isCoreUpdatable">
{{ row.update || "-" }}
<cv-link
v-if="row.docs.relnotes_url && row.update"
:href="row.docs.relnotes_url"
target="_blank"
>
<NsButton kind="ghost" :icon="Launch20">
{{ $t("common.release_notes") }}
</NsButton></cv-link
>
</cv-data-table-cell>
</cv-data-table-row>
</template>
Expand Down

0 comments on commit e1ec23d

Please sign in to comment.