From 993fe6bfb602c421efb3eaebd242f5cca9607d58 Mon Sep 17 00:00:00 2001 From: dtomlinson Date: Thu, 20 Feb 2020 10:24:14 +0000 Subject: [PATCH] updating layout of gn-20 dashboard --- grandnational-dashboard/.DS_Store | Bin 10244 -> 6148 bytes grandnational-dashboard/.gitignore | 10 +- grandnational-dashboard/README.rst | 135 + grandnational-dashboard/app/.DS_Store | Bin 6148 -> 0 bytes grandnational-dashboard/app/__init__.py | 1 - grandnational-dashboard/app/dashboard.py | 31 - grandnational-dashboard/app/main.py | 31 - .../app/templates/index.html | 101 - grandnational-dashboard/bower.json | 7 +- .../grandnational_dashboard/.DS_Store | Bin 6148 -> 0 bytes .../grandnational_dashboard/dashboard.py | 31 - .../templates/index.html | 38 +- grandnational-dashboard/manual-jq.toml | 8 - grandnational-dashboard/package-lock.json | 10 + grandnational-dashboard/package.json | 8 +- grandnational-dashboard/poetry.lock | 611 +- grandnational-dashboard/pyproject.toml | 12 +- grandnational-dashboard/requirements.txt | 17 - grandnational-dashboard/static/.DS_Store | Bin 8196 -> 6148 bytes .../static/assets/.DS_Store | Bin 8196 -> 6148 bytes .../static/assets/videos/.DS_Store | Bin 6148 -> 0 bytes .../static/assets/videos/.gitignore | 0 .../static/css/bootstrap.css | 10038 --------------- .../static/css/bootstrap.css.map | 1 - .../static/js/bootstrap.bundle.js | 7013 ---------- .../static/js/bootstrap.bundle.js.map | 1 - grandnational-dashboard/static/js/gn.js | 2 +- .../static/js/jquery-3.4.1.js | 10598 ---------------- .../static/js/jquery-3.4.1.min.map | 1 - 29 files changed, 772 insertions(+), 27933 deletions(-) delete mode 100644 grandnational-dashboard/app/.DS_Store delete mode 100644 grandnational-dashboard/app/__init__.py delete mode 100644 grandnational-dashboard/app/dashboard.py delete mode 100644 grandnational-dashboard/app/main.py delete mode 100644 grandnational-dashboard/app/templates/index.html delete mode 100644 grandnational-dashboard/grandnational_dashboard/.DS_Store delete mode 100644 grandnational-dashboard/grandnational_dashboard/dashboard.py delete mode 100644 grandnational-dashboard/manual-jq.toml delete mode 100644 grandnational-dashboard/requirements.txt delete mode 100644 grandnational-dashboard/static/assets/videos/.DS_Store create mode 100644 grandnational-dashboard/static/assets/videos/.gitignore delete mode 100644 grandnational-dashboard/static/css/bootstrap.css delete mode 100644 grandnational-dashboard/static/css/bootstrap.css.map delete mode 100644 grandnational-dashboard/static/js/bootstrap.bundle.js delete mode 100644 grandnational-dashboard/static/js/bootstrap.bundle.js.map delete mode 100644 grandnational-dashboard/static/js/jquery-3.4.1.js delete mode 100644 grandnational-dashboard/static/js/jquery-3.4.1.min.map diff --git a/grandnational-dashboard/.DS_Store b/grandnational-dashboard/.DS_Store index 762de9fa683db625766e251895cbcef0bc4ff9b0..bedf0dbac9def877473d626fbbb429133eb294bc 100644 GIT binary patch delta 150 zcmZn(XfcprU|?W$DortDU=RQ@Ie-{MGqg=C6q~50D9Q+A12Ir6lOZ`Rr8qe$KR;(; zp}G`Ef{me=p@bn3h>;{2Hx?$bFJ|Z95M%}!1k}q7BwT^GZDZkg=E?jjx||@*2Y{Gi WvJH>)jWnaGKXG3s>G=Ui62lQB*cL`w@Ms1q29Rk$^nT32noSAGwWn`T~`DlgvyLG^WM(9 z@6Eo?vv2j*M8t}ndY&jtL`ifZ(~}sU(!{#x11%BE%tA8YiR$E#K|Wc;2dwpkW>~YY1yEo4v?5^ zAPa%)DJh}wsj3GSKv_^?Fa^hYR+vK;0@+hi!HFq2v0!HwR47dD4qR566DugGN6mm{ zV2}Y(yJx6DF6wqCQooBz-lhuX4DzT+Rn+tb?COg)uT^bc1yVe0Z=#?1LpEp!_Ez2U z+JU!6)wXSUelGWzB}PWa4!w{ZN1GbIQEu|BvTyhuuV}c}#MQFlH>-iZ%DKI#8`U+- z+^VE!E^x;;EXQ;u*s7Z_xqiiR>U^unJ5Jq`e#&Y=Zd6HUc6R1-XS2E8v)P^eYi~f! z=U#bzcXvFQIh{YZc(c{r-np~;{sS2&u^<&uN?q@bpB$V8yOA%~c&n{^q`x@0hZZlD z0v?lNzuh_U;P-FN{~a&&f51z-8IGnPf;!+C+bp||&7B62g5^n^O^%aj;ykvb*1_2{ z$%~!Ehp-Kw#i6(e-yhz4^sGI?%$~|KKVWvK?-t+Z@UPfM*t%E1tWs#5k9QiW{`E+-G0{nVK3_*o|v3El1d*<9ZOA5&%Ag%ed1&# zJzX_ww;Qg=ofo*x-J;zwE9sPnY`j?G&a!K6BJ-~M=6inG+Q!nc7+}S$zq>!R+HJ#T zW`9CDz2usvbFJZ8^`(ss&-B+r`qk@lFW+n}IvX7R#ePd|-{Ow9X1X5aRl{`+r(qVm zH*BM7+DlH6`#x{2Tew4USJGX%ZPYBMG56L_I0k6rbA>ZXOVgZEP!*@ys$;ZFEH10L zxx(AQVv?C`M&9cCMqW{V` z)!#-*hEMU)0~=0I`HyD5jIW22(*2jO{PL+v_mLktoQQ_mgp<#!9~8vxM0~^&@faRC zq+N`$)I0Jykl_RrvJA%pt0sDAH5|!T?&JCUDw2rBenNe^ML3F}0Kq1@X$CX{ngPv# zWkn3%d+UfTn@Ty&?sKi?O*>hK-d4e{{NrX|9=8KqYv@` diff --git a/grandnational-dashboard/.gitignore b/grandnational-dashboard/.gitignore index 52b89ef..252dd7e 100644 --- a/grandnational-dashboard/.gitignore +++ b/grandnational-dashboard/.gitignore @@ -133,9 +133,9 @@ dmypy.json # pytype static type analyzer .pytype/ -# Custom -*bower_components +# ignore bower and node_modules *node_modules -*font-awesome -*.mp4 -*docker-image +*bower_components + +# ignore video +*static/assets/videos/gn19-short.mp4 diff --git a/grandnational-dashboard/README.rst b/grandnational-dashboard/README.rst index e69de29..89ee7ee 100644 --- a/grandnational-dashboard/README.rst +++ b/grandnational-dashboard/README.rst @@ -0,0 +1,135 @@ +*************************************** +Grand National 2020 Countdown Dashboard +*************************************** + +This repo contains all files for the Grand National 2020 Countdown Dashboard. + +.. image:: https://git.nonprod.williamhill.plc/wh_capacity/grandnational-dashboard/uploads/47fdb6cc5b3a6658ee884ab148fb8a29/image.png + :width: 40% + + +The dashboard is installed on ``sc1uxpremn81`` running in docker. + +The dashboard uses ``python`` as an ASGI server, ``css`` for formatting, and ``jQuery`` for front-end scripts. + +We use `uvicorn `_ as an ASGI server and `gunicorn `_ to manage the asynchronous workers. We use `bootstrap `_ for front-end formatting and, `jQuery `_ for front-end scripts. We use `npm `_, `bower `_ and `poetry `_ to manage dependencies. + +Optionally we can use `docker `_ to orchestrate uvicorn and guvicorn. + + +Running Locally +=============== + +Requirements +------------ + +You will need installed: + +- python>=3.6.2 +- npm +- docker `(optional)` + +on your machine as a pre-requisite. Versions of python lower than 3.6.2 may work, but you will have to delete the ``poetry.lock`` file before installing the python dependencies. Versions lower than 3.6.2 will not come with `venv` - you will need to install an alternative (``virtualenv``) or use ``potery`` to manage the virtual environment for python. + +Installation Steps +------------------ + +Create workspace +^^^^^^^^^^^^^^^^ + +On your machine clone the repo: + +``cd ~`` + +``git clone https://git.nonprod.williamhill.plc/wh_capacity/grandnational-dashboard.git`` + +In this folder, create a virtual environment for python: + +``cd ~/grandnational-dashboard`` + +``python3 -m venv gn-dashboard`` + +Activate this environment: + +``source gn-dashboard/bin/activate`` + + +Install Dependencies +^^^^^^^^^^^^^^^^^^^^ + +Install ``bower`` using ``npm``: + +``npm install -g bower`` + +Install poetry: + +``pip install poetry`` + +Install the node depdencies with ``npm``: + +``npm install`` + +`this reads the dependencies from package.json`. + +Install the bower dependencies with ``bower``: + +``bower install`` + +`this reads the dependencies from bower.json`. + +Install the python dependencies with poetry: + +``poetry install --no-dev`` + +`this reads the dependencies from pyproject.toml and poetry.lock` + +Copy The Large Static Files +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The video used as a banner is too large for gitlab. You should do: + +``cd static/assets/videos`` + +and + +``wget http://sc1uxpremn81:9001/static/assets/videos/gn19-short.mp4``. + +Alternatively, if the dashboard isn't online, you can download the file manually from confluence: + +https://conf.willhillatlas.com/display/CME/Static+Files + +Place this video locally in ``static/assets/videos/`` saved as ``gn19-short.mp4``. + +Run the Webserver +^^^^^^^^^^^^^^^^^ + +Manually +"""""""" + +Running the webserver is done with ``uvicorn``. Go into ``grandnational_dashboard`` and launch uvicorn: + +``cd grandnational_dashboard`` + +``uvicorn main:app`` + +(The folder name is the same as the repo name. This may be confusing but is intentional when creating a project with poetry without a src folder. The full path you should be in is ``~/grandnational-dashboard/grandnational_dashboard`` and there should be a ``main.py`` file inside this folder.) + +Your dashboard should then be available at http://127.0.0.1:8000 + + +Docker +"""""" + +We can use Docker for deployment. To do this go back to the root of the project and build the docker image from the ``Dockerfile``. + +``cd ~/grandnational-dashboard`` + +``docker build . -t gn-20-dash`` + +When this has built you can run the container with: + +``docker run --rm --name dashboard -p 8000:80 gn-20-dash:latest`` + +Your dashboard will then be available at http://127.0.0.1:8000. + +This docker image runs gunicorn to manage the asynchronous workers. It's scaleable, and will smartly use the resources of the machine it's running on. diff --git a/grandnational-dashboard/app/.DS_Store b/grandnational-dashboard/app/.DS_Store deleted file mode 100644 index c469b0071676fd5872f57944869513908b9db5d5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKy^hmB5T4BiE+Ge`K+2VFkSGomBf%k|lS~N3bqFIU0Ojo1x>&NkQS1M&!8(1 z@m{nQDQU|&Ad_Q6lv4-4E7V`{HU`6hVc=h5KzzG3`OQX@(&G0!-i>+JkGT&IaXj2a zyYy8Gw0TsY#?&Pbtw*64=TOwUUyF+OZMVx4eQK0GA3c7;+ikt7%KP$k^We*eTgQ0^ zzv12QEv`Z&O&b&-yA0X+#GwuFEKavW?63xW7ul)eBn&BmXN)MJXUoj6mp_m2M_FIz z`qA&lQI@nITdavWE^kP~(4jmhM4bIWQ@x2%bM{RULKd3Ad_ ztyUTr?Va7dWc+OMeEQ-*kcM)AdLZSz#yPx!Qozmf{@1P*doAw$y^Xi8UaP$?7%$;J z_WgLzf;}%7@2NXTW1j9~UGvQ58J%3znN(^gHwCkD!+>Gn4>2Il2MbN0qj9EC9v$f9 z6#!UCU&pws18Dxwr`qDjF!ODI4`<4hqe5c5Ys(qKBnz+YwH8xLL8=l}o! diff --git a/grandnational-dashboard/app/__init__.py b/grandnational-dashboard/app/__init__.py deleted file mode 100644 index b794fd4..0000000 --- a/grandnational-dashboard/app/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = '0.1.0' diff --git a/grandnational-dashboard/app/dashboard.py b/grandnational-dashboard/app/dashboard.py deleted file mode 100644 index dc5a14e..0000000 --- a/grandnational-dashboard/app/dashboard.py +++ /dev/null @@ -1,31 +0,0 @@ -from starlette.applications import Starlette -from starlette.templating import Jinja2Templates -from starlette.routing import Route, Mount -from starlette.staticfiles import StaticFiles - - -templates = Jinja2Templates(directory='templates') - - -async def home(request): - return templates.TemplateResponse( - 'index.html', - {'request': request}, - ) - -routes = [ - Route('/', endpoint=home), - Mount('/static', StaticFiles(directory='../static'), name='static'), - Mount( - '/node_modules', - StaticFiles(directory='../node_modules'), - name='node_modules', - ), - Mount( - '/bower_components', - StaticFiles(directory='../bower_components'), - name='bower_components', - ), -] - -app = Starlette(debug=True, routes=routes) diff --git a/grandnational-dashboard/app/main.py b/grandnational-dashboard/app/main.py deleted file mode 100644 index dc5a14e..0000000 --- a/grandnational-dashboard/app/main.py +++ /dev/null @@ -1,31 +0,0 @@ -from starlette.applications import Starlette -from starlette.templating import Jinja2Templates -from starlette.routing import Route, Mount -from starlette.staticfiles import StaticFiles - - -templates = Jinja2Templates(directory='templates') - - -async def home(request): - return templates.TemplateResponse( - 'index.html', - {'request': request}, - ) - -routes = [ - Route('/', endpoint=home), - Mount('/static', StaticFiles(directory='../static'), name='static'), - Mount( - '/node_modules', - StaticFiles(directory='../node_modules'), - name='node_modules', - ), - Mount( - '/bower_components', - StaticFiles(directory='../bower_components'), - name='bower_components', - ), -] - -app = Starlette(debug=True, routes=routes) diff --git a/grandnational-dashboard/app/templates/index.html b/grandnational-dashboard/app/templates/index.html deleted file mode 100644 index a549ef8..0000000 --- a/grandnational-dashboard/app/templates/index.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - Capacity Dashboard - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
- -
-
-
- -
-
-

Grand National 2020

- -
-
-

Cheltenham 2020

- -
-
-
-
-
-
-
-
-
-
-

Cheltenham Festival 2020

-
-

Day One 🐴 Tuesday 10th March

-
Featuring the Unibet Champion Hurdle
-
-

Day Two 🐴 Wednesday 11th March

-
Featuring the Betway Queen Mother Champion Chase
-
-

Day Three 🐴 Thursday 12th March

-
Featuring the Ryanair Chase
-
-

Gold Cup Day 🏆 Friday 13th March

-
Featuring the Magners Cheltenham Gold Cup
-
-
-

Grand National 2020

-
-

Liverpool's Day 🐴 Thursday 2nd April

-
Featuring the Betway Aintree Hurdle
-
-

Ladies Day at Aintree 🐴 Friday 3rd April

-
Featuring the JLT Melling Steeple
-
-

Grand National Day 🏆 Saturday 4th April

-
Featuring the Randox Health Grand National Steeple Chase
-
-

1st Favourite: Tiger Roll 🇮🇪

-
2nd Favourite: Burrows Saint 🇫🇷
-
-
-
-
- - - - diff --git a/grandnational-dashboard/bower.json b/grandnational-dashboard/bower.json index 90bd1c7..86c9cf3 100644 --- a/grandnational-dashboard/bower.json +++ b/grandnational-dashboard/bower.json @@ -3,7 +3,7 @@ "description": "", "main": "index.js", "authors": [ - "dtomlinson " + "dtomlinson " ], "license": "ISC", "homepage": "", @@ -15,8 +15,7 @@ "tests" ], "dependencies": { - "masonry-layout": "desandro/masonry#^4.2.2", - "jquery.countdown": "^2.2.0", - "Morphist": "^3.0.0" + "Morphist": "^3.0.0", + "jquery.countdown": "^2.2.0" } } diff --git a/grandnational-dashboard/grandnational_dashboard/.DS_Store b/grandnational-dashboard/grandnational_dashboard/.DS_Store deleted file mode 100644 index c469b0071676fd5872f57944869513908b9db5d5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKy^hmB5T4BiE+Ge`K+2VFkSGomBf%k|lS~N3bqFIU0Ojo1x>&NkQS1M&!8(1 z@m{nQDQU|&Ad_Q6lv4-4E7V`{HU`6hVc=h5KzzG3`OQX@(&G0!-i>+JkGT&IaXj2a zyYy8Gw0TsY#?&Pbtw*64=TOwUUyF+OZMVx4eQK0GA3c7;+ikt7%KP$k^We*eTgQ0^ zzv12QEv`Z&O&b&-yA0X+#GwuFEKavW?63xW7ul)eBn&BmXN)MJXUoj6mp_m2M_FIz z`qA&lQI@nITdavWE^kP~(4jmhM4bIWQ@x2%bM{RULKd3Ad_ ztyUTr?Va7dWc+OMeEQ-*kcM)AdLZSz#yPx!Qozmf{@1P*doAw$y^Xi8UaP$?7%$;J z_WgLzf;}%7@2NXTW1j9~UGvQ58J%3znN(^gHwCkD!+>Gn4>2Il2MbN0qj9EC9v$f9 z6#!UCU&pws18Dxwr`qDjF!ODI4`<4hqe5c5Ys(qKBnz+YwH8xLL8=l}o! diff --git a/grandnational-dashboard/grandnational_dashboard/dashboard.py b/grandnational-dashboard/grandnational_dashboard/dashboard.py deleted file mode 100644 index dc5a14e..0000000 --- a/grandnational-dashboard/grandnational_dashboard/dashboard.py +++ /dev/null @@ -1,31 +0,0 @@ -from starlette.applications import Starlette -from starlette.templating import Jinja2Templates -from starlette.routing import Route, Mount -from starlette.staticfiles import StaticFiles - - -templates = Jinja2Templates(directory='templates') - - -async def home(request): - return templates.TemplateResponse( - 'index.html', - {'request': request}, - ) - -routes = [ - Route('/', endpoint=home), - Mount('/static', StaticFiles(directory='../static'), name='static'), - Mount( - '/node_modules', - StaticFiles(directory='../node_modules'), - name='node_modules', - ), - Mount( - '/bower_components', - StaticFiles(directory='../bower_components'), - name='bower_components', - ), -] - -app = Starlette(debug=True, routes=routes) diff --git a/grandnational-dashboard/grandnational_dashboard/templates/index.html b/grandnational-dashboard/grandnational_dashboard/templates/index.html index 42bb096..49b1936 100644 --- a/grandnational-dashboard/grandnational_dashboard/templates/index.html +++ b/grandnational-dashboard/grandnational_dashboard/templates/index.html @@ -1,36 +1,40 @@ - - Capacity Dashboard + + + + Grand National Dashboard - - + - - - - - - - + + + + + + + + + + - + - + - - + + + + - -