From 80bb966d18092600a456fee38d6494996a048ec6 Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Thu, 6 Jun 2024 17:53:04 +0800 Subject: [PATCH] fix(tibuild): fix the compatibility issue introduced by #126 Signed-off-by: wuhuizuo --- tibuild/gojenkins/build_history.go | 5 +- .../internal/controller/pipeline_list_show.go | 2 - tibuild/website/src/layout/GridColumns.js | 186 +++++++++--------- 3 files changed, 92 insertions(+), 101 deletions(-) diff --git a/tibuild/gojenkins/build_history.go b/tibuild/gojenkins/build_history.go index 7fcd4d8..7573845 100644 --- a/tibuild/gojenkins/build_history.go +++ b/tibuild/gojenkins/build_history.go @@ -1,10 +1,11 @@ package gojenkins import ( - "golang.org/x/net/html" "io" "strconv" "strings" + + "golang.org/x/net/html" ) // Parse jenkins ajax response in order find the current jenkins build history @@ -24,7 +25,6 @@ func parseBuildHistory(d io.Reader) []*History { } case html.SelfClosingTagToken: tn, hasAttr := z.TagName() - // fmt.Println("START__", string(tn), hasAttr) if hasAttr { a := attr(z) // Failed > Console Output @@ -39,7 +39,6 @@ func parseBuildHistory(d io.Reader) []*History { case html.StartTagToken: depth++ tn, hasAttr := z.TagName() - // fmt.Println("START__", string(tn), hasAttr) if hasAttr { a := attr(z) // diff --git a/tibuild/internal/controller/pipeline_list_show.go b/tibuild/internal/controller/pipeline_list_show.go index e37a713..d02a5f4 100644 --- a/tibuild/internal/controller/pipeline_list_show.go +++ b/tibuild/internal/controller/pipeline_list_show.go @@ -1,7 +1,6 @@ package controller import ( - "fmt" "net/http" "github.com/gin-gonic/gin" @@ -60,7 +59,6 @@ func PipelinesShow(c *gin.Context) { pipelines_info = append(pipelines_info, m) } - fmt.Printf("result的类型是%T", pipelines_info) start_p := 0 if params.Page > 1 { diff --git a/tibuild/website/src/layout/GridColumns.js b/tibuild/website/src/layout/GridColumns.js index c894831..b7d5879 100644 --- a/tibuild/website/src/layout/GridColumns.js +++ b/tibuild/website/src/layout/GridColumns.js @@ -1,97 +1,91 @@ import * as React from 'react'; -import {useState,useEffect} from 'react'; -import {DataGrid, GridColDef, GridToolbar} from '@mui/x-data-grid'; -import {useQuery,useQueryClient} from "react-query"; -import {fetchList} from "../request/BuildList"; -import {FRONTHOST} from "../utils"; +import { useState, useEffect } from 'react'; +import { DataGrid, GridColDef, GridToolbar } from '@mui/x-data-grid'; +import { useQuery, useQueryClient } from "react-query"; +import { fetchList } from "../request/BuildList"; +import { FRONTHOST } from "../utils"; const columns: GridColDef[] = [ - { - field: "id", - hide: true, - valueGetter: (params) => params.row.pipeline_build_id, - }, - { - field: 'pipeline_build_id', - headerName: 'ID', - width: 70, - valueGetter: (params) => params.row.pipeline_build_id, - renderCell: function (params) { - return

- {params.row.pipeline_build_id} -

- } - }, - { - field: 'status', - headerName: 'Status', - }, - { - field: 'begin_time', - headerName: 'Begin Time', - width: 170 - }, - { - field: 'end_time', - headerName: 'End Time', - width: 170 - }, - { - field: 'triggered_by', - headerName: 'Triggered By', - width: 120 - }, - { - field: 'component', - headerName: 'Component', - width: 170 - }, - { - field: 'arch', - headerName: 'Arch', - width: 170 - }, - { - field: 'artifact_type', - headerName: 'Artifact Type', - width: 170 - }, - { - field: 'branch', - headerName: 'Branch', - width: 120 - }, - { - field: 'version', - headerName: 'Version', - width: 170 - }, - { - field: 'push_gcr', - headerName: 'Push GCR', - }, - { - field: 'artifact_meta', - headerName: 'Artifact Meta', - renderCell: function (params) { - return

- {params.row.artifact_type===""?"not ready":Artifact Meta} -

- } - }, - { - field: 'jenkins_log', - headerName: 'Jenkins Log', - width: 100, - renderCell: function (params) { - return

- {params.row.jenkins_log===""?"not ready":Jenkins Log} -

- } - }, - ] -; + { + field: 'pipeline_build_id', + headerName: 'ID', + width: 70, + renderCell: function (params) { + return

+ {params.row.pipeline_build_id} +

+ } + }, + { + field: 'status', + headerName: 'Status', + }, + { + field: 'begin_time', + headerName: 'Begin Time', + width: 170 + }, + { + field: 'end_time', + headerName: 'End Time', + width: 170 + }, + { + field: 'triggered_by', + headerName: 'Triggered By', + width: 120 + }, + { + field: 'component', + headerName: 'Component', + width: 170 + }, + { + field: 'arch', + headerName: 'Arch', + width: 170 + }, + { + field: 'artifact_type', + headerName: 'Artifact Type', + width: 170 + }, + { + field: 'branch', + headerName: 'Branch', + width: 120 + }, + { + field: 'version', + headerName: 'Version', + width: 170 + }, + { + field: 'push_gcr', + headerName: 'Push GCR', + }, + { + field: 'artifact_meta', + headerName: 'Artifact Meta', + renderCell: function (params) { + return

+ {params.row.artifact_type === "" ? "not ready" : Artifact Meta} +

+ } + }, + { + field: 'jenkins_log', + headerName: 'Jenkins Log', + width: 100, + renderCell: function (params) { + return

+ {params.row.jenkins_log === "" ? "not ready" : Jenkins Log} +

+ } + }, +] + ; const rows = [ { @@ -176,11 +170,11 @@ export default function DataGrid4List(tipipelineId) { ); } const r8 = listQuery.data.map((v) => { - return {...v, id: v.pipeline_build_id} - } + return { ...v, id: v.pipeline_build_id } + } ) return ( -
+