Skip to content

Commit

Permalink
fix(tibuild): fix the compatibility issue
Browse files Browse the repository at this point in the history
introduced by #126

Signed-off-by: wuhuizuo <[email protected]>
  • Loading branch information
wuhuizuo committed Jun 6, 2024
1 parent 63d1681 commit 80bb966
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 101 deletions.
5 changes: 2 additions & 3 deletions tibuild/gojenkins/build_history.go
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
// <img src="/static/f2881562/images/16x16/red.png" alt="Failed &gt; Console Output" tooltip="Failed &gt; Console Output" style="width: 16px; height: 16px; " class="icon-red icon-sm" />
Expand All @@ -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)
// <td class="build-row-cell">
Expand Down
2 changes: 0 additions & 2 deletions tibuild/internal/controller/pipeline_list_show.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package controller

import (
"fmt"
"net/http"

"github.com/gin-gonic/gin"
Expand Down Expand Up @@ -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 {
Expand Down
186 changes: 90 additions & 96 deletions tibuild/website/src/layout/GridColumns.js
Original file line number Diff line number Diff line change
@@ -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 <p>
<a target="_blank"
href={`${FRONTHOST}/home/build/result/${params.row.pipeline_build_id}`}>{params.row.pipeline_build_id}</a>
</p>
}
},
{
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 <p>
{params.row.artifact_type===""?"not ready":<a target="_blank" href={FRONTHOST+"/home/build/result/"+params.row.pipeline_build_id}>Artifact Meta</a>}
</p>
}
},
{
field: 'jenkins_log',
headerName: 'Jenkins Log',
width: 100,
renderCell: function (params) {
return <p>
{params.row.jenkins_log===""?"not ready":<a target="_blank" href={params.row.jenkins_log}>Jenkins Log</a>}
</p>
}
},
]
;
{
field: 'pipeline_build_id',
headerName: 'ID',
width: 70,
renderCell: function (params) {
return <p>
<a target="_blank"
href={`${FRONTHOST}/home/build/result/${params.row.pipeline_build_id}`}>{params.row.pipeline_build_id}</a>
</p>
}
},
{
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 <p>
{params.row.artifact_type === "" ? "not ready" : <a target="_blank" href={FRONTHOST + "/home/build/result/" + params.row.pipeline_build_id}>Artifact Meta</a>}
</p>
}
},
{
field: 'jenkins_log',
headerName: 'Jenkins Log',
width: 100,
renderCell: function (params) {
return <p>
{params.row.jenkins_log === "" ? "not ready" : <a target="_blank" href={params.row.jenkins_log}>Jenkins Log</a>}
</p>
}
},
]
;

const rows = [
{
Expand Down Expand Up @@ -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 (
<div style={{height: 400, width: '100%'}}>
<div style={{ height: 400, width: '100%' }}>
<DataGrid
rows={r8}
columns={columns}
Expand All @@ -193,8 +187,8 @@ export default function DataGrid4List(tipipelineId) {
Toolbar: GridToolbar,
}}
disableSelectionOnClick
showCellRightBorder = {true}
showColumnRightBorder = {false}
showCellRightBorder={true}
showColumnRightBorder={false}

/>
</div>
Expand Down

0 comments on commit 80bb966

Please sign in to comment.