コード例 #1
0
def application(application_id):
    client = docker.get_client()
    application = applications.get_application(application_id)
    if not application:
        flask.abort(404)
    application_status = None
    application_domain = None
    application_version = None
    application_image_version = docker.get_application_image_version(client, application)
    form = None

    if current_user.is_authenticated():

        form = forms.ApplicationForm()

        if form.validate_on_submit():
            if form.start.data:
                docker.create_application(client, current_user, application)

            if form.stop.data:
                docker.delete_application(client, current_user, application)
            return flask.redirect(flask.url_for('application', application_id=application_id))

        application_status = docker.get_application_status(client, current_user, application)
        application_domain = applications.get_application_domain(current_user, application)
        application_version = docker.get_application_version(client, current_user, application)

    return flask.render_template('application.html', application=application,
        application_status=application_status, application_domain=application_domain,
        application_version=application_version, application_image_version=application_image_version,
        form=form)
コード例 #2
0
def application_status(application_id):
    client = docker.get_client()
    application = applications.get_application(application_id)
    status = docker.get_application_status(client, current_user,
                                           application).name
    return flask.jsonify(status=status)