diff --git a/.circleci/config.yml b/.circleci/config.yml index ad7d81143a..ca3816df0e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,10 +2,11 @@ version: 2.1 executors: pw-focal-development: docker: - - image: mcr.microsoft.com/playwright:v1.23.0-focal + - image: mcr.microsoft.com/playwright:v1.29.0-focal environment: NODE_ENV: development # Needed to ensure 'dist' folder created and devDependencies installed PERCY_POSTINSTALL_BROWSER: 'true' # Needed to store the percy browser in cache deps + PERCY_LOGLEVEL: 'debug' # Enable DEBUG level logging for Percy (Issue: https://github.com/nasa/openmct/issues/5742) parameters: BUST_CACHE: description: "Set this with the CircleCI UI Trigger Workflow button (boolean = true) to bust the cache!" diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index a5525f4ce9..f6728a7d26 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -21,9 +21,9 @@ Closes -**Table of Contents** +**Table of Contents** -- [Building Applications With Open MCT](#building-applications-with-open-mct) +- [Building Applications With Open MCT](#developing-applications-with-open-mct) - [Scope and purpose of this document](#scope-and-purpose-of-this-document) - [Building From Source](#building-from-source) - [Starting an Open MCT application](#starting-an-open-mct-application) + - [Types](#types) + - [Using Types](#using-types) + - [Limitations](#limitations) - [Plugins](#plugins) - [Defining and Installing a New Plugin](#defining-and-installing-a-new-plugin) - [Domain Objects and Identifiers](#domain-objects-and-identifiers) @@ -57,23 +60,22 @@ -# Building Applications With Open MCT +# Developing Applications With Open MCT ## Scope and purpose of this document -This document is intended to serve as a reference for developing an application -based on Open MCT. It will provide details of the API functions necessary to -extend the Open MCT platform meet common use cases such as integrating with a telemetry source. +This document is intended to serve as a reference for developing an application +based on Open MCT. It will provide details of the API functions necessary to +extend the Open MCT platform meet common use cases such as integrating with a telemetry source. -The best place to start is with the [Open MCT Tutorials](https://github.com/nasa/openmct-tutorial). -These will walk you through the process of getting up and running with Open +The best place to start is with the [Open MCT Tutorials](https://github.com/nasa/openmct-tutorial). +These will walk you through the process of getting up and running with Open MCT, as well as addressing some common developer use cases. -## Building From Source +## Building From Source -The latest version of Open MCT is available from [our GitHub repository](https://github.com/nasa/openmct). -If you have `git`, and `node` installed, you can build Open MCT with the -commands +The latest version of Open MCT is available from [our GitHub repository](https://github.com/nasa/openmct). +If you have `git`, and `node` installed, you can build Open MCT with the commands ```bash git clone https://github.com/nasa/openmct.git @@ -81,28 +83,28 @@ cd openmct npm install ``` -These commands will fetch the Open MCT source from our GitHub repository, and -build a minified version that can be included in your application. The output -of the build process is placed in a `dist` folder under the openmct source -directory, which can be copied out to another location as needed. The contents -of this folder will include a minified javascript file named `openmct.js` as -well as assets such as html, css, and images necessary for the UI. +These commands will fetch the Open MCT source from our GitHub repository, and +build a minified version that can be included in your application. The output +of the build process is placed in a `dist` folder under the openmct source +directory, which can be copied out to another location as needed. The contents +of this folder will include a minified javascript file named `openmct.js` as +well as assets such as html, css, and images necessary for the UI. ## Starting an Open MCT application -To start a minimally functional Open MCT application, it is necessary to -include the Open MCT distributable, enable some basic plugins, and bootstrap -the application. The tutorials walk through the process of getting Open MCT up -and running from scratch, but provided below is a minimal HTML template that -includes Open MCT, installs some basic plugins, and bootstraps the application. -It assumes that Open MCT is installed under an `openmct` subdirectory, as -described in [Building From Source](#building-from-source). +To start a minimally functional Open MCT application, it is necessary to +include the Open MCT distributable, enable some basic plugins, and bootstrap +the application. The tutorials walk through the process of getting Open MCT up +and running from scratch, but provided below is a minimal HTML template that +includes Open MCT, installs some basic plugins, and bootstraps the application. +It assumes that Open MCT is installed under an `openmct` subdirectory, as +described in [Building From Source](#building-from-source). -This approach includes openmct using a simple script tag, resulting in a global -variable named `openmct`. This `openmct` object is used subsequently to make -API calls. +This approach includes openmct using a simple script tag, resulting in a global +variable named `openmct`. This `openmct` object is used subsequently to make +API calls. -Open MCT is packaged as a UMD (Universal Module Definition) module, so common +Open MCT is packaged as a UMD (Universal Module Definition) module, so common script loaders are also supported. ```html @@ -123,17 +125,59 @@ script loaders are also supported. ``` -The Open MCT library included above requires certain assets such as html -templates, images, and css. If you installed Open MCT from GitHub as described +The Open MCT library included above requires certain assets such as html +templates, images, and css. If you installed Open MCT from GitHub as described in the section on [Building from Source](#building-from-source) then these -assets will have been downloaded along with the Open MCT javascript library. +assets will have been downloaded along with the Open MCT javascript library. -There are some plugins bundled with the application that provide UI, -persistence, and other default configuration which are necessary to be able to -do anything with the application initially. Any of these plugins can, in -principle, be replaced with a custom plugin. The included plugins are +There are some plugins bundled with the application that provide UI, +persistence, and other default configuration which are necessary to be able to +do anything with the application initially. Any of these plugins can, in +principle, be replaced with a custom plugin. The included plugins are documented in the [Included Plugins](#included-plugins) section. +## Types + +The Open MCT library includes its own TypeScript declaration files which can be +used to provide code hints and typechecking in your own Open MCT application. + +Open MCT's type declarations are generated via `tsc` from JSDoc-style comment +blocks. For more information on this, [check out TypeScript's documentation](https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html). + +### Using Types + +In order to use Open MCT's provided types in your own application, create a +`jsconfig.js` at the root of your project with this minimal configuration: + +```json +{ + "compilerOptions": { + "baseUrl": "./", + "target": "es6", + "checkJs": true, + "moduleResolution": "node", + "paths": { + "openmct": ["node_modules/openmct/dist/openmct.d.ts"] + } + } +} +``` + +Then, simply import and use `openmct` in your application: + +```js +import openmct from "openmct"; +``` + +### Limitations + +The effort to add types for Open MCT's public API is ongoing, and the provided +type declarations may be incomplete. + +If you would like to contribute types to Open MCT, please check out +[TypeScript's documentation](https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html) on generating type declarations from JSDoc-style comment blocks. +Then read through our [contributing guide](https://github.com/nasa/openmct/blob/f7cf3f72c2efd46da7ce5719c5e52c8806d166f0/CONTRIBUTING.md) and open a PR! + ## Plugins ### Defining and Installing a New Plugin @@ -146,10 +190,10 @@ openmct.install(function install(openmctAPI) { ``` New plugins are installed in Open MCT by calling `openmct.install`, and -providing a plugin installation function. This function will be invoked on -application startup with one parameter - the openmct API object. A common -approach used in the Open MCT codebase is to define a plugin as a function that -returns this installation function. This allows configuration to be specified +providing a plugin installation function. This function will be invoked on +application startup with one parameter - the openmct API object. A common +approach used in the Open MCT codebase is to define a plugin as a function that +returns this installation function. This allows configuration to be specified when the plugin is included. eg. @@ -162,16 +206,16 @@ This approach can be seen in all of the [plugins provided with Open MCT](https:/ ## Domain Objects and Identifiers -_Domain Objects_ are the basic entities that represent domain knowledge in Open -MCT. The temperature sensor on a solar panel, an overlay plot comparing the -results of all temperature sensors, the command dictionary for a spacecraft, -the individual commands in that dictionary, the "My Items" folder: All of these +_Domain Objects_ are the basic entities that represent domain knowledge in Open +MCT. The temperature sensor on a solar panel, an overlay plot comparing the +results of all temperature sensors, the command dictionary for a spacecraft, +the individual commands in that dictionary, the "My Items" folder: All of these things are domain objects. A _Domain Object_ is simply a javascript object with some standard attributes. -An example of a _Domain Object_ is the "My Items" object which is a folder in -which a user can persist any objects that they create. The My Items object -looks like this: +An example of a _Domain Object_ is the "My Items" object which is a folder in +which a user can persist any objects that they create. The My Items object +looks like this: ```javascript { @@ -190,23 +234,24 @@ looks like this: The main attributes to note are the `identifier`, and `type` attributes. -* `identifier`: A composite key that provides a universally unique identifier +- `identifier`: A composite key that provides a universally unique identifier for this object. The `namespace` and `key` are used to identify the object. - The `key` must be unique within the namespace. -* `type`: All objects in Open MCT have a type. Types allow you to form an - ontology of knowledge and provide an abstraction for grouping, visualizing, - and interpreting data. Details on how to define a new object type are - provided below. + The `key` must be unique within the namespace. +- `type`: All objects in Open MCT have a type. Types allow you to form an + ontology of knowledge and provide an abstraction for grouping, visualizing, + and interpreting data. Details on how to define a new object type are + provided below. -Open MCT uses a number of builtin types. Typically you are going to want to +Open MCT uses a number of builtin types. Typically you are going to want to define your own when extending Open MCT. ### Domain Object Types -Custom types may be registered via the `addType` function on the Open MCT Type +Custom types may be registered via the `addType` function on the Open MCT Type registry. eg. + ```javascript openmct.types.addType('example.my-type', { name: "My Type", @@ -216,37 +261,39 @@ openmct.types.addType('example.my-type', { ``` The `addType` function accepts two arguments: -* A `string` key identifying the type. This key is used when specifying a type + +- A `string` key identifying the type. This key is used when specifying a type for an object. We recommend prefixing your types with a namespace to avoid conflicts with other plugins. -* An object type specification. An object type definition supports the following -attributes - * `name`: a `string` naming this object type - * `description`: a `string` specifying a longer-form description of this type - * `initialize`: a `function` which initializes the model for new domain objects - of this type. This can be used for setting default values on an object when +- An object type specification. An object type definition supports the following +attributes + - `name`: a `string` naming this object type + - `description`: a `string` specifying a longer-form description of this type + - `initialize`: a `function` which initializes the model for new domain objects + of this type. This can be used for setting default values on an object when it is instantiated. - * `creatable`: A `boolean` indicating whether users should be allowed to create - this type (default: `false`). This will determine whether the type appears + - `creatable`: A `boolean` indicating whether users should be allowed to create + this type (default: `false`). This will determine whether the type appears in the `Create` menu. - * `cssClass`: A `string` specifying a CSS class to apply to each representation - of this object. This is used for specifying an icon to appear next to each + - `cssClass`: A `string` specifying a CSS class to apply to each representation + of this object. This is used for specifying an icon to appear next to each object of this type. -The [Open MCT Tutorials](https://github.com/nasa/openmct-tutorial) provide a -step-by-step examples of writing code for Open MCT that includes a [section on +The [Open MCT Tutorials](https://github.com/nasa/openmct-tutorial) provide a +step-by-step examples of writing code for Open MCT that includes a [section on defining a new object type](https://github.com/nasa/openmct-tutorial#step-3---providing-objects). ## Root Objects -In many cases, you'd like a certain object (or a certain hierarchy of objects) -to be accessible from the top level of the application (the tree on the left-hand -side of Open MCT.) For example, it is typical to expose a telemetry dictionary +In many cases, you'd like a certain object (or a certain hierarchy of objects) +to be accessible from the top level of the application (the tree on the left-hand +side of Open MCT.) For example, it is typical to expose a telemetry dictionary as a hierarchy of telemetry-providing domain objects in this fashion. To do so, use the `addRoot` method of the object API. eg. + ```javascript openmct.objects.addRoot({ namespace: "example.namespace", @@ -255,12 +302,13 @@ openmct.objects.addRoot({ openmct.priority.HIGH); ``` -The `addRoot` function takes a two arguments, the first can be an [object identifier](#domain-objects-and-identifiers) for a root level object, or an array of identifiers for root +The `addRoot` function takes a two arguments, the first can be an [object identifier](#domain-objects-and-identifiers) for a root level object, or an array of identifiers for root level objects, or a function that returns a promise for an identifier or an array of root level objects, the second is a [priority](#priority-api) or numeric value. When using the `getAll` method of the object API, they will be returned in order of priority. eg. + ```javascript openmct.objects.addRoot(identifier, openmct.priority.LOW); // low = -1000, will appear last in composition or tree openmct.objects.addRoot(otherIdentifier, openmct.priority.HIGH); // high = 1000, will appear first in composition or tree @@ -270,11 +318,11 @@ Root objects are loaded just like any other objects, i.e. via an object provider ## Object Providers -An Object Provider is used to build _Domain Objects_, typically retrieved from -some source such as a persistence store or telemetry dictionary. In order to -integrate telemetry from a new source an object provider will need to be created -that can build objects representing telemetry points exposed by the telemetry -source. The API call to define a new object provider is fairly straightforward. +An Object Provider is used to build _Domain Objects_, typically retrieved from +some source such as a persistence store or telemetry dictionary. In order to +integrate telemetry from a new source an object provider will need to be created +that can build objects representing telemetry points exposed by the telemetry +source. The API call to define a new object provider is fairly straightforward. Here's a very simple example: ```javascript @@ -288,14 +336,15 @@ openmct.objects.addProvider('example.namespace', { } }); ``` + The `addProvider` function takes two arguments: -* `namespace`: A `string` representing the namespace that this object provider +- `namespace`: A `string` representing the namespace that this object provider will provide objects for. -* `provider`: An `object` with a single function, `get`. This function accepts an -[Identifier](#domain-objects-and-identifiers) for the object to be provided. -It is expected that the `get` function will return a -[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) +- `provider`: An `object` with a single function, `get`. This function accepts an +[Identifier](#domain-objects-and-identifiers) for the object to be provided. +It is expected that the `get` function will return a +[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that resolves with the object being requested. In future, object providers will support other methods to enable other operations with persistence stores, such as creating, updating, and deleting objects. @@ -310,8 +359,8 @@ may be cases where you want to provide the composition of a certain object ### Adding Composition Providers -You may want to populate a hierarchy under a custom root-level object based on -the contents of a telemetry dictionary. To do this, you can add a new +You may want to populate a hierarchy under a custom root-level object based on +the contents of a telemetry dictionary. To do this, you can add a new Composition Provider: ```javascript @@ -324,19 +373,20 @@ openmct.composition.addProvider({ } }); ``` -The `addProvider` function accepts a Composition Provider object as its sole + +The `addProvider` function accepts a Composition Provider object as its sole argument. A Composition Provider is a javascript object exposing two functions: -* `appliesTo`: A `function` that accepts a `domainObject` argument, and returns -a `boolean` value indicating whether this composition provider applies to the +- `appliesTo`: A `function` that accepts a `domainObject` argument, and returns +a `boolean` value indicating whether this composition provider applies to the given object. -* `load`: A `function` that accepts a `domainObject` as an argument, and returns +- `load`: A `function` that accepts a `domainObject` as an argument, and returns a `Promise` that resolves with an array of [Identifier](#domain-objects-and-identifiers). These identifiers will be used to fetch Domain Objects from an [Object Provider](#object-provider) ### Default Composition Provider -The default composition provider applies to any domain object with a -`composition` property. The value of `composition` should be an array of +The default composition provider applies to any domain object with a +`composition` property. The value of `composition` should be an array of identifiers, e.g.: ```javascript @@ -370,7 +420,7 @@ Open MCT are stable and documentation is included below. There are two main tasks for integrating telemetry sources-- describing telemetry objects with relevant metadata, and then providing telemetry data for those objects. You'll use an [Object Provider](#object-providers) to provide objects with the necessary [Telemetry Metadata](#telemetry-metadata), and then register a [Telemetry Provider](#telemetry-providers) to retrieve telemetry data for those objects. Alternatively, you can register a telemetry metadata provider to provide the necessary telemetry metadata. -For a step-by-step guide to building a telemetry adapter, please see the +For a step-by-step guide to building a telemetry adapter, please see the [Open MCT Tutorials](https://github.com/nasa/openmct-tutorial). #### Telemetry Metadata @@ -390,7 +440,7 @@ A telemetry object is a domain object with a telemetry property. To take an exa { "key": "value", "name": "Value", - "units": "kilograms", + "unit": "kilograms", "format": "float", "min": 0, "max": 100, @@ -425,29 +475,27 @@ attribute | type | flags | notes `name` | string | optional | a human readable label for this field. If omitted, defaults to `key`. `source` | string | optional | identifies the property of a datum where this value is stored. If omitted, defaults to `key`. `format` | string | optional | a specific format identifier, mapping to a formatter. If omitted, uses a default formatter. For enumerations, use `enum`. For timestamps, use `utc` if you are using utc dates, otherwise use a key mapping to your custom date format. -`units` | string | optional | the units of this value, e.g. `km`, `seconds`, `parsecs` +`unit` | string | optional | the unit of this value, e.g. `km`, `seconds`, `parsecs` `min` | number | optional | the minimum possible value of this measurement. Will be used by plots, gauges, etc to automatically set a min value. `max` | number | optional | the maximum possible value of this measurement. Will be used by plots, gauges, etc to automatically set a max value. `enumerations` | array | optional | for objects where `format` is `"enum"`, this array tracks all possible enumerations of the value. Each entry in this array is an object, with a `value` property that is the numerical value of the enumeration, and a `string` property that is the text value of the enumeration. ex: `{"value": 0, "string": "OFF"}`. If you use an enumerations array, `min` and `max` will be set automatically for you. - ###### Value Hints Each telemetry value description has an object defining hints. Keys in this object represent the hint itself, and the value represents the weight of that hint. A lower weight means the hint has a higher priority. For example, multiple values could be hinted for use as the y-axis of a plot (raw, engineering), but the highest priority would be the default choice. Likewise, a table will use hints to determine the default order of columns. Known hints: -* `domain`: Values with a `domain` hint will be used for the x-axis of a plot, and tables will render columns for these values first. -* `range`: Values with a `range` hint will be used as the y-axis on a plot, and tables will render columns for these values after the `domain` values. -* `image`: Indicates that the value may be interpreted as the URL to an image file, in which case appropriate views will be made available. -* `imageDownloadName`: Indicates that the value may be interpreted as the name of the image file. +- `domain`: Values with a `domain` hint will be used for the x-axis of a plot, and tables will render columns for these values first. +- `range`: Values with a `range` hint will be used as the y-axis on a plot, and tables will render columns for these values after the `domain` values. +- `image`: Indicates that the value may be interpreted as the URL to an image file, in which case appropriate views will be made available. +- `imageDownloadName`: Indicates that the value may be interpreted as the name of the image file. -##### The Time Conductor and Telemetry +##### The Time Conductor and Telemetry Open MCT provides a number of ways to pivot through data and link data via time. The Time Conductor helps synchronize multiple views around the same time. -In order for the time conductor to work, there will always be an active "time system". All telemetry metadata *must* have a telemetry value with a `key` that matches the `key` of the active time system. You can use the `source` attribute on the value metadata to remap this to a different field in the telemetry datum-- especially useful if you are working with disparate datasources that have different field mappings. - +In order for the time conductor to work, there will always be an active "time system". All telemetry metadata _must_ have a telemetry value with a `key` that matches the `key` of the active time system. You can use the `source` attribute on the value metadata to remap this to a different field in the telemetry datum-- especially useful if you are working with disparate datasources that have different field mappings. #### Telemetry Providers @@ -455,14 +503,14 @@ Telemetry providers are responsible for providing historical and real-time telem A telemetry provider is a javascript object with up to four methods: -* `supportsSubscribe(domainObject, callback, options)` optional. Must be implemented to provide realtime telemetry. Should return `true` if the provider supports subscriptions for the given domain object (and request options). -* `subscribe(domainObject, callback, options)` required if `supportsSubscribe` is implemented. Establish a subscription for realtime data for the given domain object. Should invoke `callback` with a single telemetry datum every time data is received. Must return an unsubscribe function. Multiple views can subscribe to the same telemetry object, so it should always return a new unsubscribe function. -* `supportsRequest(domainObject, options)` optional. Must be implemented to provide historical telemetry. Should return `true` if the provider supports historical requests for the given domain object. -* `request(domainObject, options)` required if `supportsRequest` is implemented. Must return a promise for an array of telemetry datums that fulfills the request. The `options` argument will include a `start`, `end`, and `domain` attribute representing the query bounds. See [Telemetry Requests and Responses](#telemetry-requests-and-responses) for more info on how to respond to requests. -* `supportsMetadata(domainObject)` optional. Implement and return `true` for objects that you want to provide dynamic metadata for. -* `getMetadata(domainObject)` required if `supportsMetadata` is implemented. Must return a valid telemetry metadata definition that includes at least one valueMetadata definition. -* `supportsLimits(domainObject)` optional. Implement and return `true` for domain objects that you want to provide a limit evaluator for. -* `getLimitEvaluator(domainObject)` required if `supportsLimits` is implemented. Must return a valid LimitEvaluator for a given domain object. +- `supportsSubscribe(domainObject, callback, options)` optional. Must be implemented to provide realtime telemetry. Should return `true` if the provider supports subscriptions for the given domain object (and request options). +- `subscribe(domainObject, callback, options)` required if `supportsSubscribe` is implemented. Establish a subscription for realtime data for the given domain object. Should invoke `callback` with a single telemetry datum every time data is received. Must return an unsubscribe function. Multiple views can subscribe to the same telemetry object, so it should always return a new unsubscribe function. +- `supportsRequest(domainObject, options)` optional. Must be implemented to provide historical telemetry. Should return `true` if the provider supports historical requests for the given domain object. +- `request(domainObject, options)` required if `supportsRequest` is implemented. Must return a promise for an array of telemetry datums that fulfills the request. The `options` argument will include a `start`, `end`, and `domain` attribute representing the query bounds. See [Telemetry Requests and Responses](#telemetry-requests-and-responses) for more info on how to respond to requests. +- `supportsMetadata(domainObject)` optional. Implement and return `true` for objects that you want to provide dynamic metadata for. +- `getMetadata(domainObject)` required if `supportsMetadata` is implemented. Must return a valid telemetry metadata definition that includes at least one valueMetadata definition. +- `supportsLimits(domainObject)` optional. Implement and return `true` for domain objects that you want to provide a limit evaluator for. +- `getLimitEvaluator(domainObject)` required if `supportsLimits` is implemented. Must return a valid LimitEvaluator for a given domain object. Telemetry providers are registered by calling `openmct.telemetry.addProvider(provider)`, e.g. @@ -475,7 +523,7 @@ openmct.telemetry.addProvider({ Note: it is not required to implement all of the methods on every provider. Depending on the complexity of your implementation, it may be helpful to instantiate and register your realtime, historical, and metadata providers separately. -#### Telemetry Requests and Responses. +#### Telemetry Requests and Responses Telemetry requests support time bounded queries. A call to a _Telemetry Provider_'s `request` function will include an `options` argument. These are simply javascript objects with attributes for the request parameters. An example of a telemetry request object with a start and end time is included below: @@ -508,6 +556,7 @@ the number of results it desires. The `size` parameter is a hint; views must not assume the response will have the exact number of results requested. example: + ```javascript { start: 1487981997240, @@ -523,6 +572,7 @@ This strategy says "I want the latest data point in this time range". A provide ##### `minmax` request strategy example: + ```javascript { start: 1487981997240, @@ -537,28 +587,28 @@ MinMax queries are issued by plots, and may be issued by other types as well. T #### Telemetry Formats -Telemetry format objects define how to interpret and display telemetry data. +Telemetry format objects define how to interpret and display telemetry data. They have a simple structure: -* `key`: A `string` that uniquely identifies this formatter. -* `format`: A `function` that takes a raw telemetry value, and returns a - human-readable `string` representation of that value. It has one required - argument, and three optional arguments that provide context and can be used - for returning scaled representations of a value. An example of this is - representing time values in a scale such as the time conductor scale. There +- `key`: A `string` that uniquely identifies this formatter. +- `format`: A `function` that takes a raw telemetry value, and returns a + human-readable `string` representation of that value. It has one required + argument, and three optional arguments that provide context and can be used + for returning scaled representations of a value. An example of this is + representing time values in a scale such as the time conductor scale. There are multiple ways of representing a point in time, and by providing a minimum scale value, maximum scale value, and a count, it's possible to provide more useful representations of time given the provided limitations. - * `value`: The raw telemetry value in its native type. - * `minValue`: An __optional__ argument specifying the minimum displayed + - `value`: The raw telemetry value in its native type. + - `minValue`: An **optional** argument specifying the minimum displayed value. - * `maxValue`: An __optional__ argument specifying the maximum displayed + - `maxValue`: An **optional** argument specifying the maximum displayed value. - * `count`: An __optional__ argument specifying the number of displayed + - `count`: An **optional** argument specifying the number of displayed values. -* `parse`: A `function` that takes a `string` representation of a telemetry +- `parse`: A `function` that takes a `string` representation of a telemetry value, and returns the value in its native type. **Note** parse might receive an already-parsed value. This function should be idempotent. -* `validate`: A `function` that takes a `string` representation of a telemetry +- `validate`: A `function` that takes a `string` representation of a telemetry value, and returns a `boolean` value indicating whether the provided string can be parsed. @@ -584,9 +634,9 @@ openmct.telemetry.addFormat({ #### Telemetry Data A single telemetry point is considered a Datum, and is represented by a standard -javascript object. Realtime subscriptions (obtained via __subscribe__) will +javascript object. Realtime subscriptions (obtained via **subscribe**) will invoke the supplied callback once for each telemetry datum recieved. Telemetry -requests (obtained via __request__) will return a promise for an array of +requests (obtained via **request**) will return a promise for an array of telemetry datums. ##### Telemetry Datums @@ -607,14 +657,14 @@ section. #### Limit Evaluators **draft** -Limit evaluators allow a telemetry integrator to define which limits exist for a +Limit evaluators allow a telemetry integrator to define which limits exist for a telemetry endpoint and how limits should be applied to telemetry from a given domain object. A limit evaluator can implement the `evalute` method which is used to define how limits -should be applied to telemetry and the `getLimits` method which is used to specify +should be applied to telemetry and the `getLimits` method which is used to specify what the limit values are for different limit levels. -Limit levels can be mapped to one of 5 colors for visualization: +Limit levels can be mapped to one of 5 colors for visualization: `purple`, `red`, `orange`, `yellow` and `cyan`. For an example of a limit evaluator, take a look at `examples/generator/SinewaveLimitProvider.js`. @@ -623,30 +673,29 @@ For an example of a limit evaluator, take a look at `examples/generator/Sinewave The APIs for requesting telemetry from Open MCT -- e.g. for use in custom views -- are currently in draft state and are being revised. If you'd like to experiment with them before they are finalized, please contact the team via the contact-us link on our website. - ## Time API Open MCT provides API for managing the temporal state of the application. -Central to this is the concept of "time bounds". Views in Open MCT will -typically show telemetry data for some prescribed date range, and the Time API +Central to this is the concept of "time bounds". Views in Open MCT will +typically show telemetry data for some prescribed date range, and the Time API provides a way to centrally manage these bounds. -The Time API exposes a number of methods for querying and setting the temporal +The Time API exposes a number of methods for querying and setting the temporal state of the application, and emits events to inform listeners when the state changes. -Because the data displayed tends to be time domain data, Open MCT must always +Because the data displayed tends to be time domain data, Open MCT must always have at least one time system installed and activated. When you download Open -MCT, it will be pre-configured to use the UTC time system, which is installed and activated, along with other default plugins, in `index.html`. Installing and activating a time system is simple, and is covered -[in the next section](#defining-and-registering-time-systems). +MCT, it will be pre-configured to use the UTC time system, which is installed and activated, along with other default plugins, in `index.html`. Installing and activating a time system is simple, and is covered +[in the next section](#defining-and-registering-time-systems). ### Time Systems and Bounds #### Defining and Registering Time Systems -The time bounds of an Open MCT application are defined as numbers, and a Time -System gives meaning and context to these numbers so that they can be correctly -interpreted. Time Systems are JavaScript objects that provide some information -about the current time reference frame. An example of defining and registering +The time bounds of an Open MCT application are defined as numbers, and a Time +System gives meaning and context to these numbers so that they can be correctly +interpreted. Time Systems are JavaScript objects that provide some information +about the current time reference frame. An example of defining and registering a new time system is given below: ``` javascript @@ -660,31 +709,31 @@ openmct.time.addTimeSystem({ }); ``` -The example above defines a new utc based time system. In fact, this time system -is configured and activated by default from `index.html` in the default -installation of Open MCT if you download the source from GitHub. Some details of +The example above defines a new utc based time system. In fact, this time system +is configured and activated by default from `index.html` in the default +installation of Open MCT if you download the source from GitHub. Some details of each of the required properties is provided below. -* `key`: A `string` that uniquely identifies this time system. -* `name`: A `string` providing a brief human readable label. If the [Time Conductor](#the-time-conductor) +- `key`: A `string` that uniquely identifies this time system. +- `name`: A `string` providing a brief human readable label. If the [Time Conductor](#the-time-conductor) plugin is enabled, this name will identify the time system in a dropdown menu. -* `cssClass`: A class name `string` that will be applied to the time system when -it appears in the UI. This will be used to represent the time system with an icon. -There are a number of built-in icon classes [available in Open MCT](https://github.com/nasa/openmct/blob/master/platform/commonUI/general/res/sass/_glyphs.scss), -or a custom class can be used here. -* `timeFormat`: A `string` corresponding to the key of a registered -[telemetry time format](#telemetry-formats). The format will be used for -displaying discrete timestamps from telemetry streams when this time system is -activated. If the [UTCTimeSystem](#included-plugins) is enabled, then the `utc` +- `cssClass`: A class name `string` that will be applied to the time system when +it appears in the UI. This will be used to represent the time system with an icon. +There are a number of built-in icon classes [available in Open MCT](https://github.com/nasa/openmct/blob/master/platform/commonUI/general/res/sass/_glyphs.scss), +or a custom class can be used here. +- `timeFormat`: A `string` corresponding to the key of a registered +[telemetry time format](#telemetry-formats). The format will be used for +displaying discrete timestamps from telemetry streams when this time system is +activated. If the [UTCTimeSystem](#included-plugins) is enabled, then the `utc` format can be used if this is a utc-based time system -* `durationFormat`: A `string` corresponding to the key of a registered -[telemetry time format](#telemetry-formats). The format will be used for -displaying time ranges, for example `00:15:00` might be used to represent a time +- `durationFormat`: A `string` corresponding to the key of a registered +[telemetry time format](#telemetry-formats). The format will be used for +displaying time ranges, for example `00:15:00` might be used to represent a time period of fifteen minutes. These are used by the Time Conductor plugin to specify -relative time offsets. If the [UTCTimeSystem](#included-plugins) is enabled, +relative time offsets. If the [UTCTimeSystem](#included-plugins) is enabled, then the `duration` format can be used if this is a utc-based time system -* `isUTCBased`: A `boolean` that defines whether this time system represents -numbers in UTC terrestrial time. +- `isUTCBased`: A `boolean` that defines whether this time system represents +numbers in UTC terrestrial time. #### Getting and Setting the Active Time System @@ -697,30 +746,30 @@ timeSystem. openmct.time.timeSystem('utc', bounds); ``` -A time system can be immediately activated after registration: +A time system can be immediately activated after registration: ```javascript openmct.time.addTimeSystem(utcTimeSystem); openmct.time.timeSystem(utcTimeSystem, bounds); ``` -Setting the active time system will trigger a [`'timeSystem'`](#time-events) +Setting the active time system will trigger a [`'timeSystem'`](#time-events) event. If you supplied bounds, a [`'bounds'`](#time-events) event will be triggered afterwards with your newly supplied bounds. #### Time Bounds -The TimeAPI provides a getter/setter for querying and setting time bounds. Time +The TimeAPI provides a getter/setter for querying and setting time bounds. Time bounds are simply an object with a `start` and an end `end` attribute. -* `start`: A `number` representing a moment in time in the active [Time System](#defining-and-registering-time-systems). +- `start`: A `number` representing a moment in time in the active [Time System](#defining-and-registering-time-systems). This will be used as the beginning of the time period displayed by time-responsive telemetry views. -* `end`: A `number` representing a moment in time in the active [Time System](#defining-and-registering-time-systems). +- `end`: A `number` representing a moment in time in the active [Time System](#defining-and-registering-time-systems). This will be used as the end of the time period displayed by time-responsive telemetry views. -If invoked with bounds, it will set the new time bounds system-wide. If invoked -without any parameters, it will return the current application-wide time bounds. +If invoked with bounds, it will set the new time bounds system-wide. If invoked +without any parameters, it will return the current application-wide time bounds. ``` javascript const ONE_HOUR = 60 * 60 * 1000; @@ -735,16 +784,16 @@ event. The Time API can be set to follow a clock source which will cause the bounds to be updated automatically whenever the clock source "ticks". A clock is simply -an object that supports registration of listeners and periodically invokes its -listeners with a number. Open MCT supports registration of new clock sources that -tick on almost anything. A tick occurs when the clock invokes callback functions +an object that supports registration of listeners and periodically invokes its +listeners with a number. Open MCT supports registration of new clock sources that +tick on almost anything. A tick occurs when the clock invokes callback functions registered by its listeners with a new time value. -An example of a clock source is the [LocalClock](https://github.com/nasa/openmct/blob/master/src/plugins/utcTimeSystem/LocalClock.js) -which emits the current time in UTC every 100ms. Clocks can tick on anything. For -example, a clock could be defined to provide the timestamp of any new data -received via a telemetry subscription. This would have the effect of advancing -the bounds of views automatically whenever data is received. A clock could also +An example of a clock source is the [LocalClock](https://github.com/nasa/openmct/blob/master/src/plugins/utcTimeSystem/LocalClock.js) +which emits the current time in UTC every 100ms. Clocks can tick on anything. For +example, a clock could be defined to provide the timestamp of any new data +received via a telemetry subscription. This would have the effect of advancing +the bounds of views automatically whenever data is received. A clock could also be defined to tick on some remote timing source. The values provided by clocks are simple `number`s, which are interpreted in the @@ -754,32 +803,32 @@ context of the active [Time System](#defining-and-registering-time-systems). A clock is an object that defines certain required metadata and functions: -* `key`: A `string` uniquely identifying this clock. This can be used later to +- `key`: A `string` uniquely identifying this clock. This can be used later to reference the clock in places such as the [Time Conductor configuration](#time-conductor-configuration) -* `cssClass`: A `string` identifying a CSS class to apply to this clock when it's -displayed in the UI. This will be used to represent the time system with an icon. -There are a number of built-in icon classes [available in Open MCT](https://github.com/nasa/openmct/blob/master/platform/commonUI/general/res/sass/_glyphs.scss), -or a custom class can be used here. -* `name`: A `string` providing a human-readable identifier for the clock source. -This will be displayed in the clock selector menu in the Time Conductor UI -component, if active. -* `description`: An __optional__ `string` providing a longer description of the -clock. The description will be visible in the clock selection menu in the Time +- `cssClass`: A `string` identifying a CSS class to apply to this clock when it's +displayed in the UI. This will be used to represent the time system with an icon. +There are a number of built-in icon classes [available in Open MCT](https://github.com/nasa/openmct/blob/master/platform/commonUI/general/res/sass/_glyphs.scss), +or a custom class can be used here. +- `name`: A `string` providing a human-readable identifier for the clock source. +This will be displayed in the clock selector menu in the Time Conductor UI +component, if active. +- `description`: An **optional** `string` providing a longer description of the +clock. The description will be visible in the clock selection menu in the Time Conductor plugin. -* `on`: A `function` supporting registration of a new callback that will be +- `on`: A `function` supporting registration of a new callback that will be invoked when the clock next ticks. It will be invoked with two arguments: - * `eventName`: A `string` specifying the event to listen on. For now, clocks + - `eventName`: A `string` specifying the event to listen on. For now, clocks support one event - `tick`. - * `callback`: A `function` that will be invoked when this clock ticks. The + - `callback`: A `function` that will be invoked when this clock ticks. The function must be invoked with one parameter - a `number` representing a valid time in the current time system. -* `off`: A `function` that allows deregistration of a tick listener. It accepts +- `off`: A `function` that allows deregistration of a tick listener. It accepts the same arguments as `on`. -* `currentValue`: A `function` that returns a `number` representing a point in -time in the active time system. It should be the last value provided by a tick, +- `currentValue`: A `function` that returns a `number` representing a point in +time in the active time system. It should be the last value provided by a tick, or some default value if no ticking has yet occurred. -A new clock can be registered using the `addClock` function exposed by the Time +A new clock can be registered using the `addClock` function exposed by the Time API: ```javascript @@ -806,26 +855,25 @@ An example clock implementation is provided in the form of the [LocalClock](http #### Getting and setting active clock -Once registered a clock can be activated by calling the `clock` function on the -Time API passing in the key or instance of a registered clock. Only one clock -may be active at once, so activating a clock will deactivate any currently +Once registered a clock can be activated by calling the `clock` function on the +Time API passing in the key or instance of a registered clock. Only one clock +may be active at once, so activating a clock will deactivate any currently active clock. [`clockOffsets`](#clock-offsets) must be specified when changing a clock. Setting the clock triggers a [`'clock'`](#time-events) event, followed by a [`'clockOffsets'`](#time-events) event, and then a [`'bounds'`](#time-events) event as the offsets are applied to the clock's currentValue(). - ``` openmct.time.clock(someClock, clockOffsets); ``` Upon being activated, the time API will listen for tick events on the clock by calling `clock.on`. -The currently active clock (if any) can be retrieved by calling the same +The currently active clock (if any) can be retrieved by calling the same function without any arguments. #### Stopping an active clock -The `stopClock` method can be used to stop an active clock, and to clear it. It +The `stopClock` method can be used to stop an active clock, and to clear it. It will stop the clock from ticking, and set the active clock to `undefined`. ``` javascript @@ -834,22 +882,22 @@ openmct.time.stopClock(); #### Clock Offsets -When a clock is active, the time bounds of the application will be updated -automatically each time the clock "ticks". The bounds are calculated based on -the current value provided by the active clock (via its `tick` event, or its -`currentValue()` method). +When a clock is active, the time bounds of the application will be updated +automatically each time the clock "ticks". The bounds are calculated based on +the current value provided by the active clock (via its `tick` event, or its +`currentValue()` method). Unlike bounds, which represent absolute time values, clock offsets represent relative time spans. Offsets are defined as an object with two properties: -* `start`: A `number` that must be < 0 and which is used to calculate the start -bounds on each clock tick. The start offset will be calculated relative to the +- `start`: A `number` that must be < 0 and which is used to calculate the start +bounds on each clock tick. The start offset will be calculated relative to the value provided by a clock's tick callback, or its `currentValue()` function. -* `end`: A `number` that must be >= 0 and which is used to calculate the end +- `end`: A `number` that must be >= 0 and which is used to calculate the end bounds on each clock tick. -The `clockOffsets` function can be used to get or set clock offsets. For example, -to show the last fifteen minutes in a ms-based time system: +The `clockOffsets` function can be used to get or set clock offsets. For example, +to show the last fifteen minutes in a ms-based time system: ```javascript var FIFTEEN_MINUTES = 15 * 60 * 1000; @@ -860,8 +908,8 @@ openmct.time.clockOffsets({ }) ``` -__Note:__ Setting the clock offsets will trigger an immediate bounds change, as -new bounds will be calculated based on the `currentValue()` of the active clock. +**Note:** Setting the clock offsets will trigger an immediate bounds change, as +new bounds will be calculated based on the `currentValue()` of the active clock. Clock offsets are only relevant when a clock source is active. ### Time Events @@ -880,89 +928,88 @@ openmct.time.on('bounds', function callback (newBounds, tick) { The events emitted by the Time API are: -* `bounds`: emitted whenever the bounds change. The callback will be invoked +- `bounds`: emitted whenever the bounds change. The callback will be invoked with two arguments: - * `bounds`: A [bounds](#getting-and-setting-bounds) bounds object + - `bounds`: A [bounds](#getting-and-setting-bounds) bounds object representing a new time period bound by the specified start and send times. - * `tick`: A `boolean` indicating whether or not this bounds change is due to - a "tick" from a [clock source](#clocks). This information can be useful - when determining a strategy for fetching telemetry data in response to a - bounds change event. For example, if the bounds change was automatic, and - is due to a tick then it's unlikely that you would need to perform a - historical data query. It should be sufficient to just show any new - telemetry received via subscription since the last tick, and optionally to - discard any older data that now falls outside of the currently set bounds. - If `tick` is false,then the bounds change was not due to an automatic tick, - and a query for historical data may be necessary, depending on your data + - `tick`: A `boolean` indicating whether or not this bounds change is due to + a "tick" from a [clock source](#clocks). This information can be useful + when determining a strategy for fetching telemetry data in response to a + bounds change event. For example, if the bounds change was automatic, and + is due to a tick then it's unlikely that you would need to perform a + historical data query. It should be sufficient to just show any new + telemetry received via subscription since the last tick, and optionally to + discard any older data that now falls outside of the currently set bounds. + If `tick` is false,then the bounds change was not due to an automatic tick, + and a query for historical data may be necessary, depending on your data caching strategy, and how significantly the start bound has changed. -* `timeSystem`: emitted whenever the active time system changes. The callback will be invoked with a single argument: - * `timeSystem`: The newly active [time system](#defining-and-registering-time-systems). -* `clock`: emitted whenever the clock changes. The callback will be invoked +- `timeSystem`: emitted whenever the active time system changes. The callback will be invoked with a single argument: + - `timeSystem`: The newly active [time system](#defining-and-registering-time-systems). +- `clock`: emitted whenever the clock changes. The callback will be invoked with a single argument: - * `clock`: The newly active [clock](#clocks), or `undefined` if an active + - `clock`: The newly active [clock](#clocks), or `undefined` if an active clock has been deactivated. -* `clockOffsets`: emitted whenever the active clock offsets change. The +- `clockOffsets`: emitted whenever the active clock offsets change. The callback will be invoked with a single argument: - * `clockOffsets`: The new [clock offsets](#clock-offsets). - + - `clockOffsets`: The new [clock offsets](#clock-offsets). ### The Time Conductor -The Time Conductor provides a user interface for managing time bounds in Open +The Time Conductor provides a user interface for managing time bounds in Open MCT. It allows a user to select from configured time systems and clocks, and to set bounds and clock offsets. -If activated, the time conductor must be provided with configuration options, +If activated, the time conductor must be provided with configuration options, detailed below. #### Time Conductor Configuration -The time conductor is configured by specifying the options that will be -available to the user from the menus in the time conductor. These will determine -the clocks available from the conductor, the time systems available for each -clock, and some default bounds and clock offsets for each combination of clock -and time system. By default, the conductor always supports a `fixed` mode where +The time conductor is configured by specifying the options that will be +available to the user from the menus in the time conductor. These will determine +the clocks available from the conductor, the time systems available for each +clock, and some default bounds and clock offsets for each combination of clock +and time system. By default, the conductor always supports a `fixed` mode where no clock is active. To specify configuration for fixed mode, simply leave out a `clock` attribute in the configuration entry object. -Configuration is provided as an `array` of menu options. Each entry of the +Configuration is provided as an `array` of menu options. Each entry of the array is an object with some properties specifying configuration. The configuration -options specified are slightly different depending on whether or not it is for +options specified are slightly different depending on whether or not it is for an active clock mode. -__Configuration for Fixed Time Mode (no active clock)__ +**Configuration for Fixed Time Mode (no active clock)** -* `timeSystem`: A `string`, the key for the time system that this configuration +- `timeSystem`: A `string`, the key for the time system that this configuration relates to. -* `bounds`: A [`Time Bounds`](#time-bounds) object. These bounds will be applied -when the user selects the time system specified in the previous `timeSystem` +- `bounds`: A [`Time Bounds`](#time-bounds) object. These bounds will be applied +when the user selects the time system specified in the previous `timeSystem` property. -* `zoomOutLimit`: An __optional__ `number` specifying the longest period of time -that can be represented by the conductor when zooming. If a `zoomOutLimit` is -provided, then a `zoomInLimit` must also be provided. If provided, the zoom +- `zoomOutLimit`: An **optional** `number` specifying the longest period of time +that can be represented by the conductor when zooming. If a `zoomOutLimit` is +provided, then a `zoomInLimit` must also be provided. If provided, the zoom slider will automatically become available in the Time Conductor UI. -* `zoomInLimit`: An __optional__ `number` specifying the shortest period of time -that can be represented by the conductor when zooming. If a `zoomInLimit` is -provided, then a `zoomOutLimit` must also be provided. If provided, the zoom +- `zoomInLimit`: An **optional** `number` specifying the shortest period of time +that can be represented by the conductor when zooming. If a `zoomInLimit` is +provided, then a `zoomOutLimit` must also be provided. If provided, the zoom slider will automatically become available in the Time Conductor UI. -__Configuration for Active Clock__ +**Configuration for Active Clock** -* `clock`: A `string`, the `key` of the clock that this configuration applies to. -* `timeSystem`: A `string`, the key for the time system that this configuration -relates to. Separate configuration must be provided for each time system that you +- `clock`: A `string`, the `key` of the clock that this configuration applies to. +- `timeSystem`: A `string`, the key for the time system that this configuration +relates to. Separate configuration must be provided for each time system that you wish to be available to users when they select the specified clock. -* `clockOffsets`: A [`clockOffsets`](#clock-offsets) object that will be -automatically applied when the combination of clock and time system specified in +- `clockOffsets`: A [`clockOffsets`](#clock-offsets) object that will be +automatically applied when the combination of clock and time system specified in this configuration is selected from the UI. #### Example conductor configuration -An example time conductor configuration is provided below. It sets up some -default options for the [UTCTimeSystem](https://github.com/nasa/openmct/blob/master/src/plugins/utcTimeSystem/UTCTimeSystem.js) -and [LocalTimeSystem](https://github.com/nasa/openmct/blob/master/src/plugins/localTimeSystem/LocalTimeSystem.js), -in both fixed mode, and for the [LocalClock](https://github.com/nasa/openmct/blob/master/src/plugins/utcTimeSystem/LocalClock.js) -source. In this configutation, the local clock supports both the UTCTimeSystem -and LocalTimeSystem. Configuration for fixed bounds mode is specified by omitting +An example time conductor configuration is provided below. It sets up some +default options for the [UTCTimeSystem](https://github.com/nasa/openmct/blob/master/src/plugins/utcTimeSystem/UTCTimeSystem.js) +and [LocalTimeSystem](https://github.com/nasa/openmct/blob/master/src/plugins/localTimeSystem/LocalTimeSystem.js), +in both fixed mode, and for the [LocalClock](https://github.com/nasa/openmct/blob/master/src/plugins/utcTimeSystem/LocalClock.js) +source. In this configutation, the local clock supports both the UTCTimeSystem +and LocalTimeSystem. Configuration for fixed bounds mode is specified by omitting a clock key. ``` javascript @@ -998,26 +1045,27 @@ openmct.install(openmct.plugins.Conductor({ ## Indicators -Indicators are small widgets that reside at the bottom of the screen and are visible from +Indicators are small widgets that reside at the bottom of the screen and are visible from every screen in Open MCT. They can be used to convey system state using an icon and text. -Typically an indicator will display an icon (customizable with a CSS class) that will +Typically an indicator will display an icon (customizable with a CSS class) that will reveal additional information when the mouse cursor is hovered over it. ### The URL Status Indicator -A common use case for indicators is to convey the state of some external system such as a -persistence backend or HTTP server. So long as this system is accessible via HTTP request, -Open MCT provides a general purpose indicator to show whether the server is available and +A common use case for indicators is to convey the state of some external system such as a +persistence backend or HTTP server. So long as this system is accessible via HTTP request, +Open MCT provides a general purpose indicator to show whether the server is available and returning a 2xx status code. The URL Status Indicator is made available as a default plugin. See -the [documentation](./src/plugins/URLIndicatorPlugin) for details on how to install and configure the +the [documentation](./src/plugins/URLIndicatorPlugin) for details on how to install and configure the URL Status Indicator. ### Creating a Simple Indicator -A simple indicator with an icon and some text can be created and added with minimal code. An indicator +A simple indicator with an icon and some text can be created and added with minimal code. An indicator of this type exposes functions for customizing the text, icon, and style of the indicator. eg. + ``` javascript var myIndicator = openmct.indicators.simpleIndicator(); myIndicator.text("Hello World!"); @@ -1026,24 +1074,24 @@ openmct.indicators.add(myIndicator); This will create a new indicator and add it to the bottom of the screen in Open MCT. By default, the indicator will appear as an information icon. Hovering over the icon will -reveal the text set via the call to `.text()`. The Indicator object returned by the API +reveal the text set via the call to `.text()`. The Indicator object returned by the API call exposes a number of functions for customizing the content and appearance of the indicator: -* `.text([text])`: Gets or sets the text shown when the user hovers over the indicator. -Accepts an __optional__ `string` argument that, if provided, will be used to set the text. -Hovering over the indicator will expand it to its full size, revealing this text alongside +- `.text([text])`: Gets or sets the text shown when the user hovers over the indicator. +Accepts an **optional** `string` argument that, if provided, will be used to set the text. +Hovering over the indicator will expand it to its full size, revealing this text alongside the icon. Returns the currently set text as a `string`. -* `.description([description])`: Gets or sets the indicator's description. Accepts an -__optional__ `string` argument that, if provided, will be used to set the text. The description -allows for more detail to be provided in a tooltip when the user hovers over the indicator. +- `.description([description])`: Gets or sets the indicator's description. Accepts an +**optional** `string` argument that, if provided, will be used to set the text. The description +allows for more detail to be provided in a tooltip when the user hovers over the indicator. Returns the currently set text as a `string`. -* `.iconClass([className])`: Gets or sets the CSS class used to define the icon. Accepts an __optional__ -`string` parameter to be used to set the class applied to the indicator. Any of -[the built-in glyphs](https://nasa.github.io/openmct/style-guide/#/browse/styleguide:home/glyphs?view=styleguide.glyphs) -may be used here, or a custom CSS class can be provided. Returns the currently defined CSS +- `.iconClass([className])`: Gets or sets the CSS class used to define the icon. Accepts an **optional** +`string` parameter to be used to set the class applied to the indicator. Any of +[the built-in glyphs](https://nasa.github.io/openmct/style-guide/#/browse/styleguide:home/glyphs?view=styleguide.glyphs) +may be used here, or a custom CSS class can be provided. Returns the currently defined CSS class as a `string`. -* `.statusClass([className])`: Gets or sets the CSS class used to determine status. Accepts an __optional __ -`string` parameter to be used to set a status class applied to the indicator. May be used to apply +- `.statusClass([className])`: Gets or sets the CSS class used to determine status. Accepts an __optional__ +`string` parameter to be used to set a status class applied to the indicator. May be used to apply different colors to indicate status. ### Custom Indicators @@ -1069,6 +1117,7 @@ Open MCT provides some built-in priority values that can be used in the applicat ### Priority Types Currently, the Open MCT Priority API provides (type: numeric value): + - HIGH: 1000 - Default: 0 - LOW: -1000 @@ -1082,4 +1131,4 @@ View provider Example: return openmct.priority.HIGH; } } -``` \ No newline at end of file +``` diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 70cc2709ec..2b5c69d209 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ accept changes from external contributors. The short version: -1. Write your contribution or describe your idea in the form of an [GitHub issue](https://github.com/nasa/openmct/issues/new/choose) or [Starting a GitHub Discussion](https://github.com/nasa/openmct/discussions) +1. Write your contribution or describe your idea in the form of a [GitHub issue](https://github.com/nasa/openmct/issues/new/choose) or [start a GitHub discussion](https://github.com/nasa/openmct/discussions). 2. Make sure your contribution meets code, test, and commit message standards as described below. 3. Submit a pull request from a topic branch back to `master`. Include a check @@ -173,7 +173,7 @@ The following guidelines are provided for anyone contributing source code to the 1. Avoid deep nesting (especially of functions), except where necessary (e.g. due to closure scope). 1. End with a single new-line character. -1. Always use ES6 `Class`es and inheritence rather than the pre-ES6 prototypal +1. Always use ES6 `Class`es and inheritance rather than the pre-ES6 prototypal pattern. 1. Within a given function's scope, do not mix declarations and imperative code, and present these in the following order: @@ -328,4 +328,4 @@ checklist). Write out a small list of tests performed with just enough detail for another developer on the team to execute. -i.e. ```When Clicking on Add button, new `object` appears in dropdown.``` \ No newline at end of file +i.e. ```When Clicking on Add button, new `object` appears in dropdown.``` diff --git a/LICENSE.md b/LICENSE.md index 2e87024fd1..c0122b008a 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # Open MCT License -Open MCT, Copyright (c) 2014-2022, United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All rights reserved. +Open MCT, Copyright (c) 2014-2023, 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. diff --git a/Procfile b/Procfile deleted file mode 100644 index 1e13b4ae05..0000000000 --- a/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: node app.js --port $PORT diff --git a/README.md b/README.md index dc685fac11..a66aa22d58 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Open MCT [![license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0) [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/nasa/openmct.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/nasa/openmct/context:javascript) [![codecov](https://codecov.io/gh/nasa/openmct/branch/master/graph/badge.svg?token=7DQIipp3ej)](https://codecov.io/gh/nasa/openmct) [![This project is using Percy.io for visual regression testing.](https://percy.io/static/images/percy-badge.svg)](https://percy.io/b2e34b17/openmct) [![npm version](https://img.shields.io/npm/v/openmct.svg)](https://www.npmjs.com/package/openmct) +# Open MCT [![license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0) [![codecov](https://codecov.io/gh/nasa/openmct/branch/master/graph/badge.svg?token=7DQIipp3ej)](https://codecov.io/gh/nasa/openmct) [![This project is using Percy.io for visual regression testing.](https://percy.io/static/images/percy-badge.svg)](https://percy.io/b2e34b17/openmct) [![npm version](https://img.shields.io/npm/v/openmct.svg)](https://www.npmjs.com/package/openmct) Open MCT (Open Mission Control Technologies) is a next-generation mission control framework for visualization of data on desktop and mobile devices. It is developed at NASA's Ames Research Center, and is being used by NASA for data analysis of spacecraft missions, as well as planning and operation of experimental rover systems. As a generalizable and open source framework, Open MCT could be used as the basis for building applications for planning, operation, and analysis of any systems producing telemetry data. @@ -6,10 +6,8 @@ Please visit our [Official Site](https://nasa.github.io/openmct/) and [Getting S Once you've created something amazing with Open MCT, showcase your work in our GitHub Discussions [Show and Tell](https://github.com/nasa/openmct/discussions/categories/show-and-tell) section. We love seeing unique and wonderful implementations of Open MCT! -## See Open MCT in Action +![Screen Shot 2022-11-23 at 9 51 36 AM](https://user-images.githubusercontent.com/4215777/203617422-4d912bfc-766f-4074-8324-409d9bbe7c05.png) -Try Open MCT now with our [live demo](https://openmct-demo.herokuapp.com/). -![Demo](https://nasa.github.io/openmct/static/res/images/Open-MCT.Browse.Layout.Mars-Weather-1.jpg) ## Building and Running Open MCT Locally @@ -30,6 +28,8 @@ Building and running Open MCT in your local dev environment is very easy. Be sur Open MCT is now running, and can be accessed by pointing a web browser at [http://localhost:8080/](http://localhost:8080/) +Open MCT is built using [`npm`](http://npmjs.com/) and [`webpack`](https://webpack.js.org/). + ## Documentation Documentation is available on the [Open MCT website](https://nasa.github.io/openmct/documentation/). @@ -43,11 +43,9 @@ our documentation. We want Open MCT to be as easy to use, install, run, and develop for as possible, and your feedback will help us get there! Feedback can be provided via [GitHub issues](https://github.com/nasa/openmct/issues/new/choose), [Starting a GitHub Discussion](https://github.com/nasa/openmct/discussions), or by emailing us at [arc-dl-openmct@mail.nasa.gov](mailto:arc-dl-openmct@mail.nasa.gov). -## Building Applications With Open MCT +## Developing Applications With Open MCT -Open MCT is built using [`npm`](http://npmjs.com/) and [`webpack`](https://webpack.js.org/). - -See our documentation for a guide on [building Applications with Open MCT](https://github.com/nasa/openmct/blob/master/API.md#starting-an-open-mct-application). +For more on developing with Open MCT, see our documentation for a guide on [Developing Applications with Open MCT](./API.md#starting-an-open-mct-application). ## Compatibility @@ -64,7 +62,7 @@ that is intended to be added or removed as a single unit. As well as providing an extension mechanism, most of the core Open MCT codebase is also written as plugins. -For information on writing plugins, please see [our API documentation](https://github.com/nasa/openmct/blob/master/API.md#plugins). +For information on writing plugins, please see [our API documentation](./API.md#plugins). ## Tests @@ -100,7 +98,7 @@ To run the performance tests: The test suite is configured to all tests localed in `e2e/tests/` ending in `*.e2e.spec.js`. For more about the e2e test suite, please see the [README](./e2e/README.md) ### Security Tests -Each commit is analyzed for known security vulnerabilities using [CodeQL](https://codeql.github.com/docs/codeql-language-guides/codeql-library-for-javascript/) and our overall security report is available on [LGTM](https://lgtm.com/projects/g/nasa/openmct/) +Each commit is analyzed for known security vulnerabilities using [CodeQL](https://codeql.github.com/docs/codeql-language-guides/codeql-library-for-javascript/). The list of CWE coverage items is avaiable in the [CodeQL docs](https://codeql.github.com/codeql-query-help/javascript-cwe/). The CodeQL workflow is specified in the [CodeQL analysis file](./.github/workflows/codeql-analysis.yml) and the custom [CodeQL config](./.github/codeql/codeql-config.yml). ### Test Reporting and Code Coverage diff --git a/app.js b/app.js deleted file mode 100644 index c7ecd9de3b..0000000000 --- a/app.js +++ /dev/null @@ -1,92 +0,0 @@ -/*global process*/ - -/** - * Usage: - * - * npm install minimist express - * node app.js [options] - */ - -const options = require('minimist')(process.argv.slice(2)); -const express = require('express'); -const app = express(); -const fs = require('fs'); -const request = require('request'); -const __DEV__ = !process.env.NODE_ENV || process.env.NODE_ENV === 'development'; - -// Defaults -options.port = options.port || options.p || 8080; -options.host = options.host || 'localhost'; -options.directory = options.directory || options.D || '.'; - -// Show command line options -if (options.help || options.h) { - console.log("\nUsage: node app.js [options]\n"); - console.log("Options:"); - console.log(" --help, -h Show this message."); - console.log(" --port, -p Specify port."); - console.log(" --directory, -D Serve files from specified directory."); - console.log(""); - process.exit(0); -} - -app.disable('x-powered-by'); - -app.use('/proxyUrl', function proxyRequest(req, res, next) { - console.log('Proxying request to: ', req.query.url); - req.pipe(request({ - url: req.query.url, - strictSSL: false - }).on('error', next)).pipe(res); -}); - -class WatchRunPlugin { - apply(compiler) { - compiler.hooks.emit.tapAsync('WatchRunPlugin', (compilation, callback) => { - console.log('Begin compile at ' + new Date()); - callback(); - }); - } -} - -const webpack = require('webpack'); -let webpackConfig; -if (__DEV__) { - webpackConfig = require('./webpack.dev'); - webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin()); - webpackConfig.entry.openmct = [ - 'webpack-hot-middleware/client?reload=true', - webpackConfig.entry.openmct - ]; - webpackConfig.plugins.push(new WatchRunPlugin()); -} else { - webpackConfig = require('./webpack.coverage'); -} - -const compiler = webpack(webpackConfig); - -app.use(require('webpack-dev-middleware')( - compiler, - { - publicPath: '/dist', - stats: 'errors-warnings' - } -)); - -if (__DEV__) { - app.use(require('webpack-hot-middleware')( - compiler, - {} - )); -} - -// Expose index.html for development users. -app.get('/', function (req, res) { - fs.createReadStream('index.html').pipe(res); -}); - -// Finally, open the HTTP server and log the instance to the console -app.listen(options.port, options.host, function () { - console.log('Open MCT application running at %s:%s', options.host, options.port); -}); - diff --git a/build-docs.sh b/build-docs.sh index d30af4f109..3d114877e6 100755 --- a/build-docs.sh +++ b/build-docs.sh @@ -1,7 +1,7 @@ #!/bin/bash #***************************************************************************** -#* Open MCT, Copyright (c) 2014-2022, United States Government +#* Open MCT, Copyright (c) 2014-2023, United States Government #* as represented by the Administrator of the National Aeronautics and Space #* Administration. All rights reserved. #* diff --git a/copyright-notice.html b/copyright-notice.html index 135675cd0e..44075bd930 100644 --- a/copyright-notice.html +++ b/copyright-notice.html @@ -1,5 +1,5 @@ - - + + + - - + + + + + + + + + - - - @@ -193,7 +209,7 @@ + @@ -238,32 +259,34 @@ import { throttle } from 'lodash'; export default { props: { - compassRoseSizingClasses: { - type: String, + cameraAngleOfView: { + type: Number, required: true }, heading: { type: Number, - required: true, - default() { - return 0; - } + required: true + }, + cameraAzimuth: { + type: Number, + default: undefined + }, + transformations: { + type: Object, + required: true + }, + hasGimble: { + type: Boolean, + required: true + }, + normalizedCameraAzimuth: { + type: Number, + required: true }, sunHeading: { type: Number, default: undefined }, - cameraAngleOfView: { - type: Number, - default: undefined - }, - cameraPan: { - type: Number, - required: true, - default() { - return 0; - } - }, sizedImageDimensions: { type: Object, required: true @@ -275,11 +298,30 @@ export default { }; }, computed: { - compassRoseStyle() { + camAngleAndPositionStyle() { + const translateX = this.transformations?.translateX; + const translateY = this.transformations?.translateY; + const rotation = this.transformations?.rotation; + const scale = this.transformations?.scale; + + return { transform: `translate(${translateX}%, ${translateY}%) rotate(${rotation}deg) scale(${scale})` }; + }, + gimbledCameraPanStyle() { + if (!this.hasGimble) { + return; + } + + const gimbledCameraPan = rotate(this.normalizedCameraAzimuth, -this.heading); + + return { + transform: `rotate(${ -gimbledCameraPan }deg)` + }; + }, + compassDialStyle() { return { transform: `rotate(${ this.north }deg)` }; }, north() { - return this.lockCompass ? rotate(-this.cameraPan) : 0; + return this.lockCompass ? rotate(-this.normalizedCameraAzimuth) : 0; }, cardinalTextRotateN() { return { transform: `translateY(-27%) rotate(${ -this.north }deg)` }; @@ -296,13 +338,6 @@ export default { hasHeading() { return this.heading !== undefined; }, - headingStyle() { - const rotation = rotate(this.north, this.heading); - - return { - transform: `rotate(${ rotation }deg)` - }; - }, hasSunHeading() { return this.sunHeading !== undefined; }, @@ -313,8 +348,8 @@ export default { transform: `rotate(${ rotation }deg)` }; }, - cameraPanStyle() { - const rotation = rotate(this.north, this.cameraPan); + cameraHeadingStyle() { + const rotation = rotate(this.north, this.normalizedCameraAzimuth); return { transform: `rotate(${ rotation }deg)` @@ -333,6 +368,24 @@ export default { return { transform: `rotate(${ -this.cameraAngleOfView / 2 }deg)` }; + }, + compassRoseSizingClasses() { + let compassRoseSizingClasses = ''; + if (this.sizedImageWidth < 300) { + compassRoseSizingClasses = '--rose-small --rose-min'; + } else if (this.sizedImageWidth < 500) { + compassRoseSizingClasses = '--rose-small'; + } else if (this.sizedImageWidth > 1000) { + compassRoseSizingClasses = '--rose-max'; + } + + return compassRoseSizingClasses; + }, + sizedImageWidth() { + return this.sizedImageDimensions.width; + }, + sizedImageHeight() { + return this.sizedImageDimensions.height; } }, watch: { diff --git a/src/plugins/imagery/components/Compass/compass.scss b/src/plugins/imagery/components/Compass/compass.scss index 5609bf9f60..a143706b2b 100644 --- a/src/plugins/imagery/components/Compass/compass.scss +++ b/src/plugins/imagery/components/Compass/compass.scss @@ -1,5 +1,5 @@ /***************************** THEME/UI CONSTANTS AND MIXINS */ -$interfaceKeyColor: #00B9C5; +$interfaceKeyColor: #fff; $elemBg: rgba(black, 0.7); @mixin sun($position: 'circle closest-side') { @@ -100,13 +100,19 @@ $elemBg: rgba(black, 0.7); } &__edge { - opacity: 0.1; + opacity: 0.2; } &__sun { opacity: 0.7; } + &__cam { + fill: $interfaceKeyColor; + transform-origin: center; + transform: scale(0.15); + } + &__cam-fov-l, &__cam-fov-r { // Cam FOV indication @@ -115,7 +121,6 @@ $elemBg: rgba(black, 0.7); } &__nsew-text, - &__spacecraft-body, &__ticks-major, &__ticks-minor { fill: $color; @@ -166,3 +171,15 @@ $elemBg: rgba(black, 0.7); padding-top: $s; } } + +/************************** ROVER */ +.cr-vrover { + $scale: 0.4; + transform-origin: center; + + &__body { + fill: $interfaceKeyColor; + opacity: 0.3; + transform-origin: center 7% !important; // Places rotation center at mast position + } +} diff --git a/src/plugins/imagery/components/Compass/pluginSpec.js b/src/plugins/imagery/components/Compass/pluginSpec.js index 1b2ab8aba5..67e57b768e 100644 --- a/src/plugins/imagery/components/Compass/pluginSpec.js +++ b/src/plugins/imagery/components/Compass/pluginSpec.js @@ -1,5 +1,5 @@ /***************************************************************************** - * Open MCT, Copyright (c) 2014-2022, United States Government + * Open MCT, Copyright (c) 2014-2023, United States Government * as represented by the Administrator of the National Aeronautics and Space * Administration. All rights reserved. * @@ -35,8 +35,15 @@ describe("The Compass component", () => { roll: 90, pitch: 90, cameraTilt: 100, - cameraPan: 90, - sunAngle: 30 + cameraAzimuth: 90, + sunAngle: 30, + transformations: { + translateX: 0, + translateY: 18, + rotation: 0, + scale: 0.3, + cameraAngleOfView: 70 + } }; let propsData = { naturalAspectRatio: 0.9, @@ -44,8 +51,7 @@ describe("The Compass component", () => { sizedImageDimensions: { width: 100, height: 100 - }, - compassRoseSizingClasses: '--rose-small --rose-min' + } }; app = new Vue({ @@ -54,7 +60,6 @@ describe("The Compass component", () => { return propsData; }, template: ` { app.$destroy(); }); - describe("when a heading value exists on the image", () => { + describe("when a heading value and cameraAngleOfView exists on the image", () => { it("should display a compass rose", () => { let compassRoseElement = instance.$el.querySelector(COMPASS_ROSE_CLASS diff --git a/src/plugins/imagery/components/ImageControls.vue b/src/plugins/imagery/components/ImageControls.vue index 96cf702bc5..0a2769801f 100644 --- a/src/plugins/imagery/components/ImageControls.vue +++ b/src/plugins/imagery/components/ImageControls.vue @@ -1,5 +1,5 @@ /***************************************************************************** - * Open MCT, Copyright (c) 2014-2022, United States Government + * Open MCT, Copyright (c) 2014-2023, United States Government * as represented by the Administrator of the National Aeronautics and Space * Administration. All rights reserved. * diff --git a/src/plugins/imagery/components/ImageThumbnail.vue b/src/plugins/imagery/components/ImageThumbnail.vue index 17016527e7..936b6430cb 100644 --- a/src/plugins/imagery/components/ImageThumbnail.vue +++ b/src/plugins/imagery/components/ImageThumbnail.vue @@ -1,5 +1,5 @@ /***************************************************************************** - * Open MCT, Copyright (c) 2014-2022, United States Government + * Open MCT, Copyright (c) 2014-2023, United States Government * as represented by the Administrator of the National Aeronautics and Space * Administration. All rights reserved. * @@ -22,23 +23,40 @@ - +
+
+ {{ tag.label }} +
+
-
- +
+
+ +
-
- -
import NotebookEmbed from './NotebookEmbed.vue'; -import TagEditor from '../../../ui/components/tags/TagEditor.vue'; import TextHighlight from '../../../utils/textHighlight/TextHighlight.vue'; import { createNewEmbed } from '../utils/notebook-entries'; import { saveNotebookImageDomainObject, updateNamespaceOfDomainObject } from '../utils/notebook-image'; +import sanitizeHtml from 'sanitize-html'; +import _ from 'lodash'; + import Moment from 'moment'; +const SANITIZATION_SCHEMA = { + allowedTags: [], + allowedAttributes: {} +}; +const URL_REGEX = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/g; const UNKNOWN_USER = 'Unknown'; export default { components: { NotebookEmbed, - TextHighlight, - TagEditor + TextHighlight }, - inject: ['openmct', 'snapshotContainer'], + inject: ['openmct', 'snapshotContainer', 'entryUrlWhitelist'], props: { domainObject: { type: Object, @@ -163,6 +192,12 @@ export default { return {}; } }, + notebookAnnotations: { + type: Array, + default() { + return []; + } + }, entry: { type: Object, default() { @@ -198,24 +233,49 @@ export default { default() { return false; } + }, + selectedEntryId: { + type: String, + default() { + return ''; + } } }, + data() { + return { + editMode: false, + canEdit: true, + enableEmbedsWrapperScroll: false, + urlWhitelist: [] + }; + }, computed: { createdOnDate() { return this.formatTime(this.entry.createdOn, 'YYYY-MM-DD'); }, - annotationQuery() { - const targetKeyString = this.openmct.objects.makeKeyString(this.domainObject.identifier); - - return { - targetKeyString, - entryId: this.entry.id, - modified: this.entry.modified - }; - }, createdOnTime() { return this.formatTime(this.entry.createdOn, 'HH:mm:ss'); }, + formattedText() { + // remove ANY tags + const text = sanitizeHtml(this.entry.text, SANITIZATION_SCHEMA); + + if (this.editMode || this.urlWhitelist.length === 0) { + return { innerText: text }; + } + + const html = this.formatValidUrls(text); + + return { innerHTML: html }; + }, + isSelectedEntry() { + return this.selectedEntryId === this.entry.id; + }, + entryTags() { + const tagsFromAnnotations = this.openmct.annotation.getTagsFromAnnotations(this.notebookAnnotations); + + return tagsFromAnnotations; + }, entryText() { let text = this.entry.text; @@ -236,7 +296,23 @@ export default { } }, mounted() { + this.manageEmbedLayout = _.debounce(this.manageEmbedLayout, 400); + + if (this.$refs.embedsWrapper) { + this.embedsWrapperResizeObserver = new ResizeObserver(this.manageEmbedLayout); + this.embedsWrapperResizeObserver.observe(this.$refs.embedsWrapper); + } + + this.manageEmbedLayout(); this.dropOnEntry = this.dropOnEntry.bind(this); + if (this.entryUrlWhitelist?.length > 0) { + this.urlWhitelist = this.entryUrlWhitelist; + } + }, + beforeDestroy() { + if (this.embedsWrapperResizeObserver) { + this.embedsWrapperResizeObserver.unobserve(this.$refs.embedsWrapper); + } }, methods: { async addNewEmbed(objectPath) { @@ -249,6 +325,8 @@ export default { }; const newEmbed = await createNewEmbed(snapshotMeta); this.entry.embeds.push(newEmbed); + + this.manageEmbedLayout(); }, cancelEditMode(event) { const isEditing = this.openmct.editor.isEditing(); @@ -266,9 +344,41 @@ export default { event.dataTransfer.effectAllowed = 'none'; } }, + checkEditability($event) { + if ($event.target.nodeName === 'A') { + this.canEdit = false; + } + }, deleteEntry() { this.$emit('deleteEntry', this.entry.id); }, + formatValidUrls(text) { + return text.replace(URL_REGEX, (match) => { + const url = new URL(match); + const domain = url.hostname; + let result = match; + let isMatch = this.urlWhitelist.find((partialDomain) => { + return domain.endsWith(partialDomain); + }); + + if (isMatch) { + result = `${match}`; + } + + return result; + }); + }, + manageEmbedLayout() { + if (this.$refs.embeds) { + const embedsWrapperLength = this.$refs.embedsWrapper.clientWidth; + const embedsTotalWidth = this.$refs.embeds.reduce((total, embed) => { + return embed.$el.clientWidth + total; + }, 0); + + this.enableEmbedsWrapperScroll = embedsTotalWidth > embedsWrapperLength; + } + + }, async dropOnEntry($event) { $event.stopImmediatePropagation(); @@ -326,6 +436,8 @@ export default { this.entry.embeds.splice(embedPosition, 1); this.timestampAndUpdate(); + + this.manageEmbedLayout(); }, updateEmbed(newEmbed) { this.entry.embeds.some(e => { @@ -350,17 +462,56 @@ export default { this.$emit('updateEntry', this.entry); }, + preventFocusIfNotSelected($event) { + if (!this.isSelectedEntry) { + $event.preventDefault(); + // blur the previous focused entry if clicking on non selected entry input + const focusedElementId = document.activeElement?.id; + if (focusedElementId !== this.entry.id) { + document.activeElement.blur(); + } + } + }, editingEntry() { + this.editMode = true; this.$emit('editingEntry'); }, updateEntryValue($event) { + this.editMode = false; const value = $event.target.innerText; if (value !== this.entry.text && value.match(/\S/)) { - this.entry.text = value; + this.entry.text = sanitizeHtml(value, SANITIZATION_SCHEMA); this.timestampAndUpdate(); } else { this.$emit('cancelEdit'); } + }, + selectEntry(event, entry) { + const targetDetails = {}; + const keyString = this.openmct.objects.makeKeyString(this.domainObject.identifier); + targetDetails[keyString] = { + entryId: entry.id + }; + const targetDomainObjects = {}; + targetDomainObjects[keyString] = this.domainObject; + this.openmct.selection.select( + [ + { + element: event.currentTarget, + context: { + type: 'notebook-entry-selection', + item: this.domainObject, + targetDetails, + targetDomainObjects, + annotations: this.notebookAnnotations, + annotationType: this.openmct.annotation.ANNOTATION_TYPES.NOTEBOOK, + onAnnotationChange: this.timestampAndUpdate + } + } + ], + false); + event.stopPropagation(); + this.$emit('entry-selection', this.entry); } } }; diff --git a/src/plugins/notebook/components/PageComponent.vue b/src/plugins/notebook/components/PageComponent.vue index 950cc142b7..cf623112ac 100644 --- a/src/plugins/notebook/components/PageComponent.vue +++ b/src/plugins/notebook/components/PageComponent.vue @@ -12,8 +12,10 @@ diff --git a/src/plugins/plan/PlanViewConfiguration.js b/src/plugins/plan/PlanViewConfiguration.js new file mode 100644 index 0000000000..249d97be27 --- /dev/null +++ b/src/plugins/plan/PlanViewConfiguration.js @@ -0,0 +1,110 @@ +/***************************************************************************** + * Open MCT, Copyright (c) 2014-2023, 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 EventEmitter from 'EventEmitter'; + +export const DEFAULT_CONFIGURATION = { + clipActivityNames: false, + swimlaneVisibility: {} +}; + +export default class PlanViewConfiguration extends EventEmitter { + constructor(domainObject, openmct) { + super(); + + this.domainObject = domainObject; + this.openmct = openmct; + + this.configurationChanged = this.configurationChanged.bind(this); + this.unlistenFromMutation = openmct.objects.observe(domainObject, 'configuration', this.configurationChanged); + } + + /** + * @returns {Object.} + */ + getConfiguration() { + const configuration = this.domainObject.configuration ?? {}; + for (const configKey of Object.keys(DEFAULT_CONFIGURATION)) { + configuration[configKey] = configuration[configKey] ?? DEFAULT_CONFIGURATION[configKey]; + } + + return configuration; + } + + #updateConfiguration(configuration) { + this.openmct.objects.mutate(this.domainObject, 'configuration', configuration); + } + + /** + * @param {string} swimlaneName + * @param {boolean} isVisible + */ + setSwimlaneVisibility(swimlaneName, isVisible) { + const configuration = this.getConfiguration(); + const { swimlaneVisibility } = configuration; + swimlaneVisibility[swimlaneName] = isVisible; + this.#updateConfiguration(configuration); + } + + resetSwimlaneVisibility() { + const configuration = this.getConfiguration(); + const swimlaneVisibility = {}; + configuration.swimlaneVisibility = swimlaneVisibility; + this.#updateConfiguration(configuration); + } + + initializeSwimlaneVisibility(swimlaneNames) { + const configuration = this.getConfiguration(); + const { swimlaneVisibility } = configuration; + let shouldMutate = false; + for (const swimlaneName of swimlaneNames) { + if (swimlaneVisibility[swimlaneName] === undefined) { + swimlaneVisibility[swimlaneName] = true; + shouldMutate = true; + } + } + + if (shouldMutate) { + configuration.swimlaneVisibility = swimlaneVisibility; + this.#updateConfiguration(configuration); + } + } + + /** + * @param {boolean} isEnabled + */ + setClipActivityNames(isEnabled) { + const configuration = this.getConfiguration(); + configuration.clipActivityNames = isEnabled; + this.#updateConfiguration(configuration); + } + + configurationChanged(configuration) { + if (configuration !== undefined) { + this.emit('change', configuration); + } + } + + destroy() { + this.unlistenFromMutation(); + } +} diff --git a/src/plugins/plan/PlanViewProvider.js b/src/plugins/plan/PlanViewProvider.js index fbfd6a5388..dcf3ac1056 100644 --- a/src/plugins/plan/PlanViewProvider.js +++ b/src/plugins/plan/PlanViewProvider.js @@ -1,5 +1,5 @@ /***************************************************************************** - * Open MCT, Copyright (c) 2014-2022, United States Government + * Open MCT, Copyright (c) 2014-2023, United States Government * as represented by the Administrator of the National Aeronautics and Space * Administration. All rights reserved. * @@ -20,7 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -import Plan from './Plan.vue'; +import Plan from './components/Plan.vue'; import Vue from 'vue'; export default function PlanViewProvider(openmct) { @@ -35,11 +35,11 @@ export default function PlanViewProvider(openmct) { name: 'Plan', cssClass: 'icon-plan', canView(domainObject) { - return domainObject.type === 'plan'; + return domainObject.type === 'plan' || domainObject.type === 'gantt-chart'; }, canEdit(domainObject) { - return false; + return domainObject.type === 'gantt-chart'; }, view: function (domainObject, objectPath) { diff --git a/src/plugins/plan/README.md b/src/plugins/plan/README.md new file mode 100644 index 0000000000..6f3962d939 --- /dev/null +++ b/src/plugins/plan/README.md @@ -0,0 +1,117 @@ +# Plan view and domain objects +Plans provide a view for a list of activities grouped by categories. + +## Plan category and activity JSON format +The JSON format for a plan consists of categories/groups and a list of activities for each category. +Activity properties include: +* name: Name of the activity +* start: Timestamps in milliseconds +* end: Timestamps in milliseconds +* type: Matches the name of the category it is in +* color: Background color for the activity +* textColor: Color of the name text for the activity +* The format of the json file is as follows: + +```json +{ + "TEST_GROUP": [{ + "name": "Event 1 with a really long name", + "start": 1665323197000, + "end": 1665344921000, + "type": "TEST_GROUP", + "color": "orange", + "textColor": "white" + }], + "GROUP_2": [{ + "name": "Event 2", + "start": 1665409597000, + "end": 1665456252000, + "type": "GROUP_2", + "color": "red", + "textColor": "white" + }] +} +``` + +## Plans using JSON file uploads +Plan domain objects can be created by uploading a JSON file with the format above to render categories and activities. + +## Using Domain Objects directly +If uploading a JSON is not desired, it is possible to visualize domain objects of type 'plan'. +The standard model is as follows: +```javascript +{ + identifier: { + namespace: "" + key: "test-plan" + } + name:"A plan object", + type:"plan", + location:"ROOT", + selectFile: { + body: { + SOME_CATEGORY: [{ + name: "An activity", + start: 1665323197000, + end: 1665323197100, + type: "SOME_CATEGORY" + } + ], + ANOTHER_CATEGORY: [{ + name: "An activity", + start: 1665323197000, + end: 1665323197100, + type: "ANOTHER_CATEGORY" + } + ] + } + } +} +``` + +If your data has non-standard keys for `start, end, type and activities` properties, use the `sourceMap` property mapping. +```javascript +{ + identifier: { + namespace: "" + key: "another-test-plan" + } + name:"Another plan object", + type:"plan", + location:"ROOT", + sourceMap: { + start: 'start_time', + end: 'end_time', + activities: 'items', + groupId: 'category' + }, + selectFile: { + body: { + items: [ + { + name: "An activity", + start_time: 1665323197000, + end_time: 1665323197100, + category: "SOME_CATEGORY" + }, + { + name: "Another activity", + start_time: 1665323198000, + end_time: 1665323198100, + category: "ANOTHER_CATEGORY" + } + ] + } + } +} +``` + +## Rendering categories and activities: +The algorithm to render categories and activities on a canvas is as follows: +* Each category gets a swimlane. +* Activities within a category are rendered within it's swimlane. +* Render each activity on a given row if it's duration+label do not overlap (start/end times) with an existing activity on that row. +* Move to the next available row within a swimlane if there is overlap +* Labels for a given activity will be rendered within it's duration slot if it fits in that rectangular space. +* Labels that do not fit within an activity's duration slot are rendered outside, to the right of the duration slot. + diff --git a/src/plugins/plan/components/ActivityTimeline.vue b/src/plugins/plan/components/ActivityTimeline.vue new file mode 100644 index 0000000000..ec0120d392 --- /dev/null +++ b/src/plugins/plan/components/ActivityTimeline.vue @@ -0,0 +1,187 @@ + + + + diff --git a/src/plugins/plan/components/Plan.vue b/src/plugins/plan/components/Plan.vue new file mode 100644 index 0000000000..fc7005b2e6 --- /dev/null +++ b/src/plugins/plan/components/Plan.vue @@ -0,0 +1,558 @@ +* Open MCT, Copyright (c) 2014-2023, 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. +*****************************************************************************/ + + + + diff --git a/src/plugins/plan/inspector/PlanInspectorViewProvider.js b/src/plugins/plan/inspector/ActivityInspectorViewProvider.js similarity index 84% rename from src/plugins/plan/inspector/PlanInspectorViewProvider.js rename to src/plugins/plan/inspector/ActivityInspectorViewProvider.js index d0f118fd45..2dfb756911 100644 --- a/src/plugins/plan/inspector/PlanInspectorViewProvider.js +++ b/src/plugins/plan/inspector/ActivityInspectorViewProvider.js @@ -1,5 +1,5 @@ /***************************************************************************** - * Open MCT, Copyright (c) 2014-2022, United States Government + * Open MCT, Copyright (c) 2014-2023, United States Government * as represented by the Administrator of the National Aeronautics and Space * Administration. All rights reserved. * @@ -20,13 +20,13 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -import PlanActivitiesView from "./PlanActivitiesView.vue"; +import PlanActivitiesView from "./components/PlanActivitiesView.vue"; import Vue from 'vue'; -export default function PlanInspectorViewProvider(openmct) { +export default function ActivityInspectorViewProvider(openmct) { return { - key: 'plan-inspector', - name: 'Plan Inspector View', + key: 'activity-inspector', + name: 'Activity', canView: function (selection) { if (selection.length === 0 || selection[0].length === 0) { return false; @@ -44,6 +44,7 @@ export default function PlanInspectorViewProvider(openmct) { show: function (element) { component = new Vue({ el: element, + name: "PlanActivitiesView", components: { PlanActivitiesView: PlanActivitiesView }, @@ -54,6 +55,9 @@ export default function PlanInspectorViewProvider(openmct) { template: '' }); }, + priority: function () { + return openmct.priority.HIGH + 1; + }, destroy: function () { if (component) { component.$destroy(); @@ -61,9 +65,6 @@ export default function PlanInspectorViewProvider(openmct) { } } }; - }, - priority: function () { - return 1; } }; } diff --git a/src/plugins/plan/inspector/GanttChartInspectorViewProvider.js b/src/plugins/plan/inspector/GanttChartInspectorViewProvider.js new file mode 100644 index 0000000000..56f66b4a5b --- /dev/null +++ b/src/plugins/plan/inspector/GanttChartInspectorViewProvider.js @@ -0,0 +1,68 @@ +/***************************************************************************** + * Open MCT, Copyright (c) 2014-2023, 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 PlanViewConfiguration from './components/PlanViewConfiguration.vue'; +import Vue from 'vue'; + +export default function GanttChartInspectorViewProvider(openmct) { + return { + key: 'plan-inspector', + name: 'Config', + canView: function (selection) { + if (selection.length === 0 || selection[0].length === 0) { + return false; + } + + const domainObject = selection[0][0].context.item; + + return domainObject?.type === 'gantt-chart'; + }, + view: function (selection) { + let component; + + return { + show: function (element) { + component = new Vue({ + el: element, + components: { + PlanViewConfiguration + }, + provide: { + openmct, + selection: selection + }, + template: '' + }); + }, + priority: function () { + return openmct.priority.HIGH + 1; + }, + destroy: function () { + if (component) { + component.$destroy(); + component = undefined; + } + } + }; + } + }; +} diff --git a/src/plugins/plan/inspector/ActivityProperty.vue b/src/plugins/plan/inspector/components/ActivityProperty.vue similarity index 96% rename from src/plugins/plan/inspector/ActivityProperty.vue rename to src/plugins/plan/inspector/components/ActivityProperty.vue index 437e249fd6..88c1f4d424 100644 --- a/src/plugins/plan/inspector/ActivityProperty.vue +++ b/src/plugins/plan/inspector/components/ActivityProperty.vue @@ -1,5 +1,5 @@ + + diff --git a/src/plugins/plan/plan.scss b/src/plugins/plan/plan.scss index 30de20814b..a582260fa9 100644 --- a/src/plugins/plan/plan.scss +++ b/src/plugins/plan/plan.scss @@ -1,5 +1,5 @@ /***************************************************************************** - * Open MCT, Copyright (c) 2014-2022, United States Government + * Open MCT, Copyright (c) 2014-2023, United States Government * as represented by the Administrator of the National Aeronautics and Space * Administration. All rights reserved. * @@ -21,21 +21,34 @@ *****************************************************************************/ .c-plan { - svg { - text-rendering: geometricPrecision; + svg { + text-rendering: geometricPrecision; - text { - stroke: none; + text { + stroke: none; + } } - .activity-label { - &--outside-rect { - fill: $colorBodyFg !important; - } - } - } + &__activity { + cursor: pointer; - canvas { - display: none; - } + &[s-selected] { + rect, use { + outline-style: dotted; + outline-width: 2px; + stroke: $colorGanttSelectedBorder; + stroke-width: 2px; + } + } + } + + &__activity-label { + &--outside-rect { + fill: $colorBodyFg !important; + } + } + + canvas { + display: none; + } } diff --git a/src/plugins/plan/plugin.js b/src/plugins/plan/plugin.js index df418f0e3d..85022fd61b 100644 --- a/src/plugins/plan/plugin.js +++ b/src/plugins/plan/plugin.js @@ -1,5 +1,5 @@ /***************************************************************************** - * Open MCT, Copyright (c) 2014-2022, United States Government + * Open MCT, Copyright (c) 2014-2023, United States Government * as represented by the Administrator of the National Aeronautics and Space * Administration. All rights reserved. * @@ -21,15 +21,18 @@ *****************************************************************************/ import PlanViewProvider from './PlanViewProvider'; -import PlanInspectorViewProvider from "./inspector/PlanInspectorViewProvider"; +import ActivityInspectorViewProvider from "./inspector/ActivityInspectorViewProvider"; +import GanttChartInspectorViewProvider from "./inspector/GanttChartInspectorViewProvider"; +import ganttChartCompositionPolicy from './GanttChartCompositionPolicy'; +import { DEFAULT_CONFIGURATION } from './PlanViewConfiguration'; -export default function (configuration) { +export default function (options = {}) { return function install(openmct) { openmct.types.addType('plan', { name: 'Plan', key: 'plan', - description: 'A configurable timeline-like view for a compatible mission plan file.', - creatable: true, + description: 'A non-configurable timeline-like view for a compatible plan file.', + creatable: options.creatable ?? false, cssClass: 'icon-plan', form: [ { @@ -45,10 +48,30 @@ export default function (configuration) { } ], initialize: function (domainObject) { + domainObject.configuration = { + clipActivityNames: DEFAULT_CONFIGURATION.clipActivityNames + }; + } + }); + // Name TBD and subject to change + openmct.types.addType('gantt-chart', { + name: 'Gantt Chart', + key: 'gantt-chart', + description: 'A configurable timeline-like view for a compatible plan file.', + creatable: true, + cssClass: 'icon-plan', + form: [], + initialize(domainObject) { + domainObject.configuration = { + clipActivityNames: true + }; + domainObject.composition = []; } }); openmct.objectViews.addProvider(new PlanViewProvider(openmct)); - openmct.inspectorViews.addProvider(new PlanInspectorViewProvider(openmct)); + openmct.inspectorViews.addProvider(new ActivityInspectorViewProvider(openmct)); + openmct.inspectorViews.addProvider(new GanttChartInspectorViewProvider(openmct)); + openmct.composition.addPolicy(ganttChartCompositionPolicy(openmct)); }; } diff --git a/src/plugins/plan/pluginSpec.js b/src/plugins/plan/pluginSpec.js index 235901bf5c..25db86289f 100644 --- a/src/plugins/plan/pluginSpec.js +++ b/src/plugins/plan/pluginSpec.js @@ -1,5 +1,5 @@ /***************************************************************************** - * Open MCT, Copyright (c) 2014-2022, United States Government + * Open MCT, Copyright (c) 2014-2023, United States Government * as represented by the Administrator of the National Aeronautics and Space * Administration. All rights reserved. * @@ -23,9 +23,11 @@ import {createOpenMct, resetApplicationState} from "utils/testing"; import PlanPlugin from "../plan/plugin"; import Vue from 'vue'; +import Properties from "../inspectorViews/properties/Properties.vue"; describe('the plugin', function () { let planDefinition; + let ganttDefinition; let element; let child; let openmct; @@ -49,6 +51,7 @@ describe('the plugin', function () { openmct.install(new PlanPlugin()); planDefinition = openmct.types.get('plan').definition; + ganttDefinition = openmct.types.get('gantt-chart').definition; element = document.createElement('div'); element.style.width = '640px'; @@ -73,15 +76,30 @@ describe('the plugin', function () { let mockPlanObject = { name: 'Plan', key: 'plan', + creatable: false + }; + + let mockGanttObject = { + name: 'Gantt', + key: 'gantt-chart', creatable: true }; - it('defines a plan object type with the correct key', () => { - expect(planDefinition.key).toEqual(mockPlanObject.key); + describe('the plan type', () => { + it('defines a plan object type with the correct key', () => { + expect(planDefinition.key).toEqual(mockPlanObject.key); + }); + it('is not creatable', () => { + expect(planDefinition.creatable).toEqual(mockPlanObject.creatable); + }); }); - - it('is creatable', () => { - expect(planDefinition.creatable).toEqual(mockPlanObject.creatable); + describe('the gantt-chart type', () => { + it('defines a gantt-chart object type with the correct key', () => { + expect(ganttDefinition.key).toEqual(mockGanttObject.key); + }); + it('is creatable', () => { + expect(ganttDefinition.creatable).toEqual(mockGanttObject.creatable); + }); }); describe('the plan view', () => { @@ -106,7 +124,7 @@ describe('the plugin', function () { const applicableViews = openmct.objectViews.get(testViewObject, [testViewObject]); let planView = applicableViews.find((viewProvider) => viewProvider.key === 'plan.view'); - expect(planView.canEdit()).toBeFalse(); + expect(planView.canEdit(testViewObject)).toBeFalse(); }); }); @@ -178,10 +196,10 @@ describe('the plugin', function () { it('displays the group label', () => { const labelEl = element.querySelector('.c-plan__contents .c-object-label .c-object-label__name'); - expect(labelEl.innerHTML).toEqual('TEST-GROUP'); + expect(labelEl.innerHTML).toMatch(/TEST-GROUP/); }); - it('displays the activities and their labels', (done) => { + it('displays the activities and their labels', async () => { const bounds = { start: 1597160002854, end: 1597181232854 @@ -189,27 +207,81 @@ describe('the plugin', function () { openmct.time.bounds(bounds); - Vue.nextTick(() => { - const rectEls = element.querySelectorAll('.c-plan__contents rect'); - expect(rectEls.length).toEqual(2); - const textEls = element.querySelectorAll('.c-plan__contents text'); - expect(textEls.length).toEqual(3); - - done(); - }); + await Vue.nextTick(); + const rectEls = element.querySelectorAll('.c-plan__contents use'); + expect(rectEls.length).toEqual(2); + const textEls = element.querySelectorAll('.c-plan__contents text'); + expect(textEls.length).toEqual(3); }); - it ('shows the status indicator when available', (done) => { + it ('shows the status indicator when available', async () => { openmct.status.set({ key: "test-object", namespace: '' }, 'draft'); - Vue.nextTick(() => { - const statusEl = element.querySelector('.c-plan__contents .is-status--draft'); - expect(statusEl).toBeDefined(); - done(); + await Vue.nextTick(); + const statusEl = element.querySelector('.c-plan__contents .is-status--draft'); + expect(statusEl).toBeDefined(); + }); + }); + + describe('the plan version', () => { + let component; + let componentObject; + let testPlanObject = { + name: 'Plan', + type: 'plan', + identifier: { + key: 'test-plan', + namespace: '' + }, + created: 123456789, + modified: 123456790, + version: 'v1' + }; + + beforeEach(async () => { + openmct.selection.select([{ + element: element, + context: { + item: testPlanObject + } + }, { + element: openmct.layout.$refs.browseObject.$el, + context: { + item: testPlanObject, + supportsMultiSelect: false + } + }], false); + + await Vue.nextTick(); + let viewContainer = document.createElement('div'); + child.append(viewContainer); + component = new Vue({ + el: viewContainer, + components: { + Properties + }, + provide: { + openmct: openmct + }, + template: '' }); }); + + afterEach(() => { + component.$destroy(); + }); + + it('provides an inspector view with the version information if available', () => { + componentObject = component.$root.$children[0]; + const propertiesEls = componentObject.$el.querySelectorAll('.c-inspect-properties__row'); + const found = Array.from(propertiesEls).some((propertyEl) => { + return (propertyEl.children[0].innerHTML.trim() === 'Version' + && propertyEl.children[1].innerHTML.trim() === 'v1'); + }); + expect(found).toBeTrue(); + }); }); }); diff --git a/src/plugins/plan/util.js b/src/plugins/plan/util.js index 4854f11b46..27cbcb5491 100644 --- a/src/plugins/plan/util.js +++ b/src/plugins/plan/util.js @@ -1,5 +1,5 @@ /***************************************************************************** - * Open MCT, Copyright (c) 2014-2022, United States Government + * Open MCT, Copyright (c) 2014-2023, United States Government * as represented by the Administrator of the National Aeronautics and Space * Administration. All rights reserved. * @@ -21,8 +21,8 @@ *****************************************************************************/ export function getValidatedData(domainObject) { - let sourceMap = domainObject.sourceMap; - let body = domainObject.selectFile?.body; + const sourceMap = domainObject.sourceMap; + const body = domainObject.selectFile?.body; let json = {}; if (typeof body === 'string') { try { @@ -64,3 +64,27 @@ export function getValidatedData(domainObject) { return json; } } + +export function getContrastingColor(hexColor) { + function cutHex(h, start, end) { + const hStr = (h.charAt(0) === '#') ? h.substring(1, 7) : h; + + return parseInt(hStr.substring(start, end), 16); + } + + // https://codepen.io/davidhalford/pen/ywEva/ + const cThreshold = 130; + + if (hexColor.indexOf('#') === -1) { + // We weren't given a hex color + return "#ff0000"; + } + + const hR = cutHex(hexColor, 0, 2); + const hG = cutHex(hexColor, 2, 4); + const hB = cutHex(hexColor, 4, 6); + + const cBrightness = ((hR * 299) + (hG * 587) + (hB * 114)) / 1000; + + return cBrightness > cThreshold ? "#000000" : "#ffffff"; +} diff --git a/src/plugins/plot/LinearScale.js b/src/plugins/plot/LinearScale.js index fd0d1aa4f3..6d24f3db83 100644 --- a/src/plugins/plot/LinearScale.js +++ b/src/plugins/plot/LinearScale.js @@ -1,5 +1,5 @@ /***************************************************************************** - * Open MCT, Copyright (c) 2014-2022, United States Government + * Open MCT, Copyright (c) 2014-2023, United States Government * as represented by the Administrator of the National Aeronautics and Space * Administration. All rights reserved. * diff --git a/src/plugins/plot/MctPlot.vue b/src/plugins/plot/MctPlot.vue index 81ee4e5dcf..8227ba044e 100644 --- a/src/plugins/plot/MctPlot.vue +++ b/src/plugins/plot/MctPlot.vue @@ -1,5 +1,5 @@ @@ -77,7 +81,7 @@ >Minimum Value
Maximum Value
import { objectPath } from "./formUtil"; import _ from "lodash"; +import eventHelpers from "../../lib/eventHelpers"; +import configStore from "../../configuration/ConfigStore"; export default { inject: ['openmct', 'domainObject'], props: { - yAxis: { - type: Object, - default() { - return {}; - } + id: { + type: Number, + required: true } }, data() { return { + yAxis: null, label: '', autoscale: '', logMode: false, autoscalePadding: '', rangeMin: '', rangeMax: '', - validationErrors: {} + validationErrors: {}, + loaded: false }; }, + beforeDestroy() { + if (this.autoscale === false && this.validationErrors.range) { + this.autoscale = true; + this.updateForm('autoscale'); + } + }, mounted() { - this.initialize(); + eventHelpers.extend(this); + this.getConfig(); + this.loaded = true; + this.initFields(); this.initFormValues(); }, methods: { - initialize: function () { + getConfig() { + const configId = this.openmct.objects.makeKeyString(this.domainObject.identifier); + const config = configStore.get(configId); + if (config) { + const mainYAxisId = config.yAxis.id; + this.isAdditionalYAxis = this.id !== mainYAxisId; + if (this.isAdditionalYAxis) { + this.additionalYAxes = config.additionalYAxes; + this.yAxis = config.additionalYAxes.find(yAxis => yAxis.id === this.id); + } else { + this.yAxis = config.yAxis; + } + } + }, + initFields() { + const prefix = `configuration.${this.getPrefix()}`; this.fields = { label: { - objectPath: 'configuration.yAxis.label' + objectPath: `${prefix}.label` }, autoscale: { coerce: Boolean, - objectPath: 'configuration.yAxis.autoscale' + objectPath: `${prefix}.autoscale` }, autoscalePadding: { coerce: Number, - objectPath: 'configuration.yAxis.autoscalePadding' + objectPath: `${prefix}.autoscalePadding` }, logMode: { coerce: Boolean, - objectPath: 'configuration.yAxis.logMode' + objectPath: `${prefix}.logMode` }, range: { - objectPath: 'configuration.yAxis.range', + objectPath: `${prefix}.range`, coerce: function coerceRange(range) { - const newRange = { - min: -1, - max: 1 - }; + const newRange = {}; if (range && typeof range.min !== 'undefined' && range.min !== null) { newRange.min = Number(range.min); @@ -198,9 +225,30 @@ export default { this.autoscale = this.yAxis.get('autoscale'); this.logMode = this.yAxis.get('logMode'); this.autoscalePadding = this.yAxis.get('autoscalePadding'); - const range = this.yAxis.get('range') ?? this.yAxis.get('displayRange'); - this.rangeMin = range?.min; - this.rangeMax = range?.max; + const range = this.yAxis.get('range'); + if (range && range.min !== undefined && range.max !== undefined) { + this.rangeMin = range.min; + this.rangeMax = range.max; + } + }, + getPrefix() { + let prefix = 'yAxis'; + if (this.isAdditionalYAxis) { + let index = -1; + if (this.domainObject?.configuration?.additionalYAxes) { + index = this.domainObject?.configuration?.additionalYAxes.findIndex((yAxis) => { + return yAxis.id === this.id; + }); + } + + if (index < 0) { + index = 0; + } + + prefix = `additionalYAxes[${index}]`; + } + + return prefix; }, updateForm(formKey) { let newVal; @@ -231,18 +279,51 @@ export default { this.yAxis.set(formKey, newVal); // Then we mutate the domain object configuration to persist the settings if (path) { - if (!this.domainObject.configuration || !this.domainObject.configuration.series) { - this.$emit('seriesUpdated', { - identifier: this.domainObject.identifier, - path: `yAxis.${formKey}`, - value: newVal - }); + if (this.isAdditionalYAxis) { + if (this.domainObject.configuration && this.domainObject.configuration.series) { + //update the id + this.openmct.objects.mutate( + this.domainObject, + `configuration.${this.getPrefix()}.id`, + this.id + ); + //update the yAxes values + this.openmct.objects.mutate( + this.domainObject, + path(this.domainObject, this.yAxis), + newVal + ); + } else { + this.$emit('seriesUpdated', { + identifier: this.domainObject.identifier, + path: `${this.getPrefix()}.${formKey}`, + id: this.id, + value: newVal + }); + } } else { - this.openmct.objects.mutate( - this.domainObject, - path(this.domainObject, this.yAxis), - newVal - ); + if (this.domainObject.configuration && this.domainObject.configuration.series) { + this.openmct.objects.mutate( + this.domainObject, + path(this.domainObject, this.yAxis), + newVal + ); + } else { + this.$emit('seriesUpdated', { + identifier: this.domainObject.identifier, + path: `${this.getPrefix()}.${formKey}`, + value: newVal + }); + } + } + + //If autoscale is turned off, we must know what the user defined min and max ranges are + if (formKey === 'autoscale' && this.autoscale === false) { + const rangeFormField = this.fields.range; + this.validationErrors.range = rangeFormField.validate?.({ + min: this.rangeMin, + max: this.rangeMax + }, this.yAxis); } } } diff --git a/src/plugins/plot/legend/PlotLegend.vue b/src/plugins/plot/legend/PlotLegend.vue index 1bdf4b3bb9..75d6787944 100644 --- a/src/plugins/plot/legend/PlotLegend.vue +++ b/src/plugins/plot/legend/PlotLegend.vue @@ -1,5 +1,5 @@ diff --git a/src/ui/components/ObjectView.vue b/src/ui/components/ObjectView.vue index 2976f7dc78..3e0e75e78a 100644 --- a/src/ui/components/ObjectView.vue +++ b/src/ui/components/ObjectView.vue @@ -6,6 +6,7 @@ > @@ -13,7 +14,7 @@
@@ -23,6 +24,7 @@ import _ from "lodash"; import StyleRuleManager from "@/plugins/condition/StyleRuleManager"; import {STYLE_CONSTANTS} from "@/plugins/condition/utils/constants"; import IndependentTimeConductor from '@/plugins/timeConductor/independent/IndependentTimeConductor.vue'; +import stalenessMixin from '@/ui/mixins/staleness-mixin'; const SupportedViewTypes = [ 'plot-stacked', @@ -35,6 +37,7 @@ export default { components: { IndependentTimeConductor }, + mixins: [stalenessMixin], inject: ["openmct"], props: { showEditView: Boolean, @@ -67,6 +70,9 @@ export default { }; }, computed: { + path() { + return this.domainObject && (this.currentObjectPath || this.objectPath); + }, objectFontStyle() { return this.domainObject && this.domainObject.configuration && this.domainObject.configuration.fontStyle; }, @@ -81,8 +87,14 @@ export default { return this.domainObject && SupportedViewTypes.includes(viewKey); }, - objectTypeClass() { - return this.domainObject && ('is-object-type-' + this.domainObject.type); + viewClasses() { + let classes; + + if (this.domainObject) { + classes = `is-object-type-${this.domainObject.type} ${this.isStale ? 'is-stale' : ''}`; + } + + return classes; } }, destroyed() { @@ -124,6 +136,7 @@ export default { if (this.domainObject) { //This is to apply styles to subobjects in a layout this.initObjectStyles(); + this.triggerStalenessSubscribe(this.domainObject); } }, methods: { @@ -157,6 +170,9 @@ export default { this.composition._destroy(); } + this.isStale = false; + this.triggerUnsubscribeFromStaleness(); + this.openmct.objectViews.off('clearData', this.clearData); }, getStyleReceiver() { @@ -188,6 +204,11 @@ export default { this.clear(); this.updateView(true); }, + triggerStalenessSubscribe(object) { + if (this.openmct.telemetry.isTelemetryObject(object)) { + this.subscribeToStaleness(object); + } + }, updateStyle(styleObj) { let elemToStyle = this.getStyleReceiver(); @@ -302,6 +323,7 @@ export default { this.updateView(immediatelySelect); + this.triggerStalenessSubscribe(this.domainObject); this.initObjectStyles(); }, initObjectStyles() { diff --git a/src/ui/components/TimeSystemAxis.vue b/src/ui/components/TimeSystemAxis.vue index b8e48d5217..50943e3281 100644 --- a/src/ui/components/TimeSystemAxis.vue +++ b/src/ui/components/TimeSystemAxis.vue @@ -94,16 +94,15 @@ export default { if (this.openmct.time.clock() === undefined) { let nowMarker = document.querySelector('.nowMarker'); if (nowMarker) { - nowMarker.parentNode.removeChild(nowMarker); + nowMarker.classList.add('hidden'); } } else { let nowMarker = document.querySelector('.nowMarker'); if (nowMarker) { - const svgEl = d3Selection.select(this.svgElement).node(); - let height = svgEl.style('height').replace('px', ''); - height = Number(height) + this.contentHeight; - nowMarker.style.height = height + 'px'; - const now = this.xScale(Date.now()); + nowMarker.classList.remove('hidden'); + nowMarker.style.height = this.contentHeight + 'px'; + const nowTimeStamp = this.openmct.time.clock().currentValue(); + const now = this.xScale(nowTimeStamp); nowMarker.style.left = now + this.offset + 'px'; } } diff --git a/src/ui/components/ToggleSwitch.vue b/src/ui/components/ToggleSwitch.vue index 65e476abc8..fe268a02d8 100644 --- a/src/ui/components/ToggleSwitch.vue +++ b/src/ui/components/ToggleSwitch.vue @@ -7,7 +7,11 @@ :checked="checked" @change="onUserSelect($event)" > - +
* + * { - margin-top: $interiorMargin; - } - - &__search { - flex: 0 0 auto; - } - - &__elements { - flex: 1 1 auto; - overflow: auto; - } - - .c-grippy { - $d: 8px; - flex: 0 0 auto; - margin-right: $interiorMarginSm; - transform: translateY(-2px); - width: $d; height: $d; - } - - &.is-context-clicked { - box-shadow: inset $colorItemTreeSelectedBg 0 0 0 1px; - } - - .hover { - background-color: $colorItemTreeSelectedBg; - } -} - -.js-last-place { - height: 10px; -} \ No newline at end of file diff --git a/src/ui/inspector/inspector.scss b/src/ui/inspector/inspector.scss index 3aafd98bab..2a3095d8e3 100644 --- a/src/ui/inspector/inspector.scss +++ b/src/ui/inspector/inspector.scss @@ -25,10 +25,6 @@ } &__selected { - .c-object-label__name { - filter: $objectLabelNameFilter; - } - .c-object-label__type-icon { opacity: $objectLabelTypeIconOpacity; } @@ -42,6 +38,41 @@ flex: 0 0 auto; font-size: 0.8em; text-transform: uppercase; + + &.c-tabs { + flex-wrap: nowrap; + } + + .c-tab { + background: $colorTabBg; + color: $colorTabFg; + padding: $interiorMargin; + + &:not(.is-current) { + overflow: hidden; + + &:after { + background-image: linear-gradient(90deg, transparent 0%, rgba($colorTabBg, 1) 70%); + content: ''; + display: block; + position: absolute; + right: 0; + height: 100%; + width: 15px; + z-index: 1; + } + } + + &.is-current { + background: $colorTabCurrentBg; + color: $colorTabCurrentFg; + padding-right: $interiorMargin + 3; + } + + &__name { + overflow: hidden; + } + } } &__content { @@ -93,6 +124,11 @@ @include propertiesHeader(); font-size: 0.65rem; grid-column: 1 / 3; + margin: $interiorMargin 0; + + &.--first { + margin-top: 0; + } } .c-tree .grid-properties { @@ -106,6 +142,15 @@ } } +.c-inspect-properties, +.c-inspect-tags { + [class*="header"] { + @include propertiesHeader(); + flex: 0 0 auto; + font-size: .85em; + } +} + .c-inspect-properties, .c-inspect-styles { [class*="header"] { @@ -187,6 +232,11 @@ line-height: 1.8em; } } + + .c-location { + // Always make the location element span columns + grid-column: 1 / 3; + } } /********************************************* INSPECTOR PROPERTIES TAB */ diff --git a/src/ui/layout/AboutDialog.vue b/src/ui/layout/AboutDialog.vue index 51d7719424..40a4a0b1dc 100644 --- a/src/ui/layout/AboutDialog.vue +++ b/src/ui/layout/AboutDialog.vue @@ -13,7 +13,7 @@ Open MCT
-

Open MCT, Copyright © 2014-2022, United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All rights reserved.

+

Open MCT, Copyright © 2014-2023, 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 import CreateAction from '@/plugins/formActions/CreateAction'; -import objectUtils from 'objectUtils'; export default { inject: ['openmct'], @@ -74,23 +73,9 @@ export default { this.openmct.menus.showSuperMenu(x, y, this.sortedItems, menuOptions); }, create(key) { - // Hack for support. TODO: rewrite create action. - // 1. Get contextual object from navigation - // 2. Get legacy type from legacy api - // 3. Instantiate create action with type, parent, context - // 4. perform action. - return this.openmct.objects.get(this.openmct.router.path[0].identifier) - .then((currentObject) => { - const createAction = new CreateAction(this.openmct, key, currentObject); + const createAction = new CreateAction(this.openmct, key, this.openmct.router.path[0]); - createAction.invoke(); - }); - }, - convertToLegacy(domainObject) { - let keyString = objectUtils.makeKeyString(domainObject.identifier); - let oldModel = objectUtils.toOldFormat(domainObject); - - return this.openmct.$injector.get('instantiate')(oldModel, keyString); + createAction.invoke(); } } }; diff --git a/src/ui/layout/Layout.vue b/src/ui/layout/Layout.vue index ee52964363..e055d97512 100644 --- a/src/ui/layout/Layout.vue +++ b/src/ui/layout/Layout.vue @@ -54,9 +54,11 @@ > @@ -74,11 +76,37 @@ @click="handleSyncTreeNavigation" > - + + + + + + + + + @@ -133,6 +162,7 @@ import Toolbar from '../toolbar/Toolbar.vue'; import AppLogo from './AppLogo.vue'; import Indicators from './status-bar/Indicators.vue'; import NotificationBanner from './status-bar/NotificationBanner.vue'; +import RecentObjectsList from './RecentObjectsList.vue'; export default { components: { @@ -147,7 +177,8 @@ export default { Toolbar, AppLogo, Indicators, - NotificationBanner + NotificationBanner, + RecentObjectsList }, inject: ['openmct'], data: function () { @@ -244,6 +275,10 @@ export default { this.hasToolbar = structure.length > 0; }, + openAndScrollTo(navigationPath) { + this.$refs.mctTree.openAndScrollTo(navigationPath); + this.$refs.mctTree.targetedPath = navigationPath; + }, setActionCollection(actionCollection) { this.actionCollection = actionCollection; }, @@ -253,6 +288,9 @@ export default { handleTreeReset() { this.triggerReset = !this.triggerReset; }, + handleClearRecentObjects() { + this.$refs.recentObjectsList.clearRecentObjects(); + }, onStartResizing() { this.isResizing = true; }, diff --git a/src/ui/layout/LayoutSpec.js b/src/ui/layout/LayoutSpec.js index 625f867044..2336898c6a 100644 --- a/src/ui/layout/LayoutSpec.js +++ b/src/ui/layout/LayoutSpec.js @@ -1,5 +1,5 @@ /***************************************************************************** - * Open MCT, Copyright (c) 2014-2022, United States Government + * Open MCT, Copyright (c) 2014-2023, United States Government * as represented by the Administrator of the National Aeronautics and Space * Administration. All rights reserved. * diff --git a/src/ui/layout/RecentObjectsList.vue b/src/ui/layout/RecentObjectsList.vue new file mode 100644 index 0000000000..81414b1085 --- /dev/null +++ b/src/ui/layout/RecentObjectsList.vue @@ -0,0 +1,228 @@ + + + + + diff --git a/src/ui/layout/RecentObjectsListItem.vue b/src/ui/layout/RecentObjectsListItem.vue new file mode 100644 index 0000000000..47544fe62d --- /dev/null +++ b/src/ui/layout/RecentObjectsListItem.vue @@ -0,0 +1,135 @@ +/***************************************************************************** + * Open MCT, Copyright (c) 2014-2023, 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. + *****************************************************************************/ + + + + diff --git a/src/ui/layout/create-button.scss b/src/ui/layout/create-button.scss index 0a0bd1e53f..9b04cfb5e7 100644 --- a/src/ui/layout/create-button.scss +++ b/src/ui/layout/create-button.scss @@ -20,7 +20,7 @@ z-index: 70; [class*="__icon"] { - filter: $colorKeyFilter; + filter: $colorKeyFilter; } [class*="__item-description"] { diff --git a/src/ui/layout/layout.scss b/src/ui/layout/layout.scss index f708dbbedd..b1d30d1ae8 100644 --- a/src/ui/layout/layout.scss +++ b/src/ui/layout/layout.scss @@ -1,5 +1,5 @@ /***************************************************************************** - * Open MCT, Copyright (c) 2014-2022, United States Government + * Open MCT, Copyright (c) 2014-2023, United States Government * as represented by the Administrator of the National Aeronautics and Space * Administration. All rights reserved. * @@ -35,7 +35,7 @@ min-height: 0; max-height: 15%; overflow: hidden; - transition: $transIn; + @include transition(min-height); &.is-expanded { min-height: 100px; @@ -65,8 +65,7 @@ } &__pane-tree, - &__pane-inspector, - &__pane-main { + &__pane-inspector { .l-pane__contents { display: flex; flex-flow: column nowrap; @@ -74,8 +73,7 @@ } } - &__pane-tree, - &__pane-main { + &__pane-tree { .l-pane__contents { > * { flex: 0 0 auto; @@ -89,6 +87,37 @@ &__pane-main { .l-pane__header { display: none; } + + .l-pane__contents { + .l-shell__main-.l-shell__main-view-browse-bar { + position: relative; + } + // Using `position: absolute` due to flex having repaint issues with the Time Conductor, #5247 + .l-shell__time-conductor, + .l-shell__main-container { + position: absolute; + left: 0; + right: 0; + height: auto; + width: auto; + + } + + .l-shell__main-container { + top: $shellMainBrowseBarH + $interiorMarginLg; + bottom: $shellTimeConductorH + $interiorMargin; + } + + @include phonePortrait() { + .l-shell__main-container { + bottom: $shellTimeConductorMobileH + $interiorMargin; + } + } + + .l-shell__time-conductor { + bottom: 0; + } + } } body.mobile & { @@ -289,7 +318,7 @@ } &__pane-tree { - width: 300px; + width: 100%; padding-left: nth($shellPanePad, 2); } @@ -307,6 +336,7 @@ height: $p + 24px; // Need to standardize the height justify-content: space-between; padding: $p; + z-index: 2; } &__resizing { @@ -320,6 +350,10 @@ display: block; height: 100%; overflow: auto; + + &.is-stale { + @include isStaleHolder(); + } } .is-editing { @@ -328,6 +362,7 @@ box-shadow: $colorBodyBg 0 0 0 1px, $editUIAreaShdw; margin-left: $m; margin-right: $m; + top: $shellToolBarH + $shellMainBrowseBarH + $interiorMarginLg !important; &[s-selected] { // Provide a clearer selection context articulation for the main edit area @@ -392,6 +427,8 @@ &__nav-to-parent-button { // This is an icon-button + margin-right: $interiorMargin; + .is-editing & { display: none; } @@ -402,17 +439,12 @@ flex: 0 1 auto; } - .c-object-label__name { - filter: $objectLabelNameFilter; - } - .c-object-label__type-icon { opacity: $objectLabelTypeIconOpacity; } &__object-name--w { @include headerFont(1.5em); - margin-left: $interiorMarginLg; min-width: 0; .is-status__indicator { @@ -428,7 +460,7 @@ /************************** DRAWER */ .c-drawer { - /* New sliding overlay or push element to contain things + /* Sliding overlay or push element to contain things * Designed for mobile and compact desktop scenarios * Variations: * --overlays: position absolute, overlays neighboring elements @@ -437,7 +469,8 @@ * &.is-expanded: applied when expanded. */ - transition: $transOut; + $transProps: width, min-width, height, min-height; + min-height: 0; min-width: 0; overflow: hidden; @@ -450,11 +483,12 @@ } &.c-drawer--align-left { + @include transition($prop: $transProps, $dur: $transOutTime); height: 100%; } &.c-drawer--align-top { - // Need anything here? + @include transition($prop: $transProps, $dur: $transOutTime); } &.c-drawer--overlays { diff --git a/src/ui/layout/mct-tree.scss b/src/ui/layout/mct-tree.scss index 1f31c3c7b9..031e9c1f6a 100644 --- a/src/ui/layout/mct-tree.scss +++ b/src/ui/layout/mct-tree.scss @@ -97,7 +97,7 @@ @include hover { background: $colorItemTreeHoverBg; - filter: $filterHov; + //filter: $filterHov; // FILTER REMOVAL, CONVERT TO THEME CONSTANT } &.is-navigated-object, @@ -108,6 +108,10 @@ color: $colorItemTreeSelectedFg; } } + &.is-targeted-item { + $c: $colorBodyFg; + @include pulseProp($animName: flashTarget, $dur: 500ms, $iter: 8, $prop: background, $valStart: rgba($c, 0.4), $valEnd: rgba($c, 0)); + } &.is-new { animation-name: animTemporaryHighlight; @@ -188,14 +192,6 @@ } } } - - &__item__label { - @include desktop { - &:hover { - filter: $filterHov; - } - } - } } .is-editing .is-navigated-object { @@ -287,8 +283,10 @@ .c-selector { &.c-tree-and-search { - border: 1px solid $colorFormLines; - border-radius: $controlCr; - padding: $interiorMargin; + background: rgba($colorFormLines, 0.1); + border-radius: $basicCr; + padding: 2px; + height: 100%; + min-height: 150px; } } diff --git a/src/ui/layout/mct-tree.vue b/src/ui/layout/mct-tree.vue index 220f82b428..8d020fd076 100644 --- a/src/ui/layout/mct-tree.vue +++ b/src/ui/layout/mct-tree.vue @@ -5,7 +5,6 @@ :class="{ 'c-selector': isSelectorTree }" - :style="treeHeight" >

-
-