Commit Graph

44 Commits

Author SHA1 Message Date
Shefali Joshi
cf3566742b
Updates copyright year to 2021 (#3699)
Co-authored-by: Deep Tailor <deep.j.tailor@nasa.gov>
Co-authored-by: Andrew Henry <akhenry@gmail.com>
2021-03-29 09:56:52 -07:00
Andrew Henry
92737b43af
[API] Changes to mutation API (#3483)
Changes how object mutation works behind the scenes in order to keep objects in sync automatically when their model changes.

* The way that objects are mutated and observed has not changed, openmct.objects.mutate and openmct.objects.observe should still be used in the same way that they were before.

* Behind the scenes, domain objects that are mutable are wrapped in a new MutableDomainObject that exposes mutator and observer functions that allow objects to be mutated in such a way that all instances can be kept in sync.

* It is now possible to retrieve MutableDomainObjects from the API, instead of regular domain objects. These are automatically updated when mutation occurs on any instance of the object, replacing the need for "*" listeners. Note that the view API now provides objects in this form by default. Therefore, you do not need to do anything differently in views, the domain objects will just magically keep themselves up to date.

* If for some reason you need to retrieve an object manually via openmct.objects.get (you should ask why you need to do this) and you want it to magically keep itself in sync, there is a new API function named openmct.objects.getMutable(identifier). Note that if you do this you will be responsible for the object's lifecycle. It relies on listeners which must be destroyed when the object is no longer needed, otherwise memory leaks will occur. You can destroy a MutableDomainObject and its (internal) listeners by calling openmct.objects.destroyMutable(mutableDomainObject). Any listeners created by calls to openmct.objects.observe need to be cleaned up separately.

* If the composition of a MutableDomainObject is retrieved using the Composition API, all children will be returned as MutableDomainObjects automatically. Their lifecycle will be managed automatically, and is tied to the lifecycle of the parent.
Any MutableDomainObject provided by the Open MCT framework itself (eg. provided to view providers by the View API, or from the composition API) will have its lifecycle managed by Open MCT, you don't need to worry destroying it.
2021-01-17 14:15:09 -08:00
David Tsay
97694fa29c
Bump copyright year to 2020 (#3169) 2020-09-14 11:17:31 -07:00
Andrew Henry
a09da30768
New eslint rules auto fix (#3058)
* no-implicit-coercion and no-unneeded-ternary

* End every line with a semicolon

* Spacing and formatting

* Enabled semi-spacing

* Applies npm run lint:fix to code after master merge

* Fix merge issues

* Switched operator-linebreak to 'before'

Co-authored-by: Joshi <simplyrender@gmail.com>
2020-07-31 12:11:03 -07:00
Andrew Henry
63bf856d89
Enable persistence operations from Object Providers (#3200)
* Implement 'save' method in Object API

* Refactor legacy persistence code to work with new save object API

* Added 'isPersistable' check to object API

* Fixed incompatibility between object API changes and composition policies

* Make save method private

Co-authored-by: Deep Tailor <deep.j.tailor@nasa.gov>
2020-07-17 09:58:03 -07:00
Joel McKinnon
43628ad9d6
Lodash upgrade and cleanup (#2990)
* Upgrades lodash
* Replaces some usage of lodash with native functions.
* Adds linting to catch cases where native functions could be used instead of lodash functions
* Renamed testTools to testUtils

Co-authored-by: Joshi <simplyrender@gmail.com>
Co-authored-by: David Tsay <david.e.tsay@nasa.gov>
Co-authored-by: David Tsay <3614296+davetsay@users.noreply.github.com>
Co-authored-by: Andrew Henry <akhenry@gmail.com>
2020-05-27 10:59:02 -07:00
Andrew Henry
c51fd21847
Experimental unit tests for the Telemetry Table component (#2533)
* Initial commit of telemetry table spec
* Added example directory to linter paths. Fixed outstanding linting issues
2019-11-27 16:04:52 -08:00
Andrew Henry
7477536478 Disable broken unit tests (#2519)
* Disabling broken unit tests

* Removed legacy RemoveAction
2019-10-10 16:23:29 -07:00
Andrew Henry
cbcfd44016 Elements pool and drag drop (#2196)
* Implemented drag-and-drop composition

* Added composition policy for tables

* Reimplemented elements pool in Vue

* No need to resolve all objects on the navigated path

* Only show elements pool in edit mode

* Remove old elements pool

* Updated legacy code to use composition policy API

* Keep object in sync when mutated
2018-10-23 10:52:37 -07:00
Andrew Henry
433dee0314 Update test specs to use Jasmine 3 (#2089)
* Updated Karma and Jasmine versions

* Added DOMObserver class. Supports promise-based testing of DOM changes

Update asynchronous test specs to use promises or done() instead of waitsFor/runs

* Modified ActionCapability to duplicate context object properties as own properties for better object equality comparisons

* Global find + replace to fix syntax issues

* Fixed various issues caused by non-deterministic runtime order of tests in Jasmine 3. Fixed issues caused by changes to determination of object equality

* Addressed review comments

* Resolved merge conflicts with master

* Fixed style errors

* Use spy.calls.count() instead of manually tracking
2018-06-29 17:32:59 -07:00
Nick Weingartner
c55eaeb193 [Copyright] Update copyright year across platform code references
Fixes #2034.
2018-05-14 15:46:17 -07:00
Andrew Henry
ec4fe8efb3 Merge pull request #1518 from nasa/copyright-1517
[Licenses] Update copyright year to 2017
2017-04-23 17:22:01 -07:00
Victor Woeltjen
185567cf29 [Licenses] Update copyright year to 2017
Fixes #1517
2017-04-05 14:52:46 -07:00
Henry
4e457f1cf0 Fixed failing tests, and added new tests 2017-03-27 11:15:27 -07:00
Henry
529abcc4b0 Added composition policy to prevent composition of non-persistable parent, except in the case of a new object in which case the parent may change 2017-03-24 17:00:12 -07:00
Henry
1cb5dd021f Modified composition policies to consider object instances instead of types. Fixes #669 2017-03-24 16:59:30 -07:00
Pete Richards
2a10a2cae2 Update specs to match composition policies 2017-02-21 15:14:35 -08:00
Pete Richards
65325b90fd Composition policy takes child instance
The composition policy now takes a child instance instead
of the child type, as in all cases we have access to the child
object.

This allows new-style objects to be contained by old-style objects.

Updated all composition policies to use standardized argument names
instead of `context` and `candidate`; this makes it easier to
understand.

Updated AddActionProvider to hardcode the object types supported.
2017-02-21 12:32:49 -08:00
steven mirecki
e751461194 Typo corrections, I avoided making changes to words that have regional spelling differences. 2016-09-03 09:16:54 -04:00
Henry
c8898ac6aa [Documentation] Updated copyright statement. Fixes #1081 2016-07-12 16:55:57 -07:00
Victor Woeltjen
fa77139077 [Code Style] Run gulp fixstyle
...to apply code style settings from #142.
2016-05-19 11:29:13 -07:00
Victor Woeltjen
d6ec7e9ab8 [Build] Remove unused variables from specs
...to satisfy JSHint.
2016-03-04 12:56:14 -08:00
Victor Woeltjen
a1a7b2b8ce [Build] Remove unused variables
...to satisfy JSHint
2016-03-04 11:41:48 -08:00
Victor Woeltjen
ac5ac8d34e [Build] Remove boilerplate from scripts
No longer necessary after JSHint configuration.
2016-03-04 10:46:38 -08:00
Henry
10e0acddb3 [New Edit Mode] #659 Fix to prevent multi-composition with same object, fix to prevent composition of object with self 2016-02-10 16:43:08 -08:00
Victor Woeltjen
aebae27391 [Tests] Remove suite.json files
Remove obsolete suite.json files; #482
2016-02-02 09:35:50 -08:00
Victor Woeltjen
cec197f888 [API Refactor] Remove bundle.json files 2016-01-08 15:32:18 -08:00
Victor Woeltjen
de53247d56 [API] Convert JSON bundles to imperative form 2016-01-07 15:08:08 -08:00
Victor Woeltjen
c450c22ddd [Code Style] Satisfy JSLint
Add missing semicolons etc. to satisfy JSLint after
changes for WTD-1482.
2015-08-11 13:03:06 -07:00
Victor Woeltjen
f377c7cb71 [Code Style] Use prototypes in containment bundle
WTD-1482.
2015-08-11 11:01:13 -07:00
Victor Woeltjen
31eb366e7f [JSDoc] Add namespace docs
WTD-1482.
2015-08-07 12:13:15 -07:00
Victor Woeltjen
c08a460d30 [JSDoc] Add annotations
Bulk-add JSDoc annotations, WTD-1482.
2015-08-07 11:44:54 -07:00
Victor Woeltjen
2648f01966 [Composition] Disallow composition for leaf types
Disallow composition for domain object types which will
not have a composition property; WTD-1221.
2015-06-04 09:16:12 -07:00
Victor Woeltjen
10863514cb [Licenses] Add license headers
WTD-1051.
2015-05-13 16:43:30 -07:00
Victor Woeltjen
036722b275 [Containment] Disallow composition in immutable objects
Disallow composition in objects which cannot be created, under
the rationale that creatable objects must also be immutable.
WTD-1098.
2015-04-10 19:24:16 -07:00
Victor Woeltjen
a55f8e1ab5 [Containment] Test compose action policy
Test compose action policy, which prevents the 'compose' action
when composition rules would be violated. WTD-962.
2015-04-10 18:39:57 -07:00
Victor Woeltjen
c59f13504e [Containment] Test containment tables
Test tables which support efficient lookup of composition policy,
WTD-962.
2015-04-10 18:29:42 -07:00
Victor Woeltjen
e3a44356a8 [Containment] Test composition policy
WTD-962.
2015-04-10 18:16:40 -07:00
Victor Woeltjen
90b8f22c2d [Containment] Add skeleton specs
Add empty specs for composition policy, WTD-962.
2015-04-10 18:09:02 -07:00
Victor Woeltjen
9e4611bcfd [Containment] Fix bundle
Fix dependencies in containment bundle to allow loading,
WTD-962.
2015-04-07 21:03:36 -07:00
Victor Woeltjen
d2c666358e [Containment] Restrict the compose action
Restrict the compose action by policy, to avoid drag-drop of
inappropriate domain object types. WTD-962.
2015-04-07 20:51:01 -07:00
Victor Woeltjen
870ff6af32 [Containment] Add message
WTD-962
2015-04-07 20:06:08 -07:00
Victor Woeltjen
838a86830e [Containment] Add bundle declaration
WTD-962.
2015-04-07 20:02:05 -07:00
Victor Woeltjen
3c00eb86ea [Containment] Add general policy for containment rules
Add general policy for supporting containment rules, WTD-962.
2015-04-07 19:58:39 -07:00