From 9e5eddec9bceafa395fe0fc42a48ed9c02c7ee74 Mon Sep 17 00:00:00 2001 From: David Tsay <3614296+davetsay@users.noreply.github.com> Date: Wed, 24 Jun 2020 11:44:40 -0700 Subject: [PATCH 1/2] [Plots] y-axis width fix (#3112) * remove lodash native implementation of lodash max * remove unused lodash imports * add 'missing' semi-colon Co-authored-by: Deep Tailor --- src/plugins/plot/src/chart/MCTChartController.js | 6 ++---- src/plugins/plot/src/configuration/Collection.js | 2 -- src/plugins/plot/src/draw/Draw2D.js | 2 -- src/plugins/plot/src/draw/DrawWebGL.js | 2 -- .../plot/src/inspector/PlotOptionsController.js | 6 ++---- .../plot/src/inspector/PlotYAxisFormController.js | 6 ++---- .../plot/src/telemetry/StackedPlotController.js | 12 ++++-------- 7 files changed, 10 insertions(+), 26 deletions(-) diff --git a/src/plugins/plot/src/chart/MCTChartController.js b/src/plugins/plot/src/chart/MCTChartController.js index 83ff610374..e211473385 100644 --- a/src/plugins/plot/src/chart/MCTChartController.js +++ b/src/plugins/plot/src/chart/MCTChartController.js @@ -30,8 +30,7 @@ define([ './MCTChartPointSet', './MCTChartAlarmPointSet', '../draw/DrawLoader', - '../lib/eventHelpers', - 'lodash' + '../lib/eventHelpers' ], function ( MCTChartLineLinear, @@ -39,8 +38,7 @@ function ( MCTChartPointSet, MCTChartAlarmPointSet, DrawLoader, - eventHelpers, - _ + eventHelpers ) { var MARKER_SIZE = 6.0, diff --git a/src/plugins/plot/src/configuration/Collection.js b/src/plugins/plot/src/configuration/Collection.js index 164bd1ebd8..32eb91eee0 100644 --- a/src/plugins/plot/src/configuration/Collection.js +++ b/src/plugins/plot/src/configuration/Collection.js @@ -22,13 +22,11 @@ /*global define*/ define([ - 'lodash', 'EventEmitter', './Model', '../lib/extend', '../lib/eventHelpers' ], function ( - _, EventEmitter, Model, extend, diff --git a/src/plugins/plot/src/draw/Draw2D.js b/src/plugins/plot/src/draw/Draw2D.js index 812a0c7a67..4947e80b5d 100644 --- a/src/plugins/plot/src/draw/Draw2D.js +++ b/src/plugins/plot/src/draw/Draw2D.js @@ -22,11 +22,9 @@ define([ - 'lodash', 'EventEmitter', '../lib/eventHelpers' ], function ( - _, EventEmitter, eventHelpers ) { diff --git a/src/plugins/plot/src/draw/DrawWebGL.js b/src/plugins/plot/src/draw/DrawWebGL.js index 1c5f5128a1..e1abfdb645 100644 --- a/src/plugins/plot/src/draw/DrawWebGL.js +++ b/src/plugins/plot/src/draw/DrawWebGL.js @@ -22,11 +22,9 @@ define([ - 'lodash', 'EventEmitter', '../lib/eventHelpers' ], function ( - _, EventEmitter, eventHelpers ) { diff --git a/src/plugins/plot/src/inspector/PlotOptionsController.js b/src/plugins/plot/src/inspector/PlotOptionsController.js index 776b7ecd94..00efa3694c 100644 --- a/src/plugins/plot/src/inspector/PlotOptionsController.js +++ b/src/plugins/plot/src/inspector/PlotOptionsController.js @@ -23,13 +23,11 @@ define([ '../configuration/configStore', '../lib/eventHelpers', - 'objectUtils', - 'lodash' + 'objectUtils' ], function ( configStore, eventHelpers, - objectUtils, - _ + objectUtils ) { function PlotOptionsController($scope, openmct, $timeout) { diff --git a/src/plugins/plot/src/inspector/PlotYAxisFormController.js b/src/plugins/plot/src/inspector/PlotYAxisFormController.js index d1e2b71de0..20c4802072 100644 --- a/src/plugins/plot/src/inspector/PlotYAxisFormController.js +++ b/src/plugins/plot/src/inspector/PlotYAxisFormController.js @@ -21,11 +21,9 @@ *****************************************************************************/ define([ - './PlotModelFormController', - 'lodash' + './PlotModelFormController' ], function ( - PlotModelFormController, - _ + PlotModelFormController ) { var PlotYAxisFormController = PlotModelFormController.extend({ diff --git a/src/plugins/plot/src/telemetry/StackedPlotController.js b/src/plugins/plot/src/telemetry/StackedPlotController.js index 9d7b27accd..26a93699eb 100644 --- a/src/plugins/plot/src/telemetry/StackedPlotController.js +++ b/src/plugins/plot/src/telemetry/StackedPlotController.js @@ -20,12 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -define([ - 'lodash' -], function ( - _ -) { - +define([], function () { function StackedPlotController($scope, openmct, objectService, $element, exportImageService) { var tickWidth = 0, composition, @@ -125,12 +120,13 @@ define([ $scope.$watch('domainObject.getModel().composition', onCompositionChange); $scope.$on('plot:tickWidth', function ($e, width) { - var plotId = $e.targetScope.domainObject.getId(); + const plotId = $e.targetScope.domainObject.getId(); if (!tickWidthMap.hasOwnProperty(plotId)) { return; } + tickWidthMap[plotId] = Math.max(width, tickWidthMap[plotId]); - var newTickWidth = _.max(tickWidthMap); + const newTickWidth = Math.max(...Object.values(tickWidthMap)); if (newTickWidth !== tickWidth || width !== tickWidth) { tickWidth = newTickWidth; $scope.$broadcast('plot:tickWidth', tickWidth); From 8e54b8a819d643b75c18a6031c52666d17125555 Mon Sep 17 00:00:00 2001 From: Jamie V Date: Wed, 24 Jun 2020 13:26:22 -0700 Subject: [PATCH 2/2] LAD Table (Set) Composition Policy (#2962) * added LAD Table composition policy, with a check for lad table sets, child can only be lad table Co-authored-by: Andrew Henry Co-authored-by: Deep Tailor --- src/plugins/LADTable/LADTableCompositionPolicy.js | 13 +++---------- src/plugins/LADTable/plugin.js | 4 ++-- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/plugins/LADTable/LADTableCompositionPolicy.js b/src/plugins/LADTable/LADTableCompositionPolicy.js index e161c3c500..18733c9d59 100644 --- a/src/plugins/LADTable/LADTableCompositionPolicy.js +++ b/src/plugins/LADTable/LADTableCompositionPolicy.js @@ -20,20 +20,13 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -export default class LADTableCompositionPolicy { - - constructor(openmct) { - this.openmct = openmct; - return this.allow.bind(this); - } - - allow(parent, child) { +export default function ladTableCompositionPolicy(openmct) { + return function (parent, child) { if(parent.type === 'LadTable') { - return this.openmct.telemetry.isTelemetryObject(child); + return openmct.telemetry.isTelemetryObject(child); } else if(parent.type === 'LadTableSet') { return child.type === 'LadTable'; } - return true; } } diff --git a/src/plugins/LADTable/plugin.js b/src/plugins/LADTable/plugin.js index 65b9d0a23f..c5b7219086 100644 --- a/src/plugins/LADTable/plugin.js +++ b/src/plugins/LADTable/plugin.js @@ -21,7 +21,7 @@ *****************************************************************************/ import LADTableViewProvider from './LADTableViewProvider'; import LADTableSetViewProvider from './LADTableSetViewProvider'; -import LADTableCompositionPolicy from './LADTableCompositionPolicy'; +import ladTableCompositionPolicy from './LADTableCompositionPolicy'; export default function plugin() { return function install(openmct) { @@ -49,6 +49,6 @@ export default function plugin() { } }); - openmct.composition.addPolicy(new LADTableCompositionPolicy(openmct)); + openmct.composition.addPolicy(ladTableCompositionPolicy(openmct)); }; }