Skip to content

Commit

Permalink
Replace custom parse-duration implementation with an existing lib
Browse files Browse the repository at this point in the history
  • Loading branch information
DingoEatingFuzz committed Jan 24, 2020
1 parent b9b6cda commit 4793dc9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 184 deletions.
6 changes: 3 additions & 3 deletions ui/app/components/drain-popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { computed } from '@ember/object';
import { equal } from '@ember/object/computed';
import { computed as overridable } from 'ember-overridable-computed';
import { task } from 'ember-concurrency';
import parseDuration from 'nomad-ui/utils/parse-duration';
import Duration from 'duration-js';

export default Component.extend({
tagName: '',
Expand Down Expand Up @@ -53,9 +53,9 @@ export default Component.extend({

let deadline;
try {
deadline = parseDuration(this.deadline);
deadline = new Duration(this.deadline).nanoseconds();
} catch (err) {
this.set('parseError', 'Failed to parse duration');
this.set('parseError', err.message);
return;
}

Expand Down
88 changes: 0 additions & 88 deletions ui/app/utils/parse-duration.js

This file was deleted.

1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"d3-shape": "^1.2.0",
"d3-time-format": "^2.1.0",
"d3-transition": "^1.1.0",
"duration-js": "^4.0.0",
"ember-ajax": "^5.0.0",
"ember-auto-import": "^1.2.21",
"ember-can": "^2.0.0",
Expand Down
93 changes: 0 additions & 93 deletions ui/tests/unit/utils/parse-duration-test.js

This file was deleted.

5 changes: 5 additions & 0 deletions ui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6375,6 +6375,11 @@ duplexify@^3.4.2, duplexify@^3.6.0:
readable-stream "^2.0.0"
stream-shift "^1.0.0"

duration-js@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/duration-js/-/duration-js-4.0.0.tgz#ab91575a4f1a6b096034685cfc6ea9aca99cd63f"
integrity sha1-q5FXWk8aawlgNGhc/G6prKmc1j8=

ecc-jsbn@~0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9"
Expand Down

0 comments on commit 4793dc9

Please sign in to comment.