Skip to content

Commit

Permalink
Feature: Link to release page instead to commits page in Firmware Info
Browse files Browse the repository at this point in the history
The Firmware Version link now referes to the release page if the given hash is a tag. It referes to the commits page if it's really a hash. (Implements #778)
  • Loading branch information
tbnobody committed Apr 6, 2023
1 parent a7b2d72 commit 477eb6c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion webapp/src/components/FirmwareInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</tr>
<tr>
<th>{{ $t('firmwareinfo.FirmwareVersion') }}</th>
<td><a :href="'https://github.com/tbnobody/OpenDTU/commits/' + systemStatus.git_hash"
<td><a :href="versionInfoUrl"
target="_blank" v-tooltip :title="$t('firmwareinfo.FirmwareVersionHint')">
{{ systemStatus.git_hash }}
</a></td>
Expand Down Expand Up @@ -72,6 +72,12 @@ export default defineComponent({
return timestampToString(value, true);
};
},
versionInfoUrl(): string {
if (this.systemStatus.git_is_hash) {
return 'https://github.com/tbnobody/OpenDTU/commits/' + this.systemStatus.git_hash;
}
return 'https://github.com/tbnobody/OpenDTU/releases/tag/' + this.systemStatus.git_hash;
}
},
});
</script>
1 change: 1 addition & 0 deletions webapp/src/types/SystemStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface SystemStatus {
sdkversion: string;
config_version: string;
git_hash: string;
git_is_hash: boolean;
resetreason_0: string;
resetreason_1: string;
cfgsavecount: number;
Expand Down
4 changes: 3 additions & 1 deletion webapp/src/views/SystemInfoView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ export default defineComponent({
},
getUpdateInfo() {
// If the left char is a "g" the value is the git hash (remove the "g")
this.systemDataList.git_hash = this.systemDataList.git_hash?.substring(0, 1) == 'g' ? this.systemDataList.git_hash?.substring(1) : this.systemDataList.git_hash;
this.systemDataList.git_is_hash = this.systemDataList.git_hash?.substring(0, 1) == 'g';
this.systemDataList.git_hash = this.systemDataList.git_is_hash ? this.systemDataList.git_hash?.substring(1) : this.systemDataList.git_hash;
// Handle format "v0.1-5-gabcdefh"
if (this.systemDataList.git_hash.lastIndexOf("-") >= 0) {
this.systemDataList.git_hash = this.systemDataList.git_hash.substring(this.systemDataList.git_hash.lastIndexOf("-") + 2)
this.systemDataList.git_is_hash = true;
}
const fetchUrl = "https://api.github.com/repos/tbnobody/OpenDTU/compare/"
Expand Down

0 comments on commit 477eb6c

Please sign in to comment.