roadmap working

This commit is contained in:
Jeremy Kauffman 2019-02-05 18:57:38 -05:00
parent 9165fabc0a
commit 7c743629c6
5 changed files with 62 additions and 25 deletions

View file

@ -234,21 +234,26 @@ class ContentActions extends Actions
public static function executeRoadmap()
{
$cache = !Request::getParam('nocache');
$githubItems = Github::listRoadmapChangesets($cache);
$projectMaxVersions = [];
foreach ($githubItems as $group => $items) {
if ($items) {
$firstItem = reset($items);
$project = $firstItem['project'];
if (!isset($projectMaxVersions[$project]) || $firstItem['sort_key'] > $projectMaxVersions[$project]) {
$projectMaxVersions[$project] = $firstItem['sort_key'];
}
}
}
$items = array_merge(['2019' => Github::listRoadmapItems($cache)], $githubItems);
/*
* below will include past changes on the roadmap, considering dropping entirely
*/
// $githubItems = Github::listRoadmapChangesets($cache);
// $projectMaxVersions = [];
// foreach ($githubItems as $group => $items) {
// if ($items) {
// $firstItem = reset($items);
// $project = $firstItem['project'];
// if (!isset($projectMaxVersions[$project]) || $firstItem['sort_key'] > $projectMaxVersions[$project]) {
// $projectMaxVersions[$project] = $firstItem['sort_key'];
// }
// }
// }
$items = ['2019' => Github::listRoadmapItems($cache)]; // + $githubItems;
return ['content/roadmap', [
'projectMaxVersions' => $projectMaxVersions,
'projectMaxVersions' => [],
'items' => $items
]];
}

View file

@ -80,30 +80,46 @@ class Github
public static function get($endpoint, array $params = [], $cache = true)
{
$twoHoursInSeconds = 7200;
if (Config::get(Config::GITHUB_APP_CLIENT_ID) && Config::get(Config::GITHUB_APP_CLIENT_SECRET))
$headers = ['Accept: application/vnd.github.v3.html+json'];
// if (Config::get(Config::GITHUB_APP_CLIENT_ID) && Config::get(Config::GITHUB_APP_CLIENT_SECRET))
// {
// $params['client_id'] = Config::get(Config::GITHUB_APP_CLIENT_ID);
// $params['client_secret'] = Config::Get(Config::GITHUB_APP_CLIENT_SECRET);
// }
if (Config::get(Config::GITHUB_PERSONAL_AUTH_TOKEN))
{
$params['client_id'] = Config::get(Config::GITHUB_APP_CLIENT_ID);
$params['client_secret'] = Config::Get(Config::GITHUB_APP_CLIENT_SECRET);
$headers[] = 'Authorization: token ' . Config::get(Config::GITHUB_PERSONAL_AUTH_TOKEN);
}
return CurlWithCache::get(
'https://api.github.com' . $endpoint . '?' . http_build_query($params),
[],
['headers' => ['Accept: application/vnd.github.v3.html+json'],'user_agent' => 'LBRY', 'json_response' => true, 'cache' => $cache === true ? $twoHoursInSeconds : $cache]
['headers' => $headers, 'user_agent' => 'LBRY', 'json_response' => true, 'cache' => $cache === true ? $twoHoursInSeconds : $cache]
);
}
public static function listRoadmapItems($cache = true)
{
//below should be replaced with internal-issues and 2019 once it works
return array_reduce(static::get('/repos/lbryio/lbry.io/issues?label=consider%20soon'), function($issues, $issue) {
// echo '<pre>';
// print_r(static::get('/repos/lbryio/internal-issues/issues?labels=2019&filter=all'));
// die('a');
$issues = array_reduce(static::get('/repos/lbryio/internal-issues/issues?labels=2019&filter=all'), function($issues, $issue) {
return array_merge($issues, [[
'name' => $issue['title'],
'badge' => 'foo', //fix
'date' => '2019-12-31', //fix
'quarter_date' => 'Q2 2019', //fix
'quarter_date' => array_reduce($issue['labels'], function($carry, $label) {
if ($carry) { return $carry; }
return $label['name'][0] === 'Q' ? $label['name'] . ' 2019' : '';
}, ''),
'body' => $issue['body_html']
]]);
}, []);
usort($issues, function($a, $b) {
if ($a['quarter_date'] === $b['quarter_date']) {
return $a['name'] < $b['name'] ? -1 : 1;
}
return $a['quarter_date'] < $b['quarter_date'] ? -1 : 1;
});
return $issues;
}
public static function listRoadmapChangesets($cache = true)

View file

@ -9,6 +9,7 @@ class Config
const GITHUB_KEY = "github_key";
const GITHUB_APP_CLIENT_ID = "github_app_client_id";
const GITHUB_APP_CLIENT_SECRET = "github_app_client_secret";
const GITHUB_PERSONAL_AUTH_TOKEN = 'github_personal_auth_token';
const LBRY_API_SERVER = "lbry_api_server";
const MAILCHIMP_KEY = "mailchimp_key";
const AWS_LOG_ACCESS_KEY = "aws_log_access_key";

View file

@ -10,20 +10,22 @@
<div class="hero-content-wrapper">
<div class="hero-content text-center">
<h1 class="cover-title">{{roadmap.title}}</h1>
<h2 class="cover-subtitle">Past successes and future plans for the journey into the land of dragons.</h2>
<h2 class="cover-subtitle">Future plans for the journey into the land of dragons.</h2>
</div>
</div>
</div>
<div style="max-width: 800px; margin: 0 auto">
<p>Our top priorities, definitions of success, and target completion dates for key initiatives in <?php echo date('Y') ?> are outlined below.</p>
<div class="roadmap-container" id="project-roadmap">
<?php foreach ($items as $group => $groupItems): ?>
<?php $firstItem = reset($groupItems) ?>
<?php $isOpen = !isset($firstItem['project']) || !isset($firstItem['sort_key']) || $firstItem['sort_key'] === $projectMaxVersions[$firstItem['project']] ?>
<?php /*
<h2 class="roadmap-group-title" <?php echo !$isOpen ? 'style="display: none"' : '' ?>">
<span class="roadmap-group-title-label">
<?php echo $group ?> <?php echo isset($firstItem['sort_key']) && $firstItem['sort_key'] === $projectMaxVersions[$firstItem['project']] ? '(latest)' : '' ?>
</span>
</h2>
</h2> */ ?>
<div class="roadmap-group <?php echo !$isOpen ? 'roadmap-group-closed' : '' ?>">
<?php $maxItems = isset($firstItem['sort_key']) ? 1 : count($groupItems) ?>
<?php $index = 0 ?>
@ -60,14 +62,16 @@
<?php echo $item['date'] ? date('m-d-Y', strtotime($item['date'])) : '' ?>
<?php endif ?>
</div>
<div class="roadmap-item-content markdown">
<div class="roadmap-item-content content markdown">
<?php echo $item['body'] ?: '<em class="no-results">No description</em>' ?>
</div>
</div>
<?php endforeach ?>
</div>
<?php endforeach ?>
<?php /*
<div class="text-center"><a href="javascript:;" class="link-primary show-all-roadmap-groups">Show Earlier Releases</a></div>
*/ ?>
</div>
</div>
<?php echo View::render('nav/_learnFooter') ?>

View file

@ -117,6 +117,17 @@ $title-spur: 8 * $width-roadmap;
{
font-size: 0.9em;
margin: 10px;
/* Paul, when you rebase on master and see this, these are temp rules I added to help the roadmap look only like lukewarm garbage rather than hot garbage*/
h3 {
font-size: $font-size-h4 !important;
margin-top: $spacing-vertical * 0.5 !important;
}
ul {
margin-left: 30px !important;
}
ul > li + li {
margin-top: $spacing-vertical * 0.25;
}
}
.roadmap-item-content a{@include anchor($color-primary);}
.roadmap-item-assignee