Skip to content

Commit

Permalink
webdash: fix input/output description render; add created at column i…
Browse files Browse the repository at this point in the history
…n list view
  • Loading branch information
adamstruck committed May 24, 2018
1 parent e2bc945 commit f0e50b5
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 21 deletions.
28 changes: 22 additions & 6 deletions webdash/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,21 @@ function formatElapsedTime(miliseconds) {

time = "";
if (days > 0) {
time += days + " Days "
time += days + "d "
}
if (hours > 0 || days > 0) {
time += hours + " Hours "
time += hours + "h "
}
if (minutes > 0 || hours > 0) {
time += minutes + " Minutes "
time += minutes + "m "
}
if (seconds > 0 || minutes > 0) {
time += seconds + " Seconds"
time += seconds + "s"
}
return time;
if (time === "") {
time = "< 1s";
}
return time;
}

function elapsedTime(task) {
Expand All @@ -56,6 +59,18 @@ function elapsedTime(task) {
return "--";
}

function creationTime(task) {
if (task.creation_time) {
created = new Date(task.creation_time);
var options = {
weekday: 'short', month: 'short', day: 'numeric',
hour: 'numeric', minute: 'numeric'
};
return created.toLocaleDateString("en-US", options);
}
return "--";
}

function isDone(task) {
return task.state == "COMPLETE" || task.state == "EXECUTOR_ERROR" || task.state == "CANCELED" || task.state == "SYSTEM_ERROR";
}
Expand Down Expand Up @@ -88,6 +103,7 @@ app.controller("TaskListController", function($rootScope, $scope, $http, $timeou
$scope.tasks = [];
$scope.isDone = isDone;
$scope.elapsedTime = elapsedTime;
$scope.creationTime = creationTime;
$scope.serverURL = getServerURL($location);
$scope.page = null;

Expand Down Expand Up @@ -196,7 +212,7 @@ app.controller("TaskListController", function($rootScope, $scope, $http, $timeou

app.controller("NodeListController", function($rootScope, $scope, $http, $timeout) {
$rootScope.pageTitle = "Nodes";
$scope.url = "/v1/nodes";
$scope.url = "/v1/nodes";
$scope.nodes = [];

function refresh() {
Expand Down
2 changes: 2 additions & 0 deletions webdash/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<th>ID</th>
<th>State</th>
<th>Name</th>
<th>Created At</th>
<th>Elapsed Time</th>
<th></th>
</thead>
Expand All @@ -13,6 +14,7 @@
<td class="task-list-id"><a href="/v1/tasks/{{task.id}}">{{ task.id }}</a></td>
<td>{{ task.state }}</td>
<td class="task-list-name">{{ task.name }}</td>
<td>{{ creationTime(task) }}</td>
<td>{{ elapsedTime(task) }}</td>
<td class="task-list-cancel"><button
class="btn-cancel mdl-button--fab mini-fab"
Expand Down
2 changes: 2 additions & 0 deletions webdash/task.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ <h6>Inputs</h6>
<td>{{ input.name }}</td>
</tr>
<tr ng-show="input.description">
<td>Description</td>
<td>{{ input.description }}</td>
</tr>
<tr>
Expand Down Expand Up @@ -107,6 +108,7 @@ <h6>Outputs</h6>
<td>{{ output.name }}</td>
</tr>
<tr ng-show="output.description">
<td>Description</td>
<td>{{ output.description }}</td>
</tr>
<tr>
Expand Down
30 changes: 15 additions & 15 deletions webdash/web.go

Large diffs are not rendered by default.

0 comments on commit f0e50b5

Please sign in to comment.