summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-02-05 19:16:34 +0000
committerGerrit Code Review <review@openstack.org>2019-02-05 19:16:34 +0000
commitd010bec30ab5a6a0a454110b766260f2d8a42fc1 (patch)
tree170dc713e868329adf3340386e8451a50b394b34
parente1c0eb080d001aabc761ea15f8bb1a2ac30749e0 (diff)
parentb4f6ef7b702691e48c575dc43c66155155cfbf4e (diff)
Merge "Disable service workers by default"
-rw-r--r--Dockerfile4
-rw-r--r--doc/source/developer/javascript.rst7
-rw-r--r--releasenotes/notes/service-worker-default-b6f6d5c277657ced.yaml6
-rw-r--r--web/src/registerServiceWorker.js3
4 files changed, 14 insertions, 6 deletions
diff --git a/Dockerfile b/Dockerfile
index 019ba42..4801f79 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -17,8 +17,8 @@ FROM opendevorg/python-builder as builder
17 17
18# Optional location of Zuul API endpoint. 18# Optional location of Zuul API endpoint.
19ARG REACT_APP_ZUUL_API 19ARG REACT_APP_ZUUL_API
20# Optional flag to disable React Service Worker. (set to true to disable) 20# Optional flag to enable React Service Worker. (set to true to enable)
21ARG REACT_APP_DISABLE_SERVICE_WORKER 21ARG REACT_APP_ENABLE_SERVICE_WORKER
22 22
23COPY . /tmp/src 23COPY . /tmp/src
24RUN /tmp/src/tools/install-js-tools.sh 24RUN /tmp/src/tools/install-js-tools.sh
diff --git a/doc/source/developer/javascript.rst b/doc/source/developer/javascript.rst
index 72b8865..ae39663 100644
--- a/doc/source/developer/javascript.rst
+++ b/doc/source/developer/javascript.rst
@@ -193,6 +193,7 @@ As long as `yarn`_ is installed, the installation of zuul will run
193.. _Patternfly: https://www.patternfly.org/ 193.. _Patternfly: https://www.patternfly.org/
194.. _create-react-app: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md 194.. _create-react-app: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md
195 195
196In some cases there is the need to disable the service worker which does 196By default, zuul-web provides a Progressive Web Application but does
197advanced caching. In order to do that set the environment variable 197not run a Service Worker. For deployers who would like to enable one,
198``REACT_APP_DISABLE_SERVICE_WORKER=true`` during installation. 198set the environment variable
199``REACT_APP_ENABLE_SERVICE_WORKER=true`` during installation.
diff --git a/releasenotes/notes/service-worker-default-b6f6d5c277657ced.yaml b/releasenotes/notes/service-worker-default-b6f6d5c277657ced.yaml
new file mode 100644
index 0000000..a98fc2b
--- /dev/null
+++ b/releasenotes/notes/service-worker-default-b6f6d5c277657ced.yaml
@@ -0,0 +1,6 @@
1---
2upgrade:
3 - |
4 Service Workers are now disabled by default in the Javascript
5 dashboard. Deployers who wish to enable them need to set
6 ``REACT_APP_ENABLE_SERVICE_WORKER``
diff --git a/web/src/registerServiceWorker.js b/web/src/registerServiceWorker.js
index 3180ade..483e5d5 100644
--- a/web/src/registerServiceWorker.js
+++ b/web/src/registerServiceWorker.js
@@ -21,8 +21,9 @@ const isLocalhost = Boolean(
21) 21)
22 22
23export default function register () { 23export default function register () {
24 if (process.env.REACT_APP_DISABLE_SERVICE_WORKER === 'true') { 24 if (process.env.REACT_APP_ENABLE_SERVICE_WORKER !== 'true') {
25 console.log('Disabled service worker') 25 console.log('Disabled service worker')
26 unregister()
26 return 27 return
27 } 28 }
28 29