Skip to content

Commit

Permalink
initial working site; job page, oops page; css, js, & image; basic test
Browse files Browse the repository at this point in the history
  • Loading branch information
sommersoft committed May 24, 2020
1 parent fc98519 commit 21c25de
Show file tree
Hide file tree
Showing 15 changed files with 597 additions and 0 deletions.
80 changes: 80 additions & 0 deletions application.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# The MIT License (MIT)
#
# Copyright (c) 2020 Michael Schroeder
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#

import os
import pathlib

import requests

from flask import Flask, render_template, request, url_for, abort
from werkzeug.exceptions import HTTPException

app = Flask(__name__)

with app.test_request_context():
url_for('static', filename='physaci.css')
url_for('static', filename='job_results.css')
url_for('static', filename='color_pallet.css')
url_for('static', filename='images/physa_silhouette_two_color.png')
url_for('static', filename='scripts/result_viewer.js')

@app.errorhandler(HTTPException)
def handle_oopsie(e):
error_info = {
'status_code': e.code,
'name': e.name,
'description': e.description
}
return render_template('oops.html', **error_info), e.code

@app.route('/')
def index():
return 'physaCI'

@app.route('/job')
def job_result():
node = request.args.get('node')
job_id = request.args.get('job-id')

if node is None or job_id is None:
abort(400, description='Missing required parameters.')

job_data = requests.get(
f'{os.environ["PHYSACI_JOB_RESULT_URL"]}?node={node}&job-id={job_id}'
)
if job_data.ok:
return render_template('physaci_results_page.html', **job_data.json())
else:
if 'application/json' in job_data.headers.get('Content-Type', ''):
error_info = job_data.json()
description = error_info.get(
'failure_reason',
'Error retrieving information.'
)
abort(job_data.status_code, description=description)
else:
abort(500)




18 changes: 18 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import os
import sys

import pytest

import application

@pytest.fixture
def client(monkeypatch):
if not os.environ.get('PHYSACI_JOB_RESULT_URL'):
monkeypatch.setenv('PHYSACI_JOB_RESULT_URL', 'https://physaci-app.azurewebsites.net/api/job-result')

application.app.config['TESTING'] = True

with application.app.test_client() as client:
yield client

monkeypatch.delenv('PHYSACI_JOB_RESULT_URL', raising=False)
2 changes: 2 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pytest
black==19.10b0
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Flask==1.1.2
requests
89 changes: 89 additions & 0 deletions static/color_pallet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/* CSS - Cascading Style Sheet */
/* Palette color codes */
/* Palette URL: http://paletton.com/#uid=73E0u0kcglL4Zvw8Eq6eXhmkwen */

/* Feel free to copy&paste color codes to your application */


/* As hex codes */

.color-primary-0 { color: #4A5B72 } /* Main Primary color */
.color-primary-1 { color: #8E98A5 }
.color-primary-2 { color: #677589 }
.color-primary-3 { color: #34445B }
.color-primary-4 { color: #1F324B }

.color-secondary-1-0 { color: #565078 } /* Main Secondary color (1) */
.color-secondary-1-1 { color: #9A97AE }
.color-secondary-1-2 { color: #736E90 }
.color-secondary-1-3 { color: #3E3960 }
.color-secondary-1-4 { color: #29234F }

.color-secondary-2-0 { color: #ADA06B } /* Main Secondary color (2) */
.color-secondary-2-1 { color: #FBF3D4 }
.color-secondary-2-2 { color: #D0C498 }
.color-secondary-2-3 { color: #8A7D4A }
.color-secondary-2-4 { color: #726329 }

.color-complement-0 { color: #AD946B } /* Main Complement color */
.color-complement-1 { color: #FBECD4 }
.color-complement-2 { color: #D0BB98 }
.color-complement-3 { color: #8A724A }
.color-complement-4 { color: #725729 }


/* Background Equivalents */
.bg-color-primary-0 { background-color: #4A5B72 } /* Main Primary color */
.bg-color-primary-1 { background-color: #8E98A5 }
.bg-color-primary-2 { background-color: #677589 }
.bg-color-primary-3 { background-color: #34445B }
.bg-color-primary-4 { background-color: #1F324B }

.bg-color-secondary-1-0 { background-color: #565078 } /* Main Secondary color (1) */
.bg-color-secondary-1-1 { background-color: #9A97AE }
.bg-color-secondary-1-2 { background-color: #736E90 }
.bg-color-secondary-1-3 { background-color: #3E3960 }
.bg-color-secondary-1-4 { background-color: #29234F }

.bg-color-secondary-2-0 { background-color: #ADA06B } /* Main Secondary color (2) */
.bg-color-secondary-2-1 { background-color: #FBF3D4 }
.bg-color-secondary-2-2 { background-color: #D0C498 }
.bg-color-secondary-2-3 { background-color: #8A7D4A }
.bg-color-secondary-2-4 { background-color: #726329 }

.bg-color-complement-0 { background-color: #AD946B } /* Main Complement color */
.bg-color-complement-1 { background-color: #FBECD4 }
.bg-color-complement-2 { background-color: #D0BB98 }
.bg-color-complement-3 { background-color: #8A724A }
.bg-color-complement-4 { background-color: #725729 }

/* As RGBa codes */

.rgba-primary-0 { color: rgba( 74, 91,114,1) } /* Main Primary color */
.rgba-primary-1 { color: rgba(142,152,165,1) }
.rgba-primary-2 { color: rgba(103,117,137,1) }
.rgba-primary-3 { color: rgba( 52, 68, 91,1) }
.rgba-primary-4 { color: rgba( 31, 50, 75,1) }

.rgba-secondary-1-0 { color: rgba( 86, 80,120,1) } /* Main Secondary color (1) */
.rgba-secondary-1-1 { color: rgba(154,151,174,1) }
.rgba-secondary-1-2 { color: rgba(115,110,144,1) }
.rgba-secondary-1-3 { color: rgba( 62, 57, 96,1) }
.rgba-secondary-1-4 { color: rgba( 41, 35, 79,1) }

.rgba-secondary-2-0 { color: rgba(173,160,107,1) } /* Main Secondary color (2) */
.rgba-secondary-2-1 { color: rgba(251,243,212,1) }
.rgba-secondary-2-2 { color: rgba(208,196,152,1) }
.rgba-secondary-2-3 { color: rgba(138,125, 74,1) }
.rgba-secondary-2-4 { color: rgba(114, 99, 41,1) }

.rgba-complement-0 { color: rgba(173,148,107,1) } /* Main Complement color */
.rgba-complement-1 { color: rgba(251,236,212,1) }
.rgba-complement-2 { color: rgba(208,187,152,1) }
.rgba-complement-3 { color: rgba(138,114, 74,1) }
.rgba-complement-4 { color: rgba(114, 87, 41,1) }



/* Generated by Paletton.com © 2002-2014 */
/* http://paletton.com */
Binary file added static/images/physa_silhouette_two_color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions static/job_results.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.board-results-wrapper {
display: flex;
flex-direction: column;
padding-bottom: 2px;
}

.board-result {
display: none;
}


.board-result-child {
display: inherit;
}

.board-result-grandchild {
padding: 0 2em 0 0;
margin: 0;
}

.board-results-summary {
display: flex;
flex-direction: row;
font-family: Arial, Helvetica, sans-serif;
font-size: large;
font-weight: 600;
padding: .5em;
color: #313131;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
}

.board-results-log {
background-color: black;
color: ghostwhite;
font-family: monospace;
font-size: large;
font-weight: 400;
padding: 3px;
}
51 changes: 51 additions & 0 deletions static/oops.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
body {
margin: 0;
}

.oh-noes-page {
display: grid;
grid-template-columns: 2fr;
grid-template-rows: 400px 2fr;
justify-items: center;
}

.upper {
grid-row: 1;
display: flex;
width: 100%;
justify-content: center;
border-bottom: 2px solid #D0BB98;
}

.header-logo {
align-self: center;
width: 12em;
height: 4em;
}

.div-header-span-1-text {
align-self: center;
padding-left: 25px;
font-family: fantasy;
font-size: 5rem;
font-weight: bolder;
}

.div-message {
grid-row: 2;
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
align-items: center;
justify-items: center;
justify-content: space-evenly;
padding-top: 1em;
border-top: 2px solid #3E3960;
}

.message-list {
text-align: center;
font-size: 4rem;
font-family: monospace;
}
Loading

0 comments on commit 21c25de

Please sign in to comment.