Unverified Commit e5070787 authored by Licho's avatar Licho Committed by GitHub

refactor: dinky-web job list component (#2082)

* refactor: package uri wrong, and trivial optimization * refactor: convert to enum * Spotless Apply --------- Co-authored-by: 's avatarleechor <leechor@users.noreply.github.com>
parent 2f4cc1c0
...@@ -19,7 +19,7 @@ const JobHistoryList = (props: HistoryProps) => { ...@@ -19,7 +19,7 @@ const JobHistoryList = (props: HistoryProps) => {
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
const jobListColums: ProColumns<Jobs.JobInstance>[] = [ const jobListColumns: ProColumns<Jobs.JobInstance>[] = [
{ {
title: l('global.table.createTime'), title: l('global.table.createTime'),
...@@ -59,7 +59,7 @@ const JobHistoryList = (props: HistoryProps) => { ...@@ -59,7 +59,7 @@ const JobHistoryList = (props: HistoryProps) => {
params={{isHistory: true}} params={{isHistory: true}}
tableStyle={{overflowX: "hidden", overflowY: "hidden", margin: "10px"}} tableStyle={{overflowX: "hidden", overflowY: "hidden", margin: "10px"}}
size={"small"} size={"small"}
columns={jobListColums} columns={jobListColumns}
actionRef={actionRef} actionRef={actionRef}
request={(params) => queryList(API_CONSTANTS.GET_JOB_LIST, { request={(params) => queryList(API_CONSTANTS.GET_JOB_LIST, {
...params, ...params,
......
...@@ -17,26 +17,26 @@ ...@@ -17,26 +17,26 @@
export const JOB_LIFE_CYCLE = { export enum JOB_LIFE_CYCLE {
UNKNOWN: 0, UNKNOWN = 0,
CREATE: 1, CREATE = 1,
DEVELOP: 2, DEVELOP = 2,
DEBUG: 3, DEBUG = 3,
RELEASE: 4, RELEASE = 4,
ONLINE: 5, ONLINE = 5,
CANCEL: 6, CANCEL = 6,
}; }
export const JOB_STATUS = { export enum JOB_STATUS {
FINISHED: 'FINISHED', FINISHED = 'FINISHED',
RUNNING: 'RUNNING', RUNNING = 'RUNNING',
FAILED: 'FAILED', FAILED = 'FAILED',
CANCELED: 'CANCELED', CANCELED = 'CANCELED',
INITIALIZING: 'INITIALIZING', INITIALIZING = 'INITIALIZING',
RESTARTING: 'RESTARTING', RESTARTING = 'RESTARTING',
CREATED: 'CREATED', CREATED = 'CREATED',
FAILING: 'FAILING', FAILING = 'FAILING',
SUSPENDED: 'SUSPENDED', SUSPENDED = 'SUSPENDED',
CANCELLING: 'CANCELLING', CANCELLING = 'CANCELLING',
UNKNOWN: 'UNKNOWN', UNKNOWN = 'UNKNOWN',
}; }
...@@ -14,7 +14,7 @@ import {JOB_STATUS_FILTER, LIFECYCLE_FILTER, TagJobLifeCycle, TagJobStatus} from ...@@ -14,7 +14,7 @@ import {JOB_STATUS_FILTER, LIFECYCLE_FILTER, TagJobLifeCycle, TagJobStatus} from
const JobList = () => { const JobList = () => {
const tableRef = useRef<ActionType>(); const tableRef = useRef<ActionType>();
const jobListColums: ProColumns<Jobs.JobInstance>[] = [ const jobListColumns: ProColumns<Jobs.JobInstance>[] = [
{ {
title: l('global.table.taskid'), title: l('global.table.taskid'),
dataIndex: 'taskId', dataIndex: 'taskId',
...@@ -80,7 +80,7 @@ const JobList = () => { ...@@ -80,7 +80,7 @@ const JobList = () => {
return ( return (
<ProTable<Jobs.JobInstance> <ProTable<Jobs.JobInstance>
rowKey={(record => record.jid)} rowKey={(record => record.jid)}
columns={jobListColums} columns={jobListColumns}
params={{isHistory: false}} params={{isHistory: false}}
actionRef={tableRef} actionRef={tableRef}
headerTitle={l('devops.joblist.joblist')} headerTitle={l('devops.joblist.joblist')}
...@@ -91,8 +91,8 @@ const JobList = () => { ...@@ -91,8 +91,8 @@ const JobList = () => {
})} })}
expandable={{ expandable={{
expandedRowRender: (record) => <JobHistoryList taskId={record.taskId} key={record.jid}/>, expandedRowRender: (record) => <JobHistoryList taskId={record.taskId} key={record.jid}/>,
expandIcon: ({expanded, onExpand, record}) => { expandIcon: ({expanded, onExpand, record}) =>
return ( (
<Button <Button
className={'options-button'} className={'options-button'}
key={`${record.id}_history`} key={`${record.id}_history`}
...@@ -100,8 +100,7 @@ const JobList = () => { ...@@ -100,8 +100,7 @@ const JobList = () => {
title={l('devops.joblist.history')} title={l('devops.joblist.history')}
icon={<ClockCircleTwoTone twoToneColor={expanded ? '#52c41a' : '#4096ff'}/>} icon={<ClockCircleTwoTone twoToneColor={expanded ? '#52c41a' : '#4096ff'}/>}
/> />
); )
}
}} }}
/> />
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment