diff --git a/.gitignore b/.gitignore index be3f3850737ed6437ec9a1cc12f0a90c6c1bb2dc..5978a7abc6478b01323644ef3847aa480e9c1317 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ eccs2.pid chromedriver python* eccs2.ini +eccs2.conf eccs2.service eccs2properties.py clean7daysOldFiles.sh diff --git a/README.md b/README.md index 3cf18c9df36b4d2bf33d46f652c6c9d2b0ec11be..2713cbb3e8a432f9edf1d636e0ace0e91bff972e 100644 --- a/README.md +++ b/README.md @@ -272,6 +272,15 @@ After the initial download, it is recommended that you occasionally go through t * `sudo chgrp apache $HOME ; sudo apache g+rx $HOME` (Apache needs permission to access the $HOME dir) * `sudo systemctl restart httpd.service` +3. Restart API WSGI server each day to update the datetime: + * `crontab -e` + + ```bash + SHELL=/bin/bash + + 0 3 * * * /usr/bin/touch $HOME/eccs2/eccs2.ini + ``` + ## Utility To perform a restart after an API change use the following command: @@ -303,7 +312,7 @@ To clean the ECCS2 results from files older than last 7 days use (modify it on y ```bash SHELL=/bin/bash - 0 5 * * * /bin/bash $HOME/eccs2/clean7daysOldFiles.sh > $HOME/eccs2/logs/clean7daysOldFiles.log 2>&1 + 0 10 * * * /bin/bash $HOME/eccs2/clean7daysOldFiles.sh > $HOME/eccs2/logs/clean7daysOldFiles.log 2>&1 ``` # Utility for developers diff --git a/clean7daysOldFiles.sh b/clean7daysOldFiles.sh index f06b1b13fdc0747d2dc32b3fab45bd9c51f7a0de..86ee441565e3462602c067837535f3f0062a8ecc 100755 --- a/clean7daysOldFiles.sh +++ b/clean7daysOldFiles.sh @@ -1,6 +1,6 @@ #!/bin/bash -BASEDIR=/var/www/html/eccs2 +BASEDIR=$HOME/eccs2 # Remove ECCS2 result older than 7 days find $BASEDIR/output/* -mtime +6 -type f -delete diff --git a/eccs2.ini.template b/eccs2.ini.template index 6173c44b1c60a7670425d5ffb6133acf57d86ba9..3ab090f9a10436f4f9b2e175abacdd116258a9a1 100644 --- a/eccs2.ini.template +++ b/eccs2.ini.template @@ -26,7 +26,7 @@ logto = logs/%(project)uwsgi.log log-maxsize = 100000000 log-backupname = logs/%(project)uwsgi.old.log -# Ogni 1000 request riavvia i workers +# Each 1000 request restart workers max-requests = 1000 # respawn processes taking more than takes more then ... seconds diff --git a/eccs2.service.template b/eccs2.service.template index 5938658a85bdbde7c7fac1d69d5565f2defd15ea..bf572c3fbadad53616d165334a3bef0dd8d08553 100644 --- a/eccs2.service.template +++ b/eccs2.service.template @@ -13,7 +13,6 @@ RuntimeDirectory=/home/<USER>/eccs2 Restart=always KillSignal=SIGQUIT Type=notify -StandardError=syslog +StandardError=inherit NotifyAccess=all -#Environment="PATH=/home/<USER>/eccs2/eccs2venv/bin" ExecStart=/home/<USER>/eccs2/eccs2venv/bin/uwsgi --ini /home/<USER>/eccs2/eccs2.ini diff --git a/eccs2properties.py b/eccs2properties.py index 2cb89553859b1006054a6fad5c6ded6f3b6949ef..2e3d9ae5236bf7bd69d371dd55c3e2b7e1bf0dc0 100644 --- a/eccs2properties.py +++ b/eccs2properties.py @@ -1,10 +1,11 @@ +import os from datetime import date DAY = date.today().isoformat() -ECCS2DIR = "/var/www/html/eccs2" -PATHCHROMEDRIVER = "/var/www/html/eccs2/chromedriver" -ECCS2PYTHON = "/var/www/html/eccs2/python/bin/python3" +ECCS2DIR = "%s/eccs2" % os.environ['HOME'] +PATHCHROMEDRIVER = "%s/chromedriver" % ECCS2DIR +ECCS2PYTHON = "%s/python/bin/python3" % ECCS2DIR # Input ECCS2INPUTDIR = "%s/input" % ECCS2DIR diff --git a/web/details_close_blue.png b/web/details_close_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..cb073659bf23d8e19220749f3a57484481d08012 Binary files /dev/null and b/web/details_close_blue.png differ diff --git a/web/details_close_transparent.png b/web/details_close_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..9a942ce400589c1c7b726fc0b99577b45c7b5b3f Binary files /dev/null and b/web/details_close_transparent.png differ diff --git a/web/details_close_transparent.png.1 b/web/details_close_transparent.png.1 new file mode 100644 index 0000000000000000000000000000000000000000..9a942ce400589c1c7b726fc0b99577b45c7b5b3f Binary files /dev/null and b/web/details_close_transparent.png.1 differ diff --git a/web/details_open_blue.png b/web/details_open_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..fd0cfa2f70fd702fd5b8e0a7ec1c7780d5124a01 Binary files /dev/null and b/web/details_open_blue.png differ diff --git a/web/details_open_transparent.png b/web/details_open_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..2a5b5ca4af8c43d9e2e903426606e54416cb32a7 Binary files /dev/null and b/web/details_open_transparent.png differ diff --git a/web/eccs2.css b/web/eccs2.css new file mode 100644 index 0000000000000000000000000000000000000000..02f4bab952cf78131cd5d8e1858f38f8bf0df6bb --- /dev/null +++ b/web/eccs2.css @@ -0,0 +1,47 @@ +td.details-control { + background: url('../images/details_open.png') no-repeat center center; + cursor: pointer; +} + +tr.shown td.details-control { + background: url('../images/details_close.png') no-repeat center center; +} + +#inner-table { + padding-left:40px; + background-color:white; +} + +#inner-table tr td{ + border: 0; +} + +table { + color: black; +} + +.eccs-central { + padding-left: 10px; + padding-right: 10px; +} + +.strong { + font-weight: bold; +} + +button#goButton { + float:right; + padding-right: 10px; + padding-left: 10px; + padding-bottom: 2px; + padding-top: 2px; + margin-left: 5px; + position: relative; + top: -3px; +} + +input#myDate { + float:right; + position: relative; + top: -3px; +} diff --git a/web/script.js b/web/eccs2.js similarity index 80% rename from web/script.js rename to web/eccs2.js index 4c4567a5ad77d87300a3edf1a72a8a004e42742b..5e38bd3473491b4bcb06606df551aaecd551588f 100644 --- a/web/script.js +++ b/web/eccs2.js @@ -65,13 +65,31 @@ function getPastResults() { } $(document).ready(function() { + // Setup - add a text input to each footer cell + $('#eccstable thead tr').clone(true).appendTo( '#eccstable thead' ); + $('#eccstable thead tr:not(:eq(1)) th').each( function (i) { + var title = $('#eccstable thead th').eq( $(this).index() ).text(); + if($(this).index() !=0 && $(this).index() !=5) $(this).html( '<input type="text" placeholder="Search '+title+'" style="text-align:center;width: 100%;" />' ); + + $( 'input', this ).on( 'keyup change', function () { + if ( table.column(i).search() !== this.value ) { + table + .column(i) + .search( this.value ) + .draw(); + } + } ); + } ); + table = $('#eccstable').DataTable( { + "responsive": "true", "ajax": { "url": url, "dataSrc": "" }, "lengthMenu": [[10, 20, 30, 40, 50, 100, -1], [10, 20, 30, 40, 50, 100, "All"]], "autoWidth": false, + "dom": '<"top"lip>rt<"bottom"><"clear">', "columns": [ { "className": 'details-control', @@ -92,18 +110,24 @@ $(document).ready(function() { }, { "data": "status", - "className": "dt-body-center" + "className": "dt-body-center", + "visible": false } ], "rowCallback": function( row, data, index ) { if (data.status == "ERROR") { - $('td', row).css('background-color', '#EA4335'); + //$('td', row).css('background-color', '#EA4335'); // NEW ECCS2 + $('td', row).css('background-color', '#EA3D3F'); // OLD ECCS + //$('td', row).css('background-color', '#FF0000'); + //$('td', row).css('background-color', '#F22422'); } if (data.status == "DISABLED") { $('td', row).css('background-color', '#FFFFFF'); } if (data.status == "OK") { - $('td', row).css('background-color', '#34A853'); + //$('td', row).css('background-color', '#34A853'); + //$('td', row).css('background-color', '#00CE00'); // NEW ECCS2 + $('td', row).css('background-color', '#72F81B'); // OLD ECCS } }, "order": [[1, 'asc']] diff --git a/web/style.css b/web/style.css deleted file mode 100644 index cfa012f402646b44adcd7964a7e4726efa350dee..0000000000000000000000000000000000000000 --- a/web/style.css +++ /dev/null @@ -1,21 +0,0 @@ -td.details-control { - background: url('./details_open.png') no-repeat center center; - cursor: pointer; -} - -tr.shown td.details-control { - background: url('./details_close.png') no-repeat center center; -} - -#inner-table { - padding-left:40px; - background-color:white; -} - -#inner-table tr td{ - border: 0; -} - -.strong { - font-weight: bold; -}