-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Tasks Run Page for dispalying runs for specific TaskID
- Loading branch information
Showing
6 changed files
with
117 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Libraries | ||
import React, {PureComponent} from 'react' | ||
|
||
// Types | ||
import {Run} from '@influxdata/influx' | ||
import {IndexList} from 'src/clockface' | ||
import {taskRuns} from '../dummyData' | ||
import {Page} from 'src/pageLayout' | ||
|
||
interface Props { | ||
taskID: string | ||
runs: Run[] | ||
} | ||
|
||
const dummyData = taskRuns | ||
|
||
class TaskRunsPage extends PureComponent<Props> { | ||
public render() { | ||
return ( | ||
<> | ||
<Page titleTag="Runs"> | ||
<Page.Header fullWidth={false}> | ||
<Page.Header.Left> | ||
<Page.Title title="Runs" /> | ||
</Page.Header.Left> | ||
<Page.Header.Right /> | ||
</Page.Header> | ||
<Page.Contents fullWidth={false} scrollable={true}> | ||
<div className="col-xs-12"> | ||
<IndexList> | ||
<IndexList.Header> | ||
<IndexList.HeaderCell columnName="Requested At" width="20%" /> | ||
<IndexList.HeaderCell columnName="Started At" width="20%" /> | ||
<IndexList.HeaderCell columnName="Finished At" width="20%" /> | ||
<IndexList.HeaderCell columnName="Status" width="10%" /> | ||
<IndexList.HeaderCell columnName="Schedule For" width="20%" /> | ||
<IndexList.HeaderCell columnName="" width="10%" /> | ||
</IndexList.Header> | ||
<IndexList.Body emptyState={<></>} columnCount={6}> | ||
{this.listRuns} | ||
</IndexList.Body> | ||
</IndexList> | ||
</div> | ||
</Page.Contents> | ||
</Page> | ||
</> | ||
) | ||
} | ||
|
||
public get listRuns(): JSX.Element[] { | ||
const taskRuns = dummyData.map(t => ( | ||
<IndexList.Row key={`task-id--${t.id}`}> | ||
<IndexList.Cell>{this.dateTimeString(t.requestedAt)}</IndexList.Cell> | ||
<IndexList.Cell>{this.dateTimeString(t.startedAt)}</IndexList.Cell> | ||
<IndexList.Cell>{this.dateTimeString(t.finishedAt)}</IndexList.Cell> | ||
<IndexList.Cell>{t.status}</IndexList.Cell> | ||
<IndexList.Cell>{this.dateTimeString(t.scheduledFor)}</IndexList.Cell> | ||
<IndexList.Cell /> | ||
</IndexList.Row> | ||
)) | ||
|
||
return taskRuns | ||
} | ||
|
||
private dateTimeString(dt: Date): string { | ||
const date = dt.toDateString() | ||
const time = dt.toLocaleTimeString() | ||
const formatted = `${date} ${time}` | ||
|
||
return formatted | ||
} | ||
} | ||
export default TaskRunsPage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,19 @@ | ||
import {Task} from '@influxdata/influx' | ||
import {Run} from '@influxdata/influx' | ||
|
||
export const dummyTasks: Task[] = [ | ||
export const taskRuns: Run[] = [ | ||
{ | ||
id: '02ef9deff2141000', | ||
orgID: '02ee9e2a29d73000', | ||
name: 'pasdlak', | ||
status: Task.StatusEnum.Active, | ||
owner: null, | ||
flux: | ||
'option task = {\n name: "pasdlak",\n cron: "2 0 * * *"\n}\nfrom(bucket: "inbucket") \n|> range(start: -1h)', | ||
cron: '2 0 * * *', | ||
}, | ||
{ | ||
id: '02f12c50dba72000', | ||
orgID: '02ee9e2a29d73000', | ||
name: 'somename', | ||
status: Task.StatusEnum.Active, | ||
owner: null, | ||
flux: | ||
'option task = {\n name: "somename",\n every: 1m,\n}\nfrom(bucket: "inbucket") \n|> range(start: -task.every)', | ||
every: '1m0s', | ||
id: '40002242', | ||
taskID: 'string', | ||
status: Run.StatusEnum.Scheduled, | ||
scheduledFor: new Date('2019-02-11T22:37:25.985Z'), | ||
startedAt: new Date('2019-02-11T22:37:25.985Z'), | ||
finishedAt: new Date('2019-02-11T22:37:25.985Z'), | ||
requestedAt: new Date('2019-02-11T22:37:25.985Z'), | ||
links: { | ||
self: '/api/v2/tasks/1/runs/1', | ||
task: '/arequei/v2/tasks/1', | ||
retry: '/api/v2/tasks/1/runs/1/retry', | ||
logs: '/api/v2/tasks/1/runs/1/logs', | ||
}, | ||
}, | ||
] |