diff --git a/controller/action/ContentActions.class.php b/controller/action/ContentActions.class.php index 26c0ee9e..da9541f9 100644 --- a/controller/action/ContentActions.class.php +++ b/controller/action/ContentActions.class.php @@ -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 ]]; } diff --git a/lib/thirdparty/Github.class.php b/lib/thirdparty/Github.class.php index 614eb3fe..2b279d6b 100644 --- a/lib/thirdparty/Github.class.php +++ b/lib/thirdparty/Github.class.php @@ -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 '
';
+//        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)
diff --git a/lib/tools/Config.class.php b/lib/tools/Config.class.php
index 9d65cce1..028a1e35 100644
--- a/lib/tools/Config.class.php
+++ b/lib/tools/Config.class.php
@@ -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";
diff --git a/view/template/content/roadmap.php b/view/template/content/roadmap.php
index b38fdf05..48daac3c 100644
--- a/view/template/content/roadmap.php
+++ b/view/template/content/roadmap.php
@@ -10,20 +10,22 @@
     

{{roadmap.title}}

-

Past successes and future plans for the journey into the land of dragons.

+

Future plans for the journey into the land of dragons.

+

Our top priorities, definitions of success, and target completion dates for key initiatives in are outlined below.

$groupItems): ?> + "> - + */ ?>
@@ -60,14 +62,16 @@
-
+
No description' ?>
+ Show Earlier Releases
+ */ ?> diff --git a/web/scss/_roadmap.scss b/web/scss/_roadmap.scss index e2824772..2040c0b3 100644 --- a/web/scss/_roadmap.scss +++ b/web/scss/_roadmap.scss @@ -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