FreeDATA/gui/src/components/settings_updater_core.vue

103 lines
2.9 KiB
Vue
Raw Normal View History

2023-09-06 23:04:24 +02:00
<script setup lang="ts">
2023-10-03 15:15:17 +02:00
import { setActivePinia } from "pinia";
import pinia from "../store/index";
2023-09-06 23:04:24 +02:00
setActivePinia(pinia);
2023-11-01 22:37:30 +01:00
import { useStateStore } from "../store/stateStore.js";
2023-12-20 03:23:01 +01:00
import { settingsStore } from "../store/settingsStore";
import { onMounted } from "vue";
import { ipcRenderer } from "electron";
2023-11-01 22:37:30 +01:00
const state = useStateStore(pinia);
2023-12-20 03:23:01 +01:00
onMounted(() => {
window.addEventListener("DOMContentLoaded", () => {
2023-12-20 03:59:33 +01:00
// we are using this area for implementing the electron runUpdater
// we need access to DOM for displaying updater results in GUI
// close app, update and restart
document
.getElementById("update_and_install")
.addEventListener("click", () => {
ipcRenderer.send("request-restart-and-install-update");
});
});
2023-12-20 03:23:01 +01:00
});
2023-09-06 23:04:24 +02:00
</script>
2023-09-02 14:03:50 +02:00
<template>
2023-11-01 22:37:30 +01:00
<div class="card m-2">
2023-10-03 15:15:17 +02:00
<div class="card-header p-1 d-flex">
<div class="container">
<div class="row">
<div class="col-1">
<i class="bi bi-cloud-download" style="font-size: 1.2rem"></i>
</div>
<div class="col-3">
<strong class="fs-5">Updater</strong>
</div>
<div class="col-7">
<div class="progress w-100 ms-1 m-1">
<div
class="progress-bar"
style="width: 0%"
role="progressbar"
id="UpdateProgressBar"
aria-valuenow="0"
aria-valuemin="0"
aria-valuemax="100"
>
<span id="UpdateProgressInfo"></span>
2023-09-02 14:03:50 +02:00
</div>
</div>
2023-10-03 15:15:17 +02:00
</div>
<div class="col-1 text-end">
<button
type="button"
id="openHelpModalUpdater"
data-bs-toggle="modal"
data-bs-target="#updaterHelpModal"
class="btn m-0 p-0 border-0"
>
<i class="bi bi-question-circle" style="font-size: 1rem"></i>
</button>
</div>
</div>
</div>
</div>
<div class="card-body p-2 mb-1">
<button
2023-10-20 20:56:52 +02:00
class="btn btn-secondary btn-sm ms-1 me-1"
2023-10-03 15:15:17 +02:00
id="updater_channel"
type="button"
disabled
>
2023-12-20 03:23:01 +01:00
Update channel:&nbsp; {{ settingsStore.local.update_channel }}
2023-10-03 15:15:17 +02:00
</button>
<button
2023-10-20 20:56:52 +02:00
class="btn btn-secondary btn-sm ms-1"
2023-10-03 15:15:17 +02:00
id="updater_status"
type="button"
disabled
>
...
</button>
<button
2023-10-20 20:56:52 +02:00
class="btn btn-secondary btn-sm ms-1"
2023-10-03 15:15:17 +02:00
id="updater_changelog"
type="button"
2023-10-20 20:56:52 +02:00
data-bs-toggle="modal"
data-bs-target="#updaterReleaseNotes"
2023-10-03 15:15:17 +02:00
>
Changelog
</button>
<button
2023-10-20 20:56:52 +02:00
class="btn btn-primary btn-sm ms-1"
2023-10-03 15:15:17 +02:00
id="update_and_install"
type="button"
style="display: none"
>
Install & Restart
</button>
</div>
</div>
</template>