roest01 / docker-speedtest-analyser

Automated docker speedtest analyser tool with included web interface to monitor your internet speed connection over time. Setup at home on your NAS (Synology, QNAP tested) and the container runs hourly speedtests. The speedtest results are displayed in an webinterface as line graph(s) over the day.
Other
108 stars 47 forks source link

Is there a way to change the format of the date on the graph? #44

Open jnags opened 4 years ago

jnags commented 4 years ago

I have the program installed in a docker container on my synology unit. (DS918+) Everything works but the date is in the incorrect format (DD.MM.YYYY) I would like it to be displayed (MM.DD.YYYY). I have "copy appConfig.example.js into /data/appConfig.js to change values" without any noticable changes. I have tried both EN as well as US for the locale. Here is a copy of the appConfig file:

let appConfig = { "customTitle": "Statistics for Real Nerds", "dateFormat": "MM.DD.YYYY", "locale": "US", "labels": { "download": "Download", "ping": "Ping", "upload": "Upload" },

How can I chnage this to reflect US date format? Thank you.

owenleonard commented 4 years ago

I had the same issue, so I dug into it a bit. I saw this error in the browser console

Uncaught SyntaxError: redeclaration of let appConfig
    <anonymous> http://10.10.26.22:9080/data/appConfig.js:1

I then looked at index.html and saw that both js/appConfig.example.js and data/appConfig.js are loaded.

    <!-- custom -->
    <script type="text/javascript" src="js/appConfig.example.js"></script>
    <script type="text/javascript" src="data/appConfig.js"></script>
    <script type="text/javascript" src="js/evaluation.js"></script>

So, I removed the js/appConfig.example.js line and rebuilt the container.

https://github.com/roest01/docker-speedtest-analyser/blob/d05b0858c6eafd09a4320517b1fc1259304dea87/index.html#L21

This eliminated the error and started respecting the changes I made to data/appConfig.js.

Better solution I also tried one more thing that doesn't require rebuilding the container. If you remove let from data/appConfig.js, then the settings will also be respected. Basically, you can't declare the appConfig object using let twice. I'll create a PR to update the instructions in js/appConfig.example.js to capture this.

owenleonard commented 4 years ago

https://github.com/roest01/docker-speedtest-analyser/pull/47

jnags commented 3 years ago

Better solution I also tried one more thing that doesn't require rebuilding the container. If you remove let from data/appConfig.js, then the settings will also be respected. Basically, you can't declare the appConfig object using let twice. I'll create a PR to update the instructions in js/appConfig.example.js to capture this.

This worked out exactly as expected. Thank you for the quick and easy fix to get this working properly!