def get_history(): try: query, _, _, _, _, limit, query_time = parse_fields(request.args) except Exception as e: return jsonify(status="error", message=str(e)), 400 try: history = db.get_history(query=query, limit=limit) except Exception as e: return jsonify(status="error", message=str(e)), 500 for alert in history: alert['href'] = absolute_url('/alert/' + alert['id']) if len(history) > 0: return jsonify( status="ok", history=history, lastTime=history[-1]['updateTime'] ) else: return jsonify( status="ok", message="not found", history=[], lastTIme=query_time )
def get_history(query: Query = None, page=1, page_size=1000) -> List[RichHistory]: return [ RichHistory.from_db(hist) for hist in db.get_history(query, page, page_size) ]
def get_history(tenant): tenant = generateDBName(tenant) try: query, _, _, _, limit, query_time = parse_fields(request) except Exception as e: return jsonify(status="error", message=str(e)), 400 try: history = db.get_history(tenant, query=query, limit=limit) except Exception as e: return jsonify(status="error", message=str(e)), 500 for alert in history: alert['href'] = "%s/%s" % (request.base_url.replace('alerts/history', 'alert'), alert['id']) if len(history) > 0: return jsonify( status="ok", history=history, lastTime=history[-1]['updateTime'] ) else: return jsonify( status="ok", message="not found", history=[], lastTIme=query_time )
autoRefresh=Switch.get('auto-refresh-allow').is_on() ) @app.route('/alerts/history', methods=['OPTIONS', 'GET']) @crossdomain(origin='*', headers=['Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'Authorization']) @auth_required @jsonp def get_history(): try: query, _, _, limit, query_time = parse_fields(request) except Exception, e: return jsonify(status="error", message=str(e)), 400 try: history = db.get_history(query=query, limit=limit) except Exception as e: return jsonify(status="error", message=str(e)), 500 for alert in history: alert['href'] = "%s/%s" % (request.base_url.replace('alerts/history', 'alert'), alert['id']) if len(history) > 0: return jsonify( status="ok", history=history, lastTime=history[-1]['updateTime'] ) else: return jsonify( status="ok",
def get_history(query=None, page=1, page_size=100): return [RichHistory.from_db(hist) for hist in db.get_history(query, page, page_size)]
@crossdomain(origin='*', headers=[ 'Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'Authorization' ]) @auth_required @jsonp def get_history(): try: query, _, _, limit, query_time = parse_fields(request) except Exception, e: return jsonify(status="error", message=str(e)), 400 try: history = db.get_history(query=query, limit=limit) except Exception as e: return jsonify(status="error", message=str(e)), 500 for alert in history: alert['href'] = "%s/%s" % (request.base_url.replace( 'alerts/history', 'alert'), alert['id']) if len(history) > 0: return jsonify(status="ok", history=history, lastTime=history[-1]['updateTime']) else: return jsonify(status="ok", message="not found", history=[],