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)
def apps(): client = docker.get_client() app_statuses = docker.get_application_statuses(client, current_user) apps = [ a[0] for a in app_statuses if a[1] == applications.ApplicationStatus.CREATED ] return flask.render_template('applications.html', applications=apps)
def app_stop(user_login, application_id): user = get_existing_user(user_login) application = get_existing_application(application_id) client = docker.get_client() docker.delete_application(client, user, application, False)
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)