diff --git a/.gitignore b/.gitignore index 0e84020..aa5c249 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ examples/*.ogg .env # openvpn server configuration services/ansible_openvpn/docker/openvpn-data +services/ansible_openvpn/docker/dashboard/config.json diff --git a/services/ansible_openvpn/docker/dashboard/README.md b/services/ansible_openvpn/docker/dashboard/README.md index 60f01f2..b5065e6 100644 --- a/services/ansible_openvpn/docker/dashboard/README.md +++ b/services/ansible_openvpn/docker/dashboard/README.md @@ -1,7 +1,20 @@ -Derived from this work -https://github.com/docker/awesome-compose/tree/c2f8036fd353dae457eba7b9b436bf3a1c85d937/flask +# Dashboard website -To test locally +This frontend website is displaying the state and data of the sensor network. + +It is linked to an elastic-search instance that store and index the files +generated by zero_*.py services. + +This website and the backend is easily deployed if you are using the docker +services described in [ansible_openvpn](../ansible_openvpn) folder. + +# Build and run image to container + +```shell +sudo docker build ./ -t dashboard && sudo docker run -p "8080:80" -v ./app/:/home/dashboard/app/ dashboard +``` + +Then open localhost:8080 in browser + +Without having to rebuild the image or restarting the container, all changes made in files will be automatically applied -docker build -t flasktest . -docker run --name flasktest -p 8000:8000 flasktest diff --git a/services/ansible_openvpn/docker/dashboard/app/config.json b/services/ansible_openvpn/docker/dashboard/app/config.json new file mode 100644 index 0000000..66896c7 --- /dev/null +++ b/services/ansible_openvpn/docker/dashboard/app/config.json @@ -0,0 +1,8 @@ +{ + "id": "hKUAUIoBOM9IQ1Kp18_2", + "name": "python2", + "api_key": "Qk77qq1AR3WxkwbuQw_Jcw", + "encoded": "aEtVQVVJb0JPTTlJUTFLcDE4XzI6UWs3N3FxMUFSM1d4a3didVF3X0pjdw==", + "url": "https://172.20.0.3:9200", + "verify_certs": false +} diff --git a/services/ansible_openvpn/docker/dashboard/app/fonts/fontawesome-webfont.ttf b/services/ansible_openvpn/docker/dashboard/app/fonts/fontawesome-webfont.ttf new file mode 100644 index 0000000..35acda2 Binary files /dev/null and b/services/ansible_openvpn/docker/dashboard/app/fonts/fontawesome-webfont.ttf differ diff --git a/services/ansible_openvpn/docker/dashboard/app/fonts/fontawesome-webfont.woff b/services/ansible_openvpn/docker/dashboard/app/fonts/fontawesome-webfont.woff new file mode 100644 index 0000000..400014a Binary files /dev/null and b/services/ansible_openvpn/docker/dashboard/app/fonts/fontawesome-webfont.woff differ diff --git a/services/ansible_openvpn/docker/dashboard/app/fonts/fontawesome-webfont.woff2 b/services/ansible_openvpn/docker/dashboard/app/fonts/fontawesome-webfont.woff2 new file mode 100644 index 0000000..4d13fc6 Binary files /dev/null and b/services/ansible_openvpn/docker/dashboard/app/fonts/fontawesome-webfont.woff2 differ diff --git a/services/ansible_openvpn/docker/dashboard/app/main.py b/services/ansible_openvpn/docker/dashboard/app/main.py index 0aed9f1..a7fb355 100644 --- a/services/ansible_openvpn/docker/dashboard/app/main.py +++ b/services/ansible_openvpn/docker/dashboard/app/main.py @@ -27,23 +27,44 @@ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from fastapi import FastAPI +from fastapi import FastAPI, Request from fastapi.responses import HTMLResponse +from fastapi.staticfiles import StaticFiles +from fastapi.templating import Jinja2Templates +import json +import os +from elasticsearch import Elasticsearch +from elasticsearch.helpers import streaming_bulk +import elasticsearch.helpers app = FastAPI() +app.mount("/static", StaticFiles(directory="app/static"), name="static") + +app.mount("/fonts", StaticFiles(directory="app/fonts"), name="fonts") + +templates = Jinja2Templates(directory="app/templates") + +if not os.path.exists("app/config.json"): + raise Exception("Configuration file not found " + + os.path.abspath("app/config.json")) +configuration = json.load(open("app/config.json", "r")) + +client = Elasticsearch( + configuration.get("url", "https://es01:9200"), + api_key=(configuration["id"], configuration["api_key"]), + verify_certs=configuration.get("verify_certs", True), timeout=60 +) + + +@app.get("/api/sensor_position") +async def get_sensor_position(request: Request): + post_data = templates.get_template("query_sensor_list.json").render() + resp = client.search(index="sensor_location_*", query=post_data) + return resp @app.get('/', response_class=HTMLResponse) -async def home(): - return """ - - -
-Please run the Ansible playbook named deploy_elastic_web_dashboard.yml
- -""" +async def home(request: Request): + return templates.TemplateResponse("status.html", + context={"request": request}) diff --git a/services/website_dashboard/app/static/d3.v5.min.js b/services/ansible_openvpn/docker/dashboard/app/static/d3.v5.min.js similarity index 100% rename from services/website_dashboard/app/static/d3.v5.min.js rename to services/ansible_openvpn/docker/dashboard/app/static/d3.v5.min.js diff --git a/services/website_dashboard/app/static/daterangepicker.css b/services/ansible_openvpn/docker/dashboard/app/static/daterangepicker.css similarity index 100% rename from services/website_dashboard/app/static/daterangepicker.css rename to services/ansible_openvpn/docker/dashboard/app/static/daterangepicker.css diff --git a/services/website_dashboard/app/static/daterangepicker.min.js b/services/ansible_openvpn/docker/dashboard/app/static/daterangepicker.min.js similarity index 100% rename from services/website_dashboard/app/static/daterangepicker.min.js rename to services/ansible_openvpn/docker/dashboard/app/static/daterangepicker.min.js diff --git a/services/website_dashboard/app/static/font-awesome.min.css b/services/ansible_openvpn/docker/dashboard/app/static/font-awesome.min.css similarity index 100% rename from services/website_dashboard/app/static/font-awesome.min.css rename to services/ansible_openvpn/docker/dashboard/app/static/font-awesome.min.css diff --git a/services/website_dashboard/app/static/forge.min.js b/services/ansible_openvpn/docker/dashboard/app/static/forge.min.js similarity index 100% rename from services/website_dashboard/app/static/forge.min.js rename to services/ansible_openvpn/docker/dashboard/app/static/forge.min.js diff --git a/services/website_dashboard/app/static/forge.min.js.map b/services/ansible_openvpn/docker/dashboard/app/static/forge.min.js.map similarity index 100% rename from services/website_dashboard/app/static/forge.min.js.map rename to services/ansible_openvpn/docker/dashboard/app/static/forge.min.js.map diff --git a/services/website_dashboard/app/static/forms.css b/services/ansible_openvpn/docker/dashboard/app/static/forms.css similarity index 100% rename from services/website_dashboard/app/static/forms.css rename to services/ansible_openvpn/docker/dashboard/app/static/forms.css diff --git a/services/website_dashboard/app/static/handsontable.full.css b/services/ansible_openvpn/docker/dashboard/app/static/handsontable.full.css similarity index 100% rename from services/website_dashboard/app/static/handsontable.full.css rename to services/ansible_openvpn/docker/dashboard/app/static/handsontable.full.css diff --git a/services/website_dashboard/app/static/handsontable.full.js b/services/ansible_openvpn/docker/dashboard/app/static/handsontable.full.js similarity index 100% rename from services/website_dashboard/app/static/handsontable.full.js rename to services/ansible_openvpn/docker/dashboard/app/static/handsontable.full.js diff --git a/services/website_dashboard/app/static/handsontable.js.map b/services/ansible_openvpn/docker/dashboard/app/static/handsontable.js.map similarity index 100% rename from services/website_dashboard/app/static/handsontable.js.map rename to services/ansible_openvpn/docker/dashboard/app/static/handsontable.js.map diff --git a/services/website_dashboard/app/static/handsontable.min.css b/services/ansible_openvpn/docker/dashboard/app/static/handsontable.min.css similarity index 100% rename from services/website_dashboard/app/static/handsontable.min.css rename to services/ansible_openvpn/docker/dashboard/app/static/handsontable.min.css diff --git a/services/website_dashboard/app/static/handsontable.min.js b/services/ansible_openvpn/docker/dashboard/app/static/handsontable.min.js similarity index 100% rename from services/website_dashboard/app/static/handsontable.min.js rename to services/ansible_openvpn/docker/dashboard/app/static/handsontable.min.js diff --git a/services/website_dashboard/app/static/jquery.min.js b/services/ansible_openvpn/docker/dashboard/app/static/jquery.min.js similarity index 100% rename from services/website_dashboard/app/static/jquery.min.js rename to services/ansible_openvpn/docker/dashboard/app/static/jquery.min.js diff --git a/services/website_dashboard/app/static/leaflet/L.Control.Locate.min.css b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/L.Control.Locate.min.css similarity index 100% rename from services/website_dashboard/app/static/leaflet/L.Control.Locate.min.css rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/L.Control.Locate.min.css diff --git a/services/website_dashboard/app/static/leaflet/L.Control.Locate.min.css.map b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/L.Control.Locate.min.css.map similarity index 100% rename from services/website_dashboard/app/static/leaflet/L.Control.Locate.min.css.map rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/L.Control.Locate.min.css.map diff --git a/services/website_dashboard/app/static/leaflet/L.Control.Locate.min.js b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/L.Control.Locate.min.js similarity index 100% rename from services/website_dashboard/app/static/leaflet/L.Control.Locate.min.js rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/L.Control.Locate.min.js diff --git a/services/website_dashboard/app/static/leaflet/L.Control.Locate.min.js.map b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/L.Control.Locate.min.js.map similarity index 100% rename from services/website_dashboard/app/static/leaflet/L.Control.Locate.min.js.map rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/L.Control.Locate.min.js.map diff --git a/services/website_dashboard/app/static/leaflet/images/layers-2x.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/images/layers-2x.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/images/layers-2x.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/images/layers-2x.png diff --git a/services/website_dashboard/app/static/leaflet/images/layers.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/images/layers.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/images/layers.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/images/layers.png diff --git a/services/website_dashboard/app/static/leaflet/images/marker-icon-2x.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/images/marker-icon-2x.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/images/marker-icon-2x.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/images/marker-icon-2x.png diff --git a/services/website_dashboard/app/static/leaflet/images/marker-icon.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/images/marker-icon.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/images/marker-icon.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/images/marker-icon.png diff --git a/services/website_dashboard/app/static/leaflet/images/marker-shadow.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/images/marker-shadow.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/images/marker-shadow.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/images/marker-shadow.png diff --git a/services/website_dashboard/app/static/leaflet/img/cabinet-icon-2x-green.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/cabinet-icon-2x-green.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/cabinet-icon-2x-green.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/cabinet-icon-2x-green.png diff --git a/services/website_dashboard/app/static/leaflet/img/cabinet-icon-2x-red.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/cabinet-icon-2x-red.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/cabinet-icon-2x-red.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/cabinet-icon-2x-red.png diff --git a/services/website_dashboard/app/static/leaflet/img/cabinet-icon-2x-yellow.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/cabinet-icon-2x-yellow.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/cabinet-icon-2x-yellow.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/cabinet-icon-2x-yellow.png diff --git a/services/website_dashboard/app/static/leaflet/img/cabinet.svg b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/cabinet.svg similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/cabinet.svg rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/cabinet.svg diff --git a/services/website_dashboard/app/static/leaflet/img/marker-icon-2x-black.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-2x-black.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/marker-icon-2x-black.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-2x-black.png diff --git a/services/website_dashboard/app/static/leaflet/img/marker-icon-2x-blue.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-2x-blue.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/marker-icon-2x-blue.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-2x-blue.png diff --git a/services/website_dashboard/app/static/leaflet/img/marker-icon-2x-green.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-2x-green.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/marker-icon-2x-green.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-2x-green.png diff --git a/services/website_dashboard/app/static/leaflet/img/marker-icon-2x-grey.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-2x-grey.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/marker-icon-2x-grey.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-2x-grey.png diff --git a/services/website_dashboard/app/static/leaflet/img/marker-icon-2x-orange.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-2x-orange.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/marker-icon-2x-orange.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-2x-orange.png diff --git a/services/website_dashboard/app/static/leaflet/img/marker-icon-2x-red.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-2x-red.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/marker-icon-2x-red.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-2x-red.png diff --git a/services/website_dashboard/app/static/leaflet/img/marker-icon-2x-violet.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-2x-violet.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/marker-icon-2x-violet.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-2x-violet.png diff --git a/services/website_dashboard/app/static/leaflet/img/marker-icon-2x-yellow.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-2x-yellow.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/marker-icon-2x-yellow.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-2x-yellow.png diff --git a/services/website_dashboard/app/static/leaflet/img/marker-icon-black.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-black.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/marker-icon-black.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-black.png diff --git a/services/website_dashboard/app/static/leaflet/img/marker-icon-blue.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-blue.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/marker-icon-blue.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-blue.png diff --git a/services/website_dashboard/app/static/leaflet/img/marker-icon-green.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-green.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/marker-icon-green.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-green.png diff --git a/services/website_dashboard/app/static/leaflet/img/marker-icon-grey.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-grey.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/marker-icon-grey.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-grey.png diff --git a/services/website_dashboard/app/static/leaflet/img/marker-icon-orange.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-orange.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/marker-icon-orange.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-orange.png diff --git a/services/website_dashboard/app/static/leaflet/img/marker-icon-red.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-red.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/marker-icon-red.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-red.png diff --git a/services/website_dashboard/app/static/leaflet/img/marker-icon-violet.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-violet.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/marker-icon-violet.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-violet.png diff --git a/services/website_dashboard/app/static/leaflet/img/marker-icon-yellow.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-yellow.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/marker-icon-yellow.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-icon-yellow.png diff --git a/services/website_dashboard/app/static/leaflet/img/marker-shadow.png b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-shadow.png similarity index 100% rename from services/website_dashboard/app/static/leaflet/img/marker-shadow.png rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/img/marker-shadow.png diff --git a/services/website_dashboard/app/static/leaflet/leaflet-color-markers.js b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/leaflet-color-markers.js similarity index 100% rename from services/website_dashboard/app/static/leaflet/leaflet-color-markers.js rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/leaflet-color-markers.js diff --git a/services/website_dashboard/app/static/leaflet/leaflet-src.esm.js b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/leaflet-src.esm.js similarity index 100% rename from services/website_dashboard/app/static/leaflet/leaflet-src.esm.js rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/leaflet-src.esm.js diff --git a/services/website_dashboard/app/static/leaflet/leaflet-src.esm.js.map b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/leaflet-src.esm.js.map similarity index 100% rename from services/website_dashboard/app/static/leaflet/leaflet-src.esm.js.map rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/leaflet-src.esm.js.map diff --git a/services/website_dashboard/app/static/leaflet/leaflet-src.js b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/leaflet-src.js similarity index 100% rename from services/website_dashboard/app/static/leaflet/leaflet-src.js rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/leaflet-src.js diff --git a/services/website_dashboard/app/static/leaflet/leaflet-src.js.map b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/leaflet-src.js.map similarity index 100% rename from services/website_dashboard/app/static/leaflet/leaflet-src.js.map rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/leaflet-src.js.map diff --git a/services/website_dashboard/app/static/leaflet/leaflet.css b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/leaflet.css similarity index 100% rename from services/website_dashboard/app/static/leaflet/leaflet.css rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/leaflet.css diff --git a/services/website_dashboard/app/static/leaflet/leaflet.js b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/leaflet.js similarity index 100% rename from services/website_dashboard/app/static/leaflet/leaflet.js rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/leaflet.js diff --git a/services/website_dashboard/app/static/leaflet/leaflet.js.map b/services/ansible_openvpn/docker/dashboard/app/static/leaflet/leaflet.js.map similarity index 100% rename from services/website_dashboard/app/static/leaflet/leaflet.js.map rename to services/ansible_openvpn/docker/dashboard/app/static/leaflet/leaflet.js.map diff --git a/services/website_dashboard/app/static/moment.min.js b/services/ansible_openvpn/docker/dashboard/app/static/moment.min.js similarity index 100% rename from services/website_dashboard/app/static/moment.min.js rename to services/ansible_openvpn/docker/dashboard/app/static/moment.min.js diff --git a/services/website_dashboard/app/static/placeholders.min.js b/services/ansible_openvpn/docker/dashboard/app/static/placeholders.min.js similarity index 100% rename from services/website_dashboard/app/static/placeholders.min.js rename to services/ansible_openvpn/docker/dashboard/app/static/placeholders.min.js diff --git a/services/website_dashboard/app/static/status.css b/services/ansible_openvpn/docker/dashboard/app/static/status.css similarity index 100% rename from services/website_dashboard/app/static/status.css rename to services/ansible_openvpn/docker/dashboard/app/static/status.css diff --git a/services/website_dashboard/app/static/status.js b/services/ansible_openvpn/docker/dashboard/app/static/status.js similarity index 93% rename from services/website_dashboard/app/static/status.js rename to services/ansible_openvpn/docker/dashboard/app/static/status.js index 93acf63..e7cc20c 100644 --- a/services/website_dashboard/app/static/status.js +++ b/services/ansible_openvpn/docker/dashboard/app/static/status.js @@ -77,19 +77,19 @@ var lmap = L.map('mapid').setView([47.7456, -3.3687], 16); var sensors = L.layerGroup(); var routers = L.layerGroup(); -L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', { +L.tileLayer('https://api.mapbox.com/styles/v1/mapbox/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1Ijoibmljb2xhcy1mIiwiYSI6ImNsbTBhMTkxMTE3ODkzZHA2ZGM0NWVhb3EifQ.XLAxFMiFQD1VomPnHjcFAA', { maxZoom: 18, attribution: 'Map data © OpenStreetMap contributors, ' + 'CC-BY-SA, ' + 'Imagery © Mapbox', - id: 'mapbox.streets' + id: 'streets-v11' }).addTo(lmap); sensors.addTo(lmap); routers.addTo(lmap); -getStations(lmap, sensors); -getRouters(lmap, routers); +//getStations(lmap, sensors); +//getRouters(lmap, routers); var legend = L.control({position: 'bottomright'}); diff --git a/services/website_dashboard/app/templates/query.json b/services/ansible_openvpn/docker/dashboard/app/templates/query.json similarity index 100% rename from services/website_dashboard/app/templates/query.json rename to services/ansible_openvpn/docker/dashboard/app/templates/query.json diff --git a/services/ansible_openvpn/docker/dashboard/app/templates/query_sensor_list.json b/services/ansible_openvpn/docker/dashboard/app/templates/query_sensor_list.json new file mode 100644 index 0000000..ad9513e --- /dev/null +++ b/services/ansible_openvpn/docker/dashboard/app/templates/query_sensor_list.json @@ -0,0 +1,39 @@ +{ + "size": 0, + "fields": [ + "TPV.lat", + "TPV.lon", + "hwa", + "date" + ], + "aggs": { + "group": { + "terms": { + "field": "hwa.keyword", + "size": 200 + }, + "aggs": { + "results_without_mb_id": { + "filter": { + "exists": { + "field": "TPV.lat" + } + } + }, + "group_docs": { + "top_hits": { + "size": 1, + "_source": false, + "sort": [ + { + "date": { + "order": "desc" + } + } + ] + } + } + } + } + } +} diff --git a/services/website_dashboard/app/templates/query_sensor_record_count.json b/services/ansible_openvpn/docker/dashboard/app/templates/query_sensor_record_count.json similarity index 100% rename from services/website_dashboard/app/templates/query_sensor_record_count.json rename to services/ansible_openvpn/docker/dashboard/app/templates/query_sensor_record_count.json diff --git a/services/website_dashboard/app/templates/status.html b/services/ansible_openvpn/docker/dashboard/app/templates/status.html similarity index 96% rename from services/website_dashboard/app/templates/status.html rename to services/ansible_openvpn/docker/dashboard/app/templates/status.html index d4cc554..b05e6d5 100644 --- a/services/website_dashboard/app/templates/status.html +++ b/services/ansible_openvpn/docker/dashboard/app/templates/status.html @@ -2,6 +2,7 @@ +