From 477eb6cfd61c14deb9ec44c3e84db00379958eac Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Thu, 6 Apr 2023 22:36:33 +0200 Subject: [PATCH] Feature: Link to release page instead to commits page in Firmware Info 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) --- webapp/src/components/FirmwareInfo.vue | 8 +++++++- webapp/src/types/SystemStatus.ts | 1 + webapp/src/views/SystemInfoView.vue | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/webapp/src/components/FirmwareInfo.vue b/webapp/src/components/FirmwareInfo.vue index 9eda893..afc03cf 100644 --- a/webapp/src/components/FirmwareInfo.vue +++ b/webapp/src/components/FirmwareInfo.vue @@ -17,7 +17,7 @@ {{ $t('firmwareinfo.FirmwareVersion') }} - {{ systemStatus.git_hash }} @@ -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; + } }, }); diff --git a/webapp/src/types/SystemStatus.ts b/webapp/src/types/SystemStatus.ts index 9e6728e..6be634c 100644 --- a/webapp/src/types/SystemStatus.ts +++ b/webapp/src/types/SystemStatus.ts @@ -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; diff --git a/webapp/src/views/SystemInfoView.vue b/webapp/src/views/SystemInfoView.vue index d34d6ce..fb73170 100644 --- a/webapp/src/views/SystemInfoView.vue +++ b/webapp/src/views/SystemInfoView.vue @@ -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/"