Skip to content

Commit 22d707e

Browse files
committed
feat: add Moment.js for parsing dates
1 parent a999f28 commit 22d707e

File tree

6 files changed

+29
-35
lines changed

6 files changed

+29
-35
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[![Build Status](https://img.shields.io/travis/Kaixhin/FGLab.svg)](https://travis-ci.org/Kaixhin/FGLab)
22
[![Dependency Status](https://img.shields.io/david/kaixhin/fglab.svg)](https://david-dm.org/Kaixhin/FGLab)
3+
[![devDependency Status](https://img.shields.io/david/dev/kaixhin/fglab.svg)](https://david-dm.org/Kaixhin/FGLab#info=devDependencies)
34
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/Kaixhin/FGLab/master/LICENSE)
45
[![Docker Pulls](https://img.shields.io/docker/pulls/kaixhin/fglab.svg)](https://hub.docker.com/r/kaixhin/fglab/)
56
[![Docker Stars](https://img.shields.io/docker/stars/kaixhin/fglab.svg)](https://hub.docker.com/r/kaixhin/fglab/)

bower.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"octicons": "~3.1.0",
2929
"d3": "~3.5.6",
3030
"c3": "~0.4.11",
31-
"largest-triangle-three-buckets": "git://github.com/joshcarr/largest-triangle-three-buckets.js.git"
31+
"largest-triangle-three-buckets": "git://github.com/joshcarr/largest-triangle-three-buckets.js.git",
32+
"moment": "~2.10.6"
3233
},
3334
"resolutions": {
3435
"jquery": "~3.0.0-alpha",

gulpfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var conventionalGithubReleaser = require("conventional-github-releaser");
1212

1313
// Load CONVENTIONAL_GITHUB_RELEASER_TOKEN from .env
1414
require("dotenv").config({silent: true});
15+
// Use --bump=<type> for a major/minor release
1516
var options = parseArgs(process.argv.slice(2), {string: ["bump", "github_token"], default: {bump: "patch", github_token: process.env.CONVENTIONAL_GITHUB_RELEASER_TOKEN}});
1617

1718
// Changelogs use AngularJS convention (https://github.com/ajoslin/conventional-changelog/blob/master/conventions/angular.md)

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,6 @@
3737
"serve-favicon": "^2.3.0",
3838
"ws": "^0.8.0"
3939
},
40-
"engines": {
41-
"node": "4.x"
42-
},
43-
"cacheDirectories": [
44-
"node_modules",
45-
"bower_components"
46-
],
4740
"devDependencies": {
4841
"conventional-github-releaser": "^0.5.0",
4942
"gulp": "^3.9.0",
@@ -53,5 +46,12 @@
5346
"gulp-util": "^3.0.6",
5447
"minimist": "^1.2.0",
5548
"run-sequence": "^1.1.4"
56-
}
49+
},
50+
"engines": {
51+
"node": "4.x"
52+
},
53+
"cacheDirectories": [
54+
"node_modules",
55+
"bower_components"
56+
]
5757
}

views/experiment.jade

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,6 @@ block title
55

66
block styles
77
link(href="/bower_components/c3/c3.min.css", rel="stylesheet")
8-
style(type="text/css").
9-
path {
10-
stroke: green;
11-
stroke-width: 1;
12-
fill: none;
13-
}
14-
path.valLoss {
15-
stroke: blue;
16-
}
17-
line {
18-
stroke: black;
19-
}
20-
text {
21-
font-size: 9pt;
22-
}
238

249
block content
2510
h1 #[span.mega-octicon.octicon-graph] Experiment: #{experiment._id}
@@ -35,16 +20,16 @@ block content
3520
dd.col-sm-9 #[a(href="/machines/#{machine._id}") #{machine.hostname}]
3621
if experiment._started
3722
dt.col-sm-3 Started
38-
dd.col-sm-9 #{experiment._started}
23+
dd#experiment-started.col-sm-9
3924
if experiment._finished
4025
dt.col-sm-3 Finished
41-
dd.col-sm-9 #{experiment._finished}
26+
dd#experiment-finished.col-sm-9
4227
dt.col-sm-3 Options
4328
dd.col-sm-9= JSON.stringify(experiment._options)
4429
- if (experiment._files.length > 0)
4530
dt.col-sm-3 Files
4631
dd.col-sm-9
47-
ul.list-unstyled
32+
ul.list-unstyled(style="margin-bottom: 0;")
4833
- each file in experiment._files
4934
li #[a(href="/files/#{file._id}") #{file.filename}]
5035
if experiment._val
@@ -73,13 +58,14 @@ block scripts
7358
script(src="/bower_components/c3/c3.min.js")
7459
script(src="/bower_components/lodash/lodash.min.js")
7560
script(src="/bower_components/largest-triangle-three-buckets/dist/largest-triangle-three-buckets.v0.1.0.min.js")
61+
script(src="/bower_components/moment/min/moment.min.js")
7662
script.
7763
// Parse from string instead prior to accessing internal objects via Jade
7864
var experiment = !{JSON.stringify(experiment)};
7965

8066
$(function() {
8167
// Adjust status
82-
var status = "#{experiment._status}";
68+
var status = experiment._status;
8369
var textClass;
8470
var iconClass;
8571
if (status === "success") {
@@ -95,6 +81,14 @@ block scripts
9581
$("#status").addClass(textClass);
9682
$("#status .octicon").addClass(iconClass);
9783

84+
// Add times
85+
if (experiment._started) {
86+
$("#experiment-started").html(moment().format(experiment._started));
87+
}
88+
if (experiment._finished) {
89+
$("#experiment-finished").html(moment().format(experiment._finished));
90+
}
91+
9892
// Create chart for training
9993
var chart;
10094
// Use Largest-Triangle-Three-Buckets downsampling

views/experiments.jade

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ block scripts
1515
script(src="/bower_components/bootstrap/dist/js/bootstrap.min.js")
1616
script(src="/bower_components/bootstrap-table/dist/bootstrap-table.min.js")
1717
script(src="/bower_components/bootstrap-table/dist/extensions/multiple-sort/bootstrap-table-multiple-sort.min.js")
18+
script(src="/bower_components/moment/min/moment.min.js")
1819
script.
1920
// Flattens JSON objects
2021
JSON.flatten = function(data) {
@@ -54,19 +55,15 @@ block scripts
5455
{field: "_id", title: "ID", sortable: "true", formatter: function(val) {return "<a href='/experiments/" + val + "'>" + val + "</a>";}},
5556
{field: "_status", title: "Status", sortable: "true", formatter: function(val) {
5657
// Colour-code status
57-
var textClass;
5858
var iconClass;
5959
if (val === "success") {
60-
textClass = "text-success";
6160
iconClass = "octicon octicon-check text-success";
6261
} else if (val === "fail") {
63-
textClass = "text-danger";
6462
iconClass = "octicon octicon-circle-slash text-danger";
6563
} else if (val == "running") {
66-
textClass = "text-info";
6764
iconClass = "octicon octicon-clock text-info";
6865
}
69-
return "<span class='" + textClass + "'>" + val + "</span> <span class='" + iconClass + "'></span>";
66+
return "<span class='" + iconClass + "'></span>";
7067
}},
7168
{field: "_val.score", title: "Val Score", sortable: "true"},
7269
{field: "_test.score", title: "Test Score", sortable: "true"}
@@ -82,8 +79,8 @@ block scripts
8279
return "<span class='" + textClass + "'>" + val + "</span>";
8380
}}(key)});
8481
}
85-
columns.push({field: "_started", title: "Started", sortable: "true"});
86-
columns.push({field: "_finished", title: "Finished", sortable: "true"});
82+
columns.push({field: "_started", title: "Started", sortable: "true", formatter: function(val) {return moment().format(val);}});
83+
columns.push({field: "_finished", title: "Finished", sortable: "true", formatter: function(val) {return moment().format(val);}});
8784

8885
// Flatten each experiment
8986
for (var i = 0; i < experiments.length; i++) {

0 commit comments

Comments
 (0)