import flask

from cauldron.cli.server import run as server_runner
from cauldron.ui import arguments
from cauldron.ui import statuses


@server_runner.APPLICATION.route('/ui-status', methods=['POST'])
def ui_status():
    args = arguments.from_request()
    last_timestamp = args.get('last_timestamp', 0)
    force = args.get('force', False)
    results = statuses.get_status(last_timestamp, force)
    return flask.jsonify(results)

[(8, 'cauldron.cli.server.run.APPLICATION.route', 'server_runner.APPLICATION.route', True, 'from cauldron.cli.server import run as server_runner\n'), (10, 'cauldron.ui.arguments.from_request', 'arguments.from_request', False, 'from cauldron.ui import arguments\n'), (13, 'cauldron.ui.statuses.get_status', 'statuses.get_status', False, 'from cauldron.ui import statuses\n'), (14, 'flask.jsonify', 'flask.jsonify', False, 'import flask\n')]