From 88223f5e6dd5dc968843a79abc9e30feff59738b Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Wed, 10 May 2017 17:41:25 -0700 Subject: [PATCH] [Time] Always include basic formats Always include basic formats; removing them from the utc format bundle. This way, they can be utilized by third parties without them having to commit to the utc time system. Fixes https://github.com/nasa/openmct/issues/1574 --- platform/commonUI/formats/bundle.js | 24 +++++++++++++++++-- .../commonUI/formats/src}/DurationFormat.js | 0 .../commonUI/formats/src}/UTCTimeFormat.js | 0 .../formats/test}/UTCTimeFormatSpec.js | 2 +- src/plugins/utcTimeSystem/plugin.js | 15 ++---------- 5 files changed, 25 insertions(+), 16 deletions(-) rename {src/plugins/utcTimeSystem => platform/commonUI/formats/src}/DurationFormat.js (100%) rename {src/plugins/utcTimeSystem => platform/commonUI/formats/src}/UTCTimeFormat.js (100%) rename {src/plugins/utcTimeSystem => platform/commonUI/formats/test}/UTCTimeFormatSpec.js (98%) diff --git a/platform/commonUI/formats/bundle.js b/platform/commonUI/formats/bundle.js index 0aea5e531e..93ba2ab845 100644 --- a/platform/commonUI/formats/bundle.js +++ b/platform/commonUI/formats/bundle.js @@ -22,15 +22,19 @@ define([ "./src/FormatProvider", + "./src/UTCTimeFormat", + "./src/DurationFormat", 'legacyRegistry' ], function ( FormatProvider, + UTCTimeFormat, + DurationFormat, legacyRegistry ) { legacyRegistry.register("platform/commonUI/formats", { - "name": "Time services bundle", - "description": "Defines interfaces and provides default implementations for handling different time systems.", + "name": "Format Registry", + "description": "Provides a registry for formats, which allow parsing and formatting of values.", "extensions": { "components": [ { @@ -42,6 +46,22 @@ define([ ] } ], + "formats": [ + { + "key": "utc", + "implementation": UTCTimeFormat + }, + { + "key": "duration", + "implementation": DurationFormat + } + ], + "constants": [ + { + "key": "DEFAULT_TIME_FORMAT", + "value": "utc" + } + ], "licenses": [ { "name": "d3", diff --git a/src/plugins/utcTimeSystem/DurationFormat.js b/platform/commonUI/formats/src/DurationFormat.js similarity index 100% rename from src/plugins/utcTimeSystem/DurationFormat.js rename to platform/commonUI/formats/src/DurationFormat.js diff --git a/src/plugins/utcTimeSystem/UTCTimeFormat.js b/platform/commonUI/formats/src/UTCTimeFormat.js similarity index 100% rename from src/plugins/utcTimeSystem/UTCTimeFormat.js rename to platform/commonUI/formats/src/UTCTimeFormat.js diff --git a/src/plugins/utcTimeSystem/UTCTimeFormatSpec.js b/platform/commonUI/formats/test/UTCTimeFormatSpec.js similarity index 98% rename from src/plugins/utcTimeSystem/UTCTimeFormatSpec.js rename to platform/commonUI/formats/test/UTCTimeFormatSpec.js index c4111709a3..d5f3ce2d8e 100644 --- a/src/plugins/utcTimeSystem/UTCTimeFormatSpec.js +++ b/platform/commonUI/formats/test/UTCTimeFormatSpec.js @@ -21,7 +21,7 @@ *****************************************************************************/ define([ - "./UTCTimeFormat", + "../src/UTCTimeFormat", "moment" ], function ( UTCTimeFormat, diff --git a/src/plugins/utcTimeSystem/plugin.js b/src/plugins/utcTimeSystem/plugin.js index e237f352f1..e3e212ec9f 100644 --- a/src/plugins/utcTimeSystem/plugin.js +++ b/src/plugins/utcTimeSystem/plugin.js @@ -22,14 +22,10 @@ define([ "./UTCTimeSystem", - "./LocalClock", - "./UTCTimeFormat", - "./DurationFormat" + "./LocalClock" ], function ( UTCTimeSystem, - LocalClock, - UTCTimeFormat, - DurationFormat + LocalClock ) { /** * Install a time system that supports UTC times. It also installs a local @@ -40,13 +36,6 @@ define([ var timeSystem = new UTCTimeSystem(); openmct.time.addTimeSystem(timeSystem); openmct.time.addClock(new LocalClock(100)); - openmct.telemetry.addFormat(new UTCTimeFormat()); - openmct.telemetry.addFormat(new DurationFormat()); - - openmct.legacyExtension("constants", { - "key": "DEFAULT_TIME_FORMAT", - "value": "utc" - }); }; }; });