From 57ad8c82f8ef3d60a6443ff1298eb66234f4903a Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+github@gmail.com>
Date: Fri, 6 Oct 2023 12:49:01 +0200
Subject: [PATCH] fixes #47

---
 assets/style.scss         |  3 +++
 controllers/dashboard.php |  6 ++++--
 lib/GitlabIssue.php       | 11 +++++++++++
 plugin.manifest           |  2 +-
 views/dashboard/index.php |  7 ++++++-
 5 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/assets/style.scss b/assets/style.scss
index 98e4050..bd94f29 100644
--- a/assets/style.scss
+++ b/assets/style.scss
@@ -27,3 +27,6 @@
 td.filter-match {
     background-color: var(--yellow-20);
 }
+#dashboard table.default td {
+    vertical-align: top;
+}
diff --git a/controllers/dashboard.php b/controllers/dashboard.php
index 775e77c..e506596 100644
--- a/controllers/dashboard.php
+++ b/controllers/dashboard.php
@@ -145,8 +145,10 @@ final class DashboardController extends TracToGitlab\Controller
 
     private function getMilestones()
     {
-        $milestones = $this->gitlab->milestones()->all(
-            $this->gitlabProjectId
+        $milestones = $this->gitlabPager->fetchAll(
+            $this->gitlab->milestones(),
+            'all',
+            [$this->gitlabProjectId]
         );
         $milestones = array_filter($milestones, function ($milestone) {
             return preg_match('/^Stud\.IP \d+\.\d+$/', $milestone['title']);
diff --git a/lib/GitlabIssue.php b/lib/GitlabIssue.php
index 2b3fd34..00f63bd 100644
--- a/lib/GitlabIssue.php
+++ b/lib/GitlabIssue.php
@@ -105,12 +105,23 @@ final class GitlabIssue implements \JsonSerializable
         return null;
     }
 
+    public function getStepStatus(): ? string
+    {
+        foreach ($this->issue['labels'] as $l) {
+            if (preg_match("/^StEP::(.+)$/", $l, $match)) {
+                return $match[1];
+            }
+        }
+        return null;
+    }
+
     public function jsonSerialize()
     {
         $result = [
             'iid' => $this->iid,
             'title' => $this->title,
             'type' => $this->type,
+            'step_status' => $this->getStepStatus(),
             'author' => $this->author['username'],
             'assignee' => $this->assignee,
             'web_url' => $this->web_url,
diff --git a/plugin.manifest b/plugin.manifest
index 8a3c757..1df419d 100644
--- a/plugin.manifest
+++ b/plugin.manifest
@@ -2,5 +2,5 @@ pluginname=Trac to gitlab converter
 pluginclassname=TracToGitlabPlugin
 pluginclassname=StudipReleasesPlugin
 origin=UOL
-version=1.4.3
+version=1.4.4
 studipMinVersion=5.0
diff --git a/views/dashboard/index.php b/views/dashboard/index.php
index 478373d..60267d8 100644
--- a/views/dashboard/index.php
+++ b/views/dashboard/index.php
@@ -53,7 +53,12 @@ $attributes = [
                         #{{ issue.iid }}
                     </a>
                 </td>
-                <td>{{ issue.type }}</td>
+                <td>
+                    {{ issue.type }}
+                    <div v-if="issue.type === 'StEP'">
+                        {{ issue.step_status ?? '?' }}
+                    </div>
+                </td>
                 <td>{{ issue.closed ? 'closed' : 'open' }}</td>
                 <td v-if="!issue.merge_requests">
                     <abbr title="<?= _('Kein MR') ?>">
-- 
GitLab