Skip to content

Commit 59b42ff

Browse files
authored
format datetimes (#38)
* format datetimes fix next_run update after toggle schedule active * use moment-timezone to lock the timezone in tests
1 parent 88ab7b6 commit 59b42ff

15 files changed

+57
-18
lines changed

frontend/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
"dependencies": {
1111
"bootswatch": "^3.3.7",
1212
"dagre-d3": "^0.4.17",
13+
"moment": "^2.22.2",
14+
"moment-timezone": "^0.5.17",
1315
"react": "^15.6.1",
1416
"react-bootstrap": "^0.30.10",
1517
"react-dom": "^15.6.1",

frontend/src/ExecutionTable.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import React from 'react';
22
import {Table} from 'react-bootstrap';
33
import {Link} from 'react-router';
44

5+
import {formatDateTime} from "./utilities";
6+
57

68
export default class ExecutionTable extends React.Component {
79

@@ -19,7 +21,7 @@ export default class ExecutionTable extends React.Component {
1921
<td>{execution.task.workflow && execution.task.workflow.name}</td>
2022
<td><Link to={`/tasks/${execution.task.id}`}>{execution.task.name}</Link></td>
2123
<td>{execution.status}</td>
22-
<td>{execution.start_timestamp}</td>
24+
<td>{formatDateTime(execution.start_timestamp)}</td>
2325
<td>{execution.minutes_running}</td>
2426
</tr>
2527
))

frontend/src/TaskDetail.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {PanelGroup, Panel, Alert, Pagination, Button} from 'react-bootstrap';
33
import {Link} from 'react-router';
44

55
import API from "./API";
6+
import {formatDateTime} from "./utilities";
67

78
export default class TaskDetail extends React.Component {
89
constructor(props) {
@@ -92,9 +93,9 @@ export default class TaskDetail extends React.Component {
9293
</Link>
9394
</dd>
9495
<dt>Start Time</dt>
95-
<dd>{execution.start_timestamp}</dd>
96+
<dd>{formatDateTime(execution.start_timestamp)}</dd>
9697
<dt>Stop Time</dt>
97-
<dd>{execution.stop_timestamp}</dd>
98+
<dd>{formatDateTime(execution.stop_timestamp)}</dd>
9899
<dt>Exit Code</dt>
99100
<dd>{execution.exit_code}</dd>
100101
<dt>Standard Output</dt>

frontend/src/WorkerDetail.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {Panel, PanelGroup, Alert} from 'react-bootstrap';
33

44
import API from "./API";
55
import ExecutionTable from "./ExecutionTable";
6+
import {formatDateTime} from "./utilities";
67

78
export default class WorkerDetail extends React.Component {
89
constructor(props) {
@@ -36,9 +37,9 @@ export default class WorkerDetail extends React.Component {
3637
<dt>Status</dt>
3738
<dd>{worker.status}</dd>
3839
<dt>Start Timestamp</dt>
39-
<dd>{worker.start_timestamp}</dd>
40+
<dd>{formatDateTime(worker.start_timestamp)}</dd>
4041
<dt>Last Heartbeat</dt>
41-
<dd>{worker.last_heartbeat}</dd>
42+
<dd>{formatDateTime(worker.last_heartbeat)}</dd>
4243
</dl>
4344
</Panel>
4445
<Panel header="Executions">

frontend/src/WorkerList.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {Table, Alert} from 'react-bootstrap';
33
import {Link} from 'react-router';
44

55
import API from "./API";
6+
import {formatDateTime} from "./utilities";
67

78
export default class WorkerList extends React.Component {
89
constructor(props) {
@@ -30,8 +31,8 @@ export default class WorkerList extends React.Component {
3031
<tr key={worker.id}>
3132
<td><Link to={`/workers/${worker.id}`}>{worker.name}</Link></td>
3233
<td>{worker.status}</td>
33-
<td>{worker.start_timestamp}</td>
34-
<td>{worker.last_heartbeat}</td>
34+
<td>{formatDateTime(worker.start_timestamp)}</td>
35+
<td>{formatDateTime(worker.last_heartbeat)}</td>
3536
</tr>
3637
)
3738
})

frontend/src/WorkflowDetailForm.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
} from 'react-bootstrap';
66

77
import API from './API'
8+
import {formatDateTime} from "./utilities";
89

910
/* Helper to extract form values from a given object */
1011
function formValues(object) {
@@ -26,6 +27,7 @@ function formValues(object) {
2627
schedule: object.schedule,
2728
schedule_active: object.schedule_active,
2829
parameters: parameters,
30+
next_run: object.next_run,
2931
}
3032
}
3133

@@ -122,7 +124,7 @@ export default class WorkflowDetailForm extends React.Component {
122124
<dt>Schedule</dt>
123125
<dd>{this.state.schedule}</dd>
124126
<dt>Next Run</dt>
125-
<dd>{this.props.workflow.next_run}</dd>
127+
<dd>{formatDateTime(this.state.next_run)}</dd>
126128
<dt>Parameters</dt>
127129
<dd>
128130
<pre>{this.state.parameters}</pre>

frontend/src/tests/__snapshots__/ExecutionList.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ exports[`ExecutionList success 1`] = `
147147
succeeded
148148
</td>
149149
<td>
150-
2017-01-30T04:17:47.008524Z
150+
January 30th 2017, 4:17:47 am
151151
</td>
152152
<td>
153153
0m 0.05s

frontend/src/tests/__snapshots__/TaskDetail.test.js.snap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,14 @@ exports[`TaskDetail success 1`] = `
156156
Start Time
157157
</dt>
158158
<dd>
159-
2017-01-30T03:26:38.211839Z
159+
January 30th 2017, 3:26:38 am
160160
</dd>
161161
<dt>
162162
Stop Time
163163
</dt>
164-
<dd />
164+
<dd>
165+
166+
</dd>
165167
<dt>
166168
Exit Code
167169
</dt>

frontend/src/tests/__snapshots__/WorkerDetail.test.js.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ exports[`WorkerDetail success 1`] = `
5353
Start Timestamp
5454
</dt>
5555
<dd>
56-
2017-01-30T04:13:47.966080Z
56+
January 30th 2017, 4:13:47 am
5757
</dd>
5858
<dt>
5959
Last Heartbeat
6060
</dt>
6161
<dd>
62-
2017-01-30T04:15:10.845289Z
62+
January 30th 2017, 4:15:10 am
6363
</dd>
6464
</dl>
6565
</div>
@@ -126,7 +126,7 @@ exports[`WorkerDetail success 1`] = `
126126
succeeded
127127
</td>
128128
<td>
129-
2017-01-30T04:17:03.806599Z
129+
January 30th 2017, 4:17:03 am
130130
</td>
131131
<td />
132132
</tr>

frontend/src/tests/__snapshots__/WorkerList.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ exports[`WorkerList success 1`] = `
118118
exited
119119
</td>
120120
<td>
121-
2017-01-30T04:13:47.966080Z
121+
January 30th 2017, 4:13:47 am
122122
</td>
123123
<td>
124-
2017-01-30T04:15:10.845289Z
124+
January 30th 2017, 4:15:10 am
125125
</td>
126126
</tr>
127127
</tbody>

0 commit comments

Comments
 (0)