Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/akhenry/openmct-yamcs int…
Browse files Browse the repository at this point in the history
…o fix-mdb-overrides-parameter-check
  • Loading branch information
shefalijoshi committed Jan 30, 2024
2 parents 096ad4a + c62d10a commit 71ff600
Show file tree
Hide file tree
Showing 23 changed files with 415 additions and 320 deletions.
17 changes: 16 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = {
"browser": true,
"es6": true,
"jasmine": true,
"amd": true
"amd": false
},
"extends": "eslint:recommended",
"parser": "@babel/eslint-parser",
Expand All @@ -37,7 +37,16 @@ module.exports = {
"impliedStrict": true
}
},
"plugins": ['import'],
"rules": {
'import/no-amd': 'error',
'import/no-commonjs': 'error',
'import/named': 'error',
'import/no-webpack-loader-syntax': 'error',
'import/first': 'error',
'import/no-import-module-exports': 'error',
'import/no-mutable-exports': 'error',
'import/no-unused-modules': 'error',
"no-bitwise": "error",
"curly": "error",
"eqeqeq": "error",
Expand Down Expand Up @@ -237,6 +246,12 @@ module.exports = {
"varsIgnorePattern": "controller"
}
]
}
},
{
"files": ['*.eslintrc.cjs'],
"env": {
"node": true
}
}
]
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: npm install and build:example
name: npm install, build, and lint

on:
push:
Expand Down Expand Up @@ -31,3 +31,15 @@ jobs:
elif [ "${{ matrix.openmct-version }}" = "stable" ]; then
npm run build:example
fi
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- run: npm install
- name: Run lint
run: npm run lint
6 changes: 2 additions & 4 deletions .github/workflows/yamcs-quickstart-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
yamcs-version:
- default
- 5.8.3 #viper
- 5.8.7 #viper
## disabling until we get confirmation- 5.3.2 #ab
openmct-version:
- latest
Expand Down Expand Up @@ -74,9 +74,7 @@ jobs:
echo "Error: Unable to fetch Yamcs version. HTTP status code: $response"
exit 1
fi
- name: Run Quickstart tests and publish to deploysentinel
env:
DEPLOYSENTINEL_API_KEY: ${{ secrets.DEPLOYSENTINEL_API_KEY }}
- name: Run Quickstart tests
run: npm run test:e2e:quickstart
- name: Capture docker logs to file
if: always()
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ test-results

# Misc
.DS_Store
.vscode/settings.json
24 changes: 13 additions & 11 deletions .webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ import { fileURLToPath } from 'node:url';

const projectRootDir = fileURLToPath(new URL('../', import.meta.url));

// eslint-disable no-undef
const WEBPACK_COMMON_CONFIG = {
/** @type {import('webpack').Configuration} */
const commonConfig = {
context: projectRootDir,
performance: {
hints: false
},
resolve: {
alias: {
saveAs: "file-saver/src/FileSaver.js",
}
entry: {
'openmct-yamcs': './src/openmct-yamcs.js'
},
module: {
rules: [
Expand All @@ -42,16 +41,19 @@ const WEBPACK_COMMON_CONFIG = {
enforce: "pre",
use: ["source-map-loader"]
}
]
],
},
output: {
globalObject: "this",
filename: '[name].js',
// eslint-disable-next-line no-undef
path: path.resolve(projectRootDir, 'dist'),
libraryTarget: 'umd',
library: 'openmctYamcs'
library: {
type: 'umd',
export: 'default',
name: 'openmctYamcs'
}
}
};
export default WEBPACK_COMMON_CONFIG;

export default commonConfig;

32 changes: 19 additions & 13 deletions .webpack/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,29 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/

import path from 'path';
import { fileURLToPath } from 'url';
import { merge } from 'webpack-merge';
import common from './webpack.common.js';
import { fileURLToPath } from 'node:url';
import commonConfig from './webpack.common.js';

// Replicate __dirname functionality for ES modules
const __dirname = path.dirname(fileURLToPath(import.meta.url));

const projectRootDir = fileURLToPath(new URL('../', import.meta.url));
export default merge(common, {
context: projectRootDir,
/** @type {import('webpack').Configuration} */
const devConfig = {
mode: 'development',
devtool: 'eval-source-map',
entry: {
'openmct-yamcs-example': path.resolve(projectRootDir, 'example/index.js')
'openmct-yamcs-example': './example/index.js'
},
devServer: {
compress: true,
port: 9000,
static: [{
// eslint-disable-next-line no-undef
directory: path.join(projectRootDir, 'example')
directory: path.join(__dirname, '../example'),
}, {
// eslint-disable-next-line no-undef
directory: path.join(projectRootDir, '/node_modules/openmct/dist'),
publicPath: '/node_modules/openmct/dist'
directory: path.join(__dirname, '../node_modules/openmct/dist'),
publicPath: '/dist',
}],
proxy: {
"/yamcs-proxy/*": {
Expand All @@ -59,5 +58,12 @@ export default merge(common, {
pathRewrite: { '^/yamcs-proxy-ws/': '' }
}
}
},
resolve: {
alias: {
openmct: path.resolve(__dirname, '../node_modules/openmct/dist/openmct.js')
}
}
});
};

export default merge(commonConfig, devConfig);
14 changes: 4 additions & 10 deletions .webpack/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,12 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/

import path from 'path';
import { merge } from 'webpack-merge';
import common from './webpack.common.js';
import { fileURLToPath } from 'node:url';

const projectRootDir = fileURLToPath(new URL('../', import.meta.url));

export default merge(common, {
context: projectRootDir,
/** @type {import('webpack').Configuration} */
const prodConfig = {
mode: 'production',
entry: {
'openmct-yamcs': path.resolve(projectRootDir, 'src/plugin.js')
},
devtool: 'source-map'
});
}
export default merge(common, prodConfig);
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,24 @@ openmct.install(installYamcsPlugin({
| yamcsInstance | The name of the instance configured in YAMCS that you wish to connect to. | myproject |
| yamcsFolder | The name of the instance configured in YAMCS that you wish to connect to. | myproject |

## dictionaryRequestCacheStrategyPromise
installYamcsPlugin also accepts an optional promise argument `dictionaryRequestCacheStrategyPromise`. This strategy is passed to the request for loading the YAMCS dictionary, or the `#loadTelemetryDictionary` function in `object-provider.js`. An example of how to make use of this is below.
```
let cacheStrategy;
const cacheStrategyPromise = new Promise(resolve => cacheStrategy)
openmct.install(installYamcsPlugin(
configuration,
cacheStrategryPromise
))
if (DICTIONARY_VERSION_IS_NEW) { // some check to determine dictionary version
cacheStrategy({cache: 'reload'})
} else {
cacheStrategy({})
}
```

## Special XTCE features

If you are using an XTCE configuration in Yamcs, there are two special
Expand Down
2 changes: 1 addition & 1 deletion example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<html>
<head>
<title>Open MCT - YAMCS Example</title>
<script src="/node_modules/openmct/dist/openmct.js"></script>
<script src="/dist/openmct.js"></script>
<script src="/openmct-yamcs-example.js" defer></script>

<link rel="icon" type="image/png" href="/node_modules/openmct/dist/favicons/favicon-96x96.png" sizes="96x96" type="image/x-icon">
Expand Down
98 changes: 49 additions & 49 deletions example/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import installYamcsPlugin from '../src/plugin.js';
import installYamcsPlugin from '../src/openmct-yamcs.js';

const config = {
"yamcsDictionaryEndpoint": "http://localhost:9000/yamcs-proxy/",
Expand All @@ -8,7 +8,9 @@ const config = {
"yamcsUserEndpoint": "http://localhost:9000/yamcs-proxy/api/user/",
"yamcsInstance": "myproject",
"yamcsProcessor": "realtime",
"yamcsFolder": "myproject"
"yamcsFolder": "myproject",
"throttleRate": 1000,
"maxBatchSize": 15
};
const STATUS_STYLES = {
"NO_STATUS": {
Expand Down Expand Up @@ -39,57 +41,55 @@ const STATUS_STYLES = {
};
const openmct = window.openmct;

(function () {
const THIRTY_MINUTES = 30 * 60 * 1000;
const THIRTY_MINUTES = 30 * 60 * 1000;

openmct.setAssetPath('/node_modules/openmct/dist');
openmct.setAssetPath('/dist');

installDefaultPlugins();
openmct.install(installYamcsPlugin(config));
openmct.install(openmct.plugins.OperatorStatus({statusStyles: STATUS_STYLES}));
installDefaultPlugins();
openmct.install(installYamcsPlugin(config));
openmct.install(openmct.plugins.OperatorStatus({statusStyles: STATUS_STYLES}));

document.addEventListener('DOMContentLoaded', function () {
openmct.start();
});
document.addEventListener('DOMContentLoaded', function () {
openmct.start();
});

function installDefaultPlugins() {
openmct.install(openmct.plugins.LocalStorage());
openmct.install(openmct.plugins.Espresso());
openmct.install(openmct.plugins.MyItems());
openmct.install(openmct.plugins.example.Generator());
openmct.install(openmct.plugins.example.ExampleImagery());
openmct.install(openmct.plugins.UTCTimeSystem());
openmct.install(openmct.plugins.TelemetryMean());
function installDefaultPlugins() {
openmct.install(openmct.plugins.LocalStorage());
openmct.install(openmct.plugins.Espresso());
openmct.install(openmct.plugins.MyItems());
openmct.install(openmct.plugins.example.Generator());
openmct.install(openmct.plugins.example.ExampleImagery());
openmct.install(openmct.plugins.UTCTimeSystem());
openmct.install(openmct.plugins.TelemetryMean());

openmct.install(openmct.plugins.DisplayLayout({
showAsView: ['summary-widget', 'example.imagery', 'yamcs.image']
}));
openmct.install(openmct.plugins.Conductor({
menuOptions: [
{
name: "Realtime",
timeSystem: 'utc',
clock: 'local',
clockOffsets: {
start: -THIRTY_MINUTES,
end: 0
}
},
{
name: "Fixed",
timeSystem: 'utc',
bounds: {
start: Date.now() - THIRTY_MINUTES,
end: 0
}
openmct.install(openmct.plugins.DisplayLayout({
showAsView: ['summary-widget', 'example.imagery', 'yamcs.image']
}));
openmct.install(openmct.plugins.Conductor({
menuOptions: [
{
name: "Realtime",
timeSystem: 'utc',
clock: 'local',
clockOffsets: {
start: -THIRTY_MINUTES,
end: 0
}
]
}));
openmct.install(openmct.plugins.SummaryWidget());
openmct.install(openmct.plugins.Notebook());
openmct.install(openmct.plugins.LADTable());
openmct.install(openmct.plugins.ClearData(['table', 'telemetry.plot.overlay', 'telemetry.plot.stacked']));
},
{
name: "Fixed",
timeSystem: 'utc',
bounds: {
start: Date.now() - THIRTY_MINUTES,
end: 0
}
}
]
}));
openmct.install(openmct.plugins.SummaryWidget());
openmct.install(openmct.plugins.Notebook());
openmct.install(openmct.plugins.LADTable());
openmct.install(openmct.plugins.ClearData(['table', 'telemetry.plot.overlay', 'telemetry.plot.stacked']));

openmct.install(openmct.plugins.FaultManagement());
}
}());
openmct.install(openmct.plugins.FaultManagement());
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"test:e2e:smoke": "npx playwright test --config=./tests/e2e/playwright-quickstart.config.js --project=chromium quickstartSmoke",
"test:e2e:quickstart": "npx playwright test --config=./tests/e2e/playwright-quickstart.config.js --project=chromium tests/e2e/yamcs/",
"test:e2e:quickstart:local": "npx playwright test --config=./tests/e2e/playwright-quickstart.config.js --project=local-chrome tests/e2e/yamcs/",
"test:e2e:watch": "npx playwright test --ui --config=./tests/e2e/playwright-quickstart.config.js",
"wait-for-yamcs": "wait-on http-get://localhost:8090/ -v"
},
"keywords": [
Expand All @@ -37,11 +38,11 @@
"devDependencies": {
"@babel/core": "7.20.12",
"@babel/eslint-parser": "7.19.1",
"@deploysentinel/playwright": "0.3.4",
"@playwright/test": "1.39.0",
"babel-loader": "9.1.0",
"babel-plugin-istanbul": "6.1.1",
"eslint": "8.38.0",
"eslint-plugin-import":"2.29.1",
"eventemitter3": "4.0.7",
"file-saver": "2.0.5",
"semver": "7.5.2",
Expand Down
2 changes: 1 addition & 1 deletion src/actions/exportToCSV/ExportToCSVAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*****************************************************************************/
import { OBJECT_TYPES } from "../../const.js";
import {idToQualifiedName} from "../../utils.js";
import {saveAs} from 'saveAs';
import { saveAs } from 'file-saver';

const SUPPORTED_TYPES = [OBJECT_TYPES.TELEMETRY_OBJECT_TYPE, OBJECT_TYPES.AGGREGATE_TELEMETRY_TYPE];

Expand Down
Loading

0 comments on commit 71ff600

Please sign in to comment.