mirror of
https://github.com/nasa/openmct.git
synced 2024-12-18 20:57:53 +00:00
Squashed commit of the following:
commit6b5528a4fc
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 17:22:27 2016 -0700 [API] Don't use new composition for legacy objects commit2af993b0bc
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 17:19:52 2016 -0700 [API] Enable bundles from spec commitc762d58b5a
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 17:12:42 2016 -0700 [API] No, don't enable bundles by default commit219c9348d9
Merge:f8819ee
5b0fa90
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 17:11:05 2016 -0700 Merge remote-tracking branch 'origin/master' into api-1124b Conflicts: bower.json commitf8819ee946
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 17:05:40 2016 -0700 [API] Fix failing specs commitce6c6385c3
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 16:55:58 2016 -0700 [API] Remove failing spec commitef0264d864
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 16:23:17 2016 -0700 [API] Satisfy JSCS commit044b1b627d
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 16:17:35 2016 -0700 [API] Run gulp fixstyle commit5b6f13f521
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 16:15:30 2016 -0700 [API] Satisfy JSLint commit5b2c0e9aee
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 15:47:54 2016 -0700 [API] Adapt composition capability commitdd7d8d2642
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 15:18:51 2016 -0700 [API] Fix dependency issues with Composition commit08e28018c1
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 15:09:09 2016 -0700 [API] Don't instantiate Error commit3b1fe93191
Merge:2b66a4d
c874ae7
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 15:08:01 2016 -0700 Merge remote-tracking branch 'origin/api-platform-updates' into api-1124b commit2b66a4d604
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 15:06:50 2016 -0700 [API] Wire in ObjectAPI appropriately commit70c810b85d
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 14:51:26 2016 -0700 [API] Remove obsolete define parameter commitc874ae7afd
Merge:34e07b9
c27c0c5
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 14:46:37 2016 -0700 Merge remote-tracking branch 'origin/master' into api-platform-updates commitfc5c07aeb6
Merge:2976c9e
ed10249
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 14:44:54 2016 -0700 Merge remote-tracking branch 'origin/fix-jspdf-version-1214' into api-1124b commit2976c9e703
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 14:39:33 2016 -0700 [API] Really fix EventEmitter import commit54d2b00e67
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 14:37:20 2016 -0700 [API] Update licenses correctly Instead of double-documenting Zepto, document eventemitter3 commit061f9d6deb
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 14:32:10 2016 -0700 [API] Update EventEmitter dependency commit1de9d182a7
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 14:20:10 2016 -0700 [API] Add license info for new dependencies commit810150d0d7
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 13:41:28 2016 -0700 [API] Update documentation to reflect API status commit1c0999b512
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 13:26:59 2016 -0700 [API] Include revision info in minified openmct commit774ae03c3e
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 13:23:11 2016 -0700 [API] Add license headers commit1defee8953
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 13:16:36 2016 -0700 [API] Decruft README.md for objects ...as this content is now in JSDoc commit7b9ac3e7fb
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 13:11:03 2016 -0700 [API] Remove tutorial directories commitf2178e2b43
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 13:08:33 2016 -0700 [API] Decruft unused view ...from context menu prototyping commit0094fea3f7
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 13:07:55 2016 -0700 [API] Decruft unused gesture commit7f79abe849
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 13:07:25 2016 -0700 [API] Remove unused OverlayManager commitf43bb6e03d
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 13:05:16 2016 -0700 [API] Decruft unused Region commit8f3c3d910e
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 13:04:23 2016 -0700 [API] Decruft unused gesture commit0956811adc
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 13:00:00 2016 -0700 [API] Remove obsolete Selection.js commitbcc5a4e2ca
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 12:57:55 2016 -0700 [API] Remove README to decruft Content is now provided in JSDoc commit27b6a51887
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 12:56:16 2016 -0700 [API] Remove README to decruft Content is now provided in JSDoc commitbb04d9db4a
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 12:55:38 2016 -0700 [API] Remove obsolete method to decruft commit7c3bfae0a6
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 12:53:26 2016 -0700 [API] Remove obsolete script to decruft commit471fe7453b
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 12:52:51 2016 -0700 [API] Remove empty View script ...and move API docs to ViewRegistry commit0d0526627b
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 12:50:37 2016 -0700 [API] Decruft unused AngularView commit43e35179a3
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 12:49:08 2016 -0700 [API] Continue decrufting commit59634be565
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 12:46:36 2016 -0700 [API] Decruft unused script commit3bd8dd9928
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 12:45:20 2016 -0700 [API] Decruft unused script commitb5f1f98555
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 12:38:03 2016 -0700 [API] Minimize logic in openmct module commit11965304fb
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 12:35:15 2016 -0700 [API] Remove redundant openmct module commit742d649d38
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 12:29:34 2016 -0700 [API] Decruft unused dependency commit6a47df095b
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 12:27:53 2016 -0700 [API] Remove gulp api task commit0012ca48c1
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 12:27:39 2016 -0700 [API] Simplify JSDoc build ...since extraneous documentation no longer needs to be worked-around. commit34e07b938d
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 10:42:48 2016 -0700 [API] Update StyleSheetLoaderSpec ...to reflect asset path details commit230230aa94
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 10:37:31 2016 -0700 [API] Remove js extension from import ...to avoid confusing RequireJS and breaking test suite commit901846e6c1
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 10:29:03 2016 -0700 [API] Use correct property for RT table template commit04b8326900
Merge:aed01d3
a93f41f
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 10:25:32 2016 -0700 Merge branch 'api-platform-updates' into api-1124b commita93f41f1c3
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 10:25:22 2016 -0700 [API] Miscellaneous platform updates Adds miscellaneous platform updates to include templates via the RequireJS text plugin; to support modification of asset paths; and to support priority order for gestures. Supports integration of new API, #1124. commitaed01d3a23
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 10:20:09 2016 -0700 [API] Remove examples ...as these do not necessarily reflect API updates commit09c73ef5f8
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 10:09:42 2016 -0700 [API] Update MCT implementation commitb1b6080161
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 09:56:50 2016 -0700 [API] Rename types in api module commitcb93da5e15
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 09:56:06 2016 -0700 [API] Fix CompositionAPI module commitd0e7eb29a9
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 30 09:51:35 2016 -0700 [API] Mark MCT#selection as private commit5e9e6099b0
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 29 21:59:06 2016 -0700 [API] Update TelemetryAPI to match docs commit6bd1af5c03
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 29 21:42:09 2016 -0700 [API] Define LimitEvaluator interface commit3f20c1bb94
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 29 17:34:41 2016 -0700 [API] Update ViewRegistry to match docs commit91214f2623
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 29 17:26:27 2016 -0700 [API] Implement TypeRegistry methods commit1fde82e673
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 29 17:22:29 2016 -0700 [API] Mark Selection as private commit0ae0abcfc3
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 29 17:20:27 2016 -0700 [API] Update ObjectAPI to match docs commit6fe1e775e0
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 29 17:16:56 2016 -0700 [API] Update GestureAPI to match docs commitd4d9f9c467
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 29 17:08:54 2016 -0700 [API] Update CompositionCollection to match docs commit0cb1ec9366
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 29 17:04:15 2016 -0700 [API] Rewrite CompositionAPI to match docs commit6ab27302f6
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 29 16:49:42 2016 -0700 [API] Document remaining Dialog method commitdfc5021e11
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 29 16:47:33 2016 -0700 [API] Fix JSDoc for Dialog commit9e3a3529e0
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 29 16:46:22 2016 -0700 [API] Rename main module commit434ea5487a
Merge:987d98b
45ecc7b
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 29 16:43:47 2016 -0700 Merge branch 'api-1110' into api-1124b commit987d98b47e
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 29 16:37:57 2016 -0700 [API] Restore JSDoc for openmct module commit53974bd69a
Merge:ed8d331
d61f446
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 29 10:54:08 2016 -0700 Merge branch 'subobject-selection-1126' into api-1124b Conflicts: bower.json index.html main.js src/openmct.js commited8d331cd3
Merge:7ce9bd9
7439d94
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 29 10:47:52 2016 -0700 [API] Merge in latest from master commitd61f446002
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Mon Sep 26 15:21:43 2016 -0700 [Selection] Add a click-elsewhere gesture commit763f7dd021
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Mon Sep 26 12:37:02 2016 -0700 [Selection] Begin adapting actions commitcad255ce83
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Mon Sep 26 11:52:14 2016 -0700 [Selection] Use variable name expected by template commit3b4239fbd9
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Mon Sep 26 11:43:38 2016 -0700 [Selection] Use AngularView for context menus commit15ef89f455
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Mon Sep 26 11:38:37 2016 -0700 [Selection] Bring over context menu template commitc9a0a469f6
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Sun Sep 25 20:30:42 2016 -0700 [Selection] Position context menus commitf926bd9762
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Sun Sep 25 19:38:03 2016 -0700 [Selection] Position overlays commitd79392aeaa
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Sun Sep 25 18:26:00 2016 -0700 [Selection] Begin integrating OverlayManager commit9a5bda4917
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Sun Sep 25 18:22:07 2016 -0700 [Selection] Sketch in overlay manager commit407550e6f4
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 23 15:48:43 2016 -0700 [Selection] Inject actionRegistry commit8b44b44e38
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 23 15:46:45 2016 -0700 [Selection] Generalize Registry commit8dfa8df28a
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 23 15:45:46 2016 -0700 [Selection] Allow providers to return array ...to allow one-to-many providers for actions, as is useful for Create et al (and, in this specific case, to support adapters.) commit9e19296b14
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 23 15:35:40 2016 -0700 [Selection] Add ActionRegistry commit106632c21c
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 23 15:32:40 2016 -0700 [Selection] Remove unused import commit235032a571
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 23 15:27:39 2016 -0700 [Selection] Wire in new contextmenu commitdb41f6e64f
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 23 15:19:16 2016 -0700 [Selection] Obey priority order commite83e0da521
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 23 15:16:32 2016 -0700 [Selection] Export openmct from main.js commitc411f8fbe3
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 23 15:07:03 2016 -0700 [Selection] Go through openmct API commit4ce952846c
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 22 11:51:00 2016 -0700 [Selection] Expose context menu adapter commitfdab4a614f
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 22 11:48:44 2016 -0700 [Selection] Expose contextual gesture commit152f55652f
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 22 11:46:37 2016 -0700 [Selection] Add adapter for context menu commitc46c42e576
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 21 15:39:56 2016 -0700 [Selection] Sketch in AngularView ...for use in the adapter layer. commit75bf956c3d
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 21 14:54:22 2016 -0700 [Selection] Use context typedef commit0a44c48338
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 21 13:27:59 2016 -0700 [Selection] Sketch in context menu gesture commite4c3412e8a
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 21 13:16:24 2016 -0700 [Selection] Sketch in context menu view commit4e1cfac4b9
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 21 12:30:36 2016 -0700 [Selection] Expose inspector registry commit0a64e9f515
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 21 12:29:43 2016 -0700 [Selection] Add ViewRegistry commit7341ed9d03
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 21 12:26:57 2016 -0700 [Selection] Handle selection changes ...from the InspectorRegion commite2631bdcfd
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 21 11:27:24 2016 -0700 [Selection] Listen/unlisten to selection ...from the inspector region commit773a7c0c24
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 21 11:25:21 2016 -0700 [Selection] Begin adding Inspector region commitfdcba66558
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 14 11:54:19 2016 -0700 [Selection] Add legacy bundle ...to act as an adapter to legacy registration API commit3b1ed7821f
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 14 11:50:33 2016 -0700 [Selection] Add openmct module ...to expose selection APIs commit1be517f3ea
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 14 11:46:06 2016 -0700 [Selection] Don't reuse old paths for new items commit5e3dcadfa4
Merge:fd97f4d
f732387
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 14 11:06:05 2016 -0700 Merge remote-tracking branch 'origin/master' into subobject-selection-1126 Conflicts: bower.json main.js test-main.js commit45ecc7bb2b
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 14:10:51 2016 -0700 [API] Ascending/descending order commita3c3f997cf
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 13:25:05 2016 -0700 [API] Move down TC example ...to come after telemetry usage example commit1ae3ce57d0
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 13:23:06 2016 -0700 [API] Telemetry registration example commit616e2b4d77
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 13:10:48 2016 -0700 [API] Exemplify mutate/observe commit0e7d812db7
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 13:04:30 2016 -0700 [API] Document ObjectAPI registration commitc074f29a07
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 11:26:13 2016 -0700 [API] Add gesture example commit92118d353e
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 11:24:01 2016 -0700 [API] Add Time Conductor example commitb111eeff07
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 11:16:24 2016 -0700 [API] Update reference commit8042e84911
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 11:15:26 2016 -0700 [API] Add composition-related content commit631c4b5dda
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 11:06:27 2016 -0700 [API] Describe composition property commitc6baf2dc1f
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 10:58:00 2016 -0700 [API] Make CompositionCollection an interface commit4db7e12d45
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 10:55:34 2016 -0700 [API] Add example for views commitb1799c695e
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 10:46:49 2016 -0700 [API] Add DomainObject commit5761c889bc
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 10:41:48 2016 -0700 [API] Move MutableObject methods to ObjectAPI commit97cf26d438
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 10:27:42 2016 -0700 [API] Telemetry provider commitc4b83b7589
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 10:18:43 2016 -0700 [API] Account for provider strategies commitd56f30c15a
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 10:15:57 2016 -0700 [API] TelemetryRequest commit7279c5d857
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 10:12:47 2016 -0700 [API] Mark properties as optional commit5d53ab83a3
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 10:11:52 2016 -0700 [API] More TelemetryProperty properties commit4565e45b36
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 10:08:07 2016 -0700 [API] Add TelemetryProperty for metadata commit5950daa6cb
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 09:33:21 2016 -0700 [API] Move out composition policy commit60800c913e
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 09:28:26 2016 -0700 [API] Gestures commit649567176d
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 09:21:18 2016 -0700 [API] Notes on context commit1df573b8c6
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 08:50:20 2016 -0700 [API] Move types into registry commitbc4ca10e53
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 08:45:18 2016 -0700 [API] Separate out ViewRegistry commit1338f02541
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 08:32:21 2016 -0700 [API] Clean up telemetry API docs slightly commit1cc6833c30
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 08:26:32 2016 -0700 [API] Add request/subscribe JSDoc commita7a47a36d6
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 08:10:40 2016 -0700 [API] Remove extraneous return jsdoc commit851d0f0d63
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Sep 7 08:09:37 2016 -0700 [API] Clean up Composition API commit5a129de73d
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 16:32:54 2016 -0700 [API] Clarify language commit0cf634a412
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 16:30:05 2016 -0700 [API] Add more front-page content commit702d7acf64
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 16:18:42 2016 -0700 [API] Begin adding front page content commit69a500bf44
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 16:07:49 2016 -0700 [API] Dedocument Selection ...and add a description to MCT#conductor commit82e5b009e8
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 13:58:19 2016 -0700 [API] Move Identifier typedef commitaafd0731ec
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 13:47:59 2016 -0700 [API] Remove 'the API' section ...as this is now generated from JSDoc, more or less commitc9705a5f2c
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 13:46:02 2016 -0700 [API] Normalize line length commit7cc4a1262c
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 13:31:07 2016 -0700 [API] Proofread intro commit02904a6081
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 13:28:49 2016 -0700 [API] Link to openmct module in the preamble commit7ce9bd969a
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 10:14:04 2016 -0700 [API] Telemetry JSdoc commit8cafd2da7e
Merge:6264ab7
bccd018
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 10:06:30 2016 -0700 Merge remote-tracking branch 'origin/api-tutorial/telemetry' into api-1110 commit6264ab75f3
Merge:7a5cad2
b4dc502
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 10:03:59 2016 -0700 Merge remote-tracking branch 'origin/api-tutorials' into api-1110 Conflicts: src/MCT.js src/api/composition/CompositionCollection.js src/api/composition/DefaultCompositionProvider.js src/api/objects/MutableObject.js commit7a5cad20ec
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 09:58:08 2016 -0700 [API] Add JSDoc for Dialog commit4de069b393
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 09:54:51 2016 -0700 [API] JSDoc for Selection commit70abd5c1f9
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 09:47:06 2016 -0700 [API] Document start event commit2a3a61da86
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 09:45:24 2016 -0700 [API] Fix event memberofs in TimeConductor commit018bd022cc
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 09:42:04 2016 -0700 [API] Document View API commit4739b36bc3
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 09:14:04 2016 -0700 [API] Add metadata to View jsdoc commitc9b1035a6d
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 09:13:01 2016 -0700 [API] Document Type.check commit6768328475
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 08:43:01 2016 -0700 [API] Document MutableObject commit60c179eac3
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 08:32:18 2016 -0700 [API] Add missing parameter names commita20e8d69b5
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 08:31:42 2016 -0700 [API] More Objects doc commit1abcb248fe
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 08:13:26 2016 -0700 [API] Include API.md as main page commita8151f5f22
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 08:09:03 2016 -0700 [API] Document CompositionProvider commitcdf21f3763
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 07:58:52 2016 -0700 [API] Mark Composition as instance method commit341bceb4e2
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Sep 6 07:57:44 2016 -0700 [API] Document composition API commit0470a02272
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 2 16:04:38 2016 -0700 [API] Reference ObjectAPI commite3dc26c130
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 2 15:25:28 2016 -0700 [API] Clean up docs commit96c3d1cac2
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 2 15:19:20 2016 -0700 [API] Use JSDoc config commit2af778145d
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 2 15:16:11 2016 -0700 [API] Clean up JSDoc slightly commit5743eeb33a
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 2 15:03:12 2016 -0700 [API] Reference EventEmitter commitf06f714bdc
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 2 15:02:18 2016 -0700 [API] Document some public fields commitd592bd1035
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 2 14:58:06 2016 -0700 [API] Give up on borrows-style documentation commitb5f62541ce
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Sep 2 14:54:27 2016 -0700 [API] Add watch for API docs commit33ced4bccf
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 1 15:51:25 2016 -0700 [API] Expose MCT on openmct commite37510dbab
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 1 15:13:52 2016 -0700 [API] Ignore internal API after processing commitf27c41014d
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 1 14:50:13 2016 -0700 [API] JSDoc for openmct.start() commitbd796f2beb
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 1 14:44:24 2016 -0700 [API] Simple constructor documentation commitbcc32c76d0
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 1 14:42:55 2016 -0700 [API] Module-level JSDoc commitff2ec6690a
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 1 14:35:52 2016 -0700 [API] Rename module to openmct commit1e0fb3611d
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Sep 1 12:34:54 2016 -0700 [API] Render API docs to HTML commit1d4f36a7d9
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Aug 26 11:48:27 2016 -0700 [API] Include JSDoc for mct namespace only commit0f96fbdd62
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Aug 26 11:31:56 2016 -0700 [API] Treat mct as a namespace commite05fb57fe4
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Aug 26 09:47:50 2016 -0700 [API] Quasi-sensible JSDoc starting point commit185cdcab08
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Aug 26 09:31:07 2016 -0700 [API] Begin adding mct.js ...which will provide an instance of OpenMCT at startup, as well as house documentation for entry point to public API. commit50ccad5aaa
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Aug 26 09:26:12 2016 -0700 [API] Rename MCT to OpenMCT commit6a23df9454
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Aug 25 14:54:07 2016 -0700 [API] Add JSDoc for MCT commitab5b1d3754
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Aug 25 13:49:21 2016 -0700 [API] Add JSDoc task commitb309f26b56
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Aug 25 13:38:44 2016 -0700 [API] Add gulp-jsdoc-to-markdown dep ...to aid in generating API docs as a measure of API completeness and consistency, for #1110 and #1111 commitb4dc50295c
Merge:02aa08a
382dde3
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Aug 25 13:26:50 2016 -0700 Merge pull request #1131 from nasa/open1094 Resolve synchronization issues with MutableObject commit382dde300a
Merge:b1b8df4
02aa08a
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Aug 25 13:25:54 2016 -0700 Merge remote-tracking branch 'origin/api-tutorials' into open1094 Conflicts: index.html tutorials/todo/todo.js commit02aa08a3ef
Merge:c95d9c7
d73c505
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Aug 25 13:19:14 2016 -0700 Merge pull request #1121 from nasa/api-containment [API] Containment commitc95d9c7956
Merge:1147f3a
2463e4d
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Aug 25 13:17:26 2016 -0700 Merge pull request #1107 from nasa/api-type-forms [API] Handle forms with a "properties" region commitfd97f4db41
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Aug 25 13:15:37 2016 -0700 [Selection] Begin implementing Hover gesture commitb1b8df4d87
Author: Andrew Henry <andrew.k.henry@nasa.gov> Date: Tue Aug 23 13:57:12 2016 +0100 Use MutationCapability commit3228a83802
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Mon Aug 22 16:31:27 2016 -0700 [Selection] Begin adding hover gesture commit1dba551fc6
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Mon Aug 22 16:07:01 2016 -0700 [Selection] Force single select ...as a simplifying assumption for the initial prototype. commit20f3b57ddd
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Mon Aug 22 14:18:26 2016 -0700 [Selection] Release listeners commit58787c4436
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Mon Aug 22 14:13:46 2016 -0700 [Selection] Remove obsolete include commit2a45893602
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Mon Aug 22 13:22:17 2016 -0700 [Selection] Begin adding context management commita94ab44431
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Mon Aug 22 12:24:40 2016 -0700 [Selection] Toggle selected class commitcc9efdff31
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Mon Aug 22 12:17:29 2016 -0700 [Selection] At Path.toArray commitbd3c6665fb
Author: Andrew Henry <andrew.k.henry@nasa.gov> Date: Mon Aug 22 14:25:39 2016 +0100 Added bridge between old and new event models commit10e90519c0
Author: Pete Richards <peter.l.richards@nasa.gov> Date: Fri Aug 19 19:10:06 2016 -0700 Tidy todo views, remove unnecessary code commitd341a8be97
Author: Pete Richards <peter.l.richards@nasa.gov> Date: Fri Aug 19 19:07:53 2016 -0700 Selection changes include new selection commit8c439d8109
Author: Andrew Henry <andrew.k.henry@nasa.gov> Date: Sun Aug 21 23:01:48 2016 -0700 Adding compatibility between old and new style mutation events commit9c88b7ce1d
Author: Henry <akhenry@gmail.com> Date: Thu Aug 18 10:38:16 2016 -0700 Removed setters from MutableObject and fixed non-working todo list tutorial Refactoring MutableObject Fixed non-working todo example commit6e664003e3
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Aug 18 13:11:09 2016 -0700 [Sub-object] Sketch in SelectGesture commit70d804fc49
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Aug 18 11:54:05 2016 -0700 [Sub-object] Emit change events commit06c184821e
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Aug 18 11:51:09 2016 -0700 [Sub-object] Add Path.append commitb76be3d2e5
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Aug 18 11:45:13 2016 -0700 [Sub-object] Basic Path/Selection implementation commit8934ba96f7
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Aug 18 10:33:34 2016 -0700 [Sub-object] Add empty Selection class commit3fb4ce7819
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri May 27 11:43:35 2016 -0700 [Sub-object] Add EventEmitter dependency Selection state will be represented in #1126 by an EventEmitter. commit2463e4d59f
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Aug 12 12:54:39 2016 -0700 [API] Update Dialog API usage commitd73c505bea
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Aug 12 11:17:00 2016 -0700 [API] Fix typo, add missing this commit831ecc59d9
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Aug 12 10:24:59 2016 -0700 [API] Wire in canContain via policy commit1de26d3c5d
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Aug 12 09:30:02 2016 -0700 [API] Throw error on containment violation commit11409ce509
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Aug 12 09:27:46 2016 -0700 [API] Add containment methods commit93872ce074
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Aug 11 16:04:26 2016 -0700 [API] Expose Dialog as constructor ...and use it that way from todo plugin commit8861644f2d
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Aug 11 16:02:04 2016 -0700 [API] Adjust Dialog API ...to allow OK button to be enabled/disabled. commitd4948f771b
Merge:0656a29
8295a0b
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Aug 11 15:31:11 2016 -0700 Merge branch 'api-todo-update' into api-type-forms commit8295a0bed1
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Aug 11 15:29:46 2016 -0700 [API] Update todo tutorial ...to expect new domain object API (instead of explicitly wrapping it.) commit0656a298da
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Aug 4 14:00:39 2016 -0700 [API] Remove test usage of properties region commitfe2ce91d50
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Jul 28 16:16:22 2016 -0700 [API] Show a custom view in dialog commit14f30b2489
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Jul 28 16:05:02 2016 -0700 [API] Restrict dialog overrides ...to those domain objects which have some view for the properties region registered. commit62d90a8114
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Jul 28 15:57:15 2016 -0700 [API] Show dialog via mct commit87682607a5
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Jul 28 15:53:07 2016 -0700 [API] Rename dependency in adapter layer commit7bf265b478
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Jul 28 15:52:52 2016 -0700 [API] Move mct service up commit1d31fe8d02
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Jul 28 15:48:28 2016 -0700 [API] Override dialogService in actions An ugly hack to allow dialogs to be shown for Save As and Edit Properties, without requiring form generation. This will permit views to be shown instead in certain cases, https://github.com/nasa/openmct/pull/999#issuecomment-236045158 commitbfdbc71e40
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu Jul 28 15:34:03 2016 -0700 [API] Define a properties region commit1147f3aa47
Author: Pete Richards <pete@pete-richards.com> Date: Mon Jul 25 14:38:44 2016 -0700 tutorials: support arbitrary hosting directory (#1097) * Include all bundles in artifact change bundle registry such that all bundles are immediately registered, but must be specifically enabled. A default registry class enables bundles that make sense for demonstration purposes. Added methods to the registry to allow enabling and disabling of bundles without having to load additional files. * support alternate asset/worker paths Change the gulp glob for assets to copy over a more minimal set of files-- only css, fonts, and images. Results in a smaller distributable archive. Update stylesheet loader to use a constant for the assets path. This can be customized at run time via MCT.setAssetPath() to allow MCT to be hosted in various locations. Update worker loader to support loading workers from blobs to support packaging as standalone file. * Load templates via requirejs * [gulp] lazy-require where reasonable Require things right before starting tasks to reduce gulp start up time. * document setAssetPath commit719f9f45e8
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jul 22 14:09:31 2016 -0700 [API] Add documentation for selection state (#1096) commit95ef70a24c
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jul 22 13:56:45 2016 -0700 [API] Use selection state from toolbar (#1070) * [API] Allow selection * [API] Keep in sync using model * [API] Add selection as EventEmitter * [API] Use selection from ToDo tutorial * [API] Restore selection functionality commitd5aa998b4c
Author: Pete Richards <pete@pete-richards.com> Date: Fri Jul 22 13:53:03 2016 -0700 [API] Draft Composition API (#1068) * [Objects] util for equality checking Add a method for checking object equality, useful for other services. * [Composition] Draft Composition API Draft composition API. Composition collections provide an observable for watching and mutating the composition of an object. Composition providers implement the loading and modification of composition. The default composition provider uses the composition attribute of domain objects, while allowing other providers to implement their own loading and mutation behavior. * add todo about event listener bindings * [Type] Add form property for defining form fields * [tutorial] Add Composition tutorial * provider doesn't have to implement events, load returns array of children * use new composition in old api * correct key name * Override instantiate to provide model ids Override instantiate in public API adapter to prevent making changes to platform code. Instantiate now passes the id of the domain object with the model so that capabilities can convert to a new-style domain object and use that to detect functionality. * Implement mutation capability with decorator Implementation mutation capability override with decorator to adapter code outside of platform. Capability override ensures that models are kept in sync even though they are no longer shared objects. * override composition cleanly Override composition capability without making changes inside platform. * cleanup after temporary collections * remove unused try/catch commit7890fcae69
Author: Pete Richards <pete@pete-richards.com> Date: Thu Jul 21 14:39:02 2016 -0700 tutorial consistency . (#1079) * [API] use new-style objects consistently * rewrite todo tutorial in test-api.html * [API] Add API doc, update object API * [Tutorials] Rename tutorials, remove old * Fix Links * updates * initial * hope this works * Object Utils always return new objects instead of mutating existing objects * keep domain object model in-sync when listening Keep the domain object model in sync with the latest version when listening for mutation events. * Remove old-style plugins * Update views to use new API * Tidy Code * Update API Docs * Add Plugin API and Example commit18843cee48
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Wed Jul 20 13:46:03 2016 -0700 [API] Change approach to applies-to checking (#1072) * [API] Allow selection * [API] Keep in sync using model * [API] Add selection as EventEmitter * [API] Use selection from ToDo tutorial * [API] Add appliesTo-style method * [API] Remove destroy method, simplify show * [View] Return a no-op * [API] Use new applies-to checking * [API] Rename TodoView to TodoRenderer * [API] Rewire views * [API] Wire up so that things work * [API] Begin adding container ...to attempt to give views something to listen to for destroy-like events * [API] Begin using regions... * [API] Begin working through Region stuff * [API] Revise Region API ...for similarity with Marionette, https://github.com/nasa/openmct/pull/1072#issuecomment-230902986 * [API] Begin separating View, ViewDefinition * [API] Finish separating View/ViewDefinition * [API] Update MCTView ...to reflect updates to Region/View/ViewDefinition APIs * [API] Simplify View API ...merging closely-related populate/show methods, and restoring compatibility with todo tutorial * [API] Wire in from todo tutorial plugin * [API] Switch back to region constants * [API] Update method signature, add JSDoc * [API] Update variable name * [API] Remove unnecessary separate regions file * [API] Relocate Region; not external api * [API] Revert changes to api.js ...as these ended up becoming entirely superficial commit1879c122c7
Author: Andrew Henry <andrew.k.henry@nasa.gov> Date: Thu Jul 7 14:30:45 2016 -0700 Mutation API (#1074) * [API] Allow selection * [API] Keep in sync using model * [API] Add selection as EventEmitter * [API] Use selection from ToDo tutorial * Object events prototype * Added examples * Transitional API * Modified todo list code to work with new setters * [API] Removed emitting of events on container when property changes value to remove ambiguity. Listeners must be listening to the same path used in the setter to catch changes commitd7ddb96c4e
Author: Pete Richards <pete@pete-richards.com> Date: Thu Jul 7 14:25:23 2016 -0700 [API] UMD Packaging (#1078) * [Bundle] load filter with requirejs * [Build] Use almond, wrap in UMD Use almond for built version of application and wrap in UMD so that it supports requirejs, commonjs, and basic browser loading. * [Main] Can choose where to load app MCT.run allows you to specify a dom element to load application within. If element is not specified, will use body. * [MCT] set class on injected div Set class on injected div so extra markup is not required. * [Build] Re-enable optimize * Add minimal bootstrap example commitbccd018d97
Author: Pete Richards <peter.l.richards@nasa.gov> Date: Fri Jul 1 10:26:49 2016 -0700 Telemetry Draft commitb55668426d
Merge:47a543b
5b656fa
Author: Andrew Henry <andrew.k.henry@nasa.gov> Date: Fri Jul 1 10:22:16 2016 -0700 Merge pull request #1062 from nasa/tc-redux [Time Conductor] V2 Public API commit5b656faa9d
Author: Henry <akhenry@gmail.com> Date: Thu Jun 30 20:50:03 2016 -0700 Added tests commit8d2c489fa9
Author: Pete Richards <pete@pete-richards.com> Date: Thu Jun 30 16:54:56 2016 -0700 [TimeConductor] Set bounds on timeSystem Change Always set bounds on timeSystem change as not having valid bounds would put views in inconsistent states. commit4366b0870d
Author: Henry <akhenry@gmail.com> Date: Wed Jun 29 12:51:02 2016 -0700 [Time Conductor] API redesign. Initial commit of V2 public API. Addresses #933 commit47a543beb7
Merge:06f87c1
c944080
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jul 1 10:17:36 2016 -0700 Merge pull request #1067 from nasa/api-css [API] Remove stylesheet from example commit06f87c1472
Merge:14a56ea
c9c41cd
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jul 1 10:13:29 2016 -0700 Merge pull request #1029 from nasa/api-toolbar-add-only [API Prototype] Add toolbar commitc9c41cdcc8
Merge:370b515
14a56ea
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jul 1 10:10:33 2016 -0700 Merge remote-tracking branch 'origin/api-tutorials' into api-toolbar-add-only Conflicts: src/MCT.js commit14a56ea17e
Merge:d51e6bf
b2e7db7
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jul 1 10:09:29 2016 -0700 Merge pull request #1028 from nasa/api-view [API Prototype] Support imperative view registration commitb2e7db71cc
Merge:96316de
d51e6bf
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jul 1 10:08:05 2016 -0700 Merge remote-tracking branch 'origin/api-tutorials' into api-view Conflicts: src/MCT.js src/api/api.js commitd51e6bfd92
Merge:5de7a96
d475d76
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jul 1 10:03:42 2016 -0700 Merge pull request #1030 from nasa/api-tutorial/objects Api tutorial/objects commitd475d767d5
Author: Pete Richards <peter.l.richards@nasa.gov> Date: Fri Jun 17 17:05:05 2016 -0700 add grootprovider commita63e053399
Author: Pete Richards <peter.l.richards@nasa.gov> Date: Fri Jun 17 16:54:32 2016 -0700 [ObjectAPI] Draft new Object API Rought prototype of new object API. commit370b515c23
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jun 17 14:21:37 2016 -0700 [API] Synchronize view to model commit4a50f325cb
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jun 17 14:18:51 2016 -0700 [API] Allow tasks to be added commitdbe6a4efc1
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jun 17 14:05:00 2016 -0700 [API] Title dialog commit13920d8802
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jun 17 14:00:45 2016 -0700 [API] Resolve/reject from dialog commitb6a8c514aa
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jun 17 13:51:15 2016 -0700 [API] Show dialog from toolbar commite4a4704baa
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jun 17 13:41:59 2016 -0700 [API] Listen to add/remove buttons commitbe0029e59a
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jun 17 13:38:54 2016 -0700 [API] Get todo toolbar to look right commit9cb273ef0a
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jun 17 13:30:08 2016 -0700 [API] Get registered toolbar to appear commiteec9b1cf4c
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jun 17 13:10:24 2016 -0700 [API] Support distinct region registration commit1f96e84542
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jun 17 12:16:46 2016 -0700 [API] Override template to allow toolbar injection commitc289a27305
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jun 17 11:43:18 2016 -0700 [API] Begin adding toolbar commitc944080790
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jun 17 11:27:04 2016 -0700 [API] Remove stylesheet from example No need to provide custom API for this. commit96316de6e4
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jun 17 11:16:08 2016 -0700 [API] Update view API commit2240a87ddc
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jun 17 10:53:56 2016 -0700 [API] Move view off of type commitd891affe48
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jun 17 10:21:00 2016 -0700 [API] Move view off of type commit21a618d1ce
Merge:580a4e5
09a833f
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jun 17 10:19:44 2016 -0700 Merge branch 'api-type-proto' into api-view commit5de7a96ccc
Merge:9c4e17b
09a833f
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jun 17 10:18:42 2016 -0700 Merge pull request #1010 from nasa/api-type-proto [API Prototype] Type registration commit09a833f524
Merge:c4fec1a
9c4e17b
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri Jun 10 13:28:09 2016 -0700 Merge branch 'api-tutorials' into api-type-proto commit580a4e52b5
Merge:4ca2f51
9c4e17b
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Jun 7 14:01:08 2016 -0700 Merge branch 'api-tutorials' into api-type-driven commit9c4e17bfab
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Jun 7 13:14:36 2016 -0700 [Tutorials] Add telemetry tutorial commitd3e5d95d6b
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Jun 7 13:00:38 2016 -0700 [Tutorials] Add example server commitc70793ac2d
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Jun 7 12:55:29 2016 -0700 [Tutorials] Add remainder of bargraph commita6ef1d3423
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Tue Jun 7 12:49:38 2016 -0700 [Tutorials] Add Bar Graph tutorial commit4ca2f51d5e
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri May 27 17:08:04 2016 -0700 [API] Use subclass style commit86ac80ddbd
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri May 27 16:56:08 2016 -0700 [API] Persist mutations commit0525ba6b0b
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri May 27 16:55:10 2016 -0700 [API] Check/uncheck todos commita79e958ffc
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri May 27 16:46:06 2016 -0700 [API] Show tasks from todo commit03cb0ccb57
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri May 27 16:36:55 2016 -0700 [API] Get View to render commit7205faa6bb
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri May 27 16:27:47 2016 -0700 [API] Add adapter bundle commit136f2ae785
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri May 27 16:19:20 2016 -0700 [API] Add MCTView directive as an adapter commita07e2fb8e5
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri May 27 16:08:43 2016 -0700 [API] Implement View commit55b531bdeb
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri May 27 15:49:16 2016 -0700 [API] Sketch in view instantiation commit7ece5897e8
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri May 27 15:31:54 2016 -0700 [API] Begin adding View commita29c7a6eab
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri May 27 13:46:30 2016 -0700 [API] Deangularize todo templates commitc4fec1af6a
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri May 27 13:31:30 2016 -0700 [API] Move type toward a newer API commita6996df3df
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri May 27 13:17:16 2016 -0700 [API] Begin moving out type commit0c660238f2
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri May 27 11:49:43 2016 -0700 [API] Add MCT class commitb73b824e55
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri May 27 11:43:35 2016 -0700 [API] Add EventEmitter dep commit1954d98628
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Fri May 27 11:30:53 2016 -0700 [Tutorials] Remove diff markings in TodoController commit7aa034ce23
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu May 26 16:05:38 2016 -0700 Add todo tutorial commit385dc5d298
Author: Victor Woeltjen <victor.woeltjen@nasa.gov> Date: Thu May 26 15:36:09 2016 -0700 Begin adding tutorials
This commit is contained in:
parent
5b0fa90e39
commit
b0e842863d
285
API.md
Normal file
285
API.md
Normal file
@ -0,0 +1,285 @@
|
|||||||
|
# Open MCT API
|
||||||
|
|
||||||
|
The Open MCT framework public api can be utilized by building the application
|
||||||
|
(`gulp install`) and then copying the file from `dist/main.js` to your
|
||||||
|
directory of choice.
|
||||||
|
|
||||||
|
Open MCT supports AMD, CommonJS, and loading via a script tag; it's easy to use
|
||||||
|
in your project. The [`openmct`]{@link module:openmct} module is exported
|
||||||
|
via AMD and CommonJS, and is also exposed as `openmct` in the global scope
|
||||||
|
if loaded via a script tag.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
Open MCT's goal is to allow you to browse, create, edit, and visualize all of
|
||||||
|
the domain knowledge you need on a daily basis.
|
||||||
|
|
||||||
|
To do this, the main building block provided by Open MCT is the _domain object_.
|
||||||
|
The temperature sensor on the starboard solar panel,
|
||||||
|
an overlay plot comparing the results of all temperature sensor,
|
||||||
|
the command dictionary for a spacecraft,
|
||||||
|
the individual commands in that dictionary, your "my documents" folder:
|
||||||
|
All of these things are domain objects.
|
||||||
|
|
||||||
|
Domain objects have Types, so a specific instrument temperature sensor is a
|
||||||
|
"Telemetry Point," and turning on a drill for a certain duration of time is
|
||||||
|
an "Activity". Types allow you to form an ontology of knowledge and provide
|
||||||
|
an abstraction for grouping, visualizing, and interpreting data.
|
||||||
|
|
||||||
|
And then we have Views. Views allow you to visualize domain objects. Views can
|
||||||
|
apply to specific domain objects; they may also apply to certain types of
|
||||||
|
domain objects, or they may apply to everything. Views are simply a method
|
||||||
|
of visualizing domain objects.
|
||||||
|
|
||||||
|
Regions allow you to specify what views are displayed for specific types of
|
||||||
|
domain objects in response to different user actions. For instance, you may
|
||||||
|
want to display a different view while editing, or you may want to update the
|
||||||
|
toolbar display when objects are selected. Regions allow you to map views to
|
||||||
|
specific user actions.
|
||||||
|
|
||||||
|
Domain objects can be mutated and persisted, developers can create custom
|
||||||
|
actions and apply them to domain objects, and many more things can be done.
|
||||||
|
For more information, read on!
|
||||||
|
|
||||||
|
## Running Open MCT
|
||||||
|
|
||||||
|
Once the [`openmct`](@link module:openmct) module has been loaded, you can
|
||||||
|
simply invoke [`start`]{@link module:openmct.MCT#start} to run Open MCT:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
openmct.start();
|
||||||
|
```
|
||||||
|
|
||||||
|
Generally, however, you will want to configure Open MCT by adding plugins
|
||||||
|
before starting it. It is important to install plugins and configure Open MCT
|
||||||
|
_before_ calling [`start`]{@link module:openmct.MCT#start}; Open MCT is not
|
||||||
|
designed to be reconfigured once started.
|
||||||
|
|
||||||
|
## Configuring Open MCT
|
||||||
|
|
||||||
|
The [`openmct`]{@link module:openmct} module (more specifically, the
|
||||||
|
[`MCT`]{@link module:openmct.MCT} class, of which `openmct` is an instance)
|
||||||
|
exposes a variety of methods to allow the application to be configured,
|
||||||
|
extended, and customized before running.
|
||||||
|
|
||||||
|
Short examples follow; see the linked documentation for further details.
|
||||||
|
|
||||||
|
### Adding Domain Object Types
|
||||||
|
|
||||||
|
Custom types may be registered via
|
||||||
|
[`openmct.types`]{@link module:openmct.MCT#types}:
|
||||||
|
|
||||||
|
```
|
||||||
|
openmct.types.addType('my-type', new openmct.Type({
|
||||||
|
label: "My Type",
|
||||||
|
description: "This is a type that I added!"
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Adding Views
|
||||||
|
|
||||||
|
Custom views may be registered based on the region in the application
|
||||||
|
where they should appear:
|
||||||
|
|
||||||
|
* [`openmct.mainViews`]{@link module:openmct.MCT#mainViews} is a registry
|
||||||
|
of views of domain objects which should appear in the main viewing area.
|
||||||
|
* [`openmct.inspectors`]{@link module:openmct.MCT#inspectors} is a registry
|
||||||
|
of views of domain objects and/or active selections, which should appear in
|
||||||
|
the Inspector.
|
||||||
|
* [`openmct.toolbars`]{@link module:openmct.MCT#toolbars} is a registry
|
||||||
|
of views of domain objects and/or active selections, which should appear in
|
||||||
|
the toolbar area while editing.
|
||||||
|
* [`openmct.indicators`]{@link module:openmct.MCT#inspectors} is a registry
|
||||||
|
of views which should appear in the status area of the application.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
openmct.mainViews.addProvider({
|
||||||
|
canView: function (domainObject) {
|
||||||
|
return domainObject.type === 'my-type';
|
||||||
|
},
|
||||||
|
view: function (domainObject) {
|
||||||
|
return new MyView(domainObject);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Adding a Root-level Object
|
||||||
|
|
||||||
|
In many cases, you'd like a certain object (or a certain hierarchy of
|
||||||
|
objects) to be accessible from the top level of the application (the
|
||||||
|
tree on the left-hand side of Open MCT.) It is typical to expose a telemetry
|
||||||
|
dictionary as a hierarchy of telemetry-providing domain objects in this
|
||||||
|
fashion.
|
||||||
|
|
||||||
|
To do so, use the [`addRoot`]{@link module:openmct.ObjectAPI#addRoot} method
|
||||||
|
of the [object API]{@link module:openmct.ObjectAPI}:
|
||||||
|
|
||||||
|
```
|
||||||
|
openmct.objects.addRoot({
|
||||||
|
identifier: { key: "my-key", namespace: "my-namespace" }
|
||||||
|
name: "My Root-level Object",
|
||||||
|
type: "my-type"
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also remove this root-level object via its identifier:
|
||||||
|
|
||||||
|
```
|
||||||
|
openmct.objects.removeRoot({ key: "my-key", namespace: "my-namespace" });
|
||||||
|
```
|
||||||
|
|
||||||
|
### Adding Composition Providers
|
||||||
|
|
||||||
|
The "composition" of a domain object is the list of objects it contains,
|
||||||
|
as shown (for example) in the tree for browsing. Open MCT provides a
|
||||||
|
default solution for composition, but there may be cases where you want
|
||||||
|
to provide the composition of a certain object (or type of object) dynamically.
|
||||||
|
For instance, you may want to populate a hierarchy under a custom root-level
|
||||||
|
object based on the contents of a telemetry dictionary.
|
||||||
|
To do this, you can add a new CompositionProvider:
|
||||||
|
|
||||||
|
```
|
||||||
|
openmct.composition.addProvider({
|
||||||
|
appliesTo: function (domainObject) {
|
||||||
|
return domainObject.type === 'my-type';
|
||||||
|
},
|
||||||
|
load: function (domainObject) {
|
||||||
|
return Promise.resolve(myDomainObjects);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Adding Telemetry Providers
|
||||||
|
|
||||||
|
When connecting to a new telemetry source, you will want to register a new
|
||||||
|
[telemetry provider]{@link module:openmct.TelemetryAPI~TelemetryProvider}
|
||||||
|
with the [telemetry API]{@link module:openmct.TelemetryAPI#addProvider}:
|
||||||
|
|
||||||
|
```
|
||||||
|
openmct.telemetry.addProvider({
|
||||||
|
canProvideTelemetry: function (domainObject) {
|
||||||
|
return domainObject.type === 'my-type';
|
||||||
|
},
|
||||||
|
properties: function (domainObject) {
|
||||||
|
return [
|
||||||
|
{ key: 'value', name: "Temperature", units: "degC" },
|
||||||
|
{ key: 'time', name: "UTC" }
|
||||||
|
];
|
||||||
|
},
|
||||||
|
request: function (domainObject, options) {
|
||||||
|
var telemetryId = domainObject.myTelemetryId;
|
||||||
|
return myAdapter.request(telemetryId, options.start, options.end);
|
||||||
|
},
|
||||||
|
subscribe: function (domainObject, callback) {
|
||||||
|
var telemetryId = domainObject.myTelemetryId;
|
||||||
|
myAdapter.subscribe(telemetryId, callback);
|
||||||
|
return myAdapter.unsubscribe.bind(myAdapter, telemetryId, callback);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
The implementations for `request` and `subscribe` can vary depending on the
|
||||||
|
nature of the endpoint which will provide telemetry. In the example above,
|
||||||
|
it is assumed that `myAdapter` contains the specific implementations
|
||||||
|
(HTTP requests, WebSocket connections, etc.) associated with some telemetry
|
||||||
|
source.
|
||||||
|
|
||||||
|
## Using Open MCT
|
||||||
|
|
||||||
|
When implementing new features, it is useful and sometimes necessary to
|
||||||
|
utilize functionality exposed by Open MCT.
|
||||||
|
|
||||||
|
### Retrieving Composition
|
||||||
|
|
||||||
|
To limit which objects are loaded at any given time, the composition of
|
||||||
|
a domain object must be requested asynchronously:
|
||||||
|
|
||||||
|
```
|
||||||
|
openmct.composition(myObject).load().then(function (childObjects) {
|
||||||
|
childObjects.forEach(doSomething);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Support Common Gestures
|
||||||
|
|
||||||
|
Custom views may also want to support common gestures using the
|
||||||
|
[gesture API]{@link module:openmct.GestureAPI}. For instance, to make
|
||||||
|
a view (or part of a view) selectable:
|
||||||
|
|
||||||
|
```
|
||||||
|
openmct.gestures.selectable(myHtmlElement, myDomainObject);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Working with Domain Objects
|
||||||
|
|
||||||
|
The [object API]{@link module:openmct.ObjectAPI} provides useful methods
|
||||||
|
for working with domain objects.
|
||||||
|
|
||||||
|
To make changes to a domain object, use the
|
||||||
|
[`mutate`]{@link module:openmct.ObjectAPI#mutate} method:
|
||||||
|
|
||||||
|
```
|
||||||
|
openmct.objects.mutate(myDomainObject, "name", "New name!");
|
||||||
|
```
|
||||||
|
|
||||||
|
Making modifications in this fashion allows other usages of the domain
|
||||||
|
object to remain up to date using the
|
||||||
|
[`observe`]{@link module:openmct.ObjectAPI#observe} method:
|
||||||
|
|
||||||
|
```
|
||||||
|
openmct.objects.observe(myDomainObject, "name", function (newName) {
|
||||||
|
myLabel.textContent = newName;
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using Telemetry
|
||||||
|
|
||||||
|
Very often in Open MCT, you wish to work with telemetry data (for instance,
|
||||||
|
to display it in a custom visualization.)
|
||||||
|
|
||||||
|
|
||||||
|
### Synchronizing with the Time Conductor
|
||||||
|
|
||||||
|
Views which wish to remain synchronized with the state of Open MCT's
|
||||||
|
time conductor should utilize
|
||||||
|
[`openmct.conductor`]{@link module:openmct.TimeConductor}:
|
||||||
|
|
||||||
|
```
|
||||||
|
openmct.conductor.on('bounds', function (newBounds) {
|
||||||
|
requestTelemetry(newBounds.start, newBounds.end).then(displayTelemetry);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Plugins
|
||||||
|
|
||||||
|
While you can register new features with Open MCT directly, it is generally
|
||||||
|
more useful to package these as a plugin. A plugin is a function that takes
|
||||||
|
[`openmct`]{@link module:openmct} as an argument, and performs configuration
|
||||||
|
upon `openmct` when invoked.
|
||||||
|
|
||||||
|
### Installing Plugins
|
||||||
|
|
||||||
|
To install plugins, use the [`install`]{@link module:openmct.MCT#install}
|
||||||
|
method:
|
||||||
|
|
||||||
|
```
|
||||||
|
openmct.install(myPlugin);
|
||||||
|
```
|
||||||
|
|
||||||
|
The plugin will be invoked to configure Open MCT before it is started.
|
||||||
|
|
||||||
|
### Writing Plugins
|
||||||
|
|
||||||
|
Plugins configure Open MCT, and should utilize the
|
||||||
|
[`openmct`]{@link module:openmct} module to do so, as summarized above in
|
||||||
|
"Configuring Open MCT" and "Using Open MCT" above.
|
||||||
|
|
||||||
|
### Distributing Plugins
|
||||||
|
|
||||||
|
Hosting or downloading plugins is outside of the scope of this documentation.
|
||||||
|
We recommend distributing plugins as UMD modules which export a single
|
||||||
|
function.
|
||||||
|
|
129
LICENSES.md
129
LICENSES.md
@ -560,3 +560,132 @@ The above copyright notice and this permission notice shall be included in all c
|
|||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Almond
|
||||||
|
|
||||||
|
* Link: https://github.com/requirejs/almond
|
||||||
|
|
||||||
|
* Version: 0.3.3
|
||||||
|
|
||||||
|
* Author: jQuery Foundation
|
||||||
|
|
||||||
|
* Description: Lightweight RequireJS replacement for builds
|
||||||
|
|
||||||
|
#### License
|
||||||
|
|
||||||
|
Copyright jQuery Foundation and other contributors, https://jquery.org/
|
||||||
|
|
||||||
|
This software consists of voluntary contributions made by many
|
||||||
|
individuals. For exact contribution history, see the revision history
|
||||||
|
available at https://github.com/requirejs/almond
|
||||||
|
|
||||||
|
The following license applies to all parts of this software except as
|
||||||
|
documented below:
|
||||||
|
|
||||||
|
====
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
====
|
||||||
|
|
||||||
|
Copyright and related rights for sample code are waived via CC0. Sample
|
||||||
|
code is defined as all source code displayed within the prose of the
|
||||||
|
documentation.
|
||||||
|
|
||||||
|
CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
||||||
|
|
||||||
|
====
|
||||||
|
|
||||||
|
Files located in the node_modules directory, and certain utilities used
|
||||||
|
to build or test the software in the test and dist directories, are
|
||||||
|
externally maintained libraries used by this software which have their own
|
||||||
|
licenses; we recommend you read them, as their terms may differ from the
|
||||||
|
terms above.
|
||||||
|
|
||||||
|
|
||||||
|
### Lodash
|
||||||
|
|
||||||
|
* Link: https://lodash.com
|
||||||
|
|
||||||
|
* Version: 3.10.1
|
||||||
|
|
||||||
|
* Author: Dojo Foundation
|
||||||
|
|
||||||
|
* Description: Utility functions
|
||||||
|
|
||||||
|
#### License
|
||||||
|
|
||||||
|
Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||||
|
Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas,
|
||||||
|
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
### EventEmitter3
|
||||||
|
|
||||||
|
* Link: https://github.com/primus/eventemitter3
|
||||||
|
|
||||||
|
* Version: 1.2.0
|
||||||
|
|
||||||
|
* Author: Arnout Kazemier
|
||||||
|
|
||||||
|
* Description: Event-driven programming support
|
||||||
|
|
||||||
|
#### License
|
||||||
|
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2014 Arnout Kazemier
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
19
README.md
19
README.md
@ -10,9 +10,24 @@ Try Open MCT now with our [live demo](https://openmct-demo.herokuapp.com/).
|
|||||||
![Demo](https://nasa.github.io/openmct/static/res/images/Open-MCT.Browse.Layout.Mars-Weather-1.jpg)
|
![Demo](https://nasa.github.io/openmct/static/res/images/Open-MCT.Browse.Layout.Mars-Weather-1.jpg)
|
||||||
|
|
||||||
## New API
|
## New API
|
||||||
A new API is currently under development that will deprecate a lot of the documentation currently in the docs directory, however Open MCT will remain compatible with the currently documented API. An updated set of tutorials is being developed with the new API, and progress on this task can be followed in the [associated pull request](https://github.com/nasa/openmct/pull/999). Any code in this branch should be considered experimental, and we welcome any feedback.
|
|
||||||
|
|
||||||
Differences between the two APIs include a move away from a declarative system of JSON configuration files towards an imperative system based on function calls. Developers will be able to extend and build on Open MCT by making direct function calls to a public API. Open MCT is also being refactored to minimize the dependencies that using Open MCT imposes on developers, such as the current requirement to use Angular JS.
|
A simpler, [easier-to-use API](https://nasa.github.io/openmct/docs/api/)
|
||||||
|
has been added to Open MCT. Changes in this
|
||||||
|
API include a move away from a declarative system of JSON configuration files
|
||||||
|
towards an imperative system based on function calls. Developers will be able
|
||||||
|
to extend and build on Open MCT by making direct function calls to a public
|
||||||
|
API. Open MCT is also being refactored to minimize the dependencies that using
|
||||||
|
Open MCT imposes on developers, such as the current requirement to use
|
||||||
|
AngularJS.
|
||||||
|
|
||||||
|
This new API has not yet been heavily used and is likely to contain defects.
|
||||||
|
You can help by trying it out, and reporting any issues you encounter
|
||||||
|
using our GitHub issue tracker. Such issues may include bugs, suggestions,
|
||||||
|
missing documentation, or even just requests for help if you're having
|
||||||
|
trouble.
|
||||||
|
|
||||||
|
We want Open MCT to be as easy to use, install, run, and develop for as
|
||||||
|
possible, and your feedback will help us get there!
|
||||||
|
|
||||||
## Building and Running Open MCT Locally
|
## Building and Running Open MCT Locally
|
||||||
|
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
"comma-separated-values": "^3.6.4",
|
"comma-separated-values": "^3.6.4",
|
||||||
"FileSaver.js": "^0.0.2",
|
"FileSaver.js": "^0.0.2",
|
||||||
"zepto": "^1.1.6",
|
"zepto": "^1.1.6",
|
||||||
|
"eventemitter3": "^1.2.0",
|
||||||
|
"lodash": "3.10.1",
|
||||||
|
"almond": "~0.3.2",
|
||||||
"html2canvas": "^0.4.1"
|
"html2canvas": "^0.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,26 +9,30 @@
|
|||||||
|
|
||||||
Open MCT provides functionality out of the box, but it's also a platform for
|
Open MCT provides functionality out of the box, but it's also a platform for
|
||||||
building rich mission operations applications based on modern web technology.
|
building rich mission operations applications based on modern web technology.
|
||||||
The platform is configured declaratively, and defines conventions for
|
The platform is configured by plugins which extend the platform at a variety
|
||||||
building on the provided capabilities by creating modular 'bundles' that
|
of extension points. The details of how to
|
||||||
extend the platform at a variety of extension points. The details of how to
|
|
||||||
extend the platform are provided in the following documentation.
|
extend the platform are provided in the following documentation.
|
||||||
|
|
||||||
## Sections
|
## Sections
|
||||||
|
|
||||||
* The [Architecture Overview](architecture/) describes the concepts used
|
|
||||||
throughout Open MCT, and gives a high level overview of the platform's design.
|
|
||||||
|
|
||||||
* The [Developer's Guide](guide/) goes into more detail about how to use the
|
|
||||||
platform and the functionality that it provides.
|
|
||||||
|
|
||||||
* The [Tutorials](tutorials/) give examples of extending the platform to add
|
|
||||||
functionality,
|
|
||||||
and integrate with data sources.
|
|
||||||
|
|
||||||
* The [API](api/) document is generated from inline documentation
|
* The [API](api/) document is generated from inline documentation
|
||||||
using [JSDoc](http://usejsdoc.org/), and describes the JavaScript objects and
|
using [JSDoc](http://usejsdoc.org/), and describes the JavaScript objects and
|
||||||
functions that make up the software platform.
|
functions that make up the software platform.
|
||||||
|
|
||||||
* Finally, the [Development Process](process/) document describes the
|
* The [Development Process](process/) document describes the
|
||||||
Open MCT software development cycle.
|
Open MCT software development cycle.
|
||||||
|
|
||||||
|
## Legacy Documentation
|
||||||
|
|
||||||
|
As we transition to a new API, the following documentation for the old API
|
||||||
|
(which is supported during the transtion) may be useful as well:
|
||||||
|
|
||||||
|
* The [Architecture Overview](architecture/) describes the concepts used
|
||||||
|
throughout Open MCT, and gives a high level overview of the platform's design.
|
||||||
|
|
||||||
|
* The [Developer's Guide](guide/) goes into more detail about how to use the
|
||||||
|
platform and the functionality that it provides.
|
||||||
|
|
||||||
|
* The [Tutorials](tutorials/) give examples of extending the platform to add
|
||||||
|
functionality,
|
||||||
|
and integrate with data sources.
|
||||||
|
@ -36,7 +36,7 @@ define([
|
|||||||
legacyRegistry
|
legacyRegistry
|
||||||
) {
|
) {
|
||||||
"use strict";
|
"use strict";
|
||||||
legacyRegistry.register("example/notifications", {
|
legacyRegistry.register("example/msl-adapter", {
|
||||||
"name" : "Mars Science Laboratory Data Adapter",
|
"name" : "Mars Science Laboratory Data Adapter",
|
||||||
"extensions" : {
|
"extensions" : {
|
||||||
"types": [
|
"types": [
|
||||||
|
57
gulpfile.js
57
gulpfile.js
@ -21,41 +21,34 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/*global require,__dirname*/
|
/*global require,__dirname*/
|
||||||
|
|
||||||
var gulp = require('gulp'),
|
var gulp = require('gulp'),
|
||||||
requirejsOptimize = require('gulp-requirejs-optimize'),
|
|
||||||
sourcemaps = require('gulp-sourcemaps'),
|
sourcemaps = require('gulp-sourcemaps'),
|
||||||
rename = require('gulp-rename'),
|
|
||||||
sass = require('gulp-sass'),
|
|
||||||
bourbon = require('node-bourbon'),
|
|
||||||
jshint = require('gulp-jshint'),
|
|
||||||
jscs = require('gulp-jscs'),
|
|
||||||
replace = require('gulp-replace-task'),
|
|
||||||
karma = require('karma'),
|
|
||||||
path = require('path'),
|
path = require('path'),
|
||||||
fs = require('fs'),
|
fs = require('fs'),
|
||||||
git = require('git-rev-sync'),
|
git = require('git-rev-sync'),
|
||||||
moment = require('moment'),
|
moment = require('moment'),
|
||||||
merge = require('merge-stream'),
|
|
||||||
project = require('./package.json'),
|
project = require('./package.json'),
|
||||||
_ = require('lodash'),
|
_ = require('lodash'),
|
||||||
paths = {
|
paths = {
|
||||||
main: 'main.js',
|
main: 'openmct.js',
|
||||||
dist: 'dist',
|
dist: 'dist',
|
||||||
assets: 'dist/assets',
|
|
||||||
reports: 'dist/reports',
|
reports: 'dist/reports',
|
||||||
scss: ['./platform/**/*.scss', './example/**/*.scss'],
|
scss: ['./platform/**/*.scss', './example/**/*.scss'],
|
||||||
scripts: [ 'main.js', 'platform/**/*.js', 'src/**/*.js' ],
|
assets: [
|
||||||
|
'./{example,platform}/**/*.{css,css.map,png,svg,ico,woff,eot,ttf}'
|
||||||
|
],
|
||||||
|
scripts: [ 'openmct.js', 'platform/**/*.js', 'src/**/*.js' ],
|
||||||
specs: [ 'platform/**/*Spec.js', 'src/**/*Spec.js' ],
|
specs: [ 'platform/**/*Spec.js', 'src/**/*Spec.js' ],
|
||||||
static: [
|
|
||||||
'index.html',
|
|
||||||
'platform/**/*',
|
|
||||||
'example/**/*',
|
|
||||||
'bower_components/**/*'
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
options = {
|
options = {
|
||||||
requirejsOptimize: {
|
requirejsOptimize: {
|
||||||
name: paths.main.replace(/\.js$/, ''),
|
name: 'bower_components/almond/almond.js',
|
||||||
|
include: paths.main.replace('.js', ''),
|
||||||
|
wrap: {
|
||||||
|
startFile: "src/start.frag",
|
||||||
|
endFile: "src/end.frag"
|
||||||
|
},
|
||||||
mainConfigFile: paths.main,
|
mainConfigFile: paths.main,
|
||||||
wrapShim: true
|
wrapShim: true
|
||||||
},
|
},
|
||||||
@ -64,7 +57,6 @@ var gulp = require('gulp'),
|
|||||||
singleRun: true
|
singleRun: true
|
||||||
},
|
},
|
||||||
sass: {
|
sass: {
|
||||||
includePaths: bourbon.includePaths,
|
|
||||||
sourceComments: true
|
sourceComments: true
|
||||||
},
|
},
|
||||||
replace: {
|
replace: {
|
||||||
@ -78,6 +70,8 @@ var gulp = require('gulp'),
|
|||||||
};
|
};
|
||||||
|
|
||||||
gulp.task('scripts', function () {
|
gulp.task('scripts', function () {
|
||||||
|
var requirejsOptimize = require('gulp-requirejs-optimize');
|
||||||
|
var replace = require('gulp-replace-task');
|
||||||
return gulp.src(paths.main)
|
return gulp.src(paths.main)
|
||||||
.pipe(sourcemaps.init())
|
.pipe(sourcemaps.init())
|
||||||
.pipe(requirejsOptimize(options.requirejsOptimize))
|
.pipe(requirejsOptimize(options.requirejsOptimize))
|
||||||
@ -87,10 +81,16 @@ gulp.task('scripts', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('test', function (done) {
|
gulp.task('test', function (done) {
|
||||||
|
var karma = require('karma');
|
||||||
new karma.Server(options.karma, done).start();
|
new karma.Server(options.karma, done).start();
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('stylesheets', function () {
|
gulp.task('stylesheets', function () {
|
||||||
|
var sass = require('gulp-sass');
|
||||||
|
var rename = require('gulp-rename');
|
||||||
|
var bourbon = require('node-bourbon');
|
||||||
|
options.sass.includePaths = bourbon.includePaths;
|
||||||
|
|
||||||
return gulp.src(paths.scss, {base: '.'})
|
return gulp.src(paths.scss, {base: '.'})
|
||||||
.pipe(sourcemaps.init())
|
.pipe(sourcemaps.init())
|
||||||
.pipe(sass(options.sass).on('error', sass.logError))
|
.pipe(sass(options.sass).on('error', sass.logError))
|
||||||
@ -104,6 +104,9 @@ gulp.task('stylesheets', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('lint', function () {
|
gulp.task('lint', function () {
|
||||||
|
var jshint = require('gulp-jshint');
|
||||||
|
var merge = require('merge-stream');
|
||||||
|
|
||||||
var nonspecs = paths.specs.map(function (glob) {
|
var nonspecs = paths.specs.map(function (glob) {
|
||||||
return "!" + glob;
|
return "!" + glob;
|
||||||
}),
|
}),
|
||||||
@ -122,6 +125,8 @@ gulp.task('lint', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('checkstyle', function () {
|
gulp.task('checkstyle', function () {
|
||||||
|
var jscs = require('gulp-jscs');
|
||||||
|
|
||||||
return gulp.src(paths.scripts)
|
return gulp.src(paths.scripts)
|
||||||
.pipe(jscs())
|
.pipe(jscs())
|
||||||
.pipe(jscs.reporter())
|
.pipe(jscs.reporter())
|
||||||
@ -129,18 +134,20 @@ gulp.task('checkstyle', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('fixstyle', function () {
|
gulp.task('fixstyle', function () {
|
||||||
|
var jscs = require('gulp-jscs');
|
||||||
|
|
||||||
return gulp.src(paths.scripts, { base: '.' })
|
return gulp.src(paths.scripts, { base: '.' })
|
||||||
.pipe(jscs({ fix: true }))
|
.pipe(jscs({ fix: true }))
|
||||||
.pipe(gulp.dest('.'));
|
.pipe(gulp.dest('.'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('static', ['stylesheets'], function () {
|
gulp.task('assets', ['stylesheets'], function () {
|
||||||
return gulp.src(paths.static, { base: '.' })
|
return gulp.src(paths.assets)
|
||||||
.pipe(gulp.dest(paths.dist));
|
.pipe(gulp.dest(paths.dist));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('watch', function () {
|
gulp.task('watch', function () {
|
||||||
gulp.watch(paths.scss, ['stylesheets']);
|
return gulp.watch(paths.scss, ['stylesheets', 'assets']);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('serve', function () {
|
gulp.task('serve', function () {
|
||||||
@ -148,9 +155,9 @@ gulp.task('serve', function () {
|
|||||||
var app = require('./app.js');
|
var app = require('./app.js');
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('develop', ['serve', 'stylesheets', 'watch']);
|
gulp.task('develop', ['serve', 'install', 'watch']);
|
||||||
|
|
||||||
gulp.task('install', [ 'static', 'scripts' ]);
|
gulp.task('install', [ 'assets', 'scripts' ]);
|
||||||
|
|
||||||
gulp.task('verify', [ 'lint', 'test', 'checkstyle' ]);
|
gulp.task('verify', [ 'lint', 'test', 'checkstyle' ]);
|
||||||
|
|
||||||
|
@ -28,12 +28,12 @@
|
|||||||
<script src="bower_components/requirejs/require.js">
|
<script src="bower_components/requirejs/require.js">
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
require(['main'], function (mct) {
|
require(['openmct'], function (openmct) {
|
||||||
require([
|
require([
|
||||||
'./example/imagery/bundle',
|
'./example/imagery/bundle',
|
||||||
'./example/eventGenerator/bundle',
|
'./example/eventGenerator/bundle',
|
||||||
'./example/generator/bundle'
|
'./example/generator/bundle'
|
||||||
], mct.run.bind(mct));
|
], openmct.start.bind(openmct));
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<link rel="stylesheet" href="platform/commonUI/general/res/css/startup-base.css">
|
<link rel="stylesheet" href="platform/commonUI/general/res/css/startup-base.css">
|
||||||
@ -47,7 +47,5 @@
|
|||||||
<div class="l-splash-holder s-splash-holder">
|
<div class="l-splash-holder s-splash-holder">
|
||||||
<div class="l-splash s-splash"></div>
|
<div class="l-splash s-splash"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-view></div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"source": {
|
"source": {
|
||||||
"include": [
|
"include": [
|
||||||
"platform/"
|
"src/"
|
||||||
],
|
],
|
||||||
"includePattern": "platform/.+\\.js$",
|
"includePattern": "src/.+\\.js$",
|
||||||
"excludePattern": ".+\\Spec\\.js$|lib/.+"
|
"excludePattern": ".+\\Spec\\.js$|lib/.+"
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": [
|
||||||
|
@ -37,9 +37,11 @@ module.exports = function(config) {
|
|||||||
{pattern: 'bower_components/**/*.js', included: false},
|
{pattern: 'bower_components/**/*.js', included: false},
|
||||||
{pattern: 'src/**/*.js', included: false},
|
{pattern: 'src/**/*.js', included: false},
|
||||||
{pattern: 'example/**/*.js', included: false},
|
{pattern: 'example/**/*.js', included: false},
|
||||||
|
{pattern: 'example/**/*.json', included: false},
|
||||||
{pattern: 'platform/**/*.js', included: false},
|
{pattern: 'platform/**/*.js', included: false},
|
||||||
{pattern: 'warp/**/*.js', included: false},
|
{pattern: 'warp/**/*.js', included: false},
|
||||||
{pattern: 'platform/**/*.html', included: false},
|
{pattern: 'platform/**/*.html', included: false},
|
||||||
|
{pattern: 'src/**/*.html', included: false},
|
||||||
'test-main.js'
|
'test-main.js'
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ requirejs.config({
|
|||||||
"angular": "bower_components/angular/angular.min",
|
"angular": "bower_components/angular/angular.min",
|
||||||
"angular-route": "bower_components/angular-route/angular-route.min",
|
"angular-route": "bower_components/angular-route/angular-route.min",
|
||||||
"csv": "bower_components/comma-separated-values/csv.min",
|
"csv": "bower_components/comma-separated-values/csv.min",
|
||||||
|
"EventEmitter": "bower_components/eventemitter3/index",
|
||||||
"es6-promise": "bower_components/es6-promise/es6-promise.min",
|
"es6-promise": "bower_components/es6-promise/es6-promise.min",
|
||||||
"html2canvas": "bower_components/html2canvas/build/html2canvas.min",
|
"html2canvas": "bower_components/html2canvas/build/html2canvas.min",
|
||||||
"moment": "bower_components/moment/moment",
|
"moment": "bower_components/moment/moment",
|
||||||
@ -35,7 +36,8 @@ requirejs.config({
|
|||||||
"screenfull": "bower_components/screenfull/dist/screenfull.min",
|
"screenfull": "bower_components/screenfull/dist/screenfull.min",
|
||||||
"text": "bower_components/text/text",
|
"text": "bower_components/text/text",
|
||||||
"uuid": "bower_components/node-uuid/uuid",
|
"uuid": "bower_components/node-uuid/uuid",
|
||||||
"zepto": "bower_components/zepto/zepto.min"
|
"zepto": "bower_components/zepto/zepto.min",
|
||||||
|
"lodash": "bower_components/lodash/lodash"
|
||||||
},
|
},
|
||||||
"shim": {
|
"shim": {
|
||||||
"angular": {
|
"angular": {
|
||||||
@ -44,6 +46,9 @@ requirejs.config({
|
|||||||
"angular-route": {
|
"angular-route": {
|
||||||
"deps": ["angular"]
|
"deps": ["angular"]
|
||||||
},
|
},
|
||||||
|
"EventEmitter": {
|
||||||
|
"exports": "EventEmitter"
|
||||||
|
},
|
||||||
"html2canvas": {
|
"html2canvas": {
|
||||||
"exports": "html2canvas"
|
"exports": "html2canvas"
|
||||||
},
|
},
|
||||||
@ -55,54 +60,25 @@ requirejs.config({
|
|||||||
},
|
},
|
||||||
"zepto": {
|
"zepto": {
|
||||||
"exports": "Zepto"
|
"exports": "Zepto"
|
||||||
|
},
|
||||||
|
"lodash": {
|
||||||
|
"exports": "lodash"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
define([
|
define([
|
||||||
'./platform/framework/src/Main',
|
'./platform/framework/src/Main',
|
||||||
'legacyRegistry',
|
'./src/defaultRegistry',
|
||||||
|
'./src/MCT'
|
||||||
|
], function (Main, defaultRegistry, MCT) {
|
||||||
|
var openmct = new MCT();
|
||||||
|
|
||||||
'./platform/framework/bundle',
|
openmct.legacyRegistry = defaultRegistry;
|
||||||
'./platform/core/bundle',
|
|
||||||
'./platform/representation/bundle',
|
openmct.on('start', function () {
|
||||||
'./platform/commonUI/about/bundle',
|
return new Main().run(defaultRegistry);
|
||||||
'./platform/commonUI/browse/bundle',
|
});
|
||||||
'./platform/commonUI/edit/bundle',
|
|
||||||
'./platform/commonUI/dialog/bundle',
|
return openmct;
|
||||||
'./platform/commonUI/formats/bundle',
|
|
||||||
'./platform/commonUI/general/bundle',
|
|
||||||
'./platform/commonUI/inspect/bundle',
|
|
||||||
'./platform/commonUI/mobile/bundle',
|
|
||||||
'./platform/commonUI/themes/espresso/bundle',
|
|
||||||
'./platform/commonUI/notification/bundle',
|
|
||||||
'./platform/containment/bundle',
|
|
||||||
'./platform/execution/bundle',
|
|
||||||
'./platform/exporters/bundle',
|
|
||||||
'./platform/telemetry/bundle',
|
|
||||||
'./platform/features/clock/bundle',
|
|
||||||
'./platform/features/fixed/bundle',
|
|
||||||
'./platform/features/imagery/bundle',
|
|
||||||
'./platform/features/layout/bundle',
|
|
||||||
'./platform/features/pages/bundle',
|
|
||||||
'./platform/features/plot/bundle',
|
|
||||||
'./platform/features/timeline/bundle',
|
|
||||||
'./platform/features/table/bundle',
|
|
||||||
'./platform/forms/bundle',
|
|
||||||
'./platform/identity/bundle',
|
|
||||||
'./platform/persistence/aggregator/bundle',
|
|
||||||
'./platform/persistence/local/bundle',
|
|
||||||
'./platform/persistence/queue/bundle',
|
|
||||||
'./platform/policy/bundle',
|
|
||||||
'./platform/entanglement/bundle',
|
|
||||||
'./platform/search/bundle',
|
|
||||||
'./platform/status/bundle',
|
|
||||||
'./platform/commonUI/regions/bundle'
|
|
||||||
], function (Main, legacyRegistry) {
|
|
||||||
return {
|
|
||||||
legacyRegistry: legacyRegistry,
|
|
||||||
run: function () {
|
|
||||||
return new Main().run(legacyRegistry);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
});
|
@ -48,7 +48,7 @@
|
|||||||
"test": "karma start --single-run",
|
"test": "karma start --single-run",
|
||||||
"jshint": "jshint platform example",
|
"jshint": "jshint platform example",
|
||||||
"watch": "karma start",
|
"watch": "karma start",
|
||||||
"jsdoc": "jsdoc -c jsdoc.json -r -d target/docs/api",
|
"jsdoc": "jsdoc -c jsdoc.json -R API.md -r -d dist/docs/api",
|
||||||
"otherdoc": "node docs/gendocs.js --in docs/src --out target/docs --suppress-toc 'docs/src/index.md|docs/src/process/index.md'",
|
"otherdoc": "node docs/gendocs.js --in docs/src --out target/docs --suppress-toc 'docs/src/index.md|docs/src/process/index.md'",
|
||||||
"docs": "npm run jsdoc ; npm run otherdoc",
|
"docs": "npm run jsdoc ; npm run otherdoc",
|
||||||
"prepublish": "node ./node_modules/bower/bin/bower install && node ./node_modules/gulp/bin/gulp.js install"
|
"prepublish": "node ./node_modules/bower/bin/bower install && node ./node_modules/gulp/bin/gulp.js install"
|
||||||
|
@ -41,6 +41,7 @@ define([
|
|||||||
"text!./res/templates/items/items.html",
|
"text!./res/templates/items/items.html",
|
||||||
"text!./res/templates/browse/object-properties.html",
|
"text!./res/templates/browse/object-properties.html",
|
||||||
"text!./res/templates/browse/inspector-region.html",
|
"text!./res/templates/browse/inspector-region.html",
|
||||||
|
"text!./res/templates/view-object.html",
|
||||||
'legacyRegistry'
|
'legacyRegistry'
|
||||||
], function (
|
], function (
|
||||||
BrowseController,
|
BrowseController,
|
||||||
@ -63,6 +64,7 @@ define([
|
|||||||
itemsTemplate,
|
itemsTemplate,
|
||||||
objectPropertiesTemplate,
|
objectPropertiesTemplate,
|
||||||
inspectorRegionTemplate,
|
inspectorRegionTemplate,
|
||||||
|
viewObjectTemplate,
|
||||||
legacyRegistry
|
legacyRegistry
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@ -142,7 +144,7 @@ define([
|
|||||||
"representations": [
|
"representations": [
|
||||||
{
|
{
|
||||||
"key": "view-object",
|
"key": "view-object",
|
||||||
"templateUrl": "templates/view-object.html"
|
"template": viewObjectTemplate
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "browse-object",
|
"key": "browse-object",
|
||||||
|
@ -48,6 +48,7 @@ define([
|
|||||||
"./src/directives/MCTSplitPane",
|
"./src/directives/MCTSplitPane",
|
||||||
"./src/directives/MCTSplitter",
|
"./src/directives/MCTSplitter",
|
||||||
"./src/directives/MCTTree",
|
"./src/directives/MCTTree",
|
||||||
|
"./src/filters/ReverseFilter",
|
||||||
"text!./res/templates/bottombar.html",
|
"text!./res/templates/bottombar.html",
|
||||||
"text!./res/templates/controls/action-button.html",
|
"text!./res/templates/controls/action-button.html",
|
||||||
"text!./res/templates/controls/input-filter.html",
|
"text!./res/templates/controls/input-filter.html",
|
||||||
@ -96,6 +97,7 @@ define([
|
|||||||
MCTSplitPane,
|
MCTSplitPane,
|
||||||
MCTSplitter,
|
MCTSplitter,
|
||||||
MCTTree,
|
MCTTree,
|
||||||
|
ReverseFilter,
|
||||||
bottombarTemplate,
|
bottombarTemplate,
|
||||||
actionButtonTemplate,
|
actionButtonTemplate,
|
||||||
inputFilterTemplate,
|
inputFilterTemplate,
|
||||||
@ -146,7 +148,8 @@ define([
|
|||||||
"depends": [
|
"depends": [
|
||||||
"stylesheets[]",
|
"stylesheets[]",
|
||||||
"$document",
|
"$document",
|
||||||
"THEME"
|
"THEME",
|
||||||
|
"ASSETS_PATH"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -158,7 +161,7 @@ define([
|
|||||||
],
|
],
|
||||||
"filters": [
|
"filters": [
|
||||||
{
|
{
|
||||||
"implementation": "filters/ReverseFilter.js",
|
"implementation": ReverseFilter,
|
||||||
"key": "reverse"
|
"key": "reverse"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -405,6 +408,11 @@ define([
|
|||||||
"key": "THEME",
|
"key": "THEME",
|
||||||
"value": "unspecified",
|
"value": "unspecified",
|
||||||
"priority": "fallback"
|
"priority": "fallback"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ASSETS_PATH",
|
||||||
|
"value": ".",
|
||||||
|
"priority": "fallback"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"containers": [
|
"containers": [
|
||||||
|
@ -37,8 +37,10 @@ define(
|
|||||||
* @param {object[]} stylesheets stylesheet extension definitions
|
* @param {object[]} stylesheets stylesheet extension definitions
|
||||||
* @param $document Angular's jqLite-wrapped document element
|
* @param $document Angular's jqLite-wrapped document element
|
||||||
* @param {string} activeTheme the theme in use
|
* @param {string} activeTheme the theme in use
|
||||||
|
* @param {string} [assetPath] the directory relative to which
|
||||||
|
* stylesheets will be found
|
||||||
*/
|
*/
|
||||||
function StyleSheetLoader(stylesheets, $document, activeTheme) {
|
function StyleSheetLoader(stylesheets, $document, activeTheme, assetPath) {
|
||||||
var head = $document.find('head'),
|
var head = $document.find('head'),
|
||||||
document = $document[0];
|
document = $document[0];
|
||||||
|
|
||||||
@ -47,6 +49,7 @@ define(
|
|||||||
// Create a link element, and construct full path
|
// Create a link element, and construct full path
|
||||||
var link = document.createElement('link'),
|
var link = document.createElement('link'),
|
||||||
path = [
|
path = [
|
||||||
|
assetPath,
|
||||||
stylesheet.bundle.path,
|
stylesheet.bundle.path,
|
||||||
stylesheet.bundle.resources,
|
stylesheet.bundle.resources,
|
||||||
stylesheet.stylesheetUrl
|
stylesheet.stylesheetUrl
|
||||||
@ -68,6 +71,8 @@ define(
|
|||||||
stylesheet.theme === activeTheme;
|
stylesheet.theme === activeTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assetPath = assetPath || ".";
|
||||||
|
|
||||||
// Add all stylesheets from extensions
|
// Add all stylesheets from extensions
|
||||||
stylesheets.filter(matchesTheme).forEach(addStyleSheet);
|
stylesheets.filter(matchesTheme).forEach(addStyleSheet);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ define(
|
|||||||
|
|
||||||
it("adjusts link locations", function () {
|
it("adjusts link locations", function () {
|
||||||
expect(mockElement.setAttribute)
|
expect(mockElement.setAttribute)
|
||||||
.toHaveBeenCalledWith('href', "a/b/c/d.css");
|
.toHaveBeenCalledWith('href', "./a/b/c/d.css");
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("for themed stylesheets", function () {
|
describe("for themed stylesheets", function () {
|
||||||
@ -95,12 +95,13 @@ define(
|
|||||||
|
|
||||||
it("includes matching themes", function () {
|
it("includes matching themes", function () {
|
||||||
expect(mockElement.setAttribute)
|
expect(mockElement.setAttribute)
|
||||||
.toHaveBeenCalledWith('href', "a/b/c/themed.css");
|
.toHaveBeenCalledWith('href', "./a/b/c/themed.css");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("excludes mismatching themes", function () {
|
it("excludes mismatching themes", function () {
|
||||||
expect(mockElement.setAttribute)
|
expect(mockElement.setAttribute)
|
||||||
.not.toHaveBeenCalledWith('href', "a/b/c/bad-theme.css");
|
.not
|
||||||
|
.toHaveBeenCalledWith('href', "./a/b/c/bad-theme.css");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -42,11 +42,19 @@ define(
|
|||||||
function addWorker(worker) {
|
function addWorker(worker) {
|
||||||
var key = worker.key;
|
var key = worker.key;
|
||||||
if (!workerUrls[key]) {
|
if (!workerUrls[key]) {
|
||||||
workerUrls[key] = [
|
if (worker.scriptUrl) {
|
||||||
worker.bundle.path,
|
workerUrls[key] = [
|
||||||
worker.bundle.sources,
|
worker.bundle.path,
|
||||||
worker.scriptUrl
|
worker.bundle.sources,
|
||||||
].join("/");
|
worker.scriptUrl
|
||||||
|
].join("/");
|
||||||
|
} else if (worker.scriptText) {
|
||||||
|
var blob = new Blob(
|
||||||
|
[worker.scriptText],
|
||||||
|
{type: 'application/javascript'}
|
||||||
|
);
|
||||||
|
workerUrls[key] = URL.createObjectURL(blob);
|
||||||
|
}
|
||||||
sharedWorkers[key] = worker.shared;
|
sharedWorkers[key] = worker.shared;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,9 @@ define([
|
|||||||
"./src/controllers/TableOptionsController",
|
"./src/controllers/TableOptionsController",
|
||||||
'../../commonUI/regions/src/Region',
|
'../../commonUI/regions/src/Region',
|
||||||
'../../commonUI/browse/src/InspectorRegion',
|
'../../commonUI/browse/src/InspectorRegion',
|
||||||
|
"text!./res/templates/table-options-edit.html",
|
||||||
|
"text!./res/templates/rt-table.html",
|
||||||
|
"text!./res/templates/historical-table.html",
|
||||||
"legacyRegistry"
|
"legacyRegistry"
|
||||||
], function (
|
], function (
|
||||||
MCTTable,
|
MCTTable,
|
||||||
@ -35,6 +38,9 @@ define([
|
|||||||
TableOptionsController,
|
TableOptionsController,
|
||||||
Region,
|
Region,
|
||||||
InspectorRegion,
|
InspectorRegion,
|
||||||
|
tableOptionsEditTemplate,
|
||||||
|
rtTableTemplate,
|
||||||
|
historicalTableTemplate,
|
||||||
legacyRegistry
|
legacyRegistry
|
||||||
) {
|
) {
|
||||||
/**
|
/**
|
||||||
@ -127,8 +133,8 @@ define([
|
|||||||
{
|
{
|
||||||
"name": "Historical Table",
|
"name": "Historical Table",
|
||||||
"key": "table",
|
"key": "table",
|
||||||
|
"template": historicalTableTemplate,
|
||||||
"cssclass": "icon-tabular",
|
"cssclass": "icon-tabular",
|
||||||
"templateUrl": "templates/historical-table.html",
|
|
||||||
"needs": [
|
"needs": [
|
||||||
"telemetry"
|
"telemetry"
|
||||||
],
|
],
|
||||||
@ -139,7 +145,7 @@ define([
|
|||||||
"name": "Real-time Table",
|
"name": "Real-time Table",
|
||||||
"key": "rt-table",
|
"key": "rt-table",
|
||||||
"cssclass": "icon-tabular-realtime",
|
"cssclass": "icon-tabular-realtime",
|
||||||
"templateUrl": "templates/rt-table.html",
|
"template": rtTableTemplate,
|
||||||
"needs": [
|
"needs": [
|
||||||
"telemetry"
|
"telemetry"
|
||||||
],
|
],
|
||||||
@ -157,7 +163,7 @@ define([
|
|||||||
"representations": [
|
"representations": [
|
||||||
{
|
{
|
||||||
"key": "table-options-edit",
|
"key": "table-options-edit",
|
||||||
"templateUrl": "templates/table-options-edit.html"
|
"template": tableOptionsEditTemplate
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stylesheets": [
|
"stylesheets": [
|
||||||
|
@ -72,7 +72,7 @@ define(
|
|||||||
|
|
||||||
// Assemble all gestures into a map, for easy look up
|
// Assemble all gestures into a map, for easy look up
|
||||||
gestures.forEach(function (gesture) {
|
gestures.forEach(function (gesture) {
|
||||||
gestureMap[gesture.key] = gesture;
|
gestureMap[gesture.key] = gestureMap[gesture.key] || gesture;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.gestureMap = gestureMap;
|
this.gestureMap = gestureMap;
|
||||||
|
@ -28,6 +28,7 @@ define([
|
|||||||
"text!./res/templates/search-item.html",
|
"text!./res/templates/search-item.html",
|
||||||
"text!./res/templates/search.html",
|
"text!./res/templates/search.html",
|
||||||
"text!./res/templates/search-menu.html",
|
"text!./res/templates/search-menu.html",
|
||||||
|
"text!./src/services/GenericSearchWorker.js",
|
||||||
'legacyRegistry'
|
'legacyRegistry'
|
||||||
], function (
|
], function (
|
||||||
SearchController,
|
SearchController,
|
||||||
@ -37,6 +38,7 @@ define([
|
|||||||
searchItemTemplate,
|
searchItemTemplate,
|
||||||
searchTemplate,
|
searchTemplate,
|
||||||
searchMenuTemplate,
|
searchMenuTemplate,
|
||||||
|
searchWorkerText,
|
||||||
legacyRegistry
|
legacyRegistry
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@ -114,7 +116,7 @@ define([
|
|||||||
"workers": [
|
"workers": [
|
||||||
{
|
{
|
||||||
"key": "genericSearchWorker",
|
"key": "genericSearchWorker",
|
||||||
"scriptUrl": "services/GenericSearchWorker.js"
|
"scriptText": searchWorkerText
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -24,10 +24,28 @@ define(function () {
|
|||||||
|
|
||||||
function BundleRegistry() {
|
function BundleRegistry() {
|
||||||
this.bundles = {};
|
this.bundles = {};
|
||||||
|
this.knownBundles = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
BundleRegistry.prototype.register = function (path, definition) {
|
BundleRegistry.prototype.register = function (path, definition) {
|
||||||
this.bundles[path] = definition;
|
if (this.knownBundles.hasOwnProperty(path)) {
|
||||||
|
throw new Error('Cannot register bundle with duplicate path', path);
|
||||||
|
}
|
||||||
|
this.knownBundles[path] = definition;
|
||||||
|
};
|
||||||
|
|
||||||
|
BundleRegistry.prototype.enable = function (path) {
|
||||||
|
if (!this.knownBundles[path]) {
|
||||||
|
throw new Error('Unknown bundle ' + path);
|
||||||
|
}
|
||||||
|
this.bundles[path] = this.knownBundles[path];
|
||||||
|
};
|
||||||
|
|
||||||
|
BundleRegistry.prototype.disable = function (path) {
|
||||||
|
if (!this.bundles[path]) {
|
||||||
|
throw new Error('Tried to disable inactive bundle ' + path);
|
||||||
|
}
|
||||||
|
delete this.bundles[path];
|
||||||
};
|
};
|
||||||
|
|
||||||
BundleRegistry.prototype.contains = function (path) {
|
BundleRegistry.prototype.contains = function (path) {
|
||||||
@ -42,8 +60,14 @@ define(function () {
|
|||||||
return Object.keys(this.bundles);
|
return Object.keys(this.bundles);
|
||||||
};
|
};
|
||||||
|
|
||||||
BundleRegistry.prototype.remove = function (path) {
|
BundleRegistry.prototype.remove = BundleRegistry.prototype.disable;
|
||||||
|
|
||||||
|
BundleRegistry.prototype.delete = function (path) {
|
||||||
|
if (!this.knownBundles[path]) {
|
||||||
|
throw new Error('Cannot remove Unknown Bundle ' + path);
|
||||||
|
}
|
||||||
delete this.bundles[path];
|
delete this.bundles[path];
|
||||||
|
delete this.knownBundles[path];
|
||||||
};
|
};
|
||||||
|
|
||||||
return BundleRegistry;
|
return BundleRegistry;
|
||||||
|
@ -51,6 +51,7 @@ define(['./BundleRegistry'], function (BundleRegistry) {
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
testBundleDef = { someKey: "some value" };
|
testBundleDef = { someKey: "some value" };
|
||||||
bundleRegistry.register(testPath, testBundleDef);
|
bundleRegistry.register(testPath, testBundleDef);
|
||||||
|
bundleRegistry.enable(testPath);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("lists registered bundles", function () {
|
it("lists registered bundles", function () {
|
||||||
|
264
src/MCT.js
Normal file
264
src/MCT.js
Normal file
@ -0,0 +1,264 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'EventEmitter',
|
||||||
|
'legacyRegistry',
|
||||||
|
'uuid',
|
||||||
|
'./api/api',
|
||||||
|
'text!./adapter/templates/edit-object-replacement.html',
|
||||||
|
'./selection/Selection',
|
||||||
|
'./api/objects/object-utils',
|
||||||
|
'./ui/ViewRegistry'
|
||||||
|
], function (
|
||||||
|
EventEmitter,
|
||||||
|
legacyRegistry,
|
||||||
|
uuid,
|
||||||
|
api,
|
||||||
|
editObjectTemplate,
|
||||||
|
Selection,
|
||||||
|
objectUtils,
|
||||||
|
ViewRegistry
|
||||||
|
) {
|
||||||
|
/**
|
||||||
|
* Open MCT is an extensible web application for building mission
|
||||||
|
* control user interfaces. This module is itself an instance of
|
||||||
|
* [MCT]{@link module:openmct.MCT}, which provides an interface for
|
||||||
|
* configuring and executing the application.
|
||||||
|
*
|
||||||
|
* @exports openmct
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Open MCT application. This may be configured by installing plugins
|
||||||
|
* or registering extensions before the application is started.
|
||||||
|
* @class MCT
|
||||||
|
* @memberof module:openmct
|
||||||
|
* @augments {EventEmitter}
|
||||||
|
*/
|
||||||
|
function MCT() {
|
||||||
|
EventEmitter.call(this);
|
||||||
|
this.legacyBundle = { extensions: {
|
||||||
|
services: [
|
||||||
|
{
|
||||||
|
key: "openmct",
|
||||||
|
implementation: function () {
|
||||||
|
return this;
|
||||||
|
}.bind(this)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
} };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tracks current selection state of the application.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this.selection = new Selection();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MCT's time conductor, which may be used to synchronize view contents
|
||||||
|
* for telemetry- or time-based views.
|
||||||
|
* @type {module:openmct.TimeConductor}
|
||||||
|
* @memberof module:openmct.MCT#
|
||||||
|
* @name conductor
|
||||||
|
*/
|
||||||
|
this.conductor = new api.TimeConductor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An interface for interacting with the composition of domain objects.
|
||||||
|
* The composition of a domain object is the list of other domain
|
||||||
|
* objects it "contains" (for instance, that should be displayed
|
||||||
|
* beneath it in the tree.)
|
||||||
|
*
|
||||||
|
* `composition` may be called as a function, in which case it acts
|
||||||
|
* as [`composition.get`]{@link module:openmct.CompositionAPI#get}.
|
||||||
|
*
|
||||||
|
* @type {module:openmct.CompositionAPI}
|
||||||
|
* @memberof module:openmct.MCT#
|
||||||
|
* @name composition
|
||||||
|
*/
|
||||||
|
this.composition = new api.CompositionAPI();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registry for views of domain objects which should appear in the
|
||||||
|
* main viewing area.
|
||||||
|
*
|
||||||
|
* @type {module:openmct.ViewRegistry}
|
||||||
|
* @memberof module:openmct.MCT#
|
||||||
|
* @name mainViews
|
||||||
|
*/
|
||||||
|
this.mainViews = new ViewRegistry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registry for views which should appear in the Inspector area.
|
||||||
|
* These views will be chosen based on selection state, so
|
||||||
|
* providers should be prepared to test arbitrary objects for
|
||||||
|
* viewability.
|
||||||
|
*
|
||||||
|
* @type {module:openmct.ViewRegistry}
|
||||||
|
* @memberof module:openmct.MCT#
|
||||||
|
* @name inspectors
|
||||||
|
*/
|
||||||
|
this.inspectors = new ViewRegistry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registry for views which should appear in the status indicator area.
|
||||||
|
* @type {module:openmct.ViewRegistry}
|
||||||
|
* @memberof module:openmct.MCT#
|
||||||
|
* @name indicators
|
||||||
|
*/
|
||||||
|
this.indicators = new ViewRegistry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registry for views which should appear in the toolbar area while
|
||||||
|
* editing.
|
||||||
|
*
|
||||||
|
* These views will be chosen based on selection state, so
|
||||||
|
* providers should be prepared to test arbitrary objects for
|
||||||
|
* viewability.
|
||||||
|
*
|
||||||
|
* @type {module:openmct.ViewRegistry}
|
||||||
|
* @memberof module:openmct.MCT#
|
||||||
|
* @name toolbars
|
||||||
|
*/
|
||||||
|
this.toolbars = new ViewRegistry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registry for domain object types which may exist within this
|
||||||
|
* instance of Open MCT.
|
||||||
|
*
|
||||||
|
* @type {module:openmct.TypeRegistry}
|
||||||
|
* @memberof module:openmct.MCT#
|
||||||
|
* @name types
|
||||||
|
*/
|
||||||
|
this.types = new api.TypeRegistry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utilities for attaching common behaviors to views.
|
||||||
|
*
|
||||||
|
* @type {module:openmct.GestureAPI}
|
||||||
|
* @memberof module:openmct.MCT#
|
||||||
|
* @name gestures
|
||||||
|
*/
|
||||||
|
this.gestures = new api.GestureAPI();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An interface for interacting with domain objects and the domain
|
||||||
|
* object hierarchy.
|
||||||
|
*
|
||||||
|
* @type {module:openmct.ObjectAPI}
|
||||||
|
* @memberof module:openmct.MCT#
|
||||||
|
* @name objects
|
||||||
|
*/
|
||||||
|
this.objects = new api.ObjectAPI();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An interface for retrieving and interpreting telemetry data associated
|
||||||
|
* with a domain object.
|
||||||
|
*
|
||||||
|
* @type {module:openmct.TelemetryAPI}
|
||||||
|
* @memberof module:openmct.MCT#
|
||||||
|
* @name telemetry
|
||||||
|
*/
|
||||||
|
this.telemetry = new api.TelemetryAPI();
|
||||||
|
|
||||||
|
this.TimeConductor = this.conductor; // compatibility for prototype
|
||||||
|
this.on('navigation', this.selection.clear.bind(this.selection));
|
||||||
|
}
|
||||||
|
|
||||||
|
MCT.prototype = Object.create(EventEmitter.prototype);
|
||||||
|
|
||||||
|
Object.keys(api).forEach(function (k) {
|
||||||
|
MCT.prototype[k] = api[k];
|
||||||
|
});
|
||||||
|
MCT.prototype.MCT = MCT;
|
||||||
|
|
||||||
|
MCT.prototype.legacyExtension = function (category, extension) {
|
||||||
|
this.legacyBundle.extensions[category] =
|
||||||
|
this.legacyBundle.extensions[category] || [];
|
||||||
|
this.legacyBundle.extensions[category].push(extension);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set path to where assets are hosted. This should be the path to main.js.
|
||||||
|
* @memberof module:openmct.MCT#
|
||||||
|
* @method setAssetPath
|
||||||
|
*/
|
||||||
|
MCT.prototype.setAssetPath = function (path) {
|
||||||
|
this.legacyExtension('constants', {
|
||||||
|
key: "ASSETS_PATH",
|
||||||
|
value: path
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start running Open MCT. This should be called only after any plugins
|
||||||
|
* have been installed.
|
||||||
|
* @fires module:openmct.MCT~start
|
||||||
|
* @memberof module:openmct.MCT#
|
||||||
|
* @method start
|
||||||
|
* @param {HTMLElement} [domElement] the DOM element in which to run
|
||||||
|
* MCT; if undefined, MCT will be run in the body of the document
|
||||||
|
*/
|
||||||
|
MCT.prototype.start = function (domElement) {
|
||||||
|
if (!domElement) {
|
||||||
|
domElement = document.body;
|
||||||
|
}
|
||||||
|
|
||||||
|
var appDiv = document.createElement('div');
|
||||||
|
appDiv.setAttribute('ng-view', '');
|
||||||
|
appDiv.className = 'user-environ';
|
||||||
|
domElement.appendChild(appDiv);
|
||||||
|
|
||||||
|
this.legacyExtension('runs', {
|
||||||
|
depends: ['navigationService'],
|
||||||
|
implementation: function (navigationService) {
|
||||||
|
navigationService
|
||||||
|
.addListener(this.emit.bind(this, 'navigation'));
|
||||||
|
}.bind(this)
|
||||||
|
});
|
||||||
|
|
||||||
|
legacyRegistry.register('adapter', this.legacyBundle);
|
||||||
|
legacyRegistry.enable('adapter');
|
||||||
|
/**
|
||||||
|
* Fired by [MCT]{@link module:openmct.MCT} when the application
|
||||||
|
* is started.
|
||||||
|
* @event start
|
||||||
|
* @memberof module:openmct.MCT~
|
||||||
|
*/
|
||||||
|
this.emit('start');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Install a plugin in MCT.
|
||||||
|
*
|
||||||
|
* @param {Function} plugin a plugin install function which will be
|
||||||
|
* invoked with the mct instance.
|
||||||
|
* @memberof module:openmct.MCT#
|
||||||
|
*/
|
||||||
|
MCT.prototype.install = function (plugin) {
|
||||||
|
plugin(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
return MCT;
|
||||||
|
});
|
66
src/adapter/actions/ActionDialogDecorator.js
Normal file
66
src/adapter/actions/ActionDialogDecorator.js
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'../../api/objects/object-utils'
|
||||||
|
], function (objectUtils) {
|
||||||
|
function ActionDialogDecorator(mct, newViews, actionService) {
|
||||||
|
this.actionService = actionService;
|
||||||
|
this.mct = mct;
|
||||||
|
this.definitions = newViews.filter(function (newView) {
|
||||||
|
return newView.region === mct.regions.properties;
|
||||||
|
}).map(function (newView) {
|
||||||
|
return newView.factory;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ActionDialogDecorator.prototype.getActions = function (context) {
|
||||||
|
var mct = this.mct;
|
||||||
|
var definitions = this.definitions;
|
||||||
|
|
||||||
|
return this.actionService.getActions(context).map(function (action) {
|
||||||
|
if (action.dialogService) {
|
||||||
|
var domainObject = objectUtils.toNewFormat(
|
||||||
|
context.domainObject.getModel(),
|
||||||
|
objectUtils.parseKeyString(context.domainObject.getId())
|
||||||
|
);
|
||||||
|
|
||||||
|
definitions = definitions.filter(function (definition) {
|
||||||
|
return definition.canView(domainObject);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (definitions.length > 0) {
|
||||||
|
action.dialogService = Object.create(action.dialogService);
|
||||||
|
action.dialogService.getUserInput = function (form, value) {
|
||||||
|
return new mct.Dialog(
|
||||||
|
definitions[0].view(context.domainObject),
|
||||||
|
form.title
|
||||||
|
).show();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return action;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return ActionDialogDecorator;
|
||||||
|
});
|
127
src/adapter/bundle.js
Normal file
127
src/adapter/bundle.js
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'legacyRegistry',
|
||||||
|
'./actions/ActionDialogDecorator',
|
||||||
|
'./directives/MCTView',
|
||||||
|
'./services/Instantiate',
|
||||||
|
'./capabilities/APICapabilityDecorator',
|
||||||
|
'./policies/AdapterCompositionPolicy',
|
||||||
|
'./runs/AlternateCompositionInitializer'
|
||||||
|
], function (
|
||||||
|
legacyRegistry,
|
||||||
|
ActionDialogDecorator,
|
||||||
|
MCTView,
|
||||||
|
Instantiate,
|
||||||
|
APICapabilityDecorator,
|
||||||
|
AdapterCompositionPolicy,
|
||||||
|
AlternateCompositionInitializer
|
||||||
|
) {
|
||||||
|
legacyRegistry.register('src/adapter', {
|
||||||
|
"extensions": {
|
||||||
|
"directives": [
|
||||||
|
{
|
||||||
|
key: "mctView",
|
||||||
|
implementation: MCTView,
|
||||||
|
depends: [
|
||||||
|
"newViews[]",
|
||||||
|
"openmct"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
services: [
|
||||||
|
{
|
||||||
|
key: "instantiate",
|
||||||
|
priority: "mandatory",
|
||||||
|
implementation: Instantiate,
|
||||||
|
depends: [
|
||||||
|
"capabilityService",
|
||||||
|
"identifierService",
|
||||||
|
"cacheService"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
components: [
|
||||||
|
{
|
||||||
|
type: "decorator",
|
||||||
|
provides: "capabilityService",
|
||||||
|
implementation: APICapabilityDecorator,
|
||||||
|
depends: [
|
||||||
|
"$injector"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "decorator",
|
||||||
|
provides: "actionService",
|
||||||
|
implementation: ActionDialogDecorator,
|
||||||
|
depends: ["openmct", "newViews[]"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
policies: [
|
||||||
|
{
|
||||||
|
category: "composition",
|
||||||
|
implementation: AdapterCompositionPolicy,
|
||||||
|
depends: ["openmct"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
runs: [
|
||||||
|
{
|
||||||
|
implementation: AlternateCompositionInitializer,
|
||||||
|
depends: ["openmct"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
licenses: [
|
||||||
|
{
|
||||||
|
"name": "almond",
|
||||||
|
"version": "0.3.3",
|
||||||
|
"description": "Lightweight RequireJS replacement for builds",
|
||||||
|
"author": "jQuery Foundation",
|
||||||
|
"website": "https://github.com/requirejs/almond",
|
||||||
|
"copyright": "Copyright jQuery Foundation and other contributors, https://jquery.org/",
|
||||||
|
"license": "license-mit",
|
||||||
|
"link": "https://github.com/requirejs/almond/blob/master/LICENSE"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "lodash",
|
||||||
|
"version": "3.10.1",
|
||||||
|
"description": "Utility functions",
|
||||||
|
"author": "Dojo Foundation",
|
||||||
|
"website": "https://lodash.com",
|
||||||
|
"copyright": "Copyright 2012-2015 The Dojo Foundation",
|
||||||
|
"license": "license-mit",
|
||||||
|
"link": "https://raw.githubusercontent.com/lodash/lodash/3.10.1/LICENSE"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "EventEmitter3",
|
||||||
|
"version": "1.2.0",
|
||||||
|
"description": "Event-driven programming support",
|
||||||
|
"author": "Arnout Kazemier",
|
||||||
|
"website": "https://github.com/primus/eventemitter3",
|
||||||
|
"copyright": "Copyright (c) 2014 Arnout Kazemier",
|
||||||
|
"license": "license-mit",
|
||||||
|
"link": "https://github.com/primus/eventemitter3/blob/1.2.0/LICENSE"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
59
src/adapter/capabilities/APICapabilityDecorator.js
Normal file
59
src/adapter/capabilities/APICapabilityDecorator.js
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'./synchronizeMutationCapability',
|
||||||
|
'./AlternateCompositionCapability'
|
||||||
|
], function (
|
||||||
|
synchronizeMutationCapability,
|
||||||
|
AlternateCompositionCapability
|
||||||
|
) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overrides certain capabilities to keep consistency between old API
|
||||||
|
* and new API.
|
||||||
|
*/
|
||||||
|
function APICapabilityDecorator($injector, capabilityService) {
|
||||||
|
this.$injector = $injector;
|
||||||
|
this.capabilityService = capabilityService;
|
||||||
|
}
|
||||||
|
|
||||||
|
APICapabilityDecorator.prototype.getCapabilities = function (
|
||||||
|
model
|
||||||
|
) {
|
||||||
|
var capabilities = this.capabilityService.getCapabilities(model);
|
||||||
|
if (capabilities.mutation) {
|
||||||
|
capabilities.mutation =
|
||||||
|
synchronizeMutationCapability(capabilities.mutation);
|
||||||
|
}
|
||||||
|
if (AlternateCompositionCapability.appliesTo(model)) {
|
||||||
|
capabilities.composition = function (domainObject) {
|
||||||
|
return new AlternateCompositionCapability(this.$injector, domainObject);
|
||||||
|
}.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return capabilities;
|
||||||
|
};
|
||||||
|
|
||||||
|
return APICapabilityDecorator;
|
||||||
|
|
||||||
|
});
|
107
src/adapter/capabilities/AlternateCompositionCapability.js
Normal file
107
src/adapter/capabilities/AlternateCompositionCapability.js
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT Web includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module defining AlternateCompositionCapability. Created by vwoeltje on 11/7/14.
|
||||||
|
*/
|
||||||
|
define([
|
||||||
|
'../../api/objects/object-utils'
|
||||||
|
], function (objectUtils) {
|
||||||
|
function AlternateCompositionCapability($injector, domainObject) {
|
||||||
|
this.domainObject = domainObject;
|
||||||
|
this.getDependencies = function () {
|
||||||
|
this.instantiate = $injector.get("instantiate");
|
||||||
|
this.contextualize = $injector.get("contextualize");
|
||||||
|
this.getDependencies = undefined;
|
||||||
|
this.openmct = $injector.get("openmct");
|
||||||
|
}.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
AlternateCompositionCapability.prototype.add = function (child, index) {
|
||||||
|
if (typeof index !== 'undefined') {
|
||||||
|
// At first glance I don't see a location in the existing
|
||||||
|
// codebase where add is called with an index. Won't support.
|
||||||
|
throw new Error(
|
||||||
|
'Composition Capability does not support adding at index'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addChildToComposition(model) {
|
||||||
|
var existingIndex = model.composition.indexOf(child.getId());
|
||||||
|
if (existingIndex === -1) {
|
||||||
|
model.composition.push(child.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.domainObject.useCapability(
|
||||||
|
'mutation',
|
||||||
|
addChildToComposition
|
||||||
|
)
|
||||||
|
.then(this.invoke.bind(this))
|
||||||
|
.then(function (children) {
|
||||||
|
return children.filter(function (c) {
|
||||||
|
return c.getId() === child.getId();
|
||||||
|
})[0];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
AlternateCompositionCapability.prototype.contextualizeChild = function (
|
||||||
|
child
|
||||||
|
) {
|
||||||
|
if (this.getDependencies) {
|
||||||
|
this.getDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
var keyString = objectUtils.makeKeyString(child.key);
|
||||||
|
var oldModel = objectUtils.toOldFormat(child);
|
||||||
|
var newDO = this.instantiate(oldModel, keyString);
|
||||||
|
return this.contextualize(newDO, this.domainObject);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
AlternateCompositionCapability.prototype.invoke = function () {
|
||||||
|
var newFormatDO = objectUtils.toNewFormat(
|
||||||
|
this.domainObject.getModel(),
|
||||||
|
this.domainObject.getId()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (this.getDependencies) {
|
||||||
|
this.getDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
var collection = this.openmct.composition.get(newFormatDO);
|
||||||
|
return collection.load()
|
||||||
|
.then(function (children) {
|
||||||
|
collection.destroy();
|
||||||
|
return children.map(this.contextualizeChild, this);
|
||||||
|
}.bind(this));
|
||||||
|
};
|
||||||
|
|
||||||
|
AlternateCompositionCapability.appliesTo = function (model) {
|
||||||
|
// Will get replaced by a runs exception to properly
|
||||||
|
// bind to running openmct instance
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
return AlternateCompositionCapability;
|
||||||
|
}
|
||||||
|
);
|
49
src/adapter/capabilities/synchronizeMutationCapability.js
Normal file
49
src/adapter/capabilities/synchronizeMutationCapability.js
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
|
||||||
|
], function (
|
||||||
|
|
||||||
|
) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps the mutation capability and synchronizes the mutation
|
||||||
|
*/
|
||||||
|
function synchronizeMutationCapability(mutationConstructor) {
|
||||||
|
|
||||||
|
return function makeCapability(domainObject) {
|
||||||
|
var capability = mutationConstructor(domainObject);
|
||||||
|
var oldListen = capability.listen.bind(capability);
|
||||||
|
capability.listen = function (listener) {
|
||||||
|
return oldListen(function (newModel) {
|
||||||
|
capability.domainObject.model =
|
||||||
|
JSON.parse(JSON.stringify(newModel));
|
||||||
|
listener(newModel);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return capability;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return synchronizeMutationCapability;
|
||||||
|
});
|
87
src/adapter/directives/MCTView.js
Normal file
87
src/adapter/directives/MCTView.js
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'angular',
|
||||||
|
'./Region',
|
||||||
|
'../../api/objects/object-utils'
|
||||||
|
], function (
|
||||||
|
angular,
|
||||||
|
Region,
|
||||||
|
objectUtils
|
||||||
|
) {
|
||||||
|
function MCTView(newViews, PublicAPI) {
|
||||||
|
var definitions = {};
|
||||||
|
|
||||||
|
newViews.forEach(function (newView) {
|
||||||
|
definitions[newView.region] = definitions[newView.region] || {};
|
||||||
|
definitions[newView.region][newView.key] = newView.factory;
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
link: function (scope, element, attrs) {
|
||||||
|
var key, mctObject, regionId, region;
|
||||||
|
|
||||||
|
function maybeShow() {
|
||||||
|
if (!definitions[regionId] || !definitions[regionId][key] || !mctObject) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
region.show(definitions[regionId][key].view(mctObject));
|
||||||
|
}
|
||||||
|
|
||||||
|
function setKey(k) {
|
||||||
|
key = k;
|
||||||
|
maybeShow();
|
||||||
|
}
|
||||||
|
|
||||||
|
function setObject(obj) {
|
||||||
|
mctObject = undefined;
|
||||||
|
PublicAPI.Objects.get(objectUtils.parseKeyString(obj.getId()))
|
||||||
|
.then(function (mobj) {
|
||||||
|
mctObject = mobj;
|
||||||
|
maybeShow();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function setRegionId(r) {
|
||||||
|
regionId = r;
|
||||||
|
maybeShow();
|
||||||
|
}
|
||||||
|
|
||||||
|
region = new Region(element[0]);
|
||||||
|
|
||||||
|
scope.$watch('key', setKey);
|
||||||
|
scope.$watch('region', setRegionId);
|
||||||
|
scope.$watch('mctObject', setObject);
|
||||||
|
},
|
||||||
|
scope: {
|
||||||
|
key: "=",
|
||||||
|
region: "=",
|
||||||
|
mctObject: "="
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return MCTView;
|
||||||
|
});
|
45
src/adapter/directives/Region.js
Normal file
45
src/adapter/directives/Region.js
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([], function () {
|
||||||
|
function Region(element) {
|
||||||
|
this.activeView = undefined;
|
||||||
|
this.element = element;
|
||||||
|
}
|
||||||
|
|
||||||
|
Region.prototype.clear = function () {
|
||||||
|
if (this.activeView) {
|
||||||
|
this.activeView.destroy();
|
||||||
|
this.activeView = undefined;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Region.prototype.show = function (view) {
|
||||||
|
this.clear();
|
||||||
|
this.activeView = view;
|
||||||
|
if (this.activeView) {
|
||||||
|
this.activeView.show(this.element);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return Region;
|
||||||
|
});
|
48
src/adapter/policies/AdapterCompositionPolicy.js
Normal file
48
src/adapter/policies/AdapterCompositionPolicy.js
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([], function () {
|
||||||
|
function AdapterCompositionPolicy(mct) {
|
||||||
|
this.mct = mct;
|
||||||
|
}
|
||||||
|
|
||||||
|
AdapterCompositionPolicy.prototype.allow = function (
|
||||||
|
containerType,
|
||||||
|
childType
|
||||||
|
) {
|
||||||
|
var containerObject = containerType.getInitialModel();
|
||||||
|
var childObject = childType.getInitialModel();
|
||||||
|
|
||||||
|
containerObject.type = containerType.getKey();
|
||||||
|
childObject.type = childType.getKey();
|
||||||
|
|
||||||
|
var composition = this.mct.Composition(containerObject);
|
||||||
|
|
||||||
|
if (composition) {
|
||||||
|
return composition.canContain(childObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
return AdapterCompositionPolicy;
|
||||||
|
});
|
36
src/adapter/runs/AlternateCompositionInitializer.js
Normal file
36
src/adapter/runs/AlternateCompositionInitializer.js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT Web includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'../capabilities/AlternateCompositionCapability'
|
||||||
|
], function (AlternateCompositionCapability) {
|
||||||
|
// Present to work around the need for openmct to be used
|
||||||
|
// from AlternateCompositionCapability.appliesTo, even though it
|
||||||
|
// cannot be injected.
|
||||||
|
function AlternateCompositionInitializer(openmct) {
|
||||||
|
AlternateCompositionCapability.appliesTo = function (model) {
|
||||||
|
return !model.composition && !!openmct.composition.get(model);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return AlternateCompositionInitializer;
|
||||||
|
});
|
49
src/adapter/services/Instantiate.js
Normal file
49
src/adapter/services/Instantiate.js
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define(
|
||||||
|
['../../../platform/core/src/objects/DomainObjectImpl'],
|
||||||
|
function (DomainObjectImpl) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overrides platform version of instantiate, passes Id with model such
|
||||||
|
* that capability detection can utilize new format domain objects.
|
||||||
|
*/
|
||||||
|
function Instantiate(
|
||||||
|
capabilityService,
|
||||||
|
identifierService,
|
||||||
|
cacheService
|
||||||
|
) {
|
||||||
|
return function (model, id) {
|
||||||
|
id = id || identifierService.generate();
|
||||||
|
var old_id = model.id;
|
||||||
|
model.id = id;
|
||||||
|
var capabilities = capabilityService.getCapabilities(model);
|
||||||
|
model.id = old_id;
|
||||||
|
cacheService.put(id, model);
|
||||||
|
return new DomainObjectImpl(id, model, capabilities);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return Instantiate;
|
||||||
|
}
|
||||||
|
);
|
46
src/adapter/templates/edit-object-replacement.html
Normal file
46
src/adapter/templates/edit-object-replacement.html
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<div class="abs l-flex-col" ng-controller="EditObjectController as EditObjectController">
|
||||||
|
<div mct-before-unload="EditObjectController.getUnloadWarning()"
|
||||||
|
class="holder flex-elem l-flex-row object-browse-bar ">
|
||||||
|
<div class="items-select left flex-elem l-flex-row grows">
|
||||||
|
<mct-representation key="'back-arrow'"
|
||||||
|
mct-object="domainObject"
|
||||||
|
class="flex-elem l-back"></mct-representation>
|
||||||
|
<mct-representation key="'object-header'"
|
||||||
|
mct-object="domainObject"
|
||||||
|
class="l-flex-row flex-elem grows object-header">
|
||||||
|
</mct-representation>
|
||||||
|
</div>
|
||||||
|
<div class="btn-bar right l-flex-row flex-elem flex-justify-end flex-fixed">
|
||||||
|
<mct-representation key="'switcher'"
|
||||||
|
mct-object="domainObject"
|
||||||
|
ng-model="representation">
|
||||||
|
</mct-representation>
|
||||||
|
<!-- Temporarily, on mobile, the action buttons are hidden-->
|
||||||
|
<mct-representation key="'action-group'"
|
||||||
|
mct-object="domainObject"
|
||||||
|
parameters="{ category: 'view-control' }"
|
||||||
|
class="mobile-hide">
|
||||||
|
</mct-representation>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="holder l-flex-col flex-elem grows l-object-wrapper">
|
||||||
|
<div class="holder l-flex-col flex-elem grows l-object-wrapper-inner">
|
||||||
|
<!-- Toolbar and Save/Cancel buttons -->
|
||||||
|
<div class="l-edit-controls flex-elem l-flex-row flex-align-end">
|
||||||
|
<mct-representation key="'adapted-view-TOOLBAR'"
|
||||||
|
mct-object="domainObject"
|
||||||
|
class="flex-elem grows">
|
||||||
|
</mct-representation>
|
||||||
|
<mct-representation key="'edit-action-buttons'"
|
||||||
|
mct-object="domainObject"
|
||||||
|
class='flex-elem conclude-editing'>
|
||||||
|
</mct-representation>
|
||||||
|
</div>
|
||||||
|
<mct-representation key="representation.selected.key"
|
||||||
|
mct-object="representation.selected.key && domainObject"
|
||||||
|
class="abs flex-elem grows object-holder-main scroll"
|
||||||
|
toolbar="toolbar">
|
||||||
|
</mct-representation>
|
||||||
|
</div><!--/ l-object-wrapper-inner -->
|
||||||
|
</div>
|
||||||
|
</div>
|
202
src/api/TimeConductor.js
Normal file
202
src/api/TimeConductor.js
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define(['EventEmitter'], function (EventEmitter) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The public API for setting and querying time conductor state. The
|
||||||
|
* time conductor is the means by which the temporal bounds of a view
|
||||||
|
* are controlled. Time-sensitive views will typically respond to
|
||||||
|
* changes to bounds or other properties of the time conductor and
|
||||||
|
* update the data displayed based on the time conductor state.
|
||||||
|
*
|
||||||
|
* The TimeConductor extends the EventEmitter class. A number of events are
|
||||||
|
* fired when properties of the time conductor change, which are
|
||||||
|
* documented below.
|
||||||
|
* @interface
|
||||||
|
* @memberof module:openmct
|
||||||
|
*/
|
||||||
|
function TimeConductor() {
|
||||||
|
EventEmitter.call(this);
|
||||||
|
|
||||||
|
//The Time System
|
||||||
|
this.system = undefined;
|
||||||
|
//The Time Of Interest
|
||||||
|
this.toi = undefined;
|
||||||
|
|
||||||
|
this.boundsVal = {
|
||||||
|
start: undefined,
|
||||||
|
end: undefined
|
||||||
|
};
|
||||||
|
|
||||||
|
//Default to fixed mode
|
||||||
|
this.followMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
TimeConductor.prototype = Object.create(EventEmitter.prototype);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate the given bounds. This can be used for pre-validation of
|
||||||
|
* bounds, for example by views validating user inputs.
|
||||||
|
* @param bounds The start and end time of the conductor.
|
||||||
|
* @returns {string | true} A validation error, or true if valid
|
||||||
|
* @memberof module:openmct.TimeConductor#
|
||||||
|
* @method validateBounds
|
||||||
|
*/
|
||||||
|
TimeConductor.prototype.validateBounds = function (bounds) {
|
||||||
|
if ((bounds.start === undefined) ||
|
||||||
|
(bounds.end === undefined) ||
|
||||||
|
isNaN(bounds.start) ||
|
||||||
|
isNaN(bounds.end)
|
||||||
|
) {
|
||||||
|
return "Start and end must be specified as integer values";
|
||||||
|
} else if (bounds.start > bounds.end) {
|
||||||
|
return "Specified start date exceeds end bound";
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
function throwOnError(validationResult) {
|
||||||
|
if (validationResult !== true) {
|
||||||
|
throw new Error(validationResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get or set the follow mode of the time conductor. In follow mode the
|
||||||
|
* time conductor ticks, regularly updating the bounds from a timing
|
||||||
|
* source appropriate to the selected time system and mode of the time
|
||||||
|
* conductor.
|
||||||
|
* @fires module:openmct.TimeConductor~follow
|
||||||
|
* @param {boolean} followMode
|
||||||
|
* @returns {boolean}
|
||||||
|
* @memberof module:openmct.TimeConductor#
|
||||||
|
* @method follow
|
||||||
|
*/
|
||||||
|
TimeConductor.prototype.follow = function (followMode) {
|
||||||
|
if (arguments.length > 0) {
|
||||||
|
this.followMode = followMode;
|
||||||
|
/**
|
||||||
|
* The TimeConductor has toggled into or out of follow mode.
|
||||||
|
* @event follow
|
||||||
|
* @memberof module:openmct.TimeConductor~
|
||||||
|
* @property {boolean} followMode true if follow mode is
|
||||||
|
* enabled, otherwise false.
|
||||||
|
*/
|
||||||
|
this.emit('follow', this.followMode);
|
||||||
|
}
|
||||||
|
return this.followMode;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} TimeConductorBounds
|
||||||
|
* @property {number} start The start time displayed by the time conductor in ms since epoch. Epoch determined by current time system
|
||||||
|
* @property {number} end The end time displayed by the time conductor in ms since epoch.
|
||||||
|
* @memberof module:openmct.TimeConductor~
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get or set the start and end time of the time conductor. Basic validation
|
||||||
|
* of bounds is performed.
|
||||||
|
*
|
||||||
|
* @param {module:openmct.TimeConductorBounds~TimeConductorBounds} newBounds
|
||||||
|
* @throws {Error} Validation error
|
||||||
|
* @fires module:openmct.TimeConductor~bounds
|
||||||
|
* @returns {module:openmct.TimeConductorBounds~TimeConductorBounds}
|
||||||
|
* @memberof module:openmct.TimeConductor#
|
||||||
|
* @method bounds
|
||||||
|
*/
|
||||||
|
TimeConductor.prototype.bounds = function (newBounds) {
|
||||||
|
if (arguments.length > 0) {
|
||||||
|
throwOnError(this.validateBounds(newBounds));
|
||||||
|
this.boundsVal = newBounds;
|
||||||
|
/**
|
||||||
|
* The start time, end time, or both have been updated.
|
||||||
|
* @event bounds
|
||||||
|
* @memberof module:openmct.TimeConductor~
|
||||||
|
* @property {TimeConductorBounds} bounds
|
||||||
|
*/
|
||||||
|
this.emit('bounds', this.boundsVal);
|
||||||
|
}
|
||||||
|
return this.boundsVal;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get or set the time system of the TimeConductor. Time systems determine
|
||||||
|
* units, epoch, and other aspects of time representation. When changing
|
||||||
|
* the time system in use, new valid bounds must also be provided.
|
||||||
|
* @param {TimeSystem} newTimeSystem
|
||||||
|
* @param {module:openmct.TimeConductor~TimeConductorBounds} bounds
|
||||||
|
* @fires module:openmct.TimeConductor~timeSystem
|
||||||
|
* @returns {TimeSystem} The currently applied time system
|
||||||
|
* @memberof module:openmct.TimeConductor#
|
||||||
|
* @method timeSystem
|
||||||
|
*/
|
||||||
|
TimeConductor.prototype.timeSystem = function (newTimeSystem, bounds) {
|
||||||
|
if (arguments.length >= 2) {
|
||||||
|
this.system = newTimeSystem;
|
||||||
|
/**
|
||||||
|
* The time system used by the time
|
||||||
|
* conductor has changed. A change in Time System will always be
|
||||||
|
* followed by a bounds event specifying new query bounds.
|
||||||
|
*
|
||||||
|
* @event module:openmct.TimeConductor~timeSystem
|
||||||
|
* @property {TimeSystem} The value of the currently applied
|
||||||
|
* Time System
|
||||||
|
* */
|
||||||
|
this.emit('timeSystem', this.system);
|
||||||
|
// Do something with bounds here. Try and convert between
|
||||||
|
// time systems? Or just set defaults when time system changes?
|
||||||
|
// eg.
|
||||||
|
this.bounds(bounds);
|
||||||
|
} else if (arguments.length === 1) {
|
||||||
|
throw new Error('Must set bounds when changing time system');
|
||||||
|
}
|
||||||
|
return this.system;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get or set the Time of Interest. The Time of Interest is the temporal
|
||||||
|
* focus of the current view. It can be manipulated by the user from the
|
||||||
|
* time conductor or from other views.
|
||||||
|
* @fires module:openmct.TimeConductor~timeOfInterest
|
||||||
|
* @param newTOI
|
||||||
|
* @returns {number} the current time of interest
|
||||||
|
* @memberof module:openmct.TimeConductor#
|
||||||
|
* @method timeOfInterest
|
||||||
|
*/
|
||||||
|
TimeConductor.prototype.timeOfInterest = function (newTOI) {
|
||||||
|
if (arguments.length > 0) {
|
||||||
|
this.toi = newTOI;
|
||||||
|
/**
|
||||||
|
* The Time of Interest has moved.
|
||||||
|
* @event timeOfInterest
|
||||||
|
* @memberof module:openmct.TimeConductor~
|
||||||
|
* @property {number} Current time of interest
|
||||||
|
*/
|
||||||
|
this.emit('timeOfInterest', this.toi);
|
||||||
|
}
|
||||||
|
return this.toi;
|
||||||
|
};
|
||||||
|
|
||||||
|
return TimeConductor;
|
||||||
|
});
|
110
src/api/TimeConductorSpec.js
Normal file
110
src/api/TimeConductorSpec.js
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define(['./TimeConductor'], function (TimeConductor) {
|
||||||
|
describe("The Time Conductor", function () {
|
||||||
|
var tc,
|
||||||
|
timeSystem,
|
||||||
|
bounds,
|
||||||
|
eventListener,
|
||||||
|
toi,
|
||||||
|
follow;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
tc = new TimeConductor();
|
||||||
|
timeSystem = {};
|
||||||
|
bounds = {start: 0, end: 0};
|
||||||
|
eventListener = jasmine.createSpy("eventListener");
|
||||||
|
toi = 111;
|
||||||
|
follow = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Supports setting and querying of time of interest and and follow mode", function () {
|
||||||
|
expect(tc.timeOfInterest()).not.toBe(toi);
|
||||||
|
tc.timeOfInterest(toi);
|
||||||
|
expect(tc.timeOfInterest()).toBe(toi);
|
||||||
|
|
||||||
|
expect(tc.follow()).not.toBe(follow);
|
||||||
|
tc.follow(follow);
|
||||||
|
expect(tc.follow()).toBe(follow);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Allows setting of valid bounds", function () {
|
||||||
|
bounds = {start: 0, end: 1};
|
||||||
|
expect(tc.bounds()).not.toBe(bounds);
|
||||||
|
expect(tc.bounds.bind(tc, bounds)).not.toThrow();
|
||||||
|
expect(tc.bounds()).toBe(bounds);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Disallows setting of invalid bounds", function () {
|
||||||
|
bounds = {start: 1, end: 0};
|
||||||
|
expect(tc.bounds()).not.toBe(bounds);
|
||||||
|
expect(tc.bounds.bind(tc, bounds)).toThrow();
|
||||||
|
expect(tc.bounds()).not.toBe(bounds);
|
||||||
|
|
||||||
|
bounds = {start: 1};
|
||||||
|
expect(tc.bounds()).not.toBe(bounds);
|
||||||
|
expect(tc.bounds.bind(tc, bounds)).toThrow();
|
||||||
|
expect(tc.bounds()).not.toBe(bounds);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Allows setting of time system with bounds", function () {
|
||||||
|
expect(tc.timeSystem()).not.toBe(timeSystem);
|
||||||
|
expect(tc.timeSystem.bind(tc, timeSystem, bounds)).not.toThrow();
|
||||||
|
expect(tc.timeSystem()).toBe(timeSystem);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Disallows setting of time system without bounds", function () {
|
||||||
|
expect(tc.timeSystem()).not.toBe(timeSystem);
|
||||||
|
expect(tc.timeSystem.bind(tc, timeSystem)).toThrow();
|
||||||
|
expect(tc.timeSystem()).not.toBe(timeSystem);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Emits an event when time system changes", function () {
|
||||||
|
expect(eventListener).not.toHaveBeenCalled();
|
||||||
|
tc.on("timeSystem", eventListener);
|
||||||
|
tc.timeSystem(timeSystem, bounds);
|
||||||
|
expect(eventListener).toHaveBeenCalledWith(timeSystem);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Emits an event when time of interest changes", function () {
|
||||||
|
expect(eventListener).not.toHaveBeenCalled();
|
||||||
|
tc.on("timeOfInterest", eventListener);
|
||||||
|
tc.timeOfInterest(toi);
|
||||||
|
expect(eventListener).toHaveBeenCalledWith(toi);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Emits an event when bounds change", function () {
|
||||||
|
expect(eventListener).not.toHaveBeenCalled();
|
||||||
|
tc.on("bounds", eventListener);
|
||||||
|
tc.bounds(bounds);
|
||||||
|
expect(eventListener).toHaveBeenCalledWith(bounds);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Emits an event when follow mode changes", function () {
|
||||||
|
expect(eventListener).not.toHaveBeenCalled();
|
||||||
|
tc.on("follow", eventListener);
|
||||||
|
tc.follow(follow);
|
||||||
|
expect(eventListener).toHaveBeenCalledWith(follow);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
82
src/api/Type.js
Normal file
82
src/api/Type.js
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define(function () {
|
||||||
|
/**
|
||||||
|
* @typedef TypeDefinition
|
||||||
|
* @memberof module:openmct.Type~
|
||||||
|
* @property {Metadata} metadata displayable metadata about this type
|
||||||
|
* @property {function (object)} [initialize] a function which initializes
|
||||||
|
* the model for new domain objects of this type
|
||||||
|
* @property {boolean} [creatable] true if users should be allowed to
|
||||||
|
* create this type (default: false)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Type describes a kind of domain object that may appear or be
|
||||||
|
* created within Open MCT.
|
||||||
|
*
|
||||||
|
* @param {module:opemct.Type~TypeDefinition} definition
|
||||||
|
* @class Type
|
||||||
|
* @memberof module:openmct
|
||||||
|
*/
|
||||||
|
function Type(definition) {
|
||||||
|
this.definition = definition;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a domain object is an instance of this type.
|
||||||
|
* @param domainObject
|
||||||
|
* @returns {boolean} true if the domain object is of this type
|
||||||
|
* @memberof module:openmct.Type#
|
||||||
|
* @method check
|
||||||
|
*/
|
||||||
|
Type.prototype.check = function (domainObject) {
|
||||||
|
// Depends on assignment from MCT.
|
||||||
|
return domainObject.type === this.key;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a definition for this type that can be registered using the
|
||||||
|
* legacy bundle format.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
Type.prototype.toLegacyDefinition = function () {
|
||||||
|
var def = {};
|
||||||
|
def.name = this.definition.metadata.label;
|
||||||
|
def.glyph = this.definition.metadata.glyph;
|
||||||
|
def.description = this.definition.metadata.description;
|
||||||
|
def.properties = this.definition.form;
|
||||||
|
|
||||||
|
if (this.definition.initialize) {
|
||||||
|
def.model = {};
|
||||||
|
this.definition.initialize(def.model);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.definition.creatable) {
|
||||||
|
def.features = ['creation'];
|
||||||
|
}
|
||||||
|
return def;
|
||||||
|
};
|
||||||
|
|
||||||
|
return Type;
|
||||||
|
});
|
52
src/api/api.js
Normal file
52
src/api/api.js
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'./Type',
|
||||||
|
'./TimeConductor',
|
||||||
|
'./objects/ObjectAPI',
|
||||||
|
'./composition/CompositionAPI',
|
||||||
|
'./types/TypeRegistry',
|
||||||
|
'./ui/Dialog',
|
||||||
|
'./ui/GestureAPI',
|
||||||
|
'./telemetry/TelemetryAPI'
|
||||||
|
], function (
|
||||||
|
Type,
|
||||||
|
TimeConductor,
|
||||||
|
ObjectAPI,
|
||||||
|
CompositionAPI,
|
||||||
|
TypeRegistry,
|
||||||
|
Dialog,
|
||||||
|
GestureAPI,
|
||||||
|
TelemetryAPI
|
||||||
|
) {
|
||||||
|
return {
|
||||||
|
Type: Type,
|
||||||
|
TimeConductor: TimeConductor,
|
||||||
|
ObjectAPI: ObjectAPI,
|
||||||
|
CompositionAPI: CompositionAPI,
|
||||||
|
Dialog: Dialog,
|
||||||
|
TypeRegistry: TypeRegistry,
|
||||||
|
GestureAPI: GestureAPI,
|
||||||
|
TelemetryAPI: TelemetryAPI
|
||||||
|
};
|
||||||
|
});
|
136
src/api/composition/CompositionAPI.js
Normal file
136
src/api/composition/CompositionAPI.js
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'lodash',
|
||||||
|
'EventEmitter',
|
||||||
|
'./DefaultCompositionProvider',
|
||||||
|
'./CompositionCollection'
|
||||||
|
], function (
|
||||||
|
_,
|
||||||
|
EventEmitter,
|
||||||
|
DefaultCompositionProvider,
|
||||||
|
CompositionCollection
|
||||||
|
) {
|
||||||
|
/**
|
||||||
|
* An interface for interacting with the composition of domain objects.
|
||||||
|
* The composition of a domain object is the list of other domain objects
|
||||||
|
* it "contains" (for instance, that should be displayed beneath it
|
||||||
|
* in the tree.)
|
||||||
|
*
|
||||||
|
* @interface CompositionAPI
|
||||||
|
* @returns {module:openmct.CompositionCollection}
|
||||||
|
* @memberof module:openmct
|
||||||
|
*/
|
||||||
|
function CompositionAPI() {
|
||||||
|
this.registry = [];
|
||||||
|
this.policies = [];
|
||||||
|
this.addProvider(new DefaultCompositionProvider());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a composition provider.
|
||||||
|
*
|
||||||
|
* Plugins can add new composition providers to change the loading
|
||||||
|
* behavior for certain domain objects.
|
||||||
|
*
|
||||||
|
* @method addProvider
|
||||||
|
* @param {module:openmct.CompositionProvider} provider the provider to add
|
||||||
|
* @memberof module:openmct.CompositionAPI#
|
||||||
|
*/
|
||||||
|
CompositionAPI.prototype.addProvider = function (provider) {
|
||||||
|
this.registry.unshift(provider);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the composition (if any) of this domain object.
|
||||||
|
*
|
||||||
|
* @method get
|
||||||
|
* @returns {module:openmct.CompositionCollection}
|
||||||
|
* @memberof module:openmct.CompositionAPI#
|
||||||
|
*/
|
||||||
|
CompositionAPI.prototype.get = function (domainObject) {
|
||||||
|
var provider = _.find(this.registry, function (p) {
|
||||||
|
return p.appliesTo(domainObject);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!provider) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new CompositionCollection(domainObject, provider);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A composition policy is a function which either allows or disallows
|
||||||
|
* placing one object in another's composition.
|
||||||
|
*
|
||||||
|
* Open MCT's policy model requires consensus, so any one policy may
|
||||||
|
* reject composition by returning false. As such, policies should
|
||||||
|
* generally be written to return true in the default case.
|
||||||
|
*
|
||||||
|
* @callback CompositionPolicy
|
||||||
|
* @memberof module:openmct.CompositionAPI~
|
||||||
|
* @param {module:openmct.DomainObject} containingObject the object which
|
||||||
|
* would act as a container
|
||||||
|
* @param {module:openmct.DomainObject} containedObject the object which
|
||||||
|
* would be contained
|
||||||
|
* @returns {boolean} false if this composition should be disallowed
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a composition policy. Composition policies may disallow domain
|
||||||
|
* objects from containing other domain objects.
|
||||||
|
*
|
||||||
|
* @method addPolicy
|
||||||
|
* @param {module:openmct.CompositionAPI~CompositionPolicy} policy
|
||||||
|
* the policy to add
|
||||||
|
* @memberof module:openmct.CompositionAPI#
|
||||||
|
*/
|
||||||
|
CompositionAPI.prototype.addPolicy = function (policy) {
|
||||||
|
this.policies.push(policy);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether or not a domain object is allowed to contain another
|
||||||
|
* domain object.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @method checkPolicy
|
||||||
|
* @param {module:openmct.DomainObject} containingObject the object which
|
||||||
|
* would act as a container
|
||||||
|
* @param {module:openmct.DomainObject} containedObject the object which
|
||||||
|
* would be contained
|
||||||
|
* @returns {boolean} false if this composition should be disallowed
|
||||||
|
|
||||||
|
* @param {module:openmct.CompositionAPI~CompositionPolicy} policy
|
||||||
|
* the policy to add
|
||||||
|
* @memberof module:openmct.CompositionAPI#
|
||||||
|
*/
|
||||||
|
CompositionAPI.prototype.checkPolicy = function (container, containee) {
|
||||||
|
return this.policies.every(function (policy) {
|
||||||
|
return policy(container, containee);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return CompositionAPI;
|
||||||
|
});
|
231
src/api/composition/CompositionCollection.js
Normal file
231
src/api/composition/CompositionCollection.js
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'EventEmitter',
|
||||||
|
'lodash',
|
||||||
|
'../objects/object-utils'
|
||||||
|
], function (
|
||||||
|
EventEmitter,
|
||||||
|
_,
|
||||||
|
objectUtils
|
||||||
|
) {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A CompositionCollection represents the list of domain objects contained
|
||||||
|
* by another domain object. It provides methods for loading this
|
||||||
|
* list asynchronously, and for modifying this list.
|
||||||
|
*
|
||||||
|
* @interface CompositionCollection
|
||||||
|
* @param {module:openmct.DomainObject} domainObject the domain object
|
||||||
|
* whose composition will be contained
|
||||||
|
* @param {module:openmct.CompositionProvider} provider the provider
|
||||||
|
* to use to retrieve other domain objects
|
||||||
|
* @param {module:openmct.CompositionAPI} api the composition API, for
|
||||||
|
* policy checks
|
||||||
|
* @memberof module:openmct
|
||||||
|
* @augments EventEmitter
|
||||||
|
*/
|
||||||
|
function CompositionCollection(domainObject, provider, api) {
|
||||||
|
EventEmitter.call(this);
|
||||||
|
this.domainObject = domainObject;
|
||||||
|
this.provider = provider;
|
||||||
|
this.api = api;
|
||||||
|
if (this.provider.on) {
|
||||||
|
this.provider.on(
|
||||||
|
this.domainObject,
|
||||||
|
'add',
|
||||||
|
this.onProviderAdd,
|
||||||
|
this
|
||||||
|
);
|
||||||
|
this.provider.on(
|
||||||
|
this.domainObject,
|
||||||
|
'remove',
|
||||||
|
this.onProviderRemove,
|
||||||
|
this
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CompositionCollection.prototype = Object.create(EventEmitter.prototype);
|
||||||
|
|
||||||
|
CompositionCollection.prototype.onProviderAdd = function (child) {
|
||||||
|
this.add(child, true);
|
||||||
|
};
|
||||||
|
|
||||||
|
CompositionCollection.prototype.onProviderRemove = function (child) {
|
||||||
|
this.remove(child, true);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the index of a domain object within this composition. If the
|
||||||
|
* domain object is not contained here, -1 will be returned.
|
||||||
|
*
|
||||||
|
* A call to [load]{@link module:openmct.CompositionCollection#load}
|
||||||
|
* must have resolved before using this method.
|
||||||
|
*
|
||||||
|
* @param {module:openmct.DomainObject} child the domain object for which
|
||||||
|
* an index should be retrieved
|
||||||
|
* @returns {number} the index of that domain object
|
||||||
|
* @memberof module:openmct.CompositionCollection#
|
||||||
|
* @name indexOf
|
||||||
|
*/
|
||||||
|
CompositionCollection.prototype.indexOf = function (child) {
|
||||||
|
return _.findIndex(this.loadedChildren, function (other) {
|
||||||
|
return objectUtils.equals(child, other);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the index of a domain object within this composition.
|
||||||
|
*
|
||||||
|
* A call to [load]{@link module:openmct.CompositionCollection#load}
|
||||||
|
* must have resolved before using this method.
|
||||||
|
*
|
||||||
|
* @param {module:openmct.DomainObject} child the domain object for which
|
||||||
|
* containment should be checked
|
||||||
|
* @returns {boolean} true if the domain object is contained here
|
||||||
|
* @memberof module:openmct.CompositionCollection#
|
||||||
|
* @name contains
|
||||||
|
*/
|
||||||
|
CompositionCollection.prototype.contains = function (child) {
|
||||||
|
return this.indexOf(child) !== -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a domain object can be added to this composition.
|
||||||
|
*
|
||||||
|
* @param {module:openmct.DomainObject} child the domain object to add
|
||||||
|
* @memberof module:openmct.CompositionCollection#
|
||||||
|
* @name canContain
|
||||||
|
*/
|
||||||
|
CompositionCollection.prototype.canContain = function (domainObject) {
|
||||||
|
return this.api.checkPolicy(this.domainObject, domainObject);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a domain object to this composition.
|
||||||
|
*
|
||||||
|
* A call to [load]{@link module:openmct.CompositionCollection#load}
|
||||||
|
* must have resolved before using this method.
|
||||||
|
*
|
||||||
|
* @param {module:openmct.DomainObject} child the domain object to add
|
||||||
|
* @param {boolean} skipMutate true if the underlying provider should
|
||||||
|
* not be updated
|
||||||
|
* @memberof module:openmct.CompositionCollection#
|
||||||
|
* @name add
|
||||||
|
*/
|
||||||
|
CompositionCollection.prototype.add = function (child, skipMutate) {
|
||||||
|
if (!this.loadedChildren) {
|
||||||
|
throw new Error("Must load composition before you can add!");
|
||||||
|
}
|
||||||
|
if (!this.canContain(child)) {
|
||||||
|
throw new Error("This object cannot contain that object.");
|
||||||
|
}
|
||||||
|
if (this.contains(child)) {
|
||||||
|
if (skipMutate) {
|
||||||
|
return; // don't add twice, don't error.
|
||||||
|
}
|
||||||
|
throw new Error("Unable to add child: already in composition");
|
||||||
|
}
|
||||||
|
this.loadedChildren.push(child);
|
||||||
|
this.emit('add', child);
|
||||||
|
if (!skipMutate) {
|
||||||
|
// add after we have added.
|
||||||
|
this.provider.add(this.domainObject, child);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the domain objects in this composition.
|
||||||
|
*
|
||||||
|
* @returns {Promise.<Array.<module:openmct.DomainObject>>} a promise for
|
||||||
|
* the domain objects in this composition
|
||||||
|
* @memberof {module:openmct.CompositionCollection#}
|
||||||
|
* @name load
|
||||||
|
*/
|
||||||
|
CompositionCollection.prototype.load = function () {
|
||||||
|
return this.provider.load(this.domainObject)
|
||||||
|
.then(function (children) {
|
||||||
|
this.loadedChildren = [];
|
||||||
|
children.map(function (c) {
|
||||||
|
this.add(c, true);
|
||||||
|
}, this);
|
||||||
|
this.emit('load');
|
||||||
|
return this.loadedChildren.slice();
|
||||||
|
}.bind(this));
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a domain object from this composition.
|
||||||
|
*
|
||||||
|
* A call to [load]{@link module:openmct.CompositionCollection#load}
|
||||||
|
* must have resolved before using this method.
|
||||||
|
*
|
||||||
|
* @param {module:openmct.DomainObject} child the domain object to remove
|
||||||
|
* @param {boolean} skipMutate true if the underlying provider should
|
||||||
|
* not be updated
|
||||||
|
* @memberof module:openmct.CompositionCollection#
|
||||||
|
* @name remove
|
||||||
|
*/
|
||||||
|
CompositionCollection.prototype.remove = function (child, skipMutate) {
|
||||||
|
if (!this.contains(child)) {
|
||||||
|
if (skipMutate) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new Error("Unable to remove child: not found in composition");
|
||||||
|
}
|
||||||
|
var index = this.indexOf(child);
|
||||||
|
var removed = this.loadedChildren.splice(index, 1)[0];
|
||||||
|
this.emit('remove', index, child);
|
||||||
|
if (!skipMutate) {
|
||||||
|
// trigger removal after we have internally removed it.
|
||||||
|
this.provider.remove(this.domainObject, removed);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop using this composition collection. This will release any resources
|
||||||
|
* associated with this collection.
|
||||||
|
* @name destroy
|
||||||
|
* @memberof module:openmct.CompositionCollection#
|
||||||
|
*/
|
||||||
|
CompositionCollection.prototype.destroy = function () {
|
||||||
|
if (this.provider.off) {
|
||||||
|
this.provider.off(
|
||||||
|
this.domainObject,
|
||||||
|
'add',
|
||||||
|
this.onProviderAdd,
|
||||||
|
this
|
||||||
|
);
|
||||||
|
this.provider.off(
|
||||||
|
this.domainObject,
|
||||||
|
'remove',
|
||||||
|
this.onProviderRemove,
|
||||||
|
this
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return CompositionCollection;
|
||||||
|
});
|
150
src/api/composition/DefaultCompositionProvider.js
Normal file
150
src/api/composition/DefaultCompositionProvider.js
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'lodash',
|
||||||
|
'EventEmitter',
|
||||||
|
'../objects/ObjectAPI',
|
||||||
|
'../objects/object-utils'
|
||||||
|
], function (
|
||||||
|
_,
|
||||||
|
EventEmitter,
|
||||||
|
ObjectAPI,
|
||||||
|
objectUtils
|
||||||
|
) {
|
||||||
|
/**
|
||||||
|
* A CompositionProvider provides the underlying implementation of
|
||||||
|
* composition-related behavior for certain types of domain object.
|
||||||
|
*
|
||||||
|
* @interface CompositionProvider
|
||||||
|
* @memberof module:openmct
|
||||||
|
* @augments EventEmitter
|
||||||
|
*/
|
||||||
|
|
||||||
|
function makeEventName(domainObject, event) {
|
||||||
|
return event + ':' + objectUtils.makeKeyString(domainObject.key);
|
||||||
|
}
|
||||||
|
|
||||||
|
function DefaultCompositionProvider() {
|
||||||
|
EventEmitter.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
DefaultCompositionProvider.prototype =
|
||||||
|
Object.create(EventEmitter.prototype);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this provider should be used to load composition for a
|
||||||
|
* particular domain object.
|
||||||
|
* @param {module:openmct.DomainObject} domainObject the domain object
|
||||||
|
* to check
|
||||||
|
* @returns {boolean} true if this provider can provide
|
||||||
|
* composition for a given domain object
|
||||||
|
* @memberof module:openmct.CompositionProvider#
|
||||||
|
* @method appliesTo
|
||||||
|
*/
|
||||||
|
DefaultCompositionProvider.prototype.appliesTo = function (domainObject) {
|
||||||
|
return !!domainObject.composition;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load any domain objects contained in the composition of this domain
|
||||||
|
* object.
|
||||||
|
* @param {module:openmct.DomainObjcet} domainObject the domain object
|
||||||
|
* for which to load composition
|
||||||
|
* @returns {Promise.<Array.<module:openmct.DomainObject>>} a promise for
|
||||||
|
* the domain objects in this composition
|
||||||
|
* @memberof module:openmct.CompositionProvider#
|
||||||
|
* @method load
|
||||||
|
*/
|
||||||
|
DefaultCompositionProvider.prototype.load = function (domainObject) {
|
||||||
|
return Promise.all(domainObject.composition.map(ObjectAPI.get));
|
||||||
|
};
|
||||||
|
|
||||||
|
DefaultCompositionProvider.prototype.on = function (
|
||||||
|
domainObject,
|
||||||
|
event,
|
||||||
|
listener,
|
||||||
|
context
|
||||||
|
) {
|
||||||
|
// these can likely be passed through to the mutation service instead
|
||||||
|
// of using an eventemitter.
|
||||||
|
this.addListener(
|
||||||
|
makeEventName(domainObject, event),
|
||||||
|
listener,
|
||||||
|
context
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
DefaultCompositionProvider.prototype.off = function (
|
||||||
|
domainObject,
|
||||||
|
event,
|
||||||
|
listener,
|
||||||
|
context
|
||||||
|
) {
|
||||||
|
// these can likely be passed through to the mutation service instead
|
||||||
|
// of using an eventemitter.
|
||||||
|
this.removeListener(
|
||||||
|
makeEventName(domainObject, event),
|
||||||
|
listener,
|
||||||
|
context
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a domain object from another domain object's composition.
|
||||||
|
*
|
||||||
|
* This method is optional; if not present, adding to a domain object's
|
||||||
|
* composition using this provider will be disallowed.
|
||||||
|
*
|
||||||
|
* @param {module:openmct.DomainObject} domainObject the domain object
|
||||||
|
* which should have its composition modified
|
||||||
|
* @param {module:openmct.DomainObject} child the domain object to remove
|
||||||
|
* @memberof module:openmct.CompositionProvider#
|
||||||
|
* @method remove
|
||||||
|
*/
|
||||||
|
DefaultCompositionProvider.prototype.remove = function (domainObject, child) {
|
||||||
|
// TODO: this needs to be synchronized via mutation
|
||||||
|
var index = domainObject.composition.indexOf(child);
|
||||||
|
domainObject.composition.splice(index, 1);
|
||||||
|
this.emit(makeEventName(domainObject, 'remove'), child);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a domain object to another domain object's composition.
|
||||||
|
*
|
||||||
|
* This method is optional; if not present, adding to a domain object's
|
||||||
|
* composition using this provider will be disallowed.
|
||||||
|
*
|
||||||
|
* @param {module:openmct.DomainObject} domainObject the domain object
|
||||||
|
* which should have its composition modified
|
||||||
|
* @param {module:openmct.DomainObject} child the domain object to add
|
||||||
|
* @memberof module:openmct.CompositionProvider#
|
||||||
|
* @method add
|
||||||
|
*/
|
||||||
|
DefaultCompositionProvider.prototype.add = function (domainObject, child) {
|
||||||
|
// TODO: this needs to be synchronized via mutation
|
||||||
|
domainObject.composition.push(child.key);
|
||||||
|
this.emit(makeEventName(domainObject, 'add'), child);
|
||||||
|
};
|
||||||
|
|
||||||
|
return DefaultCompositionProvider;
|
||||||
|
});
|
128
src/api/objects/LegacyObjectAPIInterceptor.js
Normal file
128
src/api/objects/LegacyObjectAPIInterceptor.js
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'./object-utils',
|
||||||
|
'./objectEventEmitter'
|
||||||
|
], function (
|
||||||
|
utils,
|
||||||
|
objectEventEmitter
|
||||||
|
) {
|
||||||
|
function ObjectServiceProvider(objectService, instantiate, topic) {
|
||||||
|
this.objectService = objectService;
|
||||||
|
this.instantiate = instantiate;
|
||||||
|
|
||||||
|
this.generalTopic = topic('mutation');
|
||||||
|
this.bridgeEventBuses();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bridges old and new style mutation events to provide compatibility between the two APIs
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
ObjectServiceProvider.prototype.bridgeEventBuses = function () {
|
||||||
|
var removeGeneralTopicListener;
|
||||||
|
var handleLegacyMutation;
|
||||||
|
|
||||||
|
var handleMutation = function (newStyleObject) {
|
||||||
|
var keyString = utils.makeKeyString(newStyleObject.key);
|
||||||
|
var oldStyleObject = this.instantiate(utils.toOldFormat(newStyleObject), keyString);
|
||||||
|
|
||||||
|
// Don't trigger self
|
||||||
|
removeGeneralTopicListener();
|
||||||
|
|
||||||
|
oldStyleObject.getCapability('mutation').mutate(function () {
|
||||||
|
return utils.toOldFormat(newStyleObject);
|
||||||
|
});
|
||||||
|
|
||||||
|
removeGeneralTopicListener = this.generalTopic.listen(handleLegacyMutation);
|
||||||
|
}.bind(this);
|
||||||
|
|
||||||
|
handleLegacyMutation = function (legacyObject) {
|
||||||
|
var newStyleObject = utils.toNewFormat(legacyObject.getModel(), legacyObject.getId());
|
||||||
|
|
||||||
|
//Don't trigger self
|
||||||
|
objectEventEmitter.off('mutation', handleMutation);
|
||||||
|
objectEventEmitter.emit(newStyleObject.key.identifier + ":*", newStyleObject);
|
||||||
|
objectEventEmitter.on('mutation', handleMutation);
|
||||||
|
}.bind(this);
|
||||||
|
|
||||||
|
objectEventEmitter.on('mutation', handleMutation);
|
||||||
|
removeGeneralTopicListener = this.generalTopic.listen(handleLegacyMutation);
|
||||||
|
};
|
||||||
|
|
||||||
|
ObjectServiceProvider.prototype.save = function (object) {
|
||||||
|
var key = object.key;
|
||||||
|
|
||||||
|
return object.getCapability('persistence')
|
||||||
|
.persist()
|
||||||
|
.then(function () {
|
||||||
|
return utils.toNewFormat(object, key);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
ObjectServiceProvider.prototype.delete = function (object) {
|
||||||
|
// TODO!
|
||||||
|
};
|
||||||
|
|
||||||
|
ObjectServiceProvider.prototype.get = function (key) {
|
||||||
|
var keyString = utils.makeKeyString(key);
|
||||||
|
return this.objectService.getObjects([keyString])
|
||||||
|
.then(function (results) {
|
||||||
|
var model = results[keyString].getModel();
|
||||||
|
return utils.toNewFormat(model, key);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Injects new object API as a decorator so that it hijacks all requests.
|
||||||
|
// Object providers implemented on new API should just work, old API should just work, many things may break.
|
||||||
|
function LegacyObjectAPIInterceptor(openmct, ROOTS, instantiate, topic, objectService) {
|
||||||
|
this.getObjects = function (keys) {
|
||||||
|
var results = {},
|
||||||
|
promises = keys.map(function (keyString) {
|
||||||
|
var key = utils.parseKeyString(keyString);
|
||||||
|
return openmct.objects.get(key)
|
||||||
|
.then(function (object) {
|
||||||
|
object = utils.toOldFormat(object);
|
||||||
|
results[keyString] = instantiate(object, keyString);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return Promise.all(promises)
|
||||||
|
.then(function () {
|
||||||
|
return results;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
openmct.objects.supersecretSetFallbackProvider(
|
||||||
|
new ObjectServiceProvider(objectService, instantiate, topic)
|
||||||
|
);
|
||||||
|
|
||||||
|
ROOTS.forEach(function (r) {
|
||||||
|
openmct.objects.addRoot(utils.parseKeyString(r.id));
|
||||||
|
});
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
return LegacyObjectAPIInterceptor;
|
||||||
|
});
|
90
src/api/objects/MutableObject.js
Normal file
90
src/api/objects/MutableObject.js
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'lodash',
|
||||||
|
'./objectEventEmitter'
|
||||||
|
], function (
|
||||||
|
_,
|
||||||
|
objectEventEmitter
|
||||||
|
) {
|
||||||
|
var ANY_OBJECT_EVENT = "mutation";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The MutableObject wraps a DomainObject and provides getters and
|
||||||
|
* setters for
|
||||||
|
* @param eventEmitter
|
||||||
|
* @param object
|
||||||
|
* @interface MutableObject
|
||||||
|
*/
|
||||||
|
function MutableObject(object) {
|
||||||
|
this.object = object;
|
||||||
|
this.unlisteners = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
function qualifiedEventName(object, eventName) {
|
||||||
|
return [object.key.identifier, eventName].join(':');
|
||||||
|
}
|
||||||
|
|
||||||
|
MutableObject.prototype.stopListening = function () {
|
||||||
|
this.unlisteners.forEach(function (unlisten) {
|
||||||
|
unlisten();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Observe changes to this domain object.
|
||||||
|
* @param {string} path the property to observe
|
||||||
|
* @param {Function} callback a callback to invoke when new values for
|
||||||
|
* this property are observed
|
||||||
|
* @method on
|
||||||
|
* @memberof module:openmct.MutableObject#
|
||||||
|
*/
|
||||||
|
MutableObject.prototype.on = function (path, callback) {
|
||||||
|
var fullPath = qualifiedEventName(this.object, path);
|
||||||
|
objectEventEmitter.on(fullPath, callback);
|
||||||
|
this.unlisteners.push(objectEventEmitter.off.bind(objectEventEmitter, fullPath, callback));
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modify this domain object.
|
||||||
|
* @param {string} path the property to modify
|
||||||
|
* @param {*} value the new value for this property
|
||||||
|
* @method set
|
||||||
|
* @memberof module:openmct.MutableObject#
|
||||||
|
*/
|
||||||
|
MutableObject.prototype.set = function (path, value) {
|
||||||
|
|
||||||
|
_.set(this.object, path, value);
|
||||||
|
_.set(this.object, 'modified', Date.now());
|
||||||
|
|
||||||
|
//Emit event specific to property
|
||||||
|
objectEventEmitter.emit(qualifiedEventName(this.object, path), value);
|
||||||
|
//Emit wildcare event
|
||||||
|
objectEventEmitter.emit(qualifiedEventName(this.object, '*'), this.object);
|
||||||
|
|
||||||
|
//Emit a general "any object" event
|
||||||
|
objectEventEmitter.emit(ANY_OBJECT_EVENT, this.object);
|
||||||
|
};
|
||||||
|
|
||||||
|
return MutableObject;
|
||||||
|
});
|
232
src/api/objects/ObjectAPI.js
Normal file
232
src/api/objects/ObjectAPI.js
Normal file
@ -0,0 +1,232 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'lodash',
|
||||||
|
'./object-utils',
|
||||||
|
'./MutableObject'
|
||||||
|
], function (
|
||||||
|
_,
|
||||||
|
utils,
|
||||||
|
MutableObject
|
||||||
|
) {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utilities for loading, saving, and manipulating domain objects.
|
||||||
|
* @interface ObjectAPI
|
||||||
|
* @memberof module:openmct
|
||||||
|
* @implements {module:openmct.ObjectProvider}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function ObjectAPI() {
|
||||||
|
this.providers = {};
|
||||||
|
this.rootRegistry = [];
|
||||||
|
this.rootProvider = {
|
||||||
|
'get': function () {
|
||||||
|
return Promise.resolve({
|
||||||
|
name: 'The root object',
|
||||||
|
type: 'root',
|
||||||
|
composition: this.rootRegistry
|
||||||
|
});
|
||||||
|
}.bind(this)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
ObjectAPI.prototype.supersecretSetFallbackProvider = function (p) {
|
||||||
|
this.fallbackProvider = p;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Retrieve the provider for a given key.
|
||||||
|
ObjectAPI.prototype.getProvider = function (key) {
|
||||||
|
if (key.identifier === 'ROOT') {
|
||||||
|
return this.rootProvider;
|
||||||
|
}
|
||||||
|
return this.providers[key.namespace] || this.fallbackProvider;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a new object provider for a particular namespace.
|
||||||
|
*
|
||||||
|
* @param {string} namespace the namespace for which to provide objects
|
||||||
|
* @param {module:openmct.ObjectProvider} provider the provider which
|
||||||
|
* will handle loading domain objects from this namespace
|
||||||
|
* @memberof {module:openmct.ObjectAPI#}
|
||||||
|
* @name addProvider
|
||||||
|
*/
|
||||||
|
ObjectAPI.prototype.addProvider = function (namespace, provider) {
|
||||||
|
this.providers[namespace] = provider;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the ability to read, write, and delete domain objects.
|
||||||
|
*
|
||||||
|
* When registering a new object provider, all methods on this interface
|
||||||
|
* are optional.
|
||||||
|
*
|
||||||
|
* @interface ObjectProvider
|
||||||
|
* @memberof module:openmct
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save this domain object in its current state.
|
||||||
|
*
|
||||||
|
* @method save
|
||||||
|
* @memberof module:openmct.ObjectProvider#
|
||||||
|
* @param {module:openmct.DomainObject} domainObject the domain object to
|
||||||
|
* save
|
||||||
|
* @returns {Promise} a promise which will resolve when the domain object
|
||||||
|
* has been saved, or be rejected if it cannot be saved
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete this domain object.
|
||||||
|
*
|
||||||
|
* @method delete
|
||||||
|
* @memberof module:openmct.ObjectProvider#
|
||||||
|
* @param {module:openmct.DomainObject} domainObject the domain object to
|
||||||
|
* delete
|
||||||
|
* @returns {Promise} a promise which will resolve when the domain object
|
||||||
|
* has been deleted, or be rejected if it cannot be deleted
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a domain object.
|
||||||
|
*
|
||||||
|
* @method get
|
||||||
|
* @memberof module:openmct.ObjectProvider#
|
||||||
|
* @param {string} key the key for the domain object to load
|
||||||
|
* @returns {Promise} a promise which will resolve when the domain object
|
||||||
|
* has been saved, or be rejected if it cannot be saved
|
||||||
|
*/
|
||||||
|
|
||||||
|
[
|
||||||
|
'save',
|
||||||
|
'delete',
|
||||||
|
'get'
|
||||||
|
].forEach(function (method) {
|
||||||
|
ObjectAPI.prototype[method] = function () {
|
||||||
|
var key = arguments[0],
|
||||||
|
provider = this.getProvider(key);
|
||||||
|
|
||||||
|
if (!provider) {
|
||||||
|
throw new Error('No Provider Matched');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!provider[method]) {
|
||||||
|
throw new Error('Provider does not support [' + method + '].');
|
||||||
|
}
|
||||||
|
|
||||||
|
return provider[method].apply(provider, arguments);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a root-level object.
|
||||||
|
* @param {module:openmct.DomainObject} domainObject the root-level object
|
||||||
|
* to add.
|
||||||
|
* @method addRoot
|
||||||
|
* @memberof module:openmct.ObjectAPI#
|
||||||
|
*/
|
||||||
|
ObjectAPI.prototype.addRoot = function (key) {
|
||||||
|
this.rootRegistry.unshift(key);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a root-level object.
|
||||||
|
* @param {module:openmct.ObjectAPI~Identifier} id the identifier of the
|
||||||
|
* root-level object to remove.
|
||||||
|
* @method removeRoot
|
||||||
|
* @memberof module:openmct.ObjectAPI#
|
||||||
|
*/
|
||||||
|
ObjectAPI.prototype.removeRoot = function (key) {
|
||||||
|
this.rootRegistry = this.rootRegistry.filter(function (k) {
|
||||||
|
return (
|
||||||
|
k.identifier !== key.identifier ||
|
||||||
|
k.namespace !== key.namespace
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modify a domain object.
|
||||||
|
* @param {module:openmct.DomainObject} object the object to mutate
|
||||||
|
* @param {string} path the property to modify
|
||||||
|
* @param {*} value the new value for this property
|
||||||
|
* @method mutate
|
||||||
|
* @memberof module:openmct.ObjectAPI#
|
||||||
|
*/
|
||||||
|
ObjectAPI.prototype.mutate = function (domainObject, path, value) {
|
||||||
|
return new MutableObject(domainObject).set(path, value);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Observe changes to a domain object.
|
||||||
|
* @param {module:openmct.DomainObject} object the object to observe
|
||||||
|
* @param {string} path the property to observe
|
||||||
|
* @param {Function} callback a callback to invoke when new values for
|
||||||
|
* this property are observed
|
||||||
|
* @method observe
|
||||||
|
* @memberof module:openmct.ObjectAPI#
|
||||||
|
*/
|
||||||
|
ObjectAPI.prototype.observe = function (domainObject, path, callback) {
|
||||||
|
return new MutableObject(domainObject).on(path, callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uniquely identifies a domain object.
|
||||||
|
*
|
||||||
|
* @typedef Identifier
|
||||||
|
* @memberof module:openmct.ObjectAPI~
|
||||||
|
* @property {string} namespace the namespace to/from which this domain
|
||||||
|
* object should be loaded/stored.
|
||||||
|
* @property {string} key a unique identifier for the domain object
|
||||||
|
* within that namespace
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A domain object is an entity of relevance to a user's workflow, that
|
||||||
|
* should appear as a distinct and meaningful object within the user
|
||||||
|
* interface. Examples of domain objects are folders, telemetry sensors,
|
||||||
|
* and so forth.
|
||||||
|
*
|
||||||
|
* A few common properties are defined for domain objects. Beyond these,
|
||||||
|
* individual types of domain objects may add more as they see fit.
|
||||||
|
*
|
||||||
|
* @property {module:openmct.ObjectAPI~Identifier} identifier a key/namespace pair which
|
||||||
|
* uniquely identifies this domain object
|
||||||
|
* @property {string} type the type of domain object
|
||||||
|
* @property {string} name the human-readable name for this domain object
|
||||||
|
* @property {string} [creator] the user name of the creator of this domain
|
||||||
|
* object
|
||||||
|
* @property {number} [modified] the time, in milliseconds since the UNIX
|
||||||
|
* epoch, at which this domain object was last modified
|
||||||
|
* @property {module:openmct.ObjectAPI~Identifier[]} [composition] if
|
||||||
|
* present, this will be used by the default composition provider
|
||||||
|
* to load domain objects
|
||||||
|
* @typedef DomainObject
|
||||||
|
* @memberof module:openmct
|
||||||
|
*/
|
||||||
|
|
||||||
|
return ObjectAPI;
|
||||||
|
});
|
51
src/api/objects/bundle.js
Normal file
51
src/api/objects/bundle.js
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
/*global define*/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'./LegacyObjectAPIInterceptor',
|
||||||
|
'legacyRegistry'
|
||||||
|
], function (
|
||||||
|
LegacyObjectAPIInterceptor,
|
||||||
|
legacyRegistry
|
||||||
|
) {
|
||||||
|
legacyRegistry.register('src/api/objects', {
|
||||||
|
name: 'Object API',
|
||||||
|
description: 'The public Objects API',
|
||||||
|
extensions: {
|
||||||
|
components: [
|
||||||
|
{
|
||||||
|
provides: "objectService",
|
||||||
|
type: "decorator",
|
||||||
|
priority: "mandatory",
|
||||||
|
implementation: LegacyObjectAPIInterceptor,
|
||||||
|
depends: [
|
||||||
|
"openmct",
|
||||||
|
"roots[]",
|
||||||
|
"instantiate",
|
||||||
|
"topic"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
109
src/api/objects/object-utils.js
Normal file
109
src/api/objects/object-utils.js
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
|
||||||
|
], function (
|
||||||
|
|
||||||
|
) {
|
||||||
|
|
||||||
|
// take a key string and turn it into a key object
|
||||||
|
// 'scratch:root' ==> {namespace: 'scratch', identifier: 'root'}
|
||||||
|
var parseKeyString = function (key) {
|
||||||
|
if (typeof key === 'object') {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
var namespace = '',
|
||||||
|
identifier = key;
|
||||||
|
for (var i = 0, escaped = false; i < key.length; i++) {
|
||||||
|
if (escaped) {
|
||||||
|
escaped = false;
|
||||||
|
namespace += key[i];
|
||||||
|
} else {
|
||||||
|
if (key[i] === "\\") {
|
||||||
|
escaped = true;
|
||||||
|
} else if (key[i] === ":") {
|
||||||
|
// namespace = key.slice(0, i);
|
||||||
|
identifier = key.slice(i + 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
namespace += key[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key === namespace) {
|
||||||
|
namespace = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
namespace: namespace,
|
||||||
|
identifier: identifier
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// take a key and turn it into a key string
|
||||||
|
// {namespace: 'scratch', identifier: 'root'} ==> 'scratch:root'
|
||||||
|
var makeKeyString = function (key) {
|
||||||
|
if (typeof key === 'string') {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
if (!key.namespace) {
|
||||||
|
return key.identifier;
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
key.namespace.replace(':', '\\:'),
|
||||||
|
key.identifier.replace(':', '\\:')
|
||||||
|
].join(':');
|
||||||
|
};
|
||||||
|
|
||||||
|
// Converts composition to use key strings instead of keys
|
||||||
|
var toOldFormat = function (model) {
|
||||||
|
model = JSON.parse(JSON.stringify(model));
|
||||||
|
delete model.key;
|
||||||
|
if (model.composition) {
|
||||||
|
model.composition = model.composition.map(makeKeyString);
|
||||||
|
}
|
||||||
|
return model;
|
||||||
|
};
|
||||||
|
|
||||||
|
// converts composition to use keys instead of key strings
|
||||||
|
var toNewFormat = function (model, key) {
|
||||||
|
model = JSON.parse(JSON.stringify(model));
|
||||||
|
model.key = key;
|
||||||
|
if (model.composition) {
|
||||||
|
model.composition = model.composition.map(parseKeyString);
|
||||||
|
}
|
||||||
|
return model;
|
||||||
|
};
|
||||||
|
|
||||||
|
var equals = function (a, b) {
|
||||||
|
return makeKeyString(a.key) === makeKeyString(b.key);
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
toOldFormat: toOldFormat,
|
||||||
|
toNewFormat: toNewFormat,
|
||||||
|
makeKeyString: makeKeyString,
|
||||||
|
parseKeyString: parseKeyString,
|
||||||
|
equals: equals
|
||||||
|
};
|
||||||
|
});
|
32
src/api/objects/objectEventEmitter.js
Normal file
32
src/api/objects/objectEventEmitter.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
"EventEmitter"
|
||||||
|
], function (
|
||||||
|
EventEmitter
|
||||||
|
) {
|
||||||
|
/**
|
||||||
|
* Provides a singleton event bus for sharing between objects.
|
||||||
|
*/
|
||||||
|
return new EventEmitter();
|
||||||
|
});
|
318
src/api/telemetry/TelemetryAPI.js
Normal file
318
src/api/telemetry/TelemetryAPI.js
Normal file
@ -0,0 +1,318 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
var key = '114ced6c-deb7-4169-ae71-68c571665514';
|
||||||
|
MCT.objects.getObject([key])
|
||||||
|
.then(function (results) {
|
||||||
|
console.log('got results');
|
||||||
|
return results[key];
|
||||||
|
})
|
||||||
|
.then(function (domainObject) {
|
||||||
|
console.log('got object');
|
||||||
|
MCT.telemetry.subscribe(domainObject, function (datum) {
|
||||||
|
console.log('gotData!', datum);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'lodash',
|
||||||
|
'EventEmitter'
|
||||||
|
], function (
|
||||||
|
_,
|
||||||
|
EventEmitter
|
||||||
|
) {
|
||||||
|
/**
|
||||||
|
* A LimitEvaluator may be used to detect when telemetry values
|
||||||
|
* have exceeded nominal conditions.
|
||||||
|
*
|
||||||
|
* @interface LimitEvaluator
|
||||||
|
* @memberof module:openmct.TelemetryAPI~
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check for any limit violations associated with a telemetry datum.
|
||||||
|
* @method evaluate
|
||||||
|
* @param {*} datum the telemetry datum to evaluate
|
||||||
|
* @param {TelemetryProperty} the property to check for limit violations
|
||||||
|
* @memberof module:openmct.TelemetryAPI~LimitEvaluator
|
||||||
|
* @returns {module:openmct.TelemetryAPI~LimitViolation} metadata about
|
||||||
|
* the limit violation, or undefined if a value is within limits
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A violation of limits defined for a telemetry property.
|
||||||
|
* @typedef LimitViolation
|
||||||
|
* @memberof {module:openmct.TelemetryAPI~}
|
||||||
|
* @property {string} cssclass the class (or space-separated classes) to
|
||||||
|
* apply to display elements for values which violate this limit
|
||||||
|
* @property {string} name the human-readable name for the limit violation
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A TelemetryFormatter converts telemetry values for purposes of
|
||||||
|
* display as text.
|
||||||
|
*
|
||||||
|
* @interface TelemetryFormatter
|
||||||
|
* @memberof module:openmct.TelemetryAPI~
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the 'key' from the datum and format it accordingly to
|
||||||
|
* telemetry metadata in domain object.
|
||||||
|
*
|
||||||
|
* @method format
|
||||||
|
* @memberof module:openmct.TelemetryAPI~TelemetryFormatter#
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// format map is a placeholder until we figure out format service.
|
||||||
|
var FORMAT_MAP = {
|
||||||
|
generic: function (range) {
|
||||||
|
return function (datum) {
|
||||||
|
return datum[range.key];
|
||||||
|
};
|
||||||
|
},
|
||||||
|
enum: function (range) {
|
||||||
|
var enumMap = _.indexBy(range.enumerations, 'value');
|
||||||
|
return function (datum) {
|
||||||
|
try {
|
||||||
|
return enumMap[datum[range.valueKey]].text;
|
||||||
|
} catch (e) {
|
||||||
|
return datum[range.valueKey];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
FORMAT_MAP.number =
|
||||||
|
FORMAT_MAP.float =
|
||||||
|
FORMAT_MAP.integer =
|
||||||
|
FORMAT_MAP.ascii =
|
||||||
|
FORMAT_MAP.generic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes a property which would be found in a datum of telemetry
|
||||||
|
* associated with a particular domain object.
|
||||||
|
*
|
||||||
|
* @typedef TelemetryProperty
|
||||||
|
* @memberof module:openmct.TelemetryAPI~
|
||||||
|
* @property {string} key the name of the property in the datum which
|
||||||
|
* contains this telemetry value
|
||||||
|
* @property {string} name the human-readable name for this property
|
||||||
|
* @property {string} [units] the units associated with this property
|
||||||
|
* @property {boolean} [temporal] true if this property is a timestamp, or
|
||||||
|
* may be otherwise used to order telemetry in a time-like
|
||||||
|
* fashion; default is false
|
||||||
|
* @property {boolean} [numeric] true if the values for this property
|
||||||
|
* can be interpreted plainly as numbers; default is true
|
||||||
|
* @property {boolean} [enumerated] true if this property may have only
|
||||||
|
* certain specific values; default is false
|
||||||
|
* @property {string} [values] for enumerated states, an ordered list
|
||||||
|
* of possible values
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes and bounds requests for telemetry data.
|
||||||
|
*
|
||||||
|
* @typedef TelemetryRequest
|
||||||
|
* @memberof module:openmct.TelemetryAPI~
|
||||||
|
* @property {string} sort the key of the property to sort by. This may
|
||||||
|
* be prefixed with a "+" or a "-" sign to sort in ascending
|
||||||
|
* or descending order respectively. If no prefix is present,
|
||||||
|
* ascending order will be used.
|
||||||
|
* @property {*} start the lower bound for values of the sorting property
|
||||||
|
* @property {*} end the upper bound for values of the sorting property
|
||||||
|
* @property {string[]} strategies symbolic identifiers for strategies
|
||||||
|
* (such as `minmax`) which may be recognized by providers;
|
||||||
|
* these will be tried in order until an appropriate provider
|
||||||
|
* is found
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides telemetry data. To connect to new data sources, new
|
||||||
|
* TelemetryProvider implementations should be
|
||||||
|
* [registered]{@link module:openmct.TelemetryAPI#addProvider}.
|
||||||
|
*
|
||||||
|
* @interface TelemetryProvider
|
||||||
|
* @memberof module:openmct.TelemetryAPI~
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An interface for retrieving telemetry data associated with a domain
|
||||||
|
* object.
|
||||||
|
*
|
||||||
|
* @interface TelemetryAPI
|
||||||
|
* @augments module:openmct.TelemetryAPI~TelemetryProvider
|
||||||
|
* @memberof module:openmct
|
||||||
|
*/
|
||||||
|
function TelemetryAPI() {
|
||||||
|
this.providers = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this provider can supply telemetry data associated with
|
||||||
|
* this domain object.
|
||||||
|
*
|
||||||
|
* @method canProvideTelemetry
|
||||||
|
* @param {module:openmct.DomainObject} domainObject the object for
|
||||||
|
* which telemetry would be provided
|
||||||
|
* @returns {boolean} true if telemetry can be provided
|
||||||
|
* @memberof module:openmct.TelemetryAPI~TelemetryProvider#
|
||||||
|
*/
|
||||||
|
TelemetryAPI.prototype.canProvideTelemetry = function (domainObject) {
|
||||||
|
return this.providers.some(function (provider) {
|
||||||
|
return provider.canProvideTelemetry(domainObject);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a telemetry provider with the telemetry service. This
|
||||||
|
* allows you to connect alternative telemetry sources.
|
||||||
|
* @method addProvider
|
||||||
|
* @memberof module:openmct.TelemetryAPI#
|
||||||
|
* @param {module:openmct.TelemetryAPI~TelemetryProvider} provider the new
|
||||||
|
* telemetry provider
|
||||||
|
* @param {string} [strategy] the request strategy supported by
|
||||||
|
* this provider. If omitted, this will be used as a
|
||||||
|
* default provider (when no strategy is requested or no
|
||||||
|
* matching strategy is found.)
|
||||||
|
*/
|
||||||
|
TelemetryAPI.prototype.addProvider = function (provider) {
|
||||||
|
this.providers.push(provider);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request historical telemetry for a domain object.
|
||||||
|
* The `options` argument allows you to specify filters
|
||||||
|
* (start, end, etc.), sort order, and strategies for retrieving
|
||||||
|
* telemetry (aggregation, latest available, etc.).
|
||||||
|
*
|
||||||
|
* @method request
|
||||||
|
* @memberof module:openmct.TelemetryAPI~TelemetryProvider#
|
||||||
|
* @param {module:openmct.DomainObject} domainObject the object
|
||||||
|
* which has associated telemetry
|
||||||
|
* @param {module:openmct.TelemetryAPI~TelemetryRequest} options
|
||||||
|
* options for this historical request
|
||||||
|
* @returns {Promise.<object[]>} a promise for an array of
|
||||||
|
* telemetry data
|
||||||
|
*/
|
||||||
|
TelemetryAPI.prototype.request = function (domainObject, options) {
|
||||||
|
var provider = this.providers.reduce(function (result, p) {
|
||||||
|
return (p.canProvideTelemetry(domainObject)) ?
|
||||||
|
p : result;
|
||||||
|
}, undefined);
|
||||||
|
return provider ?
|
||||||
|
provider.request(domainObject, options) :
|
||||||
|
Promise.reject([]);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscribe to realtime telemetry for a specific domain object.
|
||||||
|
* The callback will be called whenever data is received from a
|
||||||
|
* realtime provider.
|
||||||
|
*
|
||||||
|
* @method subscribe
|
||||||
|
* @memberof module:openmct.TelemetryAPI~TelemetryProvider#
|
||||||
|
* @param {module:openmct.DomainObject} domainObject the object
|
||||||
|
* which has associated telemetry
|
||||||
|
* @param {Function} callback the callback to invoke with new data, as
|
||||||
|
* it becomes available
|
||||||
|
* @param {module:openmct.TelemetryAPI~TelemetryRequest} options
|
||||||
|
* options for this request
|
||||||
|
* @returns {Function} a function which may be called to terminate
|
||||||
|
* the subscription
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all telemetry properties defined for this
|
||||||
|
* domain object.
|
||||||
|
*
|
||||||
|
* @param {module:openmct.DomainObject} domainObject the domain
|
||||||
|
* object for which to request telemetry
|
||||||
|
* @returns {module:openmct.TelemetryAPI~TelemetryProperty[]}
|
||||||
|
* telemetry metadata
|
||||||
|
* @method properties
|
||||||
|
* @memberof module:openmct.TelemetryAPI~TelemetryProvider#
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Telemetry formatters help you format telemetry values for
|
||||||
|
* display. Under the covers, they use telemetry metadata to
|
||||||
|
* interpret your telemetry data, and then they use the format API
|
||||||
|
* to format that data for display.
|
||||||
|
*
|
||||||
|
* This method is optional.
|
||||||
|
* If a provider does not implement this method, it is presumed
|
||||||
|
* that all telemetry associated with this domain object can
|
||||||
|
* be formatted correctly by string coercion.
|
||||||
|
*
|
||||||
|
* @param {module:openmct.DomainObject} domainObject the domain
|
||||||
|
* object for which to format telemetry
|
||||||
|
* @returns {module:openmct.TelemetryAPI~TelemetryFormatter}
|
||||||
|
* @method formatter
|
||||||
|
* @memberof module:openmct.TelemetryAPI~TelemetryProvider#
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a limit evaluator for this domain object.
|
||||||
|
* Limit Evaluators help you evaluate limit and alarm status of individual telemetry datums for display purposes without having to interact directly with the Limit API.
|
||||||
|
*
|
||||||
|
* This method is optional.
|
||||||
|
* If a provider does not implement this method, it is presumed
|
||||||
|
* that no limits are defined for this domain object's telemetry.
|
||||||
|
*
|
||||||
|
* @param {module:openmct.DomainObject} domainObject the domain
|
||||||
|
* object for which to evaluate limits
|
||||||
|
* @returns {module:openmct.TelemetryAPI~LimitEvaluator}
|
||||||
|
* @method limitEvaluator
|
||||||
|
* @memberof module:openmct.TelemetryAPI~TelemetryProvider#
|
||||||
|
*/
|
||||||
|
_.forEach({
|
||||||
|
request: undefined,
|
||||||
|
subscribe: undefined,
|
||||||
|
properties: [],
|
||||||
|
formatter: undefined,
|
||||||
|
limitEvaluator: undefined
|
||||||
|
}, function (defaultValue, method) {
|
||||||
|
TelemetryAPI.prototype[method] = function (domainObject) {
|
||||||
|
var provider = this.providers.reduce(function (result, p) {
|
||||||
|
return (p.canProvideTelemetry(domainObject)) ?
|
||||||
|
p : result;
|
||||||
|
}, undefined);
|
||||||
|
return provider ?
|
||||||
|
provider[method].apply(provider, arguments) :
|
||||||
|
defaultValue;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return TelemetryAPI;
|
||||||
|
});
|
45
src/api/telemetry/bundle.js
Normal file
45
src/api/telemetry/bundle.js
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'./TelemetryAPI',
|
||||||
|
'legacyRegistry'
|
||||||
|
], function (
|
||||||
|
TelemetryAPI,
|
||||||
|
legacyRegistry
|
||||||
|
) {
|
||||||
|
legacyRegistry.register('api/telemetry-api', {
|
||||||
|
name: 'Telemetry API',
|
||||||
|
description: 'The public Telemetry API',
|
||||||
|
extensions: {
|
||||||
|
runs: [
|
||||||
|
{
|
||||||
|
key: "TelemetryAPI",
|
||||||
|
implementation: TelemetryAPI,
|
||||||
|
depends: [
|
||||||
|
'formatService'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
51
src/api/types/TypeRegistry.js
Normal file
51
src/api/types/TypeRegistry.js
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([], function () {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A TypeRegistry maintains the definitions for different types
|
||||||
|
* that domain objects may have.
|
||||||
|
* @interface TypeRegistry
|
||||||
|
* @memberof module:openmct
|
||||||
|
*/
|
||||||
|
function TypeRegistry() {
|
||||||
|
this.types = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a new type of view.
|
||||||
|
*
|
||||||
|
* @param {string} typeKey a string identifier for this type
|
||||||
|
* @param {module:openmct.Type} type the type to add
|
||||||
|
* @method addProvider
|
||||||
|
* @memberof module:openmct.TypeRegistry#
|
||||||
|
*/
|
||||||
|
TypeRegistry.prototype.addType = function (typeKey, type) {
|
||||||
|
this.types[typeKey] = type;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
return TypeRegistry;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
107
src/api/ui/Dialog.js
Normal file
107
src/api/ui/Dialog.js
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define(['text!./dialog.html', 'zepto'], function (dialogTemplate, $) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A dialog may be displayed to show blocking content to users.
|
||||||
|
* @param {module:openmct.View} view the view to show in the dialog
|
||||||
|
* @param {string} [title] the title for this dialog
|
||||||
|
* @constructor
|
||||||
|
* @memberof module:openmct
|
||||||
|
*/
|
||||||
|
function Dialog(view, title) {
|
||||||
|
this.view = view;
|
||||||
|
this.title = title;
|
||||||
|
this.showing = false;
|
||||||
|
this.enabledState = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display this dialog.
|
||||||
|
* @returns {Promise} a promise that will be resolved if the user
|
||||||
|
* chooses "OK", an rejected if the user chooses "cancel"
|
||||||
|
* @method show
|
||||||
|
* @memberof module:openmct.Dialog#
|
||||||
|
*/
|
||||||
|
Dialog.prototype.show = function () {
|
||||||
|
if (this.showing) {
|
||||||
|
throw new Error("Dialog already showing.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var $body = $('body');
|
||||||
|
var $dialog = $(dialogTemplate);
|
||||||
|
var $contents = $dialog.find('.contents .editor');
|
||||||
|
var $close = $dialog.find('.close');
|
||||||
|
|
||||||
|
var $ok = $dialog.find('.ok');
|
||||||
|
var $cancel = $dialog.find('.cancel');
|
||||||
|
|
||||||
|
if (this.title) {
|
||||||
|
$dialog.find('.title').text(this.title);
|
||||||
|
}
|
||||||
|
|
||||||
|
$body.append($dialog);
|
||||||
|
this.view.show($contents[0]);
|
||||||
|
this.$dialog = $dialog;
|
||||||
|
this.$ok = $ok;
|
||||||
|
this.showing = true;
|
||||||
|
|
||||||
|
[$ok, $cancel, $close].forEach(function ($button) {
|
||||||
|
$button.on('click', this.hide.bind(this));
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
$ok.on('click', resolve);
|
||||||
|
$cancel.on('click', reject);
|
||||||
|
$close.on('click', reject);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
Dialog.prototype.hide = function () {
|
||||||
|
if (!this.showing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$dialog.remove();
|
||||||
|
this.view.destroy();
|
||||||
|
this.showing = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get or set the "enabled" state of the OK button for this dialog.
|
||||||
|
* @param {boolean} [state] true to enable, false to disable
|
||||||
|
* @returns {boolean} true if enabled, false if disabled
|
||||||
|
* @method enabled
|
||||||
|
* @memberof module:openmct.Dialog#
|
||||||
|
*/
|
||||||
|
Dialog.prototype.enabled = function (state) {
|
||||||
|
if (state !== undefined) {
|
||||||
|
this.enabledState = state;
|
||||||
|
if (this.showing) {
|
||||||
|
this.$ok.toggleClass('disabled', !state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.enabledState;
|
||||||
|
};
|
||||||
|
|
||||||
|
return Dialog;
|
||||||
|
});
|
68
src/api/ui/GestureAPI.js
Normal file
68
src/api/ui/GestureAPI.js
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([], function () {
|
||||||
|
/**
|
||||||
|
* Allows support for common user actions to be attached to views.
|
||||||
|
* @interface GestureAPI
|
||||||
|
* @memberof module:openmct
|
||||||
|
*/
|
||||||
|
function GestureAPI(selectGesture, contextMenuGesture) {
|
||||||
|
this.selectGesture = selectGesture;
|
||||||
|
this.contextMenuGesture = contextMenuGesture;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Designate an HTML element as selectable, and associated with a
|
||||||
|
* particular object.
|
||||||
|
*
|
||||||
|
* @param {HTMLElement} htmlElement the element to make selectable
|
||||||
|
* @param {*} item the object which should become selected when this
|
||||||
|
* element is clicked.
|
||||||
|
* @returns {Function} a function to remove selectability from this
|
||||||
|
* HTML element.
|
||||||
|
* @method selectable
|
||||||
|
* @memberof module:openmct.GestureAPI#
|
||||||
|
*/
|
||||||
|
GestureAPI.prototype.selectable = function (htmlElement, item) {
|
||||||
|
return this.selectGesture.apply(htmlElement, item);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Designate an HTML element as having a context menu associated with
|
||||||
|
* the provided item.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {HTMLElement} htmlElement the element to make selectable
|
||||||
|
* @param {*} item the object for which a context menu should appear
|
||||||
|
* @returns {Function} a function to remove this geture from this
|
||||||
|
* HTML element.
|
||||||
|
* @method selectable
|
||||||
|
* @memberof module:openmct.GestureAPI#
|
||||||
|
*/
|
||||||
|
GestureAPI.prototype.contextMenu = function (htmlElement, item) {
|
||||||
|
return this.contextMenuGesture.apply(htmlElement, item);
|
||||||
|
};
|
||||||
|
|
||||||
|
return GestureAPI;
|
||||||
|
});
|
21
src/api/ui/dialog.html
Normal file
21
src/api/ui/dialog.html
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<div class="abs overlay">
|
||||||
|
<div class="abs blocker"></div>
|
||||||
|
<div class="abs holder">
|
||||||
|
<a class="clk-icon icon ui-symbol close">x</a>
|
||||||
|
<div class="abs contents">
|
||||||
|
<div class="abs top-bar">
|
||||||
|
<div class="title"></div>
|
||||||
|
<div class="hint"></div>
|
||||||
|
</div>
|
||||||
|
<div class='abs editor'>
|
||||||
|
</div>
|
||||||
|
<div class="abs bottom-bar">
|
||||||
|
<a class='s-btn major ok'>OK</a>
|
||||||
|
<a class='s-btn cancel'>Cancel</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
135
src/defaultRegistry.js
Normal file
135
src/defaultRegistry.js
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'legacyRegistry',
|
||||||
|
|
||||||
|
'../src/adapter/bundle',
|
||||||
|
'../src/api/objects/bundle',
|
||||||
|
|
||||||
|
'../example/builtins/bundle',
|
||||||
|
'../example/composite/bundle',
|
||||||
|
'../example/eventGenerator/bundle',
|
||||||
|
'../example/export/bundle',
|
||||||
|
'../example/extensions/bundle',
|
||||||
|
'../example/forms/bundle',
|
||||||
|
'../example/generator/bundle',
|
||||||
|
'../example/identity/bundle',
|
||||||
|
'../example/imagery/bundle',
|
||||||
|
'../example/mobile/bundle',
|
||||||
|
'../example/msl/bundle',
|
||||||
|
'../example/notifications/bundle',
|
||||||
|
'../example/persistence/bundle',
|
||||||
|
'../example/plotOptions/bundle',
|
||||||
|
'../example/policy/bundle',
|
||||||
|
'../example/profiling/bundle',
|
||||||
|
'../example/scratchpad/bundle',
|
||||||
|
'../example/taxonomy/bundle',
|
||||||
|
'../example/worker/bundle',
|
||||||
|
|
||||||
|
'../platform/commonUI/about/bundle',
|
||||||
|
'../platform/commonUI/browse/bundle',
|
||||||
|
'../platform/commonUI/dialog/bundle',
|
||||||
|
'../platform/commonUI/edit/bundle',
|
||||||
|
'../platform/commonUI/formats/bundle',
|
||||||
|
'../platform/commonUI/general/bundle',
|
||||||
|
'../platform/commonUI/inspect/bundle',
|
||||||
|
'../platform/commonUI/mobile/bundle',
|
||||||
|
'../platform/commonUI/notification/bundle',
|
||||||
|
'../platform/commonUI/regions/bundle',
|
||||||
|
'../platform/commonUI/themes/espresso/bundle',
|
||||||
|
'../platform/commonUI/themes/snow/bundle',
|
||||||
|
'../platform/containment/bundle',
|
||||||
|
'../platform/core/bundle',
|
||||||
|
'../platform/entanglement/bundle',
|
||||||
|
'../platform/execution/bundle',
|
||||||
|
'../platform/exporters/bundle',
|
||||||
|
'../platform/features/clock/bundle',
|
||||||
|
'../platform/features/conductor/bundle',
|
||||||
|
'../platform/features/imagery/bundle',
|
||||||
|
'../platform/features/layout/bundle',
|
||||||
|
'../platform/features/pages/bundle',
|
||||||
|
'../platform/features/plot/bundle',
|
||||||
|
'../platform/features/static-markup/bundle',
|
||||||
|
'../platform/features/table/bundle',
|
||||||
|
'../platform/features/timeline/bundle',
|
||||||
|
'../platform/forms/bundle',
|
||||||
|
'../platform/framework/bundle',
|
||||||
|
'../platform/framework/src/load/Bundle',
|
||||||
|
'../platform/identity/bundle',
|
||||||
|
'../platform/persistence/aggregator/bundle',
|
||||||
|
'../platform/persistence/couch/bundle',
|
||||||
|
'../platform/persistence/elastic/bundle',
|
||||||
|
'../platform/persistence/local/bundle',
|
||||||
|
'../platform/persistence/queue/bundle',
|
||||||
|
'../platform/policy/bundle',
|
||||||
|
'../platform/representation/bundle',
|
||||||
|
'../platform/search/bundle',
|
||||||
|
'../platform/status/bundle',
|
||||||
|
'../platform/telemetry/bundle'
|
||||||
|
], function (legacyRegistry) {
|
||||||
|
|
||||||
|
var DEFAULTS = [
|
||||||
|
'src/adapter',
|
||||||
|
'src/api/objects',
|
||||||
|
'platform/framework',
|
||||||
|
'platform/core',
|
||||||
|
'platform/representation',
|
||||||
|
'platform/commonUI/about',
|
||||||
|
'platform/commonUI/browse',
|
||||||
|
'platform/commonUI/edit',
|
||||||
|
'platform/commonUI/dialog',
|
||||||
|
'platform/commonUI/formats',
|
||||||
|
'platform/commonUI/general',
|
||||||
|
'platform/commonUI/inspect',
|
||||||
|
'platform/commonUI/mobile',
|
||||||
|
'platform/commonUI/themes/espresso',
|
||||||
|
'platform/commonUI/notification',
|
||||||
|
'platform/containment',
|
||||||
|
'platform/execution',
|
||||||
|
'platform/exporters',
|
||||||
|
'platform/telemetry',
|
||||||
|
'platform/features/clock',
|
||||||
|
'platform/features/imagery',
|
||||||
|
'platform/features/layout',
|
||||||
|
'platform/features/pages',
|
||||||
|
'platform/features/plot',
|
||||||
|
'platform/features/timeline',
|
||||||
|
'platform/features/table',
|
||||||
|
'platform/forms',
|
||||||
|
'platform/identity',
|
||||||
|
'platform/persistence/aggregator',
|
||||||
|
'platform/persistence/local',
|
||||||
|
'platform/persistence/queue',
|
||||||
|
'platform/policy',
|
||||||
|
'platform/entanglement',
|
||||||
|
'platform/search',
|
||||||
|
'platform/status',
|
||||||
|
'platform/commonUI/regions'
|
||||||
|
];
|
||||||
|
|
||||||
|
DEFAULTS.forEach(function (bundlePath) {
|
||||||
|
legacyRegistry.enable(bundlePath);
|
||||||
|
});
|
||||||
|
|
||||||
|
return legacyRegistry;
|
||||||
|
});
|
3
src/end.frag
Normal file
3
src/end.frag
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
return require('main');
|
||||||
|
}));
|
78
src/selection/ContextManager.js
Normal file
78
src/selection/ContextManager.js
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define(['zepto'], function ($) {
|
||||||
|
/**
|
||||||
|
* @typedef Context
|
||||||
|
* @property {*} item
|
||||||
|
* @property {HTMLElement} element
|
||||||
|
* @property {Context} parent the containing context (may be undefined)
|
||||||
|
* @memberof module:openmct
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function ContextManager() {
|
||||||
|
this.counter = 0;
|
||||||
|
this.contexts = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
ContextManager.prototype.nextId = function () {
|
||||||
|
this.counter += 1;
|
||||||
|
return "context-" + this.counter;
|
||||||
|
};
|
||||||
|
|
||||||
|
ContextManager.prototype.context = function (item, htmlElement) {
|
||||||
|
var $element = $(htmlElement);
|
||||||
|
var id = $element.attr('data-context') || this.nextId();
|
||||||
|
|
||||||
|
$element.attr('data-context', id);
|
||||||
|
|
||||||
|
if (this.contexts[id] && this.contexts[id].item !== item) {
|
||||||
|
this.release(htmlElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.contexts[id]) {
|
||||||
|
var $parent = $element.closest('[data-context]');
|
||||||
|
var parentId = $parent.attr('data-context');
|
||||||
|
var parentContext = parentId ? this.contexts[parentId] : undefined;
|
||||||
|
this.contexts[id] = {
|
||||||
|
item: item,
|
||||||
|
element: htmlElement,
|
||||||
|
parent: parentContext
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.contexts[id];
|
||||||
|
};
|
||||||
|
|
||||||
|
ContextManager.prototype.release = function (htmlElement) {
|
||||||
|
var $element = $(htmlElement);
|
||||||
|
var id = $element.attr('data-context');
|
||||||
|
|
||||||
|
if (id) {
|
||||||
|
delete this.contexts[id];
|
||||||
|
$element.removeAttr('data-context');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return ContextManager;
|
||||||
|
});
|
58
src/selection/HoverGesture.js
Normal file
58
src/selection/HoverGesture.js
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define(['zepto'], function ($) {
|
||||||
|
function HoverGesture(hoverManager) {
|
||||||
|
this.hoverManager = hoverManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
HoverGesture.prototype.apply = function (htmlElement) {
|
||||||
|
var $element = $(htmlElement);
|
||||||
|
var hoverManager = this.hoverManager;
|
||||||
|
|
||||||
|
function update() {
|
||||||
|
$(hoverManager.all()).removeClass('hovering');
|
||||||
|
$(hoverManager.top()).addClass('hovering');
|
||||||
|
}
|
||||||
|
|
||||||
|
function enter() {
|
||||||
|
hoverManager.add(htmlElement);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
function leave() {
|
||||||
|
hoverManager.remove(htmlElement);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
$element.on('mouseenter', enter);
|
||||||
|
$element.on('mouseleave', leave);
|
||||||
|
|
||||||
|
return function () {
|
||||||
|
leave();
|
||||||
|
$element.off('mouseenter', enter);
|
||||||
|
$element.off('mouseleave', leave);
|
||||||
|
}.bind(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
return HoverGesture;
|
||||||
|
});
|
60
src/selection/SelectGesture.js
Normal file
60
src/selection/SelectGesture.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define(['zepto'], function ($) {
|
||||||
|
function SelectGesture(selection, contextManager) {
|
||||||
|
this.selection = selection;
|
||||||
|
this.contextManager = contextManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectGesture.prototype.apply = function (htmlElement, item) {
|
||||||
|
var $element = $(htmlElement);
|
||||||
|
var contextManager = this.contextManager;
|
||||||
|
var selection = this.selection;
|
||||||
|
var path = contextManager.path(item, htmlElement);
|
||||||
|
|
||||||
|
function select() {
|
||||||
|
selection.add(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
function change() {
|
||||||
|
var selected = selection.primary();
|
||||||
|
$element.toggleClass(
|
||||||
|
'selected',
|
||||||
|
selected && path.matches(selected)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$element.addClass('selectable');
|
||||||
|
$element.on('click', select);
|
||||||
|
selection.on('change', change);
|
||||||
|
change(); // Initialize
|
||||||
|
|
||||||
|
return function () {
|
||||||
|
contextManager.release(htmlElement);
|
||||||
|
$element.off('click', select);
|
||||||
|
selection.off('change', change);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
return SelectGesture;
|
||||||
|
});
|
69
src/selection/Selection.js
Normal file
69
src/selection/Selection.js
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define(['EventEmitter'], function (EventEmitter) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manages selection state for Open MCT
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function Selection() {
|
||||||
|
EventEmitter.call(this);
|
||||||
|
this.selected = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
Selection.prototype = Object.create(EventEmitter.prototype);
|
||||||
|
|
||||||
|
Selection.prototype.add = function (context) {
|
||||||
|
this.clear(); // Only allow single select as initial simplification
|
||||||
|
this.selected.push(context);
|
||||||
|
this.emit('change');
|
||||||
|
};
|
||||||
|
|
||||||
|
Selection.prototype.remove = function (path) {
|
||||||
|
this.selected = this.selected.filter(function (otherPath) {
|
||||||
|
return !path.matches(otherPath);
|
||||||
|
});
|
||||||
|
this.emit('change');
|
||||||
|
};
|
||||||
|
|
||||||
|
Selection.prototype.contains = function (path) {
|
||||||
|
return this.selected.some(function (otherPath) {
|
||||||
|
return path.matches(otherPath);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
Selection.prototype.clear = function () {
|
||||||
|
this.selected = [];
|
||||||
|
this.emit('change');
|
||||||
|
};
|
||||||
|
|
||||||
|
Selection.prototype.primary = function () {
|
||||||
|
return this.selected[this.selected.length - 1];
|
||||||
|
};
|
||||||
|
|
||||||
|
Selection.prototype.all = function () {
|
||||||
|
return this.selected;
|
||||||
|
};
|
||||||
|
|
||||||
|
return Selection;
|
||||||
|
});
|
39
src/start.frag
Normal file
39
src/start.frag
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open MCT https://nasa.github.io/openmct/
|
||||||
|
* Version @@version
|
||||||
|
* Built @@timestamp
|
||||||
|
* Revision @@revision
|
||||||
|
* Branch @@branch
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define([], factory);
|
||||||
|
} else if (typeof exports === 'object') {
|
||||||
|
module.exports = factory();
|
||||||
|
} else {
|
||||||
|
root.MCT = factory();
|
||||||
|
}
|
||||||
|
}(this, function() {
|
145
src/ui/ViewRegistry.js
Normal file
145
src/ui/ViewRegistry.js
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([], function () {
|
||||||
|
/**
|
||||||
|
* A ViewRegistry maintains the definitions for different kinds of views
|
||||||
|
* that may occur in different places in the user interface.
|
||||||
|
* @interface ViewRegistry
|
||||||
|
* @memberof module:openmct
|
||||||
|
*/
|
||||||
|
function ViewRegistry() {
|
||||||
|
this.providers = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewRegistry.prototype.get = function (item) {
|
||||||
|
return this.providers.filter(function (provider) {
|
||||||
|
return provider.canView(item);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a new type of view.
|
||||||
|
*
|
||||||
|
* @param {module:openmct.ViewProvider} provider the provider for this view
|
||||||
|
* @method addProvider
|
||||||
|
* @memberof module:openmct.ViewRegistry#
|
||||||
|
*/
|
||||||
|
ViewRegistry.prototype.addProvider = function (provider) {
|
||||||
|
this.providers.push(provider);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A View is used to provide displayable content, and to react to
|
||||||
|
* associated life cycle events.
|
||||||
|
*
|
||||||
|
* @name View
|
||||||
|
* @interface
|
||||||
|
* @memberof module:openmct
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Populate the supplied DOM element with the contents of this view.
|
||||||
|
*
|
||||||
|
* View implementations should use this method to attach any
|
||||||
|
* listeners or acquire other resources that are necessary to keep
|
||||||
|
* the contents of this view up-to-date.
|
||||||
|
*
|
||||||
|
* @param {HTMLElement} container the DOM element to populate
|
||||||
|
* @method show
|
||||||
|
* @memberof module:openmct.View#
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release any resources associated with this view.
|
||||||
|
*
|
||||||
|
* View implementations should use this method to detach any
|
||||||
|
* listeners or release other resources that are no longer necessary
|
||||||
|
* once a view is no longer used.
|
||||||
|
*
|
||||||
|
* @method destroy
|
||||||
|
* @memberof module:openmct.View#
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exposes types of views in Open MCT.
|
||||||
|
*
|
||||||
|
* @interface ViewProvider
|
||||||
|
* @memberof module:openmct
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this provider can supply views for a domain object.
|
||||||
|
*
|
||||||
|
* When called by Open MCT, this may include additional arguments
|
||||||
|
* which are on the path to the object to be viewed; for instance,
|
||||||
|
* when viewing "A Folder" within "My Items", this method will be
|
||||||
|
* invoked with "A Folder" (as a domain object) as the first argument,
|
||||||
|
* and "My Items" as the second argument.
|
||||||
|
*
|
||||||
|
* @method canView
|
||||||
|
* @memberof module:openmct.ViewProvider#
|
||||||
|
* @param {module:openmct.DomainObject} domainObject the domain object
|
||||||
|
* to be viewed
|
||||||
|
* @returns {boolean} true if this domain object can be viewed using
|
||||||
|
* this provider
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provide a view of this object.
|
||||||
|
*
|
||||||
|
* When called by Open MCT, this may include additional arguments
|
||||||
|
* which are on the path to the object to be viewed; for instance,
|
||||||
|
* when viewing "A Folder" within "My Items", this method will be
|
||||||
|
* invoked with "A Folder" (as a domain object) as the first argument,
|
||||||
|
* and "My Items" as the second argument.
|
||||||
|
*
|
||||||
|
* @method view
|
||||||
|
* @memberof module:openmct.ViewProvider#
|
||||||
|
* @param {*} object the object to be viewed
|
||||||
|
* @returns {module:openmct.View} a view of this domain object
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get metadata associated with this view provider. This may be used
|
||||||
|
* to populate the user interface with options associated with this
|
||||||
|
* view provider.
|
||||||
|
*
|
||||||
|
* @method metadata
|
||||||
|
* @memberof module:openmct.ViewProvider#
|
||||||
|
* @returns {module:openmct.ViewProvider~ViewMetadata} view metadata
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef ViewMetadata
|
||||||
|
* @memberof module:openmct.ViewProvider~
|
||||||
|
* @property {string} name the human-readable name of this view
|
||||||
|
* @property {string} key a machine-readable name for this view
|
||||||
|
* @property {string} [description] a longer-form description (typically
|
||||||
|
* a single sentence or short paragraph) of this kind of view
|
||||||
|
* @property {string} cssclass the CSS class to apply to labels for this
|
||||||
|
* view (to add icons, for instance)
|
||||||
|
*/
|
||||||
|
|
||||||
|
return ViewRegistry;
|
||||||
|
|
||||||
|
});
|
10
test-main.js
10
test-main.js
@ -53,6 +53,7 @@ requirejs.config({
|
|||||||
"angular": "bower_components/angular/angular.min",
|
"angular": "bower_components/angular/angular.min",
|
||||||
"angular-route": "bower_components/angular-route/angular-route.min",
|
"angular-route": "bower_components/angular-route/angular-route.min",
|
||||||
"csv": "bower_components/comma-separated-values/csv.min",
|
"csv": "bower_components/comma-separated-values/csv.min",
|
||||||
|
"EventEmitter": "bower_components/eventemitter3/index",
|
||||||
"es6-promise": "bower_components/es6-promise/es6-promise.min",
|
"es6-promise": "bower_components/es6-promise/es6-promise.min",
|
||||||
"html2canvas": "bower_components/html2canvas/build/html2canvas.min",
|
"html2canvas": "bower_components/html2canvas/build/html2canvas.min",
|
||||||
"moment": "bower_components/moment/moment",
|
"moment": "bower_components/moment/moment",
|
||||||
@ -61,7 +62,8 @@ requirejs.config({
|
|||||||
"screenfull": "bower_components/screenfull/dist/screenfull.min",
|
"screenfull": "bower_components/screenfull/dist/screenfull.min",
|
||||||
"text": "bower_components/text/text",
|
"text": "bower_components/text/text",
|
||||||
"uuid": "bower_components/node-uuid/uuid",
|
"uuid": "bower_components/node-uuid/uuid",
|
||||||
"zepto": "bower_components/zepto/zepto.min"
|
"zepto": "bower_components/zepto/zepto.min",
|
||||||
|
"lodash": "bower_components/lodash/lodash"
|
||||||
},
|
},
|
||||||
|
|
||||||
"shim": {
|
"shim": {
|
||||||
@ -71,6 +73,9 @@ requirejs.config({
|
|||||||
"angular-route": {
|
"angular-route": {
|
||||||
"deps": [ "angular" ]
|
"deps": [ "angular" ]
|
||||||
},
|
},
|
||||||
|
"EventEmitter": {
|
||||||
|
"exports": "EventEmitter"
|
||||||
|
},
|
||||||
"moment-duration-format": {
|
"moment-duration-format": {
|
||||||
"deps": [ "moment" ]
|
"deps": [ "moment" ]
|
||||||
},
|
},
|
||||||
@ -79,6 +84,9 @@ requirejs.config({
|
|||||||
},
|
},
|
||||||
"zepto": {
|
"zepto": {
|
||||||
"exports": "Zepto"
|
"exports": "Zepto"
|
||||||
|
},
|
||||||
|
"lodash": {
|
||||||
|
"exports": "lodash"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user