mirror of
https://github.com/nasa/openmct.git
synced 2025-06-19 15:43:48 +00:00
Build refactor to webpack (#2139)
* Move to webpack build * Use webpack for building openmct. Move SCSS to one folder and load all core css up front. Remove bower, begin removing gulp in favor of npm run. * Uses eslint instead of jshint and jscs. Merge style checking rules into .eshintrc.js, carrying over core parts of crockford style and our adaptations. Current code base fails to pass the linter, want to separate linter changes from fixes to linting rules. * Support for Vue SFC with example * Remove outdated examples * Use HTML loader for html (supports relative imports of resources e.g. images) and raw-loader for when javascript must be loaded as text.
This commit is contained in:
committed by
Andrew Henry
parent
9582fb2b06
commit
0d53898af9
@ -37,11 +37,11 @@ define([
|
||||
"./src/inspector/HideElementPoolDirective",
|
||||
"./src/services/ExportImageService",
|
||||
'./src/PlotViewPolicy',
|
||||
"text!./res/templates/plot-options.html",
|
||||
"text!./res/templates/plot-options-browse.html",
|
||||
"text!./res/templates/plot-options-edit.html",
|
||||
"text!./res/templates/stacked-plot.html",
|
||||
"text!./res/templates/plot.html"
|
||||
"./res/templates/plot-options.html",
|
||||
"./res/templates/plot-options-browse.html",
|
||||
"./res/templates/plot-options-edit.html",
|
||||
"./res/templates/stacked-plot.html",
|
||||
"./res/templates/plot.html"
|
||||
], function (
|
||||
MCTChartDirective,
|
||||
MCTPlotDirective,
|
||||
|
@ -40,7 +40,7 @@ define(
|
||||
if (!adaptedObject.telemetry) {
|
||||
return domainObject.hasCapability('delegation') &&
|
||||
domainObject.getCapability('delegation')
|
||||
.doesDelegateCapability('telemetry');
|
||||
.doesDelegateCapability('telemetry');
|
||||
}
|
||||
|
||||
var metadata = this.openmct.telemetry.getMetadata(adaptedObject);
|
||||
|
@ -29,17 +29,17 @@ define(
|
||||
function (DrawWebGL, Draw2D) {
|
||||
|
||||
var CHARTS = [
|
||||
{
|
||||
MAX_INSTANCES: 16,
|
||||
API: DrawWebGL,
|
||||
ALLOCATIONS: []
|
||||
},
|
||||
{
|
||||
MAX_INSTANCES: Number.POSITIVE_INFINITY,
|
||||
API: Draw2D,
|
||||
ALLOCATIONS: []
|
||||
}
|
||||
];
|
||||
{
|
||||
MAX_INSTANCES: 16,
|
||||
API: DrawWebGL,
|
||||
ALLOCATIONS: []
|
||||
},
|
||||
{
|
||||
MAX_INSTANCES: Number.POSITIVE_INFINITY,
|
||||
API: Draw2D,
|
||||
ALLOCATIONS: []
|
||||
}
|
||||
];
|
||||
|
||||
/**
|
||||
* Draw loader attaches a draw API to a canvas element and returns the
|
||||
|
@ -37,7 +37,7 @@ define([
|
||||
event: event,
|
||||
callback: callback,
|
||||
context: context,
|
||||
_cb: !!context ? callback.bind(context) : callback
|
||||
_cb: context ? callback.bind(context) : callback
|
||||
};
|
||||
if (object.$watch && event.indexOf('change:') === 0) {
|
||||
var scopePath = event.replace('change:', '');
|
||||
@ -58,20 +58,20 @@ define([
|
||||
}
|
||||
|
||||
this._listeningTo.filter(function (listener) {
|
||||
if (object && object !== listener.object) {
|
||||
return false;
|
||||
}
|
||||
if (event && event !== listener.event) {
|
||||
return false;
|
||||
}
|
||||
if (callback && callback !== listener.callback) {
|
||||
return false;
|
||||
}
|
||||
if (context && context !== listener.context) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
if (object && object !== listener.object) {
|
||||
return false;
|
||||
}
|
||||
if (event && event !== listener.event) {
|
||||
return false;
|
||||
}
|
||||
if (callback && callback !== listener.callback) {
|
||||
return false;
|
||||
}
|
||||
if (context && context !== listener.context) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.map(function (listener) {
|
||||
if (listener.unlisten) {
|
||||
listener.unlisten();
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
define([
|
||||
'./MCTPlotController',
|
||||
'text!../../res/templates/mct-plot.html'
|
||||
'../../res/templates/mct-plot.html'
|
||||
], function (
|
||||
MCTPlotController,
|
||||
PlotTemplate
|
||||
|
@ -91,16 +91,16 @@ define(
|
||||
console.log('error capturing image', error);
|
||||
dialog.dismiss();
|
||||
var errorDialog = dialogService.showBlockingMessage({
|
||||
title: "Error capturing image",
|
||||
severity: "error",
|
||||
hint: "Image was not captured successfully!",
|
||||
options: [{
|
||||
label: "OK",
|
||||
callback: function () {
|
||||
errorDialog.dismiss();
|
||||
}
|
||||
}]
|
||||
});
|
||||
title: "Error capturing image",
|
||||
severity: "error",
|
||||
hint: "Image was not captured successfully!",
|
||||
options: [{
|
||||
label: "OK",
|
||||
callback: function () {
|
||||
errorDialog.dismiss();
|
||||
}
|
||||
}]
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'text!../../res/templates/plot.html'
|
||||
'../../res/templates/plot.html'
|
||||
], function (
|
||||
PlotTemplate
|
||||
) {
|
||||
|
@ -160,10 +160,10 @@ define([
|
||||
this.config.series.map(function (plotSeries) {
|
||||
this.startLoading();
|
||||
plotSeries.load({
|
||||
size: this.$element[0].offsetWidth,
|
||||
start: range.min,
|
||||
end: range.max
|
||||
})
|
||||
size: this.$element[0].offsetWidth,
|
||||
start: range.min,
|
||||
end: range.max
|
||||
})
|
||||
.then(this.stopLoading.bind(this));
|
||||
if (purge) {
|
||||
plotSeries.purgeRecordsOutsideRange(range);
|
||||
|
@ -28,7 +28,6 @@ define([
|
||||
|
||||
function StackedPlotController($scope, openmct, objectService, $element, exportImageService) {
|
||||
var tickWidth = 0,
|
||||
newFormatObject,
|
||||
composition,
|
||||
currentRequest,
|
||||
unlisten,
|
||||
@ -39,15 +38,6 @@ define([
|
||||
|
||||
$scope.telemetryObjects = [];
|
||||
|
||||
function oldId(newIdentifier) {
|
||||
var idParts = [];
|
||||
if (newIdentifier.namespace) {
|
||||
idParts.push(newIdentifier.namespace.replace(/\:/g, '\\:'));
|
||||
}
|
||||
idParts.push(newIdentifier.key);
|
||||
return idParts.join(':');
|
||||
}
|
||||
|
||||
function onDomainObjectChange(domainObject) {
|
||||
var thisRequest = {
|
||||
pending: 0
|
||||
@ -64,7 +54,7 @@ define([
|
||||
}
|
||||
|
||||
function addChild(child) {
|
||||
var id = oldId(child.identifier);
|
||||
var id = openmct.objects.makeKeyString(child.identifier);
|
||||
thisTickWidthMap[id] = 0;
|
||||
thisRequest.pending += 1;
|
||||
objectService.getObjects([id])
|
||||
@ -76,7 +66,7 @@ define([
|
||||
}
|
||||
|
||||
function removeChild(childIdentifier) {
|
||||
var id = oldId(childIdentifier);
|
||||
var id = openmct.objects.makeKeyString(childIdentifier);
|
||||
delete thisTickWidthMap[id];
|
||||
var childObj = telemetryObjects.filter(function (c) {
|
||||
return c.getId() === id;
|
||||
@ -89,21 +79,20 @@ define([
|
||||
}
|
||||
thisRequest.pending += 1;
|
||||
openmct.objects.get(domainObject.getId())
|
||||
.then(function (obj) {
|
||||
thisRequest.pending -= 1;
|
||||
if (thisRequest !== currentRequest) {
|
||||
return;
|
||||
}
|
||||
newFormatObject = obj;
|
||||
composition = openmct.composition.get(obj);
|
||||
composition.on('add', addChild);
|
||||
composition.on('remove', removeChild);
|
||||
composition.load();
|
||||
unlisten = function () {
|
||||
composition.off('add', addChild);
|
||||
composition.off('remove', removeChild);
|
||||
};
|
||||
});
|
||||
.then(function (obj) {
|
||||
thisRequest.pending -= 1;
|
||||
if (thisRequest !== currentRequest) {
|
||||
return;
|
||||
}
|
||||
composition = openmct.composition.get(obj);
|
||||
composition.on('add', addChild);
|
||||
composition.on('remove', removeChild);
|
||||
composition.load();
|
||||
unlisten = function () {
|
||||
composition.off('add', addChild);
|
||||
composition.off('remove', removeChild);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function onCompositionChange(newComp, oldComp) {
|
||||
|
Reference in New Issue
Block a user