Skip to content

Commit

Permalink
modify autotest space record component (#1241)
Browse files Browse the repository at this point in the history
  • Loading branch information
chengjoey authored Jul 31, 2021
1 parent 57012fc commit 9d29de5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
1 change: 0 additions & 1 deletion bundle/autotest_space.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ func (b *Bundle) ExportTestSpace(userID string, req apistructs.AutoTestSpaceExpo
hc := b.hc
var exportID uint64
_, err = hc.Post(host).Path("/api/autotests/spaces/actions/export").
Header(httputil.InternalHeader, "bundle").
Header(httputil.UserHeader, req.UserID).
JSONBody(req).Do().JSON(&exportID)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
type Column struct {
DataIndex string `json:"dataIndex"`
Title string `json:"title"`
Width uint64 `json:"width,omitempty"`
}

type Props struct {
Expand Down Expand Up @@ -112,21 +113,26 @@ func (r *RecordTable) setProps() {
r.Props.Columns = append(r.Props.Columns, Column{
DataIndex: "id",
Title: "ID",
Width: 80,
}, Column{
DataIndex: "type",
Title: i18nLocale.Get(i18n.I18nKeyTableType),
Width: 80,
}, Column{
DataIndex: "operator",
Title: i18nLocale.Get(i18n.I18nKeyTableOperator),
Width: 150,
}, Column{
DataIndex: "time",
Title: i18nLocale.Get(i18n.I18nKeyTableTime),
Width: 150,
}, Column{
DataIndex: "desc",
Title: i18nLocale.Get(i18n.I18nKeyTableDesc),
}, Column{
DataIndex: "status",
Title: i18nLocale.Get(i18n.I18nKeyTableStatus),
Width: 80,
}, Column{
DataIndex: "result",
Title: i18nLocale.Get(i18n.I18nKeyTableResult),
Expand Down Expand Up @@ -158,11 +164,20 @@ func (r *RecordTable) setData() error {
recordTypeKey = i18n.I18nKeyExport
}
var statusKey string
var recordState string
switch fileRecord.State {
case apistructs.FileRecordStateFail:
statusKey = i18n.I18nKeyStatusFailed
recordState = "error"
case apistructs.FileRecordStateSuccess:
statusKey = i18n.I18nKeyStatusSuccess
recordState = "success"
case apistructs.FileRecordStatePending:
statusKey = i18n.I18nKeyStatusPending
recordState = "pending"
case apistructs.FileRecordStateProcessing:
statusKey = i18n.I18nKeyStatusProcessing
recordState = "processing"
}
var operatorName string
operator, err := r.ctxBdl.Bdl.GetCurrentUser(fileRecord.OperatorID)
Expand All @@ -178,12 +193,12 @@ func (r *RecordTable) setData() error {
Status: Status{
RenderType: "textWithBadge",
Value: i18nLocale.Get(statusKey),
Status: string(fileRecord.State),
Status: recordState,
},
Result: Result{
RenderType: "downloadUrl",
URL: fmt.Sprintf("%s/api/files/%s", conf.RootDomain(), fileRecord.ApiFileUUID),
Value: i18nLocale.Get(i18n.I18nKeyDownloadFile),
Value: fileRecord.FileName,
},
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const (
I18nKeyExport = "wb.content.autotest.space.export"
I18nKeyStatusSuccess = "wb.content.autotest.space.status.success"
I18nKeyStatusFailed = "wb.content.autotest.space.status.failed"
I18nKeyStatusPending = "wb.content.autotest.space.status.pending"
I18nKeyStatusProcessing = "wb.content.autotest.space.status.processing"
I18nKeyDownloadFile = "wb.content.autotest.space.download.file"
I18nKeyImportExportRecord = "wb.content.autotest.space.import.export.record"
I18nKeyImportExportTable = "wb.content.autotest.space.import.export.table"
Expand Down
4 changes: 4 additions & 0 deletions pkg/erda-configs/i18n/autotest.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
"wb.content.autotest.space.export": "导出",
"wb.content.autotest.space.status.success": "成功",
"wb.content.autotest.space.status.failed": "失败",
"wb.content.autotest.space.status.pending": "排队中",
"wb.content.autotest.space.status.processing": "进行中",
"wb.content.autotest.space.download.file": "下载文件",
"wb.content.autotest.space.import.export.record": "导入导出记录",
"wb.content.autotest.space.import.export.table": "导入导出记录表",
Expand Down Expand Up @@ -79,6 +81,8 @@
"wb.content.autotest.space.export": "Export",
"wb.content.autotest.space.status.success": "Success",
"wb.content.autotest.space.status.failed": "Failed",
"wb.content.autotest.space.status.pending": "Pending",
"wb.content.autotest.space.status.processing": "Processing",
"wb.content.autotest.space.download.file": "Download File",
"wb.content.autotest.space.import.export.record": "Import and export records",
"wb.content.autotest.space.import.export.table": "Import and export records table",
Expand Down

0 comments on commit 9d29de5

Please sign in to comment.