webapp: Added information about firmware updates
This commit is contained in:
parent
0a68b5af30
commit
b756912fd6
@ -51,6 +51,9 @@ export default defineComponent({
|
|||||||
resetreason_1: "",
|
resetreason_1: "",
|
||||||
cfgsavecount: 0,
|
cfgsavecount: 0,
|
||||||
uptime: 0,
|
uptime: 0,
|
||||||
|
update_text: "",
|
||||||
|
update_url: "",
|
||||||
|
update_status: "",
|
||||||
// MemoryInfo
|
// MemoryInfo
|
||||||
heap_total: 0,
|
heap_total: 0,
|
||||||
heap_used: 0,
|
heap_used: 0,
|
||||||
@ -72,8 +75,35 @@ export default defineComponent({
|
|||||||
.then((data) => {
|
.then((data) => {
|
||||||
this.systemDataList = data;
|
this.systemDataList = data;
|
||||||
this.dataLoading = false;
|
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>
|
</script>
|
||||||
|
|||||||
@ -21,7 +21,13 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Firmware Version / Git Hash</th>
|
<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>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Reset Reason CPU 0</th>
|
<th>Reset Reason CPU 0</th>
|
||||||
@ -59,6 +65,9 @@ export default defineComponent({
|
|||||||
resetreason_1: String,
|
resetreason_1: String,
|
||||||
cfgsavecount: { type: Number, required: true },
|
cfgsavecount: { type: Number, required: true },
|
||||||
uptime: { type: Number, required: true },
|
uptime: { type: Number, required: true },
|
||||||
|
update_text: String,
|
||||||
|
update_url: String,
|
||||||
|
update_status: String,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
timeInHours() {
|
timeInHours() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user