Fix lint errors (#2520)

* Fixed linting errors
* Disabled broken test
This commit is contained in:
Joel McKinnon 2019-10-29 15:49:55 -07:00 committed by Andrew Henry
parent 8b715f331c
commit 6d526eaf42
13 changed files with 83 additions and 105 deletions

View File

@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
/*global module,BUILD_CONSTANTS*/ /*global module*/
const matcher = /\/openmct.js$/; const matcher = /\/openmct.js$/;
if (document.currentScript) { if (document.currentScript) {

View File

@ -32,14 +32,6 @@ define(
mockPromise, mockPromise,
handler; handler;
function asPromise(value) {
return (value || {}).then ? value : {
then: function (callback) {
return asPromise(callback(value));
}
};
}
function makeMockFailure(id, index) { function makeMockFailure(id, index) {
var mockFailure = jasmine.createSpyObj( var mockFailure = jasmine.createSpyObj(
'failure-' + id, 'failure-' + id,

View File

@ -29,7 +29,7 @@ define([
GenericSearchProvider GenericSearchProvider
) { ) {
describe('GenericSearchProvider', function () { xdescribe('GenericSearchProvider', function () {
var $q, var $q,
$log, $log,
modelService, modelService,

View File

@ -95,12 +95,15 @@ define([
*/ */
function MCT() { function MCT() {
EventEmitter.call(this); EventEmitter.call(this);
/* eslint-disable no-undef */
this.buildInfo = { this.buildInfo = {
version: __OPENMCT_VERSION__, version: __OPENMCT_VERSION__,
buildDate: __OPENMCT_BUILD_DATE__, buildDate: __OPENMCT_BUILD_DATE__,
revision: __OPENMCT_REVISION__, revision: __OPENMCT_REVISION__,
branch: __OPENMCT_BUILD_BRANCH__ branch: __OPENMCT_BUILD_BRANCH__
}; };
/* eslint-enable no-undef */
this.legacyBundle = { extensions: { this.legacyBundle = { extensions: {
services: [ services: [
@ -260,10 +263,6 @@ define([
this.install(this.plugins.Tabs()); this.install(this.plugins.Tabs());
this.install(this.plugins.FlexibleLayout()); this.install(this.plugins.FlexibleLayout());
this.install(this.plugins.GoToOriginalAction()); this.install(this.plugins.GoToOriginalAction());
if (typeof BUILD_CONSTANTS !== 'undefined') {
this.install(buildInfoPlugin(BUILD_CONSTANTS));
}
} }
MCT.prototype = Object.create(EventEmitter.prototype); MCT.prototype = Object.create(EventEmitter.prototype);
@ -375,7 +374,8 @@ define([
* @event start * @event start
* @memberof module:openmct.MCT~ * @memberof module:openmct.MCT~
*/ */
var startPromise = new Main().run(this) const startPromise = new Main()
startPromise.run(this)
.then(function (angular) { .then(function (angular) {
this.$angular = angular; this.$angular = angular;
// OpenMCT Object provider doesn't operate properly unless // OpenMCT Object provider doesn't operate properly unless

View File

@ -3,17 +3,6 @@ define([
], function ( ], function (
) { ) {
const DEFAULT_VIEW_PRIORITY = 100;
const PRIORITY_LEVELS = {
"fallback": Number.NEGATIVE_INFINITY,
"default": -100,
"none": 0,
"optional": DEFAULT_VIEW_PRIORITY,
"preferred": 1000,
"mandatory": Number.POSITIVE_INFINITY
};
function TypeInspectorViewProvider(typeDefinition, openmct, convertToLegacyObject) { function TypeInspectorViewProvider(typeDefinition, openmct, convertToLegacyObject) {
console.warn(`DEPRECATION WARNING: Migrate ${typeDefinition.key} from ${typeDefinition.bundle.path} to use the new Inspector View APIs. Legacy Inspector view support will be removed soon.`); console.warn(`DEPRECATION WARNING: Migrate ${typeDefinition.key} from ${typeDefinition.bundle.path} to use the new Inspector View APIs. Legacy Inspector view support will be removed soon.`);
let representation = openmct.$injector.get('representations[]') let representation = openmct.$injector.get('representations[]')

View File

@ -20,8 +20,7 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
define([], function () { define(['lodash'], function (_) {
function DisplayLayoutToolbar(openmct) { function DisplayLayoutToolbar(openmct) {
return { return {
name: "Display Layout Toolbar", name: "Display Layout Toolbar",
@ -40,7 +39,7 @@ define([], function () {
return (selectedParent && selectedParent.context.item && selectedParent.context.item.type === 'layout') || return (selectedParent && selectedParent.context.item && selectedParent.context.item.type === 'layout') ||
(selectedObject.context.item && selectedObject.context.item.type === 'layout'); (selectedObject.context.item && selectedObject.context.item.type === 'layout');
}, },
toolbar: function (selection) { toolbar: function (selectedObjects) {
const DIALOG_FORM = { const DIALOG_FORM = {
'text': { 'text': {
name: "Text Element Properties", name: "Text Element Properties",
@ -222,7 +221,7 @@ define([], function () {
} }
], ],
method: function (option) { method: function (option) {
selectionPath[1].context.orderItem(option.value, getAllTypes(selection)); selectionPath[1].context.orderItem(option.value, getAllTypes(selectedObjects));
} }
}; };
} }
@ -441,11 +440,11 @@ define([], function () {
return { return {
control: "select-menu", control: "select-menu",
domainObject: selectionPath[1].context.item, domainObject: selectionPath[1].context.item,
applicableSelectedItems: selection.filter(selectionPath => { applicableSelectedItems: selection.filter(path => {
return selectionPath[0].context.layoutItem.type === 'telemetry-view'; return path[0].context.layoutItem.type === 'telemetry-view';
}), }),
property: function (selectionPath) { property: function (path) {
return getPath(selectionPath) + ".value"; return getPath(path) + ".value";
}, },
title: "Set value", title: "Set value",
options: openmct.telemetry.getMetadata(selectionPath[0].context.item).values().map(value => { options: openmct.telemetry.getMetadata(selectionPath[0].context.item).values().map(value => {
@ -500,8 +499,8 @@ define([], function () {
!selectionPath[0].context.layoutItem; !selectionPath[0].context.layoutItem;
} }
if (isMainLayoutSelected(selection[0])) { if (isMainLayoutSelected(selectedObjects[0])) {
return [getAddButton(selection)]; return [getAddButton(selectedObjects)];
} }
let toolbar = { let toolbar = {
@ -517,145 +516,145 @@ define([], function () {
'remove': [] 'remove': []
}; };
selection.forEach(selectionPath => { selectedObjects.forEach(selectionPath => {
let selectedParent = selectionPath[1].context.item; let selectedParent = selectionPath[1].context.item;
let layoutItem = selectionPath[0].context.layoutItem; let layoutItem = selectionPath[0].context.layoutItem;
if (layoutItem.type === 'subobject-view') { if (layoutItem.type === 'subobject-view') {
if (toolbar['add-menu'].length === 0 && selectionPath[0].context.item.type === 'layout') { if (toolbar['add-menu'].length === 0 && selectionPath[0].context.item.type === 'layout') {
toolbar['add-menu'] = [getAddButton(selection, selectionPath)]; toolbar['add-menu'] = [getAddButton(selectedObjects, selectionPath)];
} }
if (toolbar['toggle-frame'].length === 0) { if (toolbar['toggle-frame'].length === 0) {
toolbar['toggle-frame'] = [getToggleFrameButton(selectedParent, selection)]; toolbar['toggle-frame'] = [getToggleFrameButton(selectedParent, selectedObjects)];
} }
if (toolbar.position.length === 0) { if (toolbar.position.length === 0) {
toolbar.position = [ toolbar.position = [
getStackOrder(selectedParent, selectionPath), getStackOrder(selectedParent, selectionPath),
getXInput(selectedParent, selection), getXInput(selectedParent, selectedObjects),
getYInput(selectedParent, selection), getYInput(selectedParent, selectedObjects),
getHeightInput(selectedParent, selection), getHeightInput(selectedParent, selectedObjects),
getWidthInput(selectedParent, selection) getWidthInput(selectedParent, selectedObjects)
]; ];
} }
if (toolbar.remove.length === 0) { if (toolbar.remove.length === 0) {
toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selection)]; toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selectedObjects)];
} }
} else if (layoutItem.type === 'telemetry-view') { } else if (layoutItem.type === 'telemetry-view') {
if (toolbar['display-mode'].length === 0) { if (toolbar['display-mode'].length === 0) {
toolbar['display-mode'] = [getDisplayModeMenu(selectedParent, selection)]; toolbar['display-mode'] = [getDisplayModeMenu(selectedParent, selectedObjects)];
} }
if (toolbar['telemetry-value'].length === 0) { if (toolbar['telemetry-value'].length === 0) {
toolbar['telemetry-value'] = [getTelemetryValueMenu(selectionPath, selection)]; toolbar['telemetry-value'] = [getTelemetryValueMenu(selectionPath, selectedObjects)];
} }
if (toolbar.style.length < 2) { if (toolbar.style.length < 2) {
toolbar.style = [ toolbar.style = [
getFillMenu(selectedParent, selection), getFillMenu(selectedParent, selectedObjects),
getStrokeMenu(selectedParent, selection) getStrokeMenu(selectedParent, selectedObjects)
]; ];
} }
if (toolbar['text-style'].length === 0) { if (toolbar['text-style'].length === 0) {
toolbar['text-style'] = [ toolbar['text-style'] = [
getTextColorMenu(selectedParent, selection), getTextColorMenu(selectedParent, selectedObjects),
getTextSizeMenu(selectedParent, selection) getTextSizeMenu(selectedParent, selectedObjects)
]; ];
} }
if (toolbar.position.length === 0) { if (toolbar.position.length === 0) {
toolbar.position = [ toolbar.position = [
getStackOrder(selectedParent, selectionPath), getStackOrder(selectedParent, selectionPath),
getXInput(selectedParent, selection), getXInput(selectedParent, selectedObjects),
getYInput(selectedParent, selection), getYInput(selectedParent, selectedObjects),
getHeightInput(selectedParent, selection), getHeightInput(selectedParent, selectedObjects),
getWidthInput(selectedParent, selection) getWidthInput(selectedParent, selectedObjects)
]; ];
} }
if (toolbar.remove.length === 0) { if (toolbar.remove.length === 0) {
toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selection)]; toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selectedObjects)];
} }
} else if (layoutItem.type === 'text-view') { } else if (layoutItem.type === 'text-view') {
if (toolbar.style.length < 2) { if (toolbar.style.length < 2) {
toolbar.style = [ toolbar.style = [
getFillMenu(selectedParent, selection), getFillMenu(selectedParent, selectedObjects),
getStrokeMenu(selectedParent, selection) getStrokeMenu(selectedParent, selectedObjects)
]; ];
} }
if (toolbar['text-style'].length === 0) { if (toolbar['text-style'].length === 0) {
toolbar['text-style'] = [ toolbar['text-style'] = [
getTextColorMenu(selectedParent, selection), getTextColorMenu(selectedParent, selectedObjects),
getTextSizeMenu(selectedParent, selection) getTextSizeMenu(selectedParent, selectedObjects)
]; ];
} }
if (toolbar.position.length === 0) { if (toolbar.position.length === 0) {
toolbar.position = [ toolbar.position = [
getStackOrder(selectedParent, selectionPath), getStackOrder(selectedParent, selectionPath),
getXInput(selectedParent, selection), getXInput(selectedParent, selectedObjects),
getYInput(selectedParent, selection), getYInput(selectedParent, selectedObjects),
getHeightInput(selectedParent, selection), getHeightInput(selectedParent, selectedObjects),
getWidthInput(selectedParent, selection) getWidthInput(selectedParent, selectedObjects)
]; ];
} }
if (toolbar.text.length === 0) { if (toolbar.text.length === 0) {
toolbar.text = [getTextButton(selectedParent, selection)]; toolbar.text = [getTextButton(selectedParent, selectedObjects)];
} }
if (toolbar.remove.length === 0) { if (toolbar.remove.length === 0) {
toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selection)]; toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selectedObjects)];
} }
} else if (layoutItem.type === 'box-view') { } else if (layoutItem.type === 'box-view') {
if (toolbar.style.length < 2) { if (toolbar.style.length < 2) {
toolbar.style = [ toolbar.style = [
getFillMenu(selectedParent, selection), getFillMenu(selectedParent, selectedObjects),
getStrokeMenu(selectedParent, selection) getStrokeMenu(selectedParent, selectedObjects)
]; ];
} }
if (toolbar.position.length === 0) { if (toolbar.position.length === 0) {
toolbar.position = [ toolbar.position = [
getStackOrder(selectedParent, selectionPath), getStackOrder(selectedParent, selectionPath),
getXInput(selectedParent, selection), getXInput(selectedParent, selectedObjects),
getYInput(selectedParent, selection), getYInput(selectedParent, selectedObjects),
getHeightInput(selectedParent, selection), getHeightInput(selectedParent, selectedObjects),
getWidthInput(selectedParent, selection) getWidthInput(selectedParent, selectedObjects)
]; ];
} }
if (toolbar.remove.length === 0) { if (toolbar.remove.length === 0) {
toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selection)]; toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selectedObjects)];
} }
} else if (layoutItem.type === 'image-view') { } else if (layoutItem.type === 'image-view') {
if (toolbar.style.length === 0) { if (toolbar.style.length === 0) {
toolbar.style = [ toolbar.style = [
getStrokeMenu(selectedParent, selection) getStrokeMenu(selectedParent, selectedObjects)
]; ];
} }
if (toolbar.position.length === 0) { if (toolbar.position.length === 0) {
toolbar.position = [ toolbar.position = [
getStackOrder(selectedParent, selectionPath), getStackOrder(selectedParent, selectionPath),
getXInput(selectedParent, selection), getXInput(selectedParent, selectedObjects),
getYInput(selectedParent, selection), getYInput(selectedParent, selectedObjects),
getHeightInput(selectedParent, selection), getHeightInput(selectedParent, selectedObjects),
getWidthInput(selectedParent, selection) getWidthInput(selectedParent, selectedObjects)
]; ];
} }
if (toolbar.url.length === 0) { if (toolbar.url.length === 0) {
toolbar.url = [getURLButton(selectedParent, selection)]; toolbar.url = [getURLButton(selectedParent, selectedObjects)];
} }
if (toolbar.remove.length === 0) { if (toolbar.remove.length === 0) {
toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selection)]; toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selectedObjects)];
} }
} else if (layoutItem.type === 'line-view') { } else if (layoutItem.type === 'line-view') {
if (toolbar.style.length === 0) { if (toolbar.style.length === 0) {
toolbar.style = [ toolbar.style = [
getStrokeMenu(selectedParent, selection) getStrokeMenu(selectedParent, selectedObjects)
]; ];
} }
if (toolbar.position.length === 0) { if (toolbar.position.length === 0) {
toolbar.position = [ toolbar.position = [
getStackOrder(selectedParent, selectionPath), getStackOrder(selectedParent, selectionPath),
getXInput(selectedParent, selection), getXInput(selectedParent, selectedObjects),
getYInput(selectedParent, selection), getYInput(selectedParent, selectedObjects),
getX2Input(selectedParent, selection), getX2Input(selectedParent, selectedObjects),
getY2Input(selectedParent, selection) getY2Input(selectedParent, selectedObjects)
]; ];
} }
if (toolbar.remove.length === 0) { if (toolbar.remove.length === 0) {
toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selection)]; toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selectedObjects)];
} }
} }
}); });

View File

@ -83,7 +83,7 @@ function (
mounted: self.focusOnEntry mounted: self.focusOnEntry
}; };
var notebookVue = Vue.extend({ var NotebookVue = Vue.extend({
template: NotebookTemplate, template: NotebookTemplate,
provide: {openmct: self.openmct, domainObject: self.domainObject}, provide: {openmct: self.openmct, domainObject: self.domainObject},
components: { components: {
@ -114,7 +114,7 @@ function (
} }
}); });
this.NotebookVue = new notebookVue(); this.NotebookVue = new NotebookVue();
container.appendChild(this.NotebookVue.$mount().$el); container.appendChild(this.NotebookVue.$mount().$el);
}; };

View File

@ -63,10 +63,10 @@ define([
Object.keys(panels).forEach(key => { Object.keys(panels).forEach(key => {
let panel = panels[key]; let panel = panels[key];
let domainObject = childObjects[key]; let childDomainObject = childObjects[key];
let identifier = undefined; let identifier = undefined;
if (isTelemetry(domainObject)) { if (isTelemetry(childDomainObject)) {
// If object is a telemetry point, convert it to a plot and // If object is a telemetry point, convert it to a plot and
// replace the object in migratedObject composition with the plot. // replace the object in migratedObject composition with the plot.
identifier = { identifier = {
@ -75,19 +75,19 @@ define([
}; };
let plotObject = { let plotObject = {
identifier: identifier, identifier: identifier,
location: domainObject.location, location: childDomainObject.location,
name: domainObject.name, name: childDomainObject.name,
type: "telemetry.plot.overlay" type: "telemetry.plot.overlay"
}; };
let plotType = openmct.types.get('telemetry.plot.overlay'); let plotType = openmct.types.get('telemetry.plot.overlay');
plotType.definition.initialize(plotObject); plotType.definition.initialize(plotObject);
plotObject.composition.push(domainObject.identifier); plotObject.composition.push(childDomainObject.identifier);
openmct.objects.mutate(plotObject, 'persisted', Date.now()); openmct.objects.mutate(plotObject, 'persisted', Date.now());
let keyString = openmct.objects.makeKeyString(domainObject.identifier); let keyString = openmct.objects.makeKeyString(childDomainObject.identifier);
let clonedComposition = Object.assign([], migratedObject.composition); let clonedComposition = Object.assign([], migratedObject.composition);
clonedComposition.forEach((identifier, index) => { clonedComposition.forEach((objIdentifier, index) => {
if (openmct.objects.makeKeyString(identifier) === keyString) { if (openmct.objects.makeKeyString(objIdentifier) === keyString) {
migratedObject.composition[index] = plotObject.identifier; migratedObject.composition[index] = plotObject.identifier;
} }
}); });
@ -98,7 +98,7 @@ define([
height: panel.dimensions[1], height: panel.dimensions[1],
x: panel.position[0], x: panel.position[0],
y: panel.position[1], y: panel.position[1],
identifier: identifier || domainObject.identifier, identifier: identifier || childDomainObject.identifier,
id: uuid(), id: uuid(),
type: 'subobject-view', type: 'subobject-view',
hasFrame: panel.hasFrame hasFrame: panel.hasFrame

View File

@ -140,7 +140,7 @@ define([
* @returns {Promise} * @returns {Promise}
*/ */
fetch: function (options) { fetch: function (options) {
const strategy = options.shouldUseMinMax ? 'minMax' : undefined; const strategy = options.shouldUseMinMax ? 'minMax' : undefined;
options = _.extend({}, { size: 1000, strategy, filters: this.filters }, options || {}); options = _.extend({}, { size: 1000, strategy, filters: this.filters }, options || {});
if (!this.unsubscribe) { if (!this.unsubscribe) {
this.unsubscribe = this.openmct this.unsubscribe = this.openmct

View File

@ -138,7 +138,7 @@ define([
this.listenTo(series, 'change:interpolate', function () { this.listenTo(series, 'change:interpolate', function () {
this.loadSeriesData(series); this.loadSeriesData(series);
}, this); }, this);
this.loadSeriesData(series); this.loadSeriesData(series);
}; };

View File

@ -215,9 +215,7 @@ define([
* Update the widget's appearance from the configuration of the active rule * Update the widget's appearance from the configuration of the active rule
*/ */
SummaryWidget.prototype.updateWidget = function () { SummaryWidget.prototype.updateWidget = function () {
const WIDGET_CLASS = 'c-sw js-sw', const WIDGET_ICON_CLASS = 'c-sw__icon js-sw__icon';
WIDGET_LABEL_CLASS = 'c-sw__label js-sw__label',
WIDGET_ICON_CLASS = 'c-sw__icon js-sw__icon';
var activeRule = this.rulesById[this.activeId]; var activeRule = this.rulesById[this.activeId];
this.applyStyle($('#widget', this.domElement), activeRule.getProperty('style')); this.applyStyle($('#widget', this.domElement), activeRule.getProperty('style'));
$('#widget', this.domElement).prop('title', activeRule.getProperty('message')); $('#widget', this.domElement).prop('title', activeRule.getProperty('message'));

View File

@ -86,7 +86,7 @@ define(
*/ */
matchesFilters(row) { matchesFilters(row) {
let doesMatchFilters = true; let doesMatchFilters = true;
for (const key in this.columnFilters) { Object.keys(this.columnFilters).forEach((key) => {
if (!doesMatchFilters || !this.rowHasColumn(row, key)) { if (!doesMatchFilters || !this.rowHasColumn(row, key)) {
return false; return false;
} }
@ -97,8 +97,7 @@ define(
} }
doesMatchFilters = formattedValue.toLowerCase().indexOf(this.columnFilters[key]) !== -1; doesMatchFilters = formattedValue.toLowerCase().indexOf(this.columnFilters[key]) !== -1;
} });
return doesMatchFilters; return doesMatchFilters;
} }

View File

@ -3,6 +3,7 @@
Application router -- must Application router -- must
*/ */
/*global _,module*/
const LocationBar = require('location-bar'); const LocationBar = require('location-bar');
const EventEmitter = require('EventEmitter'); const EventEmitter = require('EventEmitter');
@ -117,7 +118,7 @@ class ApplicationRouter extends EventEmitter {
changedParams[key] = value; changedParams[key] = value;
} }
} }
for (let [key, value] of Object.entries(oldParams)) { for (let key of Object.keys(oldParams)) {
if (!newParams.hasOwnProperty(key)) { if (!newParams.hasOwnProperty(key)) {
changedParams[key] = undefined; changedParams[key] = undefined;
} }