This commit is contained in:
Tarek Ziade 2016-11-16 09:09:17 +01:00
Родитель d5360af084
Коммит 6395f14c36
8 изменённых файлов: 79 добавлений и 80 удалений

6
.gitignore поставляемый
Просмотреть файл

@ -1,7 +1,11 @@
*.un~
.DS_Store
bin
include
include
lib
.Python
__pycache__
*.pyc
servicebook.egg-info
.coverage
.tox

6
MANIFEST.in Normal file
Просмотреть файл

@ -0,0 +1,6 @@
include README.rst
include Makefile
include requirements.txt
include requirements-test.txt
include tox.ini
include .travis.yml

42
servicebook/data.py Normal file
Просмотреть файл

@ -0,0 +1,42 @@
PEOPLE = """\
Stuart Philp
Krupa Raj
Dave Hunt
Richard Pappalardo
Karl Thiessen
Peter deHaan
Chris Hartjes
Stephen Donner
Kevin Brosnan
Aaron Train
Matt Brandt
Rebecca Billings
John Dorlus
No-Jun Park
Benny Forehand Jr.
"""
GROUPS = [("User Interfaces", "https://wiki.mozilla.org/TestEngineering/UI",
"Dave Hunt"),
("Services", "https://wiki.mozilla.org/TestEngineering/Services",
"Richard Pappalardo"),
("Customization",
"https://wiki.mozilla.org/TestEngineering/Customization",
"Krupa Raj")]
_ABSEARCHDEPLOY = [['stage', 'https://search.stage.mozaws.net'],
['prod', 'https://search.services.mozilla.com']]
_ABDESC = """\
The ABSearch Service is used by Firefox to a/b test new search settings.
"""
_ABBUGZILLA = ["Cloud Services", "Server: absearch"]
PROJS = [["Shavar (Tracking Protection)", "", "Rebecca", "Richard", "#shavar",
"Services", [], []],
["ABSearch", _ABDESC, "Karl", "Chris", "#absearch", "Services",
_ABSEARCHDEPLOY, _ABBUGZILLA],
["Balrog", "", "Chris", "Karl", "#balrog", "Services", [], []]]

Просмотреть файл

@ -2,57 +2,14 @@
from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy import create_engine
import mappings
from servicebook import mappings
from servicebook.data import PEOPLE, GROUPS, PROJS
session_factory = sessionmaker(autoflush=False)
Session = scoped_session(session_factory)
_PEOPLE = """\
Stuart Philp
Krupa Raj
Dave Hunt
Richard Pappalardo
Karl Thiessen
Peter deHaan
Chris Hartjes
Stephen Donner
Kevin Brosnan
Aaron Train
Matt Brandt
Rebecca Billings
John Dorlus
No-Jun Park
Benny Forehand Jr.
"""
_GROUPS = [
("User Interfaces", "https://wiki.mozilla.org/TestEngineering/UI", "Dave Hunt"),
("Services", "https://wiki.mozilla.org/TestEngineering/Services", "Richard Pappalardo"),
("Customization", "https://wiki.mozilla.org/TestEngineering/Customization", "Krupa Raj"),
]
_ABSEARCHDEPLOY = [['stage', 'https://search.stage.mozaws.net'],
['prod', 'https://search.services.mozilla.com']]
_ABDESC = """\
The ABSearch Service is used by Firefox to a/b test new search settings.
"""
_ABBUGZILLA = ["Cloud Services", "Server: absearch"]
_PROJS = [
["Shavar (Tracking Protection)", "", "Rebecca", "Richard", "#shavar",
"Services", [], []],
["ABSearch", _ABDESC, "Karl", "Chris", "#absearch", "Services", _ABSEARCHDEPLOY,
_ABBUGZILLA],
["Balrog", "", "Chris", "Karl", "#balrog", "Services", [], []]
]
def init(sqluri='sqlite:////tmp/qa_projects.db', fill=False):
engine = create_engine(sqluri)
session_factory.configure(bind=engine)
@ -62,7 +19,7 @@ def init(sqluri='sqlite:////tmp/qa_projects.db', fill=False):
session = Session()
for person in _PEOPLE.split('\n'):
for person in PEOPLE.split('\n'):
if person.strip() == '':
continue
first, last = person.split(' ', 1)
@ -74,21 +31,20 @@ def init(sqluri='sqlite:////tmp/qa_projects.db', fill=False):
g = mappings.Group
def _find_person(firstname):
q = session.query(p).filter(p.firstname==firstname)
q = session.query(p).filter(p.firstname == firstname)
return q.first()
def _find_group(name):
q = session.query(g).filter(g.name==name)
q = session.query(g).filter(g.name == name)
return q.first()
for label, home, lead in _GROUPS:
lead = session.query(p).filter(p.lastname==lead.split(' ', 1)[-1])
for label, home, lead in GROUPS:
lead = session.query(p).filter(p.lastname == lead.split(' ', 1)[-1])
session.add(mappings.Group(label, home, lead.first()))
session.commit()
for project in _PROJS:
for project in PROJS:
proj = mappings.Project()
proj.name = project[0]
proj.description = project[1]

Просмотреть файл

@ -1,29 +1,26 @@
import json
import yaml
import requests
from flask import Flask, render_template
from flask_bootstrap import Bootstrap
from flask_nav.elements import Navbar, View, Subgroup, Link, Text, Separator
from flask_nav import Nav
from flask import render_template
from flask_nav import View, Navbar
from flask import Blueprint
from flask import request
#from flaskext.wtf import Form
#from wtforms.ext.appengine.db import model_form
from db import init, Session
import mappings
from nav import nav
from servicebook.db import Session
from servicebook.mappings import Project
from servicebook.nav import nav
frontend = Blueprint('frontend', __name__)
nav.register_element('frontend_top', Navbar(View('Mozilla QA ~ Service Book', '.home'),))
nav.register_element('frontend_top',
Navbar(View('Mozilla QA ~ Service Book', '.home'),))
@frontend.route("/")
def home():
projects = Session.query(mappings.Project)
projects = Session.query(Project)
return render_template('home.html', projects=projects)
@ -36,13 +33,12 @@ def swagger():
res = requests.get(endpoint)
spec = yaml.load(res.content)
return render_template('swagger.html', swagger_url=endpoint,
spec=json.dumps(spec))
spec=json.dumps(spec))
@frontend.route("/project/<int:project_id>")
def project(project_id):
q = Session.query(mappings.Project).filter(mappings.Project.id==project_id)
q = Session.query(Project).filter(Project.id == project_id)
project = q.one()
# scraping bugzilla info

Просмотреть файл

@ -70,5 +70,3 @@ class Project(Base):
accessibility_tests = Column(ScalarListType(URLType))
sec_tests = Column(ScalarListType(URLType))
localization_tests = Column(ScalarListType(URLType))

Просмотреть файл

@ -1,14 +1,11 @@
import os
from flask import Flask, render_template, send_from_directory
from flask_bootstrap import Bootstrap
from flask_nav.elements import Navbar, View, Subgroup, Link, Text, Separator
from flask_nav import Nav
from flask import Blueprint
from db import init, Session
import mappings
import frontend
from nav import nav
from flask import Flask
from flask_bootstrap import Bootstrap
from servicebook.db import init
from servicebook import frontend
from servicebook.nav import nav
HERE = os.path.dirname(__file__)

Просмотреть файл