diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /app/views/pwa | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'app/views/pwa')
-rw-r--r-- | app/views/pwa/offline.html.haml | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/app/views/pwa/offline.html.haml b/app/views/pwa/offline.html.haml new file mode 100644 index 00000000000..5eae546bea9 --- /dev/null +++ b/app/views/pwa/offline.html.haml @@ -0,0 +1,31 @@ += link_to root_path do + = render 'shared/logo.svg' +%h1= _('Offline') +.container + %h3= _('You are currently offline, or the GitLab instance is not reachable.') + %p= _("In the background, we're attempting to connect you again.") + -# haml-lint:disable InlineJavaScript + :javascript + window.addEventListener('online', () => { + window.location.reload(); + }); + + async function checkNetworkAndReload() { + try { + const response = await fetch('.'); + // Verify we get a valid response from the server + if (response.status >= 200 && response.status < 500) { + window.location.reload(); + return; + } + } catch { + // Unable to connect to the server, ignore. + } + window.setTimeout(checkNetworkAndReload, 2500); + } + + if (window.location.pathname.endsWith('/-/offline')) { + return; + } + + checkNetworkAndReload(); |