Last active
June 14, 2018 09:38
-
-
Save catalinaturlea/48e63c93daac303c553d2dc50aa8454e to your computer and use it in GitHub Desktop.
WebSlides Youtrack Generations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from youtrack.connection import Connection as YouTrack | |
#// authentication request with permanent token | |
#yt = YouTrack('https://instance_name.myjetbrains.com/youtrack/', token='perm:abcdefghijklmn') | |
#// versus authentication with username and password | |
yt = YouTrack('https://everskill.myjetbrains.com/youtrack/', login='add_yours_here', password='add_yours_here') | |
def print_issues(project, issues, type): | |
sys.stdout.write("<section class=\"aligncenter\"><div class=\"wrap\">\ | |
<div class=\"content-left\">") | |
sys.stdout.write("<h1>" + project + ": " + type + "</h1>") | |
for issue in issues: | |
if issue.Type == type: | |
print_issue(issue) | |
sys.stdout.write("</div></section>") | |
def print_issues_with_component(project, issues, type, component): | |
sys.stdout.write("<section class=\"aligncenter\"><div class=\"wrap\">\ | |
<div class=\"content-left\">") | |
sys.stdout.write("<h1>" + type + " - " + component + "</h1>") | |
for issue in issues: | |
if issue.Type == type and issue.Component == component: | |
print_issue(issue) | |
sys.stdout.write("</div></section>") | |
def print_issue(issue): | |
tags = "" if not issue.tags else '[%s]' % ', '.join(map(str, issue.tags or [])) | |
# status = u'\u2714' if issue.State == 'Done' else u'\u2718' | |
# status = status.encode('ascii', 'ignore') | |
status = "<span style=\"color:green\">✓</span>" if issue.State == 'Done' else "<span style=\"color:red\">✗</span>" | |
# issue.id - for the ID | |
sys.stdout.write("<br>" + status + " " + tags + " " + issue.summary + "<br>") | |
sys.stdout.write("<html><head> <meta charset=\"utf-8\">\ | |
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><link href=\"https://fonts.googleapis.com/css?family=Roboto:100,100i,300,300i,400,400i,700,700i%7CMaitree:200,300,400,600,700&subset=latin-ext\" rel=\"stylesheet\"/>\ | |
<!-- CSS Colors -->\ | |
<link rel=\"stylesheet\" type='text/css' media='all' href=\"static/css/webslides.css\"/>\ | |
<!-- Optional - CSS SVG Icons (Font Awesome) -->\ | |
<link rel=\"stylesheet\" type='text/css' media='all' href=\"static/css/svg-icons.css\"/>\ | |
<body><article id=\"webslides\">" | |
) | |
projects = ['MF', 'WF', 'BD', 'AS'] | |
for project in projects: | |
issues = yt.getIssues(project, 'Sprints:18#24', 0, 200) | |
if project == 'MF': | |
components = ['Android', 'iOS'] | |
for component in components: | |
print_issues_with_component(project, issues, "Bug", component) | |
print_issues_with_component(project, issues, "User Story", component) | |
else : | |
print_issues(project, issues, "Bug") | |
print_issues(project, issues, "User Story") | |
sys.stdout.write("<script src=\"static/js/webslides.js\"></script>\ | |
<script> window.ws = new WebSlides();</script>\ | |
<!-- OPTIONAL - svg-icons.js (fontastic.me - Font Awesome as svg icons) -->\ | |
<script defer src=\"static/js/svg-icons.js\"></script>\ | |
</body></html>") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment