Compare commits
	
		
			11 Commits
		
	
	
		
			condition-
			...
			1.7.5-mast
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					3d61cdc40a | ||
| 
						 | 
					f8f2e7da9b | ||
| 
						 | 
					240f58b2d0 | ||
| 
						 | 
					7d3baee7b5 | ||
| 
						 | 
					1312c9ef89 | ||
| 
						 | 
					1f5cb7ca42 | ||
| 
						 | 
					4a7ebe326c | ||
| 
						 | 
					10da314a4a | ||
| 
						 | 
					b3ceccd7fb | ||
| 
						 | 
					1bde4c9a0c | ||
| 
						 | 
					4b85360446 | 
@@ -1,36 +1,69 @@
 | 
			
		||||
version: 2
 | 
			
		||||
jobs:
 | 
			
		||||
  build:
 | 
			
		||||
version: 2.1
 | 
			
		||||
executors:
 | 
			
		||||
  linux:
 | 
			
		||||
    docker:
 | 
			
		||||
        - image: circleci/node:13-browsers
 | 
			
		||||
          environment:
 | 
			
		||||
            CHROME_BIN: "/usr/bin/google-chrome"
 | 
			
		||||
    steps:
 | 
			
		||||
        - checkout
 | 
			
		||||
        - run:
 | 
			
		||||
            name: Update npm
 | 
			
		||||
            command: 'sudo npm install -g npm@latest'
 | 
			
		||||
        - restore_cache:
 | 
			
		||||
            key: dependency-cache-{{ checksum "package.json" }}
 | 
			
		||||
        - run:
 | 
			
		||||
            name: Installing dependencies (npm install)
 | 
			
		||||
            command: npm install
 | 
			
		||||
        - save_cache:
 | 
			
		||||
            key: dependency-cache-{{ checksum "package.json" }}
 | 
			
		||||
            paths:
 | 
			
		||||
              - node_modules
 | 
			
		||||
        - run:
 | 
			
		||||
            name: npm run test:coverage
 | 
			
		||||
            command: npm run test:coverage
 | 
			
		||||
        - run:
 | 
			
		||||
            name: npm run lint
 | 
			
		||||
            command: npm run lint
 | 
			
		||||
        - store_artifacts:
 | 
			
		||||
            path: dist
 | 
			
		||||
            prefix: dist
 | 
			
		||||
 | 
			
		||||
workflows:
 | 
			
		||||
  version: 2
 | 
			
		||||
      - image: cimg/base:stable
 | 
			
		||||
orbs:
 | 
			
		||||
  node: circleci/node@4.5.1
 | 
			
		||||
  browser-tools: circleci/browser-tools@1.1.3
 | 
			
		||||
jobs:
 | 
			
		||||
  test:
 | 
			
		||||
    parameters:
 | 
			
		||||
      node-version:
 | 
			
		||||
        type: string
 | 
			
		||||
      browser:
 | 
			
		||||
        type: string
 | 
			
		||||
      always-pass:
 | 
			
		||||
        type: boolean  
 | 
			
		||||
    executor: linux
 | 
			
		||||
    steps:
 | 
			
		||||
      - checkout
 | 
			
		||||
      - restore_cache:
 | 
			
		||||
          key: deps-{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}
 | 
			
		||||
      - node/install:
 | 
			
		||||
          node-version: << parameters.node-version >>
 | 
			
		||||
      - node/install-packages:
 | 
			
		||||
          override-ci-command: npm install
 | 
			
		||||
      - when: # Just to save time until caching saves the browser bin
 | 
			
		||||
          condition:
 | 
			
		||||
            equal: [ "FirefoxESR", <<parameters.browser>> ]
 | 
			
		||||
          steps:
 | 
			
		||||
            - browser-tools/install-firefox:
 | 
			
		||||
                version: "78.11.0esr" #https://archive.mozilla.org/pub/firefox/releases/          
 | 
			
		||||
      - when: # Just to save time until caching saves the browser bin
 | 
			
		||||
          condition:
 | 
			
		||||
            equal: [ "ChromeHeadless", <<parameters.browser>> ]
 | 
			
		||||
          steps:
 | 
			
		||||
            - browser-tools/install-chrome:
 | 
			
		||||
                replace-existing: false
 | 
			
		||||
      - save_cache:
 | 
			
		||||
          key: deps-{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}
 | 
			
		||||
          paths:
 | 
			
		||||
            - ~/.npm
 | 
			
		||||
            - ~/.cache
 | 
			
		||||
            - node_modules
 | 
			
		||||
      - run: npm run test:coverage -- --browsers=<<parameters.browser>> || <<parameters.always-pass>>
 | 
			
		||||
      - store_test_results:
 | 
			
		||||
          path: dist/reports/tests/
 | 
			
		||||
      - store_artifacts:
 | 
			
		||||
          path: dist/reports/
 | 
			
		||||
workflows:
 | 
			
		||||
  matrix-tests:
 | 
			
		||||
    jobs:
 | 
			
		||||
      - build
 | 
			
		||||
      - test:
 | 
			
		||||
          name: node10-chrome
 | 
			
		||||
          node-version: lts/dubnium
 | 
			
		||||
          browser: ChromeHeadless
 | 
			
		||||
          always-pass: false
 | 
			
		||||
      - test:
 | 
			
		||||
          name: node12-firefoxESR
 | 
			
		||||
          node-version: lts/erbium
 | 
			
		||||
          browser: FirefoxESR
 | 
			
		||||
          always-pass: true
 | 
			
		||||
      - test:
 | 
			
		||||
          name: node14-chrome
 | 
			
		||||
          node-version: lts/fermium
 | 
			
		||||
          browser: ChromeHeadless
 | 
			
		||||
          always-pass: true
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								.github/workflows/lighthouse.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/lighthouse.yml
									
									
									
									
										vendored
									
									
								
							@@ -13,6 +13,8 @@ jobs:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
        with:
 | 
			
		||||
          ref: ${{ github.event.inputs.version }}
 | 
			
		||||
      - uses: actions/setup-node@v1
 | 
			
		||||
      - uses: actions/setup-node@v2
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: '14'
 | 
			
		||||
      - run: npm install && npm install -g @lhci/cli #Don't want to include this in our deps
 | 
			
		||||
      - run: lhci autorun
 | 
			
		||||
@@ -23,9 +23,9 @@
 | 
			
		||||
/*global module,process*/
 | 
			
		||||
 | 
			
		||||
const devMode = process.env.NODE_ENV !== 'production';
 | 
			
		||||
const browsers = [process.env.NODE_ENV === 'debug' ? 'ChromeDebugging' : 'FirefoxHeadless'];
 | 
			
		||||
const browsers = [process.env.NODE_ENV === 'debug' ? 'ChromeDebugging' : 'ChromeHeadless'];
 | 
			
		||||
const coverageEnabled = process.env.COVERAGE === 'true';
 | 
			
		||||
const reporters = ['progress', 'html'];
 | 
			
		||||
const reporters = ['progress', 'html', 'junit'];
 | 
			
		||||
 | 
			
		||||
if (coverageEnabled) {
 | 
			
		||||
    reporters.push('coverage-istanbul');
 | 
			
		||||
@@ -59,7 +59,8 @@ module.exports = (config) => {
 | 
			
		||||
        browsers: browsers,
 | 
			
		||||
        client: {
 | 
			
		||||
            jasmine: {
 | 
			
		||||
                random: false
 | 
			
		||||
                random: false,
 | 
			
		||||
                timeoutInterval: 30000
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        customLaunchers: {
 | 
			
		||||
@@ -67,6 +68,10 @@ module.exports = (config) => {
 | 
			
		||||
                base: 'Chrome',
 | 
			
		||||
                flags: ['--remote-debugging-port=9222'],
 | 
			
		||||
                debug: true
 | 
			
		||||
            },
 | 
			
		||||
            FirefoxESR: {
 | 
			
		||||
                base: 'FirefoxHeadless',
 | 
			
		||||
                name: 'FirefoxESR'
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        colors: true,
 | 
			
		||||
@@ -78,12 +83,21 @@ module.exports = (config) => {
 | 
			
		||||
            preserveDescribeNesting: true,
 | 
			
		||||
            foldAll: false
 | 
			
		||||
        },
 | 
			
		||||
        browserConsoleLogOptions: { level: "error",  format: "%b %T: %m",  terminal: true },
 | 
			
		||||
        junitReporter: {
 | 
			
		||||
            outputDir: "dist/reports/tests",
 | 
			
		||||
            outputFile: "test-results.xml",
 | 
			
		||||
            useBrowserName: false
 | 
			
		||||
        },
 | 
			
		||||
        browserConsoleLogOptions: {
 | 
			
		||||
            level: "error",
 | 
			
		||||
            format: "%b %T: %m",
 | 
			
		||||
            terminal: true
 | 
			
		||||
        },
 | 
			
		||||
        coverageIstanbulReporter: {
 | 
			
		||||
            fixWebpackSourcePaths: true,
 | 
			
		||||
            dir: process.env.CIRCLE_ARTIFACTS ?
 | 
			
		||||
                process.env.CIRCLE_ARTIFACTS + '/coverage' :
 | 
			
		||||
                "dist/reports/coverage",
 | 
			
		||||
            dir: process.env.CIRCLE_ARTIFACTS
 | 
			
		||||
                ? process.env.CIRCLE_ARTIFACTS + '/coverage'
 | 
			
		||||
                : "dist/reports/coverage",
 | 
			
		||||
            reports: ['html', 'lcovonly', 'text-summary'],
 | 
			
		||||
            thresholds: {
 | 
			
		||||
                global: {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								package.json
									
									
									
									
									
								
							@@ -37,17 +37,18 @@
 | 
			
		||||
    "html2canvas": "^1.0.0-rc.7",
 | 
			
		||||
    "imports-loader": "^0.8.0",
 | 
			
		||||
    "istanbul-instrumenter-loader": "^3.0.1",
 | 
			
		||||
    "jasmine-core": "^3.1.0",
 | 
			
		||||
    "jasmine-core": "^3.7.1",
 | 
			
		||||
    "jsdoc": "^3.3.2",
 | 
			
		||||
    "karma": "5.1.1",
 | 
			
		||||
    "karma": "6.3.4",
 | 
			
		||||
    "karma-chrome-launcher": "3.1.0",
 | 
			
		||||
    "karma-firefox-launcher": "2.1.0",
 | 
			
		||||
    "karma-cli": "2.0.0",
 | 
			
		||||
    "karma-coverage": "2.0.3",
 | 
			
		||||
    "karma-coverage-istanbul-reporter": "3.0.3",
 | 
			
		||||
    "karma-firefox-launcher": "1.3.0",
 | 
			
		||||
    "karma-junit-reporter": "2.0.1",
 | 
			
		||||
    "karma-html-reporter": "0.2.7",
 | 
			
		||||
    "karma-jasmine": "3.3.1",
 | 
			
		||||
    "karma-sourcemap-loader": "0.3.7",
 | 
			
		||||
    "karma-jasmine": "4.0.1",
 | 
			
		||||
    "karma-sourcemap-loader": "0.3.8",
 | 
			
		||||
    "karma-webpack": "4.0.2",
 | 
			
		||||
    "location-bar": "^3.0.1",
 | 
			
		||||
    "lodash": "^4.17.12",
 | 
			
		||||
@@ -89,6 +90,7 @@
 | 
			
		||||
    "test": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" karma start --single-run",
 | 
			
		||||
    "test:debug": "cross-env NODE_ENV=debug karma start --no-single-run",
 | 
			
		||||
    "test:coverage": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" COVERAGE=true karma start --single-run",
 | 
			
		||||
    "test:coverage:firefox": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" karma start --single-run --browsers=FirefoxHeadless",
 | 
			
		||||
    "test:watch": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" karma start --no-single-run",
 | 
			
		||||
    "verify": "concurrently 'npm:test' 'npm:lint'",
 | 
			
		||||
    "jsdoc": "jsdoc -c jsdoc.json -R API.md -r -d dist/docs/api",
 | 
			
		||||
@@ -100,6 +102,9 @@
 | 
			
		||||
    "type": "git",
 | 
			
		||||
    "url": "https://github.com/nasa/openmct.git"
 | 
			
		||||
  },
 | 
			
		||||
  "engines": {
 | 
			
		||||
    "node": ">=10.10.2 <16.0.0"
 | 
			
		||||
  },
 | 
			
		||||
  "author": "",
 | 
			
		||||
  "license": "Apache-2.0",
 | 
			
		||||
  "private": true
 | 
			
		||||
 
 | 
			
		||||
@@ -1,70 +0,0 @@
 | 
			
		||||
This bundle provides the Timeline domain object type, as well
 | 
			
		||||
as other associated domain object types and relevant views.
 | 
			
		||||
 | 
			
		||||
# Implementation notes
 | 
			
		||||
 | 
			
		||||
## Model Properties
 | 
			
		||||
 | 
			
		||||
The properties below record properties relevant to using and
 | 
			
		||||
understanding timelines based on their JSON representation.
 | 
			
		||||
Additional common properties, such as `modified`
 | 
			
		||||
or `persisted` timestamps, may also be present.
 | 
			
		||||
 | 
			
		||||
### Timeline Model
 | 
			
		||||
 | 
			
		||||
A timeline's model looks like:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
{
 | 
			
		||||
    "type": "timeline",
 | 
			
		||||
    "start": {
 | 
			
		||||
        "timestamp": <number> (milliseconds since epoch),
 | 
			
		||||
        "epoch": <string> (currently, always "SET")
 | 
			
		||||
    },
 | 
			
		||||
    "capacity": <number> (optional; battery capacity in watt-hours)
 | 
			
		||||
    "composition": <string[]> (array of identifiers for contained objects)
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The identifiers in a timeline's `composition` field should refer to
 | 
			
		||||
other Timeline objects, or to Activity objects.
 | 
			
		||||
 | 
			
		||||
### Activity Model
 | 
			
		||||
 | 
			
		||||
An activity's model looks like:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
{
 | 
			
		||||
    "type": "activity",
 | 
			
		||||
    "start": {
 | 
			
		||||
        "timestamp": <number> (milliseconds since epoch),
 | 
			
		||||
        "epoch": <string> (currently, always "SET")
 | 
			
		||||
    },
 | 
			
		||||
    "duration": {
 | 
			
		||||
        "timestamp": <number> (duration of this activity, in milliseconds)
 | 
			
		||||
        "epoch": "SET" (this is ignored)
 | 
			
		||||
    },
 | 
			
		||||
    "relationships": {
 | 
			
		||||
        "modes": <string[]> (array of applicable Activity Mode ids)
 | 
			
		||||
    },
 | 
			
		||||
    "link": <string> (optional; URL linking to associated external resource)
 | 
			
		||||
    "composition": <string[]> (array of identifiers for contained objects)
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The identifiers in a timeline's `composition` field should only refer to
 | 
			
		||||
other Activity objects.
 | 
			
		||||
 | 
			
		||||
### Activity Mode Model
 | 
			
		||||
 | 
			
		||||
An activity mode's model looks like:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
{
 | 
			
		||||
    "type": "mode",
 | 
			
		||||
    "resources": {
 | 
			
		||||
        "comms": <number> (communications utilization, in Kbps)
 | 
			
		||||
        "power": <number> (power utilization, in watts)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
@@ -1,52 +0,0 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2021, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT is licensed under the Apache License, Version 2.0 (the
 | 
			
		||||
 * "License"); you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 * http://www.apache.org/licenses/LICENSE-2.0.
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 | 
			
		||||
 * License for the specific language governing permissions and limitations
 | 
			
		||||
 * under the License.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT includes source code licensed under additional open source
 | 
			
		||||
 * licenses. See the Open Source Licenses file (LICENSES.md) included with
 | 
			
		||||
 * this source code distribution or the Licensing information page available
 | 
			
		||||
 * at runtime from the About dialog for additional information.
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
define([
 | 
			
		||||
    "./res/templates/deprecated-timeline-message.html"
 | 
			
		||||
], function (
 | 
			
		||||
    deprecatedTimelineMessage
 | 
			
		||||
) {
 | 
			
		||||
    return {
 | 
			
		||||
        name: 'platform/features/timeline',
 | 
			
		||||
        definition: {
 | 
			
		||||
            extensions: {
 | 
			
		||||
                types: [
 | 
			
		||||
                    {
 | 
			
		||||
                        key: "timeline",
 | 
			
		||||
                        name: "Timeline",
 | 
			
		||||
                        description: "Timeline, Activity and Activity Mode objects have been deprecated and will no longer be supported. (07/18/2018)",
 | 
			
		||||
                        priority: 502
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                views: [
 | 
			
		||||
                    {
 | 
			
		||||
                        key: "timeline",
 | 
			
		||||
                        name: "Timeline",
 | 
			
		||||
                        type: "timeline",
 | 
			
		||||
                        description: "Timeline, Activity and Activity Mode objects have been deprecated and will no longer be supported. (07/18/2018)",
 | 
			
		||||
                        template: deprecatedTimelineMessage
 | 
			
		||||
                    }
 | 
			
		||||
                ]
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
});
 | 
			
		||||
@@ -1,10 +0,0 @@
 | 
			
		||||
<div>
 | 
			
		||||
    Timeline, Activity and Activity Mode objects have been deprecated and will no longer be supported.
 | 
			
		||||
</div>
 | 
			
		||||
<div>
 | 
			
		||||
    Please open an issue in the
 | 
			
		||||
    <a href="https://github.com/nasa/openmct/issues" target="_blank">
 | 
			
		||||
        Open MCT Issue tracker
 | 
			
		||||
    </a>
 | 
			
		||||
    if you have any questions about the timeline plugin.
 | 
			
		||||
</div>
 | 
			
		||||
@@ -173,10 +173,11 @@ define([
 | 
			
		||||
        const limitEvaluator = oldObject.getCapability("limit");
 | 
			
		||||
 | 
			
		||||
        return {
 | 
			
		||||
            limits: function () {
 | 
			
		||||
                return limitEvaluator.limits();
 | 
			
		||||
            limits: () => {
 | 
			
		||||
                return limitEvaluator.limits.then !== undefined
 | 
			
		||||
                    ? limitEvaluator.limits()
 | 
			
		||||
                    : Promise.resolve(limitEvaluator.limits());
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        };
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,6 @@ const DEFAULTS = [
 | 
			
		||||
    'platform/telemetry',
 | 
			
		||||
    'platform/features/clock',
 | 
			
		||||
    'platform/features/hyperlink',
 | 
			
		||||
    'platform/features/timeline',
 | 
			
		||||
    'platform/forms',
 | 
			
		||||
    'platform/identity',
 | 
			
		||||
    'platform/persistence/aggregator',
 | 
			
		||||
@@ -84,7 +83,6 @@ define([
 | 
			
		||||
    '../platform/features/my-items/bundle',
 | 
			
		||||
    '../platform/features/hyperlink/bundle',
 | 
			
		||||
    '../platform/features/static-markup/bundle',
 | 
			
		||||
    '../platform/features/timeline/bundle',
 | 
			
		||||
    '../platform/forms/bundle',
 | 
			
		||||
    '../platform/framework/bundle',
 | 
			
		||||
    '../platform/framework/src/load/Bundle',
 | 
			
		||||
 
 | 
			
		||||
@@ -280,7 +280,7 @@ describe("The Imagery View Layout", () => {
 | 
			
		||||
            expect(imageInfo.url.indexOf(imageTelemetry[COUNT - 1].timeId)).not.toEqual(-1);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it("should show the clicked thumbnail as the main image", (done) => {
 | 
			
		||||
        xit("should show the clicked thumbnail as the main image", (done) => {
 | 
			
		||||
            const target = imageTelemetry[5].url;
 | 
			
		||||
            parent.querySelectorAll(`img[src='${target}']`)[0].click();
 | 
			
		||||
            Vue.nextTick(() => {
 | 
			
		||||
@@ -317,7 +317,7 @@ describe("The Imagery View Layout", () => {
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it("should navigate via arrow keys", (done) => {
 | 
			
		||||
        xit("should navigate via arrow keys", (done) => {
 | 
			
		||||
            let keyOpts = {
 | 
			
		||||
                element: parent.querySelector('.c-imagery'),
 | 
			
		||||
                key: 'ArrowLeft',
 | 
			
		||||
 
 | 
			
		||||
@@ -24,19 +24,23 @@ import Plot from './Plot.vue';
 | 
			
		||||
import Vue from 'vue';
 | 
			
		||||
 | 
			
		||||
export default function PlotViewProvider(openmct) {
 | 
			
		||||
    function hasTelemetry(domainObject) {
 | 
			
		||||
    function hasNumericTelemetry(domainObject) {
 | 
			
		||||
        if (!Object.prototype.hasOwnProperty.call(domainObject, 'telemetry')) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        let metadata = openmct.telemetry.getMetadata(domainObject);
 | 
			
		||||
 | 
			
		||||
        return metadata.values().length > 0 && hasDomainAndRange(metadata);
 | 
			
		||||
        return metadata.values().length > 0 && hasDomainAndNumericRange(metadata);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function hasDomainAndRange(metadata) {
 | 
			
		||||
        return (metadata.valuesForHints(['range']).length > 0
 | 
			
		||||
            && metadata.valuesForHints(['domain']).length > 0);
 | 
			
		||||
    function hasDomainAndNumericRange(metadata) {
 | 
			
		||||
        const rangeValues = metadata.valuesForHints(['range']);
 | 
			
		||||
        const domains = metadata.valuesForHints(['domain']);
 | 
			
		||||
 | 
			
		||||
        return domains.length > 0
 | 
			
		||||
            && rangeValues.length > 0
 | 
			
		||||
            && !rangeValues.every(value => value.format === 'string');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function isCompactView(objectPath) {
 | 
			
		||||
@@ -44,11 +48,11 @@ export default function PlotViewProvider(openmct) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return {
 | 
			
		||||
        key: 'plot-simple',
 | 
			
		||||
        key: 'plot-single',
 | 
			
		||||
        name: 'Plot',
 | 
			
		||||
        cssClass: 'icon-telemetry',
 | 
			
		||||
        canView(domainObject, objectPath) {
 | 
			
		||||
            return hasTelemetry(domainObject, openmct);
 | 
			
		||||
            return hasNumericTelemetry(domainObject);
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        view: function (domainObject, objectPath) {
 | 
			
		||||
 
 | 
			
		||||
@@ -201,15 +201,57 @@ describe("the plugin", function () {
 | 
			
		||||
                        hints: {
 | 
			
		||||
                            range: 1
 | 
			
		||||
                        }
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        key: "yet-another-key",
 | 
			
		||||
                        format: "string",
 | 
			
		||||
                        hints: {
 | 
			
		||||
                            range: 2
 | 
			
		||||
                        }
 | 
			
		||||
                    }]
 | 
			
		||||
                }
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            const applicableViews = openmct.objectViews.get(testTelemetryObject, mockObjectPath);
 | 
			
		||||
            let plotView = applicableViews.find((viewProvider) => viewProvider.key === "plot-simple");
 | 
			
		||||
            const plotView = applicableViews.find((viewProvider) => viewProvider.key === "plot-single");
 | 
			
		||||
 | 
			
		||||
            expect(plotView).toBeDefined();
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it("does not provide a plot view if the telemetry is entirely non numeric", () => {
 | 
			
		||||
            const testTelemetryObject = {
 | 
			
		||||
                id: "test-object",
 | 
			
		||||
                type: "test-object",
 | 
			
		||||
                telemetry: {
 | 
			
		||||
                    values: [{
 | 
			
		||||
                        key: "some-key",
 | 
			
		||||
                        hints: {
 | 
			
		||||
                            domain: 1
 | 
			
		||||
                        }
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        key: "other-key",
 | 
			
		||||
                        format: "string",
 | 
			
		||||
                        hints: {
 | 
			
		||||
                            range: 1
 | 
			
		||||
                        }
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        key: "yet-another-key",
 | 
			
		||||
                        format: "string",
 | 
			
		||||
                        hints: {
 | 
			
		||||
                            range: 1
 | 
			
		||||
                        }
 | 
			
		||||
                    }]
 | 
			
		||||
                }
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            const applicableViews = openmct.objectViews.get(testTelemetryObject, mockObjectPath);
 | 
			
		||||
            const plotView = applicableViews.find((viewProvider) => viewProvider.key === "plot-single");
 | 
			
		||||
 | 
			
		||||
            expect(plotView).toBeUndefined();
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it("provides an overlay plot view for objects with telemetry", () => {
 | 
			
		||||
            const testTelemetryObject = {
 | 
			
		||||
                id: "test-object",
 | 
			
		||||
@@ -323,7 +365,7 @@ describe("the plugin", function () {
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            applicableViews = openmct.objectViews.get(testTelemetryObject, mockObjectPath);
 | 
			
		||||
            plotViewProvider = applicableViews.find((viewProvider) => viewProvider.key === "plot-simple");
 | 
			
		||||
            plotViewProvider = applicableViews.find((viewProvider) => viewProvider.key === "plot-single");
 | 
			
		||||
            plotView = plotViewProvider.view(testTelemetryObject, [testTelemetryObject]);
 | 
			
		||||
            plotView.show(child, true);
 | 
			
		||||
 | 
			
		||||
@@ -571,7 +613,7 @@ describe("the plugin", function () {
 | 
			
		||||
            expect(legend.length).toBe(6);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it("Renders X-axis ticks for the telemetry object", () => {
 | 
			
		||||
        xit("Renders X-axis ticks for the telemetry object", () => {
 | 
			
		||||
            let xAxisElement = element.querySelectorAll(".gl-plot-axis-area.gl-plot-x .gl-plot-tick-wrapper");
 | 
			
		||||
            expect(xAxisElement.length).toBe(1);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -85,7 +85,7 @@
 | 
			
		||||
                <button
 | 
			
		||||
                    ref="startOffset"
 | 
			
		||||
                    class="c-button c-conductor__delta-button"
 | 
			
		||||
                    @click="showTimePopupStart"
 | 
			
		||||
                    @click.prevent="showTimePopupStart"
 | 
			
		||||
                >
 | 
			
		||||
                    {{ offsets.start }}
 | 
			
		||||
                </button>
 | 
			
		||||
@@ -133,7 +133,7 @@
 | 
			
		||||
                <button
 | 
			
		||||
                    ref="endOffset"
 | 
			
		||||
                    class="c-button c-conductor__delta-button"
 | 
			
		||||
                    @click="showTimePopupEnd"
 | 
			
		||||
                    @click.prevent="showTimePopupEnd"
 | 
			
		||||
                >
 | 
			
		||||
                    {{ offsets.end }}
 | 
			
		||||
                </button>
 | 
			
		||||
 
 | 
			
		||||
@@ -46,6 +46,7 @@
 | 
			
		||||
 | 
			
		||||
    <multipane
 | 
			
		||||
        class="l-shell__main"
 | 
			
		||||
        :class="[resizingClass]"
 | 
			
		||||
        type="horizontal"
 | 
			
		||||
    >
 | 
			
		||||
        <pane
 | 
			
		||||
@@ -53,6 +54,8 @@
 | 
			
		||||
            handle="after"
 | 
			
		||||
            label="Browse"
 | 
			
		||||
            collapsable
 | 
			
		||||
            @start-resizing="onStartResizing"
 | 
			
		||||
            @end-resizing="onEndResizing"
 | 
			
		||||
        >
 | 
			
		||||
            <button
 | 
			
		||||
                slot="controls"
 | 
			
		||||
@@ -102,6 +105,8 @@
 | 
			
		||||
            handle="before"
 | 
			
		||||
            label="Inspect"
 | 
			
		||||
            collapsable
 | 
			
		||||
            @start-resizing="onStartResizing"
 | 
			
		||||
            @end-resizing="onEndResizing"
 | 
			
		||||
        >
 | 
			
		||||
            <Inspector
 | 
			
		||||
                ref="inspector"
 | 
			
		||||
@@ -157,12 +162,16 @@ export default {
 | 
			
		||||
            actionCollection: undefined,
 | 
			
		||||
            triggerSync: false,
 | 
			
		||||
            triggerReset: false,
 | 
			
		||||
            headExpanded
 | 
			
		||||
            headExpanded,
 | 
			
		||||
            isResizing: false
 | 
			
		||||
        };
 | 
			
		||||
    },
 | 
			
		||||
    computed: {
 | 
			
		||||
        toolbar() {
 | 
			
		||||
            return this.hasToolbar && this.isEditing;
 | 
			
		||||
        },
 | 
			
		||||
        resizingClass() {
 | 
			
		||||
            return this.isResizing ? 'l-shell__resizing' : '';
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    mounted() {
 | 
			
		||||
@@ -240,6 +249,12 @@ export default {
 | 
			
		||||
        },
 | 
			
		||||
        handleTreeReset() {
 | 
			
		||||
            this.triggerReset = !this.triggerReset;
 | 
			
		||||
        },
 | 
			
		||||
        onStartResizing() {
 | 
			
		||||
            this.isResizing = true;
 | 
			
		||||
        },
 | 
			
		||||
        onEndResizing() {
 | 
			
		||||
            this.isResizing = false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -293,6 +293,12 @@
 | 
			
		||||
        justify-content: space-between;
 | 
			
		||||
        padding: $p;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    &__resizing {
 | 
			
		||||
        iframe {
 | 
			
		||||
            pointer-events: none;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.is-editing {
 | 
			
		||||
 
 | 
			
		||||
@@ -41,8 +41,13 @@
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
const COLLAPSE_THRESHOLD_PX = 40;
 | 
			
		||||
const HIDE_TREE_PARAM = 'hideTree';
 | 
			
		||||
const HIDE_INSPECTOR_PARAM = 'hideInspector';
 | 
			
		||||
const PANE_INSPECTOR = 'Inspect';
 | 
			
		||||
const PANE_TREE = 'Browse';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
    inject: ['openmct'],
 | 
			
		||||
    props: {
 | 
			
		||||
        handle: {
 | 
			
		||||
            type: String,
 | 
			
		||||
@@ -70,20 +75,59 @@ export default {
 | 
			
		||||
        this.type = this.$parent.type;
 | 
			
		||||
        this.styleProp = (this.type === 'horizontal') ? 'width' : 'height';
 | 
			
		||||
    },
 | 
			
		||||
    async mounted() {
 | 
			
		||||
        await this.$nextTick();
 | 
			
		||||
        // Hide tree and/or inspector pane if specified in URL
 | 
			
		||||
        this.handleHideUrl();
 | 
			
		||||
        this.openmct.router.on('change:params', this.handleHideUrl);
 | 
			
		||||
    },
 | 
			
		||||
    beforeDestroy() {
 | 
			
		||||
        this.openmct.router.off('change:params', this.handleHideUrl);
 | 
			
		||||
    },
 | 
			
		||||
    methods: {
 | 
			
		||||
        toggleCollapse: function () {
 | 
			
		||||
        toggleCollapse: function (e) {
 | 
			
		||||
            let target = this.label === PANE_TREE ? HIDE_TREE_PARAM : HIDE_INSPECTOR_PARAM;
 | 
			
		||||
            this.collapsed = !this.collapsed;
 | 
			
		||||
            if (this.collapsed) {
 | 
			
		||||
                // Pane is expanded and is being collapsed
 | 
			
		||||
                this.currentSize = (this.dragCollapse === true) ? this.initial : this.$el.style[this.styleProp];
 | 
			
		||||
                this.$el.style[this.styleProp] = '';
 | 
			
		||||
                this.handleCollapse();
 | 
			
		||||
                this.addHideParam(target);
 | 
			
		||||
            } else {
 | 
			
		||||
                // Pane is collapsed and is being expanded
 | 
			
		||||
                this.$el.style[this.styleProp] = this.currentSize;
 | 
			
		||||
                delete this.currentSize;
 | 
			
		||||
                delete this.dragCollapse;
 | 
			
		||||
                this.handleExpand();
 | 
			
		||||
                this.removeHideParam(target);
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        handleHideUrl: function () {
 | 
			
		||||
            if (!this.collapsable) {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            let hideTreeParam = this.openmct.router.getSearchParam(HIDE_TREE_PARAM);
 | 
			
		||||
            let hideInspectorParam = this.openmct.router.getSearchParam(HIDE_INSPECTOR_PARAM);
 | 
			
		||||
            let hideTree = hideTreeParam === 'true' && this.label === PANE_TREE;
 | 
			
		||||
            let hideInspector = hideInspectorParam === 'true' && this.label === PANE_INSPECTOR;
 | 
			
		||||
            if (hideTree || hideInspector) {
 | 
			
		||||
                this.collapsed = true;
 | 
			
		||||
                this.handleCollapse();
 | 
			
		||||
            } else {
 | 
			
		||||
                this.collapsed = false;
 | 
			
		||||
                this.handleExpand();
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        addHideParam: function (target) {
 | 
			
		||||
            this.openmct.router.setSearchParam(target, 'true');
 | 
			
		||||
        },
 | 
			
		||||
        removeHideParam: function (target) {
 | 
			
		||||
            this.openmct.router.deleteSearchParam(target);
 | 
			
		||||
        },
 | 
			
		||||
        handleCollapse: function () {
 | 
			
		||||
            this.currentSize = (this.dragCollapse === true) ? this.initial : this.$el.style[this.styleProp];
 | 
			
		||||
            this.$el.style[this.styleProp] = '';
 | 
			
		||||
        },
 | 
			
		||||
        handleExpand: function () {
 | 
			
		||||
            this.$el.style[this.styleProp] = this.currentSize;
 | 
			
		||||
            delete this.currentSize;
 | 
			
		||||
            delete this.dragCollapse;
 | 
			
		||||
        },
 | 
			
		||||
        trackSize: function () {
 | 
			
		||||
            if (!this.dragCollapse === true) {
 | 
			
		||||
                if (this.type === 'vertical') {
 | 
			
		||||
@@ -126,12 +170,14 @@ export default {
 | 
			
		||||
            document.body.addEventListener('mousemove', this.updatePosition);
 | 
			
		||||
            document.body.addEventListener('mouseup', this.end);
 | 
			
		||||
            this.resizing = true;
 | 
			
		||||
            this.$emit('start-resizing');
 | 
			
		||||
            this.trackSize();
 | 
			
		||||
        },
 | 
			
		||||
        end: function (event) {
 | 
			
		||||
            document.body.removeEventListener('mousemove', this.updatePosition);
 | 
			
		||||
            document.body.removeEventListener('mouseup', this.end);
 | 
			
		||||
            this.resizing = false;
 | 
			
		||||
            this.$emit('end-resizing');
 | 
			
		||||
            this.trackSize();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										90
									
								
								src/ui/layout/paneSpec.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								src/ui/layout/paneSpec.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,90 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2021, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT is licensed under the Apache License, Version 2.0 (the
 | 
			
		||||
 * "License"); you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 * http://www.apache.org/licenses/LICENSE-2.0.
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 | 
			
		||||
 * License for the specific language governing permissions and limitations
 | 
			
		||||
 * under the License.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT includes source code licensed under additional open source
 | 
			
		||||
 * licenses. See the Open Source Licenses file (LICENSES.md) included with
 | 
			
		||||
 * this source code distribution or the Licensing information page available
 | 
			
		||||
 * at runtime from the About dialog for additional information.
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
import {
 | 
			
		||||
    createOpenMct,
 | 
			
		||||
    resetApplicationState
 | 
			
		||||
} from 'utils/testing';
 | 
			
		||||
 | 
			
		||||
describe("the pane", () => {
 | 
			
		||||
    let openmct;
 | 
			
		||||
    let appHolder;
 | 
			
		||||
    let element;
 | 
			
		||||
    let child;
 | 
			
		||||
    let resolveFunction;
 | 
			
		||||
 | 
			
		||||
    beforeEach((done) => {
 | 
			
		||||
        openmct = createOpenMct();
 | 
			
		||||
 | 
			
		||||
        appHolder = document.createElement('div');
 | 
			
		||||
        appHolder.style.width = '640px';
 | 
			
		||||
        appHolder.style.height = '480px';
 | 
			
		||||
 | 
			
		||||
        openmct = createOpenMct();
 | 
			
		||||
        openmct.install(openmct.plugins.MyItems());
 | 
			
		||||
        openmct.install(openmct.plugins.LocalTimeSystem());
 | 
			
		||||
        openmct.install(openmct.plugins.UTCTimeSystem());
 | 
			
		||||
 | 
			
		||||
        element = document.createElement('div');
 | 
			
		||||
        child = document.createElement('div');
 | 
			
		||||
        element.appendChild(child);
 | 
			
		||||
 | 
			
		||||
        openmct.on('start', done);
 | 
			
		||||
        openmct.start(appHolder);
 | 
			
		||||
 | 
			
		||||
        document.body.append(appHolder);
 | 
			
		||||
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    afterEach(() => {
 | 
			
		||||
        return resetApplicationState(openmct);
 | 
			
		||||
    });
 | 
			
		||||
    it('toggling tree will toggle tree hide params', (done) => {
 | 
			
		||||
        document.querySelector('.l-shell__pane-tree .l-pane__collapse-button').click();
 | 
			
		||||
        expect(openmct.router.getSearchParam('hideTree')).toBe('true');
 | 
			
		||||
        done();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it('tree pane collapses when adding hide tree param in URL', () => {
 | 
			
		||||
        openmct.router.setSearchParam('hideTree', 'true');
 | 
			
		||||
        expect(document.querySelector('.l-shell__pane-tree.l-pane--collapsed')).toBeDefined();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it('inspector pane collapses when adding hide inspector param in URL', () => {
 | 
			
		||||
        openmct.router.setSearchParam('hideInspector', 'true');
 | 
			
		||||
        expect(document.querySelector('.l-shell__pane-inspector.l-pane--collapsed')).toBeDefined();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it('toggle inspector pane will toggle inspector hide param', (done) => {
 | 
			
		||||
        // There's a short delay on addubg the param.
 | 
			
		||||
        resolveFunction = () => {
 | 
			
		||||
            setTimeout(() => {
 | 
			
		||||
                expect(openmct.router.getSearchParam('hideInspector')).toBe('true');
 | 
			
		||||
                done();
 | 
			
		||||
            }, 500);
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        openmct.router.on('change:params', resolveFunction);
 | 
			
		||||
        document.querySelector('.l-shell__pane-inspector .l-pane__collapse-button').click();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
		Reference in New Issue
	
	Block a user