Compare commits
8 Commits
vue-hack
...
vista-r35r
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2254bd8204 | ||
|
|
c8a097d798 | ||
|
|
97baa15176 | ||
|
|
fca69b69df | ||
|
|
968242d63b | ||
|
|
e2f3728a6e | ||
|
|
5d44ff9b9f | ||
|
|
642b4c7d6f |
@@ -30,6 +30,8 @@ define([
|
||||
{
|
||||
key: "sin",
|
||||
name: "Sine",
|
||||
format: 'printf',
|
||||
sprintf: '%0.2f',
|
||||
hints: {
|
||||
range: 1
|
||||
}
|
||||
@@ -37,6 +39,8 @@ define([
|
||||
{
|
||||
key: "cos",
|
||||
name: "Cosine",
|
||||
format: 'printf',
|
||||
sprintf: '%0.2f',
|
||||
hints: {
|
||||
range: 2
|
||||
}
|
||||
|
||||
@@ -47,7 +47,9 @@ define([
|
||||
|
||||
var interval = setInterval(function () {
|
||||
var now = Date.now();
|
||||
callback(pointForTimestamp(now, duration, domainObject.name));
|
||||
var datum = pointForTimestamp(now, duration, domainObject.name);
|
||||
datum.value += "";
|
||||
callback(datum);
|
||||
}, duration);
|
||||
|
||||
return function () {
|
||||
|
||||
@@ -49,7 +49,8 @@ requirejs.config({
|
||||
"d3-format": "node_modules/d3-format/build/d3-format.min",
|
||||
"d3-interpolate": "node_modules/d3-interpolate/build/d3-interpolate.min",
|
||||
"d3-time": "node_modules/d3-time/build/d3-time.min",
|
||||
"d3-time-format": "node_modules/d3-time-format/build/d3-time-format.min"
|
||||
"d3-time-format": "node_modules/d3-time-format/build/d3-time-format.min",
|
||||
"printj": "node_modules/printj/dist/printj.min"
|
||||
},
|
||||
"shim": {
|
||||
"angular": {
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
"mkdirp": "^0.5.1",
|
||||
"moment": "^2.11.1",
|
||||
"node-bourbon": "^4.2.3",
|
||||
"printj": "^1.1.0",
|
||||
"requirejs": "2.1.x",
|
||||
"split": "^1.0.0",
|
||||
"v8-compile-cache": "^1.1.0"
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'lodash'
|
||||
'lodash',
|
||||
'printj'
|
||||
], function (
|
||||
_
|
||||
_,
|
||||
printj
|
||||
) {
|
||||
|
||||
// TODO: needs reference to formatService;
|
||||
@@ -57,8 +59,8 @@ define([
|
||||
return vm;
|
||||
}, {byValue: {}, byString: {}});
|
||||
this.formatter.format = function (value) {
|
||||
if (typeof value === "number") {
|
||||
return this.enumerations.byValue[value] || value;
|
||||
if (this.enumerations.byValue.hasOwnProperty(value)) {
|
||||
return this.enumerations.byValue[value];
|
||||
}
|
||||
return value;
|
||||
}.bind(this);
|
||||
@@ -71,6 +73,12 @@ define([
|
||||
return Number(string);
|
||||
}.bind(this);
|
||||
}
|
||||
if (valueMetadata.sprintf) {
|
||||
this.formatter = numberFormatter;
|
||||
this.formatter.format = function (value) {
|
||||
return printj.sprintf(valueMetadata.sprintf, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TelemetryValueFormatter.prototype.parse = function (datum) {
|
||||
|
||||
@@ -146,10 +146,14 @@ define([
|
||||
this.updateStats(seriesStats);
|
||||
}
|
||||
}, this);
|
||||
this.listenTo(series, 'change:yKey', function () {
|
||||
this.updateFromSeries(this.seriesCollection);
|
||||
}, this);
|
||||
},
|
||||
untrackSeries: function (series) {
|
||||
this.stopListening(series);
|
||||
this.resetStats();
|
||||
this.updateFromSeries(this.seriesCollection);
|
||||
},
|
||||
toggleAutoscale: function (autoscale) {
|
||||
if (autoscale) {
|
||||
@@ -162,8 +166,13 @@ define([
|
||||
* Update yAxis format, values, and label from known series.
|
||||
*/
|
||||
updateFromSeries: function (series) {
|
||||
var plotModel = this.plot.get('domainObject');
|
||||
var label = _.get(plotModel, 'configuration.yAxis.label');
|
||||
var sampleSeries = series.first();
|
||||
if (!sampleSeries) {
|
||||
if (!label) {
|
||||
this.unset('label');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -172,9 +181,6 @@ define([
|
||||
var yFormat = sampleSeries.formats[yKey];
|
||||
this.set('format', yFormat.format.bind(yFormat));
|
||||
this.set('values', yMetadata.values);
|
||||
|
||||
var plotModel = this.plot.get('domainObject');
|
||||
var label = _.get(plotModel, 'configuration.xAxis.label');
|
||||
if (!label) {
|
||||
var labelUnits = series.map(function (s) {
|
||||
return s.metadata.value(s.get('yKey')).units;
|
||||
|
||||
@@ -1,177 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, 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 class for encapsulating structure and behaviour of the plot
|
||||
* options form
|
||||
* @memberOf platform/features/plot
|
||||
* @param topic
|
||||
* @constructor
|
||||
*/
|
||||
function PlotOptionsForm() {
|
||||
|
||||
/*
|
||||
Defined below are the form structures for the plot options.
|
||||
*/
|
||||
this.xAxisForm = {
|
||||
name: 'x-axis',
|
||||
sections: [{
|
||||
name: 'x-axis',
|
||||
rows: [
|
||||
{
|
||||
name: 'Domain',
|
||||
control: 'select',
|
||||
key: 'key',
|
||||
options: [
|
||||
{
|
||||
name: 'SCET',
|
||||
value: 'scet'
|
||||
},
|
||||
{
|
||||
name: 'ERT',
|
||||
value: 'ert'
|
||||
},
|
||||
{
|
||||
name: 'SCLK',
|
||||
value: 'sclk'
|
||||
},
|
||||
{
|
||||
name: 'LST',
|
||||
value: 'lst'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}]};
|
||||
|
||||
this.yAxisForm = {
|
||||
name: 'y-axis',
|
||||
sections: [{
|
||||
// Will need to be repeated for each y-axis, with a
|
||||
// distinct name for each. Ideally the name of the axis
|
||||
// itself.
|
||||
name: 'y-axis',
|
||||
rows: [
|
||||
{
|
||||
name: 'Range',
|
||||
control: 'select',
|
||||
key: 'key',
|
||||
options: [
|
||||
{
|
||||
name: 'Autoselect',
|
||||
value: 'auto'
|
||||
},
|
||||
{
|
||||
name: 'EU',
|
||||
value: 'eu'
|
||||
},
|
||||
{
|
||||
name: 'DN',
|
||||
value: 'dn'
|
||||
},
|
||||
{
|
||||
name: 'Status',
|
||||
value: 'enum'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'Autoscale',
|
||||
control: 'checkbox',
|
||||
key: 'autoscale'
|
||||
},
|
||||
{
|
||||
name: 'Min',
|
||||
control: 'textfield',
|
||||
key: 'min',
|
||||
pattern: '[0-9]',
|
||||
inputsize: 'sm'
|
||||
},
|
||||
{
|
||||
name: 'Max',
|
||||
control: 'textfield',
|
||||
key: 'max',
|
||||
pattern: '[0-9]',
|
||||
inputsize: 'sm'
|
||||
}
|
||||
]
|
||||
}]
|
||||
};
|
||||
this.plotSeriesForm = {
|
||||
name: 'Series Options',
|
||||
sections: [
|
||||
{
|
||||
rows: [
|
||||
{
|
||||
name: 'Color',
|
||||
control: 'color',
|
||||
key: 'color'
|
||||
}]
|
||||
},
|
||||
{
|
||||
rows: [
|
||||
{
|
||||
name: 'Markers',
|
||||
control: 'checkbox',
|
||||
key: 'markers',
|
||||
layout: 'control-first'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
rows: [
|
||||
{
|
||||
name: 'No Line',
|
||||
control: 'radio',
|
||||
key: 'interpolate',
|
||||
value: 'none',
|
||||
layout: 'control-first'
|
||||
},
|
||||
{
|
||||
name: 'Step Line',
|
||||
control: 'radio',
|
||||
key: 'interpolate',
|
||||
value: 'stepAfter',
|
||||
layout: 'control-first'
|
||||
},
|
||||
{
|
||||
name: 'Linear Line',
|
||||
control: 'radio',
|
||||
key: 'interpolate',
|
||||
value: 'linear',
|
||||
layout: 'control-first'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
return PlotOptionsForm;
|
||||
});
|
||||
|
||||
@@ -220,6 +220,7 @@ define([
|
||||
return;
|
||||
}
|
||||
this.marquee.end = this.positionOverPlot;
|
||||
this.marquee.endPixels = this.positionOverElement;
|
||||
};
|
||||
|
||||
MCTPlotController.prototype.startMarquee = function ($event) {
|
||||
@@ -227,6 +228,8 @@ define([
|
||||
if (this.positionOverPlot) {
|
||||
this.freeze();
|
||||
this.marquee = {
|
||||
startPixels: this.positionOverElement,
|
||||
endPixels: this.positionOverElement,
|
||||
start: this.positionOverPlot,
|
||||
end: this.positionOverPlot,
|
||||
color: [1, 1, 1, 0.5]
|
||||
@@ -237,8 +240,14 @@ define([
|
||||
};
|
||||
|
||||
MCTPlotController.prototype.endMarquee = function () {
|
||||
if (this.marquee.start.x !== this.marquee.end.x &&
|
||||
this.marquee.start.y !== this.marquee.end.y) {
|
||||
var startPixels = this.marquee.startPixels;
|
||||
var endPixels = this.marquee.endPixels;
|
||||
var marqueeDistance = Math.sqrt(
|
||||
Math.pow(startPixels.x - endPixels.x, 2) +
|
||||
Math.pow(startPixels.y - endPixels.y, 2)
|
||||
);
|
||||
// Don't zoom if mouse moved less than 7.5 pixels.
|
||||
if (marqueeDistance > 7.5) {
|
||||
this.$scope.xAxis.set('displayRange', {
|
||||
min: Math.min(this.marquee.start.x, this.marquee.end.x),
|
||||
max: Math.max(this.marquee.start.x, this.marquee.end.x)
|
||||
@@ -248,6 +257,10 @@ define([
|
||||
max: Math.max(this.marquee.start.y, this.marquee.end.y)
|
||||
});
|
||||
this.$scope.$emit('user:viewport:change:end');
|
||||
} else {
|
||||
// A history entry is created by startMarquee, need to remove
|
||||
// if marquee zoom doesn't occur.
|
||||
this.back();
|
||||
}
|
||||
this.$scope.rectangles = [];
|
||||
this.marquee = undefined;
|
||||
|
||||
45
src/plugins/summaryWidget/SummaryWidgetViewPolicy.js
Normal file
45
src/plugins/summaryWidget/SummaryWidgetViewPolicy.js
Normal file
@@ -0,0 +1,45 @@
|
||||
/*****************************************************************************
|
||||
* 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([
|
||||
|
||||
], function (
|
||||
|
||||
) {
|
||||
|
||||
/**
|
||||
* Policy determining which views can apply to summary widget. Disables
|
||||
* any view other than normal summary widget view.
|
||||
*/
|
||||
function SummaryWidgetViewPolicy() {
|
||||
}
|
||||
|
||||
SummaryWidgetViewPolicy.prototype.allow = function (view, domainObject) {
|
||||
if (domainObject.getModel().type === 'summary-widget') {
|
||||
return view.key === 'summary-widget-viewer';
|
||||
}
|
||||
return true;
|
||||
|
||||
};
|
||||
|
||||
return SummaryWidgetViewPolicy;
|
||||
});
|
||||
@@ -2,12 +2,14 @@ define([
|
||||
'./SummaryWidgetsCompositionPolicy',
|
||||
'./src/telemetry/SummaryWidgetMetadataProvider',
|
||||
'./src/telemetry/SummaryWidgetTelemetryProvider',
|
||||
'./src/views/SummaryWidgetViewProvider'
|
||||
'./src/views/SummaryWidgetViewProvider',
|
||||
'./SummaryWidgetViewPolicy'
|
||||
], function (
|
||||
SummaryWidgetsCompositionPolicy,
|
||||
SummaryWidgetMetadataProvider,
|
||||
SummaryWidgetTelemetryProvider,
|
||||
SummaryWidgetViewProvider
|
||||
SummaryWidgetViewProvider,
|
||||
SummaryWidgetViewPolicy
|
||||
) {
|
||||
|
||||
function plugin() {
|
||||
@@ -87,6 +89,11 @@ define([
|
||||
openmct.legacyExtension('policies', {category: 'composition',
|
||||
implementation: SummaryWidgetsCompositionPolicy, depends: ['openmct']
|
||||
});
|
||||
openmct.legacyExtension('policies', {
|
||||
category: 'view',
|
||||
implementation: SummaryWidgetViewPolicy,
|
||||
depends: ['openmct']
|
||||
});
|
||||
openmct.telemetry.addProvider(new SummaryWidgetMetadataProvider(openmct));
|
||||
openmct.telemetry.addProvider(new SummaryWidgetTelemetryProvider(openmct));
|
||||
openmct.objectViews.addProvider(new SummaryWidgetViewProvider(openmct));
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*****************************************************************************
|
||||
* 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([
|
||||
'../SummaryWidgetViewPolicy'
|
||||
], function (
|
||||
SummaryWidgetViewPolicy
|
||||
) {
|
||||
|
||||
describe('SummaryWidgetViewPolicy', function () {
|
||||
var policy;
|
||||
var domainObject;
|
||||
var view;
|
||||
beforeEach(function () {
|
||||
policy = new SummaryWidgetViewPolicy();
|
||||
domainObject = jasmine.createSpyObj('domainObject', [
|
||||
'getModel'
|
||||
]);
|
||||
domainObject.getModel.andReturn({});
|
||||
view = {};
|
||||
});
|
||||
|
||||
it('returns true for other object types', function () {
|
||||
domainObject.getModel.andReturn({
|
||||
type: 'random'
|
||||
});
|
||||
expect(policy.allow(view, domainObject)).toBe(true);
|
||||
});
|
||||
|
||||
it('allows summary widget view for summary widgets', function () {
|
||||
domainObject.getModel.andReturn({
|
||||
type: 'summary-widget'
|
||||
});
|
||||
view.key = 'summary-widget-viewer';
|
||||
expect(policy.allow(view, domainObject)).toBe(true);
|
||||
});
|
||||
|
||||
it('disallows other views for summary widgets', function () {
|
||||
domainObject.getModel.andReturn({
|
||||
type: 'summary-widget'
|
||||
});
|
||||
view.key = 'other view';
|
||||
expect(policy.allow(view, domainObject)).toBe(false);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user