From 824a597825b0bf37c93ce8651eb5ccd28f9cceec Mon Sep 17 00:00:00 2001 From: Scott Bell Date: Fri, 25 Mar 2022 17:13:10 +0100 Subject: [PATCH] remove raw-loader as a dependency (#4998) * remove raw-loader as a dependency * move clock to correct dir and response to canvas clicking --- .../generator/SinewaveLimitProvider.e2e.spec.js | 4 ++++ .../generator => plugins/clock}/Clock.e2e.spec.js | 0 example/generator/GeneratorProvider.js | 4 ++-- example/generator/WorkerInterface.js | 13 +++---------- example/generator/plugin.js | 2 +- karma.conf.js | 4 ++++ package.json | 1 - webpack.common.js | 1 + 8 files changed, 15 insertions(+), 14 deletions(-) rename e2e/tests/{example/generator => plugins/clock}/Clock.e2e.spec.js (100%) diff --git a/e2e/tests/example/generator/SinewaveLimitProvider.e2e.spec.js b/e2e/tests/example/generator/SinewaveLimitProvider.e2e.spec.js index fc8101c9ef..88a469404c 100644 --- a/e2e/tests/example/generator/SinewaveLimitProvider.e2e.spec.js +++ b/e2e/tests/example/generator/SinewaveLimitProvider.e2e.spec.js @@ -157,5 +157,9 @@ test.describe('Sine Wave Generator', () => { y: 28 } }); + + // Verify that where we click on canvas shows the number we clicked on + await expect(page.locator('.value-to-display-nearestValue')).toContainText('0.00'); + }); }); diff --git a/e2e/tests/example/generator/Clock.e2e.spec.js b/e2e/tests/plugins/clock/Clock.e2e.spec.js similarity index 100% rename from e2e/tests/example/generator/Clock.e2e.spec.js rename to e2e/tests/plugins/clock/Clock.e2e.spec.js diff --git a/example/generator/GeneratorProvider.js b/example/generator/GeneratorProvider.js index e5cf92973a..2b845a1aae 100644 --- a/example/generator/GeneratorProvider.js +++ b/example/generator/GeneratorProvider.js @@ -35,8 +35,8 @@ define([ phase: 0 }; - function GeneratorProvider() { - this.workerInterface = new WorkerInterface(); + function GeneratorProvider(openmct) { + this.workerInterface = new WorkerInterface(openmct); } GeneratorProvider.prototype.canProvideTelemetry = function (domainObject) { diff --git a/example/generator/WorkerInterface.js b/example/generator/WorkerInterface.js index 2e9c40929a..2ddb3ee181 100644 --- a/example/generator/WorkerInterface.js +++ b/example/generator/WorkerInterface.js @@ -21,20 +21,13 @@ *****************************************************************************/ define([ - 'raw-loader!./generatorWorker.js', 'uuid' ], function ( - workerText, uuid ) { - - var workerBlob = new Blob( - [workerText], - {type: 'application/javascript'} - ); - var workerUrl = URL.createObjectURL(workerBlob); - - function WorkerInterface() { + function WorkerInterface(openmct) { + // eslint-disable-next-line no-undef + const workerUrl = `${openmct.getAssetPath()}${__OPENMCT_ROOT_RELATIVE__}generatorWorker.js`; this.worker = new Worker(workerUrl); this.worker.onmessage = this.onMessage.bind(this); this.callbacks = {}; diff --git a/example/generator/plugin.js b/example/generator/plugin.js index 53d250db51..953383aad9 100644 --- a/example/generator/plugin.js +++ b/example/generator/plugin.js @@ -146,7 +146,7 @@ define([ } }); - openmct.telemetry.addProvider(new GeneratorProvider()); + openmct.telemetry.addProvider(new GeneratorProvider(openmct)); openmct.telemetry.addProvider(new GeneratorMetadataProvider()); openmct.telemetry.addProvider(new SinewaveLimitProvider()); }; diff --git a/karma.conf.js b/karma.conf.js index 4ebdd8bdb0..789e85c849 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -38,6 +38,10 @@ module.exports = (config) => { { pattern: 'dist/inMemorySearchWorker.js*', included: false + }, + { + pattern: 'dist/generatorWorker.js*', + included: false } ], port: 9876, diff --git a/package.json b/package.json index 6b4f2d5fda..de499bd582 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,6 @@ "plotly.js-basic-dist": "2.5.0", "plotly.js-gl2d-dist": "2.5.0", "printj": "1.3.1", - "raw-loader": "4.0.2", "request": "2.88.2", "resolve-url-loader": "4.0.0", "sass": "1.49.0", diff --git a/webpack.common.js b/webpack.common.js index 61a96d6053..9eb980b112 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -18,6 +18,7 @@ const gitBranch = require('child_process') const config = { entry: { openmct: './openmct.js', + generatorWorker: './example/generator/generatorWorker.js', couchDBChangesFeed: './src/plugins/persistence/couch/CouchChangesFeed.js', inMemorySearchWorker: './src/api/objects/InMemorySearchWorker.js', espressoTheme: './src/plugins/themes/espresso-theme.scss',