Skip to content

Commit

Permalink
Initial PoC release
Browse files Browse the repository at this point in the history
  • Loading branch information
molsky committed Sep 29, 2016
1 parent 3d5fa0e commit cd54017
Show file tree
Hide file tree
Showing 21 changed files with 380 additions and 87 deletions.
96 changes: 10 additions & 86 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,89 +1,13 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.pyc
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache
*.xml
*.png
*.bu

# Scrapy stuff:
.scrapy
log.html
report.html

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject
.idea/
flask/
tests/
__pycache__/
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Changelog

## 0.01 - 29.09.2016.
* First release, proof of concept (rushed codefest project)
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MIT License
The MIT License (MIT)

Copyright (c) 2016 molsky

Expand Down
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Robot Framework Web UI

# Documentation
Nothing yet.

# Setup
First: update settings.ini file under app_configs folder (absolute path to folder where tests are located)

1. Create 'flask' virtualenv inside 'src' folder
2. Activate virtualenv and install requirements
3. Run app './run.py'
4. Open browser and go to (by default) 'http://127.0.0.1:5000/'

# Technologies
* Python 3.5
* Flask
* jQuery 2
* Bootstrap 3

# Todo
* Python 2 support
* Ability to abort test execution
* Show real time execution status via WEB UI (Console -page)
* Show newest execution messages in footer section
* Flask + gunicorn + nginx: To serve result files and images properly for users
* Ability to view result and log files via WEB UI
* Add user roles?
* Login page
* Settings page or panel to enable configuration via WEB UI
* Search/filter features
* pabot support
* Handle correctly situations when app has more than 1 user at the same time
* Update to Bootstrap 4 and jQuery 3 when Bootstrap 4 is ready
2 changes: 2 additions & 0 deletions requirements.pip
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
flask
flask-debugtoolbar
11 changes: 11 additions & 0 deletions src/rfwebui/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from flask import Flask
from flask_debugtoolbar import DebugToolbarExtension
from rfwebui.configs.config import config


app = Flask("rfwebui")
app.config.from_object(config['development'])
toolbar = DebugToolbarExtension(app)


from rfwebui import views
2 changes: 2 additions & 0 deletions src/rfwebui/app_configs/settings.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Files]
Path = None
Empty file added src/rfwebui/code/__init__.py
Empty file.
20 changes: 20 additions & 0 deletions src/rfwebui/code/helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import configparser
import os


def ConfigSectionMap(section):
Config = configparser.ConfigParser()
config_file = os.path.join(os.path.dirname(__file__), '../app_configs/settings.ini')
Config.read(config_file)

dict1 = {}
options = Config.options(section)
for option in options:
try:
dict1[option] = Config.get(section, option)
if dict1[option] == -1:
DebugPrint("skip: %s" % option)
except:
print("exception on %s!" % option)
dict1[option] = None
return dict1
Empty file added src/rfwebui/configs/__init__.py
Empty file.
42 changes: 42 additions & 0 deletions src/rfwebui/configs/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
class Config:
DEBUG = False
TESTING = False

CSRF_ENABLED = True
SECRET_KEY = 'you-will-never-guess'
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SECURE = False

MAX_CONTENT_LENGTH = 10 * 1024 * 1024 # 10 Mb limit

@staticmethod
def init_app(app):
pass


class DevelopmentConfig(Config):
DEBUG = True
TESTING = True

DEBUG_TB_TEMPLATE_EDITOR_ENABLED = True


class DebugConfig(Config):
DEBUG = True
TESTING = True

EXPLAIN_TEMPLATE_LOADING = True
TRAP_HTTP_EXCEPTIONS = True


class ProductionConfig(Config):
DEBUG = False
TESTING = False

config = {
'debug': DebugConfig,
'development': DevelopmentConfig,
'production': ProductionConfig,

'default': ProductionConfig
}
Binary file added src/rfwebui/static/favicon.ico
Binary file not shown.
45 changes: 45 additions & 0 deletions src/rfwebui/static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
body {
padding-top: 70px;
padding-bottom: 50px;
}

.left {
float: left;
}

.right {
float: right;
}

.color_user {
background-color: #dbf4fd;
}

.color_server {
background-color: #f0f4f8;
}

.footer {
border-top: 1px solid black;
background-color: rgb(201, 201, 201);
position: fixed;
height: 60px;
bottom: 0;
width: 100%;
padding: 10px;
}

#settings {
background-color: rgba(0,0,255,0.5);
height: 100vh;
width: 100vw;
z-index: 10000;
top: 0;
position: fixed;
display: none;
}

#settings_menu_container {
opacity: 1;
margin-top: 100px;
}
25 changes: 25 additions & 0 deletions src/rfwebui/static/ui_handler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"use strict";

$( "#settings_btn" ).click(function() {
$('.btn').button('reset');
$( "#settings" ).show( "slow", function() {} );
});

$( "#settings_btn_close" ).click(function() {
$( "#settings" ).hide( "slow", function() {} );
});

$( ".run" ).click(function(event) {
var id = event.target.id;
$("#" + id).attr("disabled", true);
$("#" + id).html('Running ...');
$("#" + id).toggleClass('btn-default btn-warning');
});

function runIsDone(data) {
var obj = JSON.parse(data);
var id = (obj.test_name).split(".")[0];
$("#" + id).attr("disabled", false);
$("#" + id).html('Run');
$("#" + id).toggleClass('btn-warning btn-default');
}
10 changes: 10 additions & 0 deletions src/rfwebui/templates/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% extends "base.html" %}

{% block content %}
<div class="panel panel-danger">
<div class="panel-heading">
<h3 class="panel-title">Error</h3>
</div>
<div class="panel-body">Page doesn't exists.</div>
</div>
{% endblock %}
10 changes: 10 additions & 0 deletions src/rfwebui/templates/405.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% extends "base.html" %}

{% block content %}
<div class="panel panel-danger">
<div class="panel-heading">
<h3 class="panel-title">Error</h3>
</div>
<div class="panel-body">Something unexpected happened.</div>
</div>
{% endblock %}
55 changes: 55 additions & 0 deletions src/rfwebui/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ title }}</title>

<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='style.css') }}">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">

</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="javascript:void(0)">Robot Framework - Web UI</a>
</div>
<ul class="nav navbar-nav navbar-left">
<li id="home"><a href="{{ url_for('index') }}">Test Suites</a></li>
<li id="console"><a href="javascript:void(0)">Console</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li id="settings_btn"><a href="javascript:void(0)"><span class="glyphicon glyphicon-cog"></span> Settings</a></li>
</ul>
</div>
</nav>

<div id="settings">
<div class="container" id="settings_menu_container">
<div class="panel panel-default">
<div class="panel-body">
"Admin panel"
</div>
<div class="panel-footer">
<button type="button" class="btn btn-default" id="settings_btn_close">Close</button>
</div>
</div>
</div>
</div>

<div class="container">
{% block content %}{% endblock %}
</div>
{% block footer %}{% endblock %}

<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script src="{{ url_for('static',filename='ui_handler.js') }}"></script>

{% block script %}{% endblock %}
</body>
</html>
10 changes: 10 additions & 0 deletions src/rfwebui/templates/config_error.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% extends "base.html" %}

{% block content %}
<div class="panel panel-danger">
<div class="panel-heading">
<h3 class="panel-title">Config Error</h3>
</div>
<div class="panel-body">{{ cfg_error_message }}</div>
</div>
{% endblock %}
Loading

0 comments on commit cd54017

Please sign in to comment.