-
-
Notifications
You must be signed in to change notification settings - Fork 512
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
webapp: Added global reboot wait screen
- Loading branch information
Showing
11 changed files
with
105 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import type { Router } from 'vue-router'; | ||
|
||
export function waitRestart(router: Router) { | ||
setTimeout(() => { | ||
router.push('/wait'); | ||
}, 1000); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<template> | ||
<BasePage :title="$t('wait.NotReady')"> | ||
<CardElement :text="$t('wait.PleaseWait')" textVariant="text-bg-primary"> | ||
<div class="text-center"> | ||
<div class="spinner-border" role="status"> | ||
<span class="visually-hidden"></span> | ||
</div> | ||
</div> | ||
</CardElement> | ||
</BasePage> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import BasePage from '@/components/BasePage.vue'; | ||
import CardElement from '@/components/CardElement.vue'; | ||
import { defineComponent } from 'vue'; | ||
export default defineComponent({ | ||
components: { | ||
BasePage, | ||
CardElement, | ||
}, | ||
data() { | ||
return { | ||
hostCheckInterval: 0, | ||
}; | ||
}, | ||
mounted() { | ||
this.hostCheckInterval = setInterval(this.checkRemoteHostAndReload, 1000); | ||
}, | ||
unmounted() { | ||
clearInterval(this.hostCheckInterval); | ||
}, | ||
methods: { | ||
checkRemoteHostAndReload(): void { | ||
// Check if the browser is online | ||
if (navigator.onLine) { | ||
const remoteHostUrl = '/api/system/status'; | ||
// Use a simple fetch request to check if the remote host is reachable | ||
fetch(remoteHostUrl, { method: 'GET' }) | ||
.then((response) => { | ||
// Check if the response status is OK (200-299 range) | ||
if (response.ok) { | ||
console.log('Remote host is available. Reloading page...'); | ||
clearInterval(this.hostCheckInterval); | ||
this.hostCheckInterval = 0; | ||
// Perform a page reload | ||
window.location.replace('/'); | ||
} else { | ||
console.log('Remote host is not reachable. Do something else if needed.'); | ||
} | ||
}) | ||
.catch((error) => { | ||
console.error('Error checking remote host:', error); | ||
}); | ||
} else { | ||
console.log('Browser is offline. Cannot check remote host.'); | ||
} | ||
}, | ||
}, | ||
}); | ||
</script> |