Compare commits

...

4 Commits

Author SHA1 Message Date
Pete Richards
3b5bfb8047 [Plot] Wait for width before loading
Plot waits for element to have width before loading.  Otherwise,
it may make a minmax request with an invalid size parameter.

Fixes https://github.com/nasa/openmct/issues/1974
2018-04-03 14:53:49 -07:00
Pete Richards
1a23f2b390 Allow property values of zero. (#1961)
Allow SWG properties of zero to be used instead of overwriting
them with defaults.
2018-03-27 10:02:15 -07:00
Harry
4df6d6141b [Testing] Create unit tests for Types API (#1890)
* [Testing] Create unit tests for Tests API

* [Documentation] Fix spelling in TypeRegistry.js

* update TypeRegistrySpec to conform to code review
use .get() on typeRegistryInstance

Fixes #1514
2018-03-26 13:28:56 -07:00
Pete Richards
1c97138607 Pin d3 major/minor versoins (#1963)
Pin to specific d3 major/minor versions while allowing new
patches.  Previously, we were pinned to major versions only, and
minor versions contained changes to the distributed files which
would result in broken builds.

This should hopefully prevent broken builds from dependency updates.
2018-03-26 11:30:28 -07:00
5 changed files with 95 additions and 12 deletions

View File

@@ -66,7 +66,7 @@ define([
if (request && request.hasOwnProperty(prop)) {
workerRequest[prop] = request[prop];
}
if (!workerRequest[prop]) {
if (!workerRequest.hasOwnProperty(prop)) {
workerRequest[prop] = REQUEST_DEFAULTS[prop];
}
workerRequest[prop] = Number(workerRequest[prop]);

View File

@@ -3,16 +3,16 @@
"version": "0.13.3-SNAPSHOT",
"description": "The Open MCT core platform",
"dependencies": {
"d3-array": "^1.0.2",
"d3-axis": "^1.0.4",
"d3-collection": "^1.0.2",
"d3-color": "^1.0.2",
"d3-format": "^1.0.2",
"d3-interpolate": "^1.1.3",
"d3-scale": "^1.0.4",
"d3-selection": "^1.0.3",
"d3-time": "^1.0.4",
"d3-time-format": "^2.0.3",
"d3-array": "1.2.x",
"d3-axis": "1.0.x",
"d3-collection": "1.0.x",
"d3-color": "1.0.x",
"d3-format": "1.2.x",
"d3-interpolate": "1.1.x",
"d3-scale": "1.0.x",
"d3-selection": "1.3.x",
"d3-time": "1.0.x",
"d3-time-format": "2.1.x",
"express": "^4.13.1",
"minimist": "^1.1.1",
"request": "^2.69.0",

View File

@@ -90,7 +90,7 @@ define(['./Type'], function (Type) {
/**
* Retrieve a registered type by its key.
* @method get
* @param {string} typeKey the key for htis type
* @param {string} typeKey the key for this type
* @memberof module:openmct.TypeRegistry#
* @returns {module:openmct.Type} the registered type
*/

View File

@@ -0,0 +1,55 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2017, 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(['./TypeRegistry', './Type'], function (TypeRegistry, Type) {
describe('The Type API', function () {
var typeRegistryInstance;
beforeEach(function () {
typeRegistryInstance = new TypeRegistry ();
typeRegistryInstance.addType('testType', {
name: 'Test Type',
description: 'This is a test type.',
creatable: true
});
});
it('types can be standardized', function () {
typeRegistryInstance.addType('standardizationTestType', {
label: 'Test Type',
description: 'This is a test type.',
creatable: true
});
typeRegistryInstance.standardizeType(typeRegistryInstance.types.standardizationTestType);
expect(typeRegistryInstance.get('standardizationTestType').definition.label).toBeUndefined();
expect(typeRegistryInstance.get('standardizationTestType').definition.name).toBe('Test Type');
});
it('new types are registered successfully and can be retrieved', function () {
expect(typeRegistryInstance.get('testType').definition.name).toBe('Test Type');
});
it('type registry contains new keys', function () {
expect(typeRegistryInstance.listKeys ()).toContain('testType');
});
});
});

View File

@@ -82,6 +82,10 @@ define([
};
PlotController.prototype.loadSeriesData = function (series) {
if (this.$element[0].offsetWidth === 0) {
this.scheduleLoad(series);
return;
}
this.startLoading();
var options = {
size: this.$element[0].offsetWidth,
@@ -92,6 +96,26 @@ define([
.then(this.stopLoading.bind(this));
};
PlotController.prototype.scheduleLoad = function (series) {
if (!this.scheduledLoads) {
this.startLoading();
this.scheduledLoads = [];
this.checkForSize = setInterval(function () {
if (this.$element[0].offsetWidth === 0) {
return;
}
this.stopLoading();
this.scheduledLoads.forEach(this.loadSeriesData, this);
delete this.scheduledLoads;
clearInterval(this.checkForSize);
delete this.checkForSize;
}.bind(this));
}
if (this.scheduledLoads.indexOf(series) === -1) {
this.scheduledLoads.push(series);
}
};
PlotController.prototype.addSeries = function (series) {
this.listenTo(series, 'change:yKey', function () {
this.loadSeriesData(series);
@@ -126,6 +150,10 @@ define([
PlotController.prototype.destroy = function () {
configStore.untrack(this.config.id);
this.stopListening();
if (this.checkForSize) {
clearInterval(this.checkForSize);
delete this.checkForSize;
}
};
PlotController.prototype.loadMoreData = function (range, purge) {