Announcing live test PRs (#5857)

* Implement one.

* REVERT ME LATER

* Initial implementation dooonnee.

* log

* Fixes

* Lazyness squared
This commit is contained in:
Erki
2018-12-31 04:55:16 +02:00
committed by Werner
parent 746772f1c1
commit 2daef5c6b6
7 changed files with 122 additions and 14 deletions

View File

@@ -1017,3 +1017,5 @@ var/list/gamemode_cache = list()
config.python_path = "/usr/bin/env python2" config.python_path = "/usr/bin/env python2"
else //probably windows, if not this should work anyway else //probably windows, if not this should work anyway
config.python_path = "python" config.python_path = "python"
revdata.generate_greeting_info()

View File

@@ -40,8 +40,9 @@ var/datum/controller/subsystem/ticker/SSticker
var/delay_end = 0 //if set to nonzero, the round will not restart on it's own var/delay_end = 0 //if set to nonzero, the round will not restart on it's own
var/triai = 0 //Global holder for Triumvirate var/triai = 0 //Global holder for Triumvirate
var/tipped = 0 //Did we broadcast the tip of the day yet? var/tipped = FALSE //Did we broadcast the tip of the day yet?
var/selected_tip // What will be the tip of the day? var/selected_tip // What will be the tip of the day?
var/testmerges_printed = FALSE
var/round_end_announced = 0 // Spam Prevention. Announce round end only once. var/round_end_announced = 0 // Spam Prevention. Announce round end only once.
@@ -134,6 +135,10 @@ var/datum/controller/subsystem/ticker/SSticker
pregame_timeleft-- pregame_timeleft--
return return
if (pregame_timeleft <= 20 && !testmerges_printed)
print_testmerges()
testmerges_printed = TRUE
if (pregame_timeleft <= 10 && !tipped) if (pregame_timeleft <= 10 && !tipped)
send_tip_of_the_round() send_tip_of_the_round()
tipped = TRUE tipped = TRUE
@@ -326,6 +331,12 @@ var/datum/controller/subsystem/ticker/SSticker
world << "<font color='purple'><b>Tip of the round: \ world << "<font color='purple'><b>Tip of the round: \
</b>[html_encode(m)]</font>" </b>[html_encode(m)]</font>"
/datum/controller/subsystem/ticker/proc/print_testmerges()
var/data = revdata.testmerge_overview()
if (data)
to_world(data)
/datum/controller/subsystem/ticker/proc/pregame() /datum/controller/subsystem/ticker/proc/pregame()
set waitfor = FALSE set waitfor = FALSE
sleep(1) // Sleep so the MC has a chance to update its init time. sleep(1) // Sleep so the MC has a chance to update its init time.

View File

@@ -5,6 +5,8 @@ var/global/datum/getrev/revdata = new()
var/revision var/revision
var/date var/date
var/showinfo var/showinfo
var/list/datum/tgs_revision_information/test_merge/test_merges
var/greeting_info
/datum/getrev/New() /datum/getrev/New()
var/list/head_branch = file2list(".git/HEAD", "\n") var/list/head_branch = file2list(".git/HEAD", "\n")
@@ -24,6 +26,13 @@ var/global/datum/getrev/revdata = new()
date = unix2date(unix_time) date = unix2date(unix_time)
break break
var/datum/tgs_api/api = TGS_READ_GLOBAL(tgs)
if (api)
test_merges = api.TestMerges()
else
test_merges = list()
world.log << "Running revision:" world.log << "Running revision:"
world.log << branch world.log << branch
world.log << date world.log << date
@@ -44,3 +53,62 @@ client/verb/showrevinfo()
src << "Revision unknown" src << "Revision unknown"
src << "<b>Current Map:</b> [current_map.full_name]" src << "<b>Current Map:</b> [current_map.full_name]"
/datum/getrev/proc/testmerge_overview()
if (!test_merges.len)
return
var/list/out = list("<br><center><font color='purple'><b>PRs test-merged for this round:</b><br>")
for (var/TM in test_merges)
out += testmerge_short_overview(TM)
out += "</font></center><br>"
return out.Join()
/datum/getrev/proc/generate_greeting_info()
if (!test_merges.len)
greeting_info = {"<div class="alert alert-info">
There are currently no test merges loaded onto the server.
</div>"}
return
var/list/out = list("<p>There are currently [test_merges.len] PRs being tested live.</p>",
{"<table class="table table-hover">"}
)
for (var/TM in test_merges)
out += testmerge_long_oveview(TM)
out += "</table>"
greeting_info = out.Join()
/datum/getrev/proc/testmerge_short_overview(datum/tgs_revision_information/test_merge/tm)
. = list()
. += "<hr><p>PR #[tm.number]: \"[html_encode(tm.title)]\""
. += "<br>\tAuthor: [html_encode(tm.author)]"
if (config.githuburl)
. += "<br>\t<a href='[config.githuburl]pull/[tm.number]'>\[Details...\]</a>"
. += "</p>"
/datum/getrev/proc/testmerge_long_oveview(datum/tgs_revision_information/test_merge/tm)
var/divid = "pr[tm.number]"
. = list()
. += {"<tr data-toggle="collapse" data-target="#[divid]" class="clickable">"}
. += {"<th>PR #[tm.number] - [html_encode(tm.title)]</th>"}
. += {"</tr><tr><td class="hiddenRow"><div id="[divid]" class="collapse">"}
. += {"<table class="table">"}
. += {"<tr><th>Author:</th><td>[html_encode(tm.author)]</td></tr>"}
. += {"<tr><th>Merged:</th><td>[tm.time_merged]</td></tr>"}
if (config.githuburl)
. += {"<tr><td colspan="2"><a href="?JSlink=github;pr=[tm.number]">Link to Github</a></td></tr>"}
. += {"<tr><th>Description:</th><td>[html_encode(tm.body)]</td></tr>"}
. += {"</table></div></td></tr>"}

View File

@@ -179,7 +179,7 @@
var/datum/asset/welcome = get_asset_datum(/datum/asset/simple/misc) var/datum/asset/welcome = get_asset_datum(/datum/asset/simple/misc)
welcome.send(user) welcome.send(user)
user << browse('html/templates/welcome_screen.html', "window=greeting;size=640x500") user << browse('html/templates/welcome_screen.html', "window=greeting;size=740x500")
/* /*
* A proc used to close the server greeting window for a user. * A proc used to close the server greeting window for a user.
@@ -247,6 +247,16 @@
data["content"] = motd data["content"] = motd
user << output(JS_SANITIZE(data), "greeting.browser:AddContent") user << output(JS_SANITIZE(data), "greeting.browser:AddContent")
data["div"] = "#testmerges"
data["content"] = revdata.greeting_info
if (revdata.test_merges.len)
data["update"] = 1
else
data["update"] = 0
data["changeHash"] = null
user << output(JS_SANITIZE(data), "greeting.browser:AddContent")
/* /*
* Basically the Topic proc for the greeting datum. * Basically the Topic proc for the greeting datum.
*/ */
@@ -338,3 +348,5 @@
#undef OUTDATED_MOTD #undef OUTDATED_MOTD
#undef MEMOFILE #undef MEMOFILE
#undef JS_SANITIZE

View File

@@ -186,7 +186,11 @@
if ("github") if ("github")
if (!config.githuburl) if (!config.githuburl)
src << "<span class='danger'>Github URL not set in the config. Unable to open the site.</span>" src << "<span class='danger'>Github URL not set in the config. Unable to open the site.</span>"
else if (alert("This will open the issue tracker in your browser. Are you sure?",, "Yes", "No") == "Yes") else if (alert("This will open the Github page in your browser. Are you sure?",, "Yes", "No") == "Yes")
if (href_list["pr"])
var/pr_link = "[config.githuburl]pull/[href_list["pr"]]"
src << link(pr_link)
else
src << link(config.githuburl) src << link(config.githuburl)
// Forum link from various panels. // Forum link from various panels.

View File

@@ -0,0 +1,5 @@
author: Skull132
delete-after: true
changes:
- rscadd: "The active test merges are now displayed at the start of each round. They can also be inspected from the greetings window."

View File

@@ -10,6 +10,10 @@
.nav-tabs>li.updated>a, .nav-tabs>li.updated>a:hover, .nav-tabs>li.updated>a:focus { .nav-tabs>li.updated>a, .nav-tabs>li.updated>a:hover, .nav-tabs>li.updated>a:focus {
background-color: #fcf8e3; background-color: #fcf8e3;
} }
.hiddenRow {
padding: 0 !important;
}
</style> </style>
</head> </head>
<body> <body>
@@ -18,6 +22,7 @@
<ul class="nav nav-tabs" id="myTab" role="tablist"> <ul class="nav nav-tabs" id="myTab" role="tablist">
<li role="presentation" class="active" id="home-tab"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li> <li role="presentation" class="active" id="home-tab"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>
<li role="presentation" id="motd-tab"><a href="#motd" aria-controls="motd" role="tab" data-toggle="tab">Announcements</a></li> <li role="presentation" id="motd-tab"><a href="#motd" aria-controls="motd" role="tab" data-toggle="tab">Announcements</a></li>
<li role="presentation" id="testmerges-tab"><a href="#testmerges" aria-controls="testmerges" role="tab" data-toggle="tab">Test Merges</a></li>
<li role="presentation" id="memo-tab"><a href="#memo" aria-controls="memo" role="tab" data-toggle="tab">Staff Memos</a></li> <li role="presentation" id="memo-tab"><a href="#memo" aria-controls="memo" role="tab" data-toggle="tab">Staff Memos</a></li>
<li role="presentation" id="note-tab"><a href="#note" aria-controls="note" role="tab" data-toggle="tab">Notifications</a></li> <li role="presentation" id="note-tab"><a href="#note" aria-controls="note" role="tab" data-toggle="tab">Notifications</a></li>
<li role="presentation"><a href="#webint">My Profile</a></li> <li role="presentation"><a href="#webint">My Profile</a></li>
@@ -47,6 +52,7 @@
</p> </p>
</div> </div>
<div role="tabpanel" class="tab-pane" id="motd"><div class="row"></div></div> <div role="tabpanel" class="tab-pane" id="motd"><div class="row"></div></div>
<div role="tabpanel" class="tab-pane" id="testmerges"></div>
<div role="tabpanel" class="tab-pane" id="memo"></div> <div role="tabpanel" class="tab-pane" id="memo"></div>
<div role="tabpanel" class="tab-pane" id="note"><div class="alert alert-info" id="note-placeholder">You do not have any notifications to show.</div></div> <div role="tabpanel" class="tab-pane" id="note"><div class="alert alert-info" id="note-placeholder">You do not have any notifications to show.</div></div>
</div> </div>