You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by li...@apache.org on 2022/08/31 14:20:19 UTC

[incubator-devlake] branch main updated: feat: add page for history runs at blueprint state (#2899)

This is an automated email from the ASF dual-hosted git repository.

likyh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 625f8ec8 feat: add page for history runs at blueprint state (#2899)
625f8ec8 is described below

commit 625f8ec8fccf8b27b2d40230377fb7835ebbf637
Author: likyh <l...@likyh.com>
AuthorDate: Wed Aug 31 22:20:14 2022 +0800

    feat: add page for history runs at blueprint state (#2899)
    
    * feat: add page for history runs at blueprint state
    
    * fix: fix for review
    
    Co-authored-by: linyh <ya...@meri.co>
---
 config-ui/src/pages/blueprints/blueprint-detail.jsx | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/config-ui/src/pages/blueprints/blueprint-detail.jsx b/config-ui/src/pages/blueprints/blueprint-detail.jsx
index 4ae2ffae..a299cc6a 100644
--- a/config-ui/src/pages/blueprints/blueprint-detail.jsx
+++ b/config-ui/src/pages/blueprints/blueprint-detail.jsx
@@ -55,6 +55,7 @@ import BlueprintNavigationLinks from '@/components/blueprints/BlueprintNavigatio
 
 import useBlueprintManager from '@/hooks/useBlueprintManager'
 import usePipelineManager from '@/hooks/usePipelineManager'
+import usePaginator from '@/hooks/usePaginator'
 
 const BlueprintDetail = (props) => {
   // eslint-disable-next-line no-unused-vars
@@ -72,7 +73,6 @@ const BlueprintDetail = (props) => {
   const [showCurrentRunTasks, setShowCurrentRunTasks] = useState(true)
   const [showInspector, setShowInspector] = useState(false)
   const [currentStages, setCurrentStages] = useState([])
-  const [historicalRuns, setHistoricalRuns] = useState([])
 
   const pollTimer = 5000
   const pollInterval = useRef()
@@ -135,6 +135,13 @@ const BlueprintDetail = (props) => {
     getPipelineLogfile
   } = usePipelineManager()
 
+  const {
+    data: historicalRuns,
+    pagedData: pagedHistoricalRuns,
+    setData: setHistoricalRuns,
+    renderControlsComponent: renderPagnationControls
+  } = usePaginator()
+
   const buildPipelineStages = useCallback((tasks = []) => {
     let stages = {}
     console.log('>>>> RECEIVED PIPELINE TASKS FOR STAGE...', tasks)
@@ -701,7 +708,7 @@ const BlueprintDetail = (props) => {
                     </tr>
                   </thead>
                   <tbody>
-                    {historicalRuns.map((run, runIdx) => (
+                    {pagedHistoricalRuns.map((run, runIdx) => (
                       <tr key={`historical-run-key-${runIdx}`}>
                         <td
                           style={{
@@ -806,6 +813,7 @@ const BlueprintDetail = (props) => {
                 </table>
               </Card>
             </div>
+            {historicalRuns.length > 0 && <div style={{ alignSelf: 'flex-end', padding: '10px' }}>{renderPagnationControls()}</div>}
           </main>
         </Content>
       </div>