webapp: Added information about firmware updates
This commit is contained in:
parent
0a68b5af30
commit
b756912fd6
@ -51,6 +51,9 @@ export default defineComponent({
|
||||
resetreason_1: "",
|
||||
cfgsavecount: 0,
|
||||
uptime: 0,
|
||||
update_text: "",
|
||||
update_url: "",
|
||||
update_status: "",
|
||||
// MemoryInfo
|
||||
heap_total: 0,
|
||||
heap_used: 0,
|
||||
@ -72,8 +75,35 @@ export default defineComponent({
|
||||
.then((data) => {
|
||||
this.systemDataList = data;
|
||||
this.dataLoading = false;
|
||||
this.getUpdateInfo();
|
||||
})
|
||||
},
|
||||
getUpdateInfo() {
|
||||
const fetchUrl = "https://api.github.com/repos/tbnobody/OpenDTU/compare/"
|
||||
+ this.systemDataList.git_hash?.substring(1) + "...HEAD";
|
||||
|
||||
fetch(fetchUrl)
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
throw new Error('Error fetching version information');
|
||||
})
|
||||
.then((data) => {
|
||||
if (data.total_commits > 0) {
|
||||
this.systemDataList.update_text = "New version available! Show changes!"
|
||||
this.systemDataList.update_status = "text-bg-danger";
|
||||
this.systemDataList.update_url = data.html_url;
|
||||
} else {
|
||||
this.systemDataList.update_text = "Up to date!"
|
||||
this.systemDataList.update_status = "text-bg-success";
|
||||
}
|
||||
})
|
||||
.catch((error: Error) => {
|
||||
this.systemDataList.update_text = error.message;
|
||||
this.systemDataList.update_status = "text-bg-secondary";
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -21,7 +21,13 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Firmware Version / Git Hash</th>
|
||||
<td><a :href="'https://github.com/tbnobody/OpenDTU/commits/' + git_hash?.substring(1)" target="_blank">{{ git_hash?.substring(1) }}</a></td>
|
||||
<td><a :href="'https://github.com/tbnobody/OpenDTU/commits/' + git_hash?.substring(1)"
|
||||
target="_blank">{{ git_hash?.substring(1) }}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Firmware Update</th>
|
||||
<td><a :href="update_url" target="_blank"><span class="badge" :class="update_status">{{
|
||||
update_text }}</span></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Reset Reason CPU 0</th>
|
||||
@ -59,6 +65,9 @@ export default defineComponent({
|
||||
resetreason_1: String,
|
||||
cfgsavecount: { type: Number, required: true },
|
||||
uptime: { type: Number, required: true },
|
||||
update_text: String,
|
||||
update_url: String,
|
||||
update_status: String,
|
||||
},
|
||||
computed: {
|
||||
timeInHours() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user