# HG changeset patch # User sean # Date 1439295489 -7200 # Node ID be6a1aaec717233d60df12bb45c467b4e129f13a # Parent 3da0d624bec0c75133198dc426b42dbc508f4b77 added the post listener, write logs if someone sends a post diff -r 3da0d624bec0 -r be6a1aaec717 dash.conf --- a/dash.conf Wed Aug 05 13:38:15 2015 +0200 +++ b/dash.conf Tue Aug 11 14:18:09 2015 +0200 @@ -20,6 +20,8 @@ [settings] show_top_bar=False +rows=2 +check_interval=5 # Tiles: # example: @@ -71,7 +73,7 @@ div_name=techintern script=display_issues_techintern -[tile5] -type=d3js -div_name=webview_test -script=webview_template +#[tile5] +#type=d3js +#div_name=webview_test +#script=webview_template diff -r 3da0d624bec0 -r be6a1aaec717 dash.py --- a/dash.py Wed Aug 05 13:38:15 2015 +0200 +++ b/dash.py Tue Aug 11 14:18:09 2015 +0200 @@ -6,7 +6,8 @@ from bottle import get, post, request, view, response, route from bottle import template, run, static_file, error -import os.path,sys,configparser,functools,bottle +import os.path, sys, configparser, functools, bottle +import logging CONFIG_FILE = "dash.conf" PATH = os.path.abspath(os.path.dirname(sys.argv[0])) @@ -24,10 +25,18 @@ settings = {} default_settings = configparser.ConfigParser() -default_settings['settings'] = {'show_top_bar': False} +default_settings['settings'] = {'show_top_bar': False, 'rows': 2} + +#logging: + +logger = logging.getLogger('myapp') +hdlr = logging.FileHandler(PATH + '/bottledash.log') +formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') +hdlr.setFormatter(formatter) +logger.addHandler(hdlr) +logger.setLevel(logging.INFO) ##read the config file. usually "dash.conf" - def read_config(): # print(PATH) @@ -139,6 +148,17 @@ def call_dashboard(): return dict(tiles=tiles, settings=settings) +@post('/updown') +def updown(): + service = request.forms.get('service') + status = request.forms.get('status') + + logger.info('------- new alert --------') + logger.info('Service : ' + str(service)) + logger.info('Status : ' + str(status)) + logger.info('--------------------------') + return "thx! :: " + str(service) + " is " + str(status) + " !" + @route('/config') def call_config(): return 'Not implemented yet' diff -r 3da0d624bec0 -r be6a1aaec717 views/bottledash_view.tpl --- a/views/bottledash_view.tpl Wed Aug 05 13:38:15 2015 +0200 +++ b/views/bottledash_view.tpl Tue Aug 11 14:18:09 2015 +0200 @@ -3,8 +3,6 @@ License: GNU GPL >= v2. See LICENSE for details. --> <% - - import math, os, sys, subprocess, html.parser from datetime import date @@ -29,7 +27,7 @@ "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember")[today.month-1] - number_of_rows = 1 + number_of_rows = 2 ################# # viewport size #