From 07373817b0758eccbed557808b2e4ad99d73540d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Jun 2023 12:59:47 -0700 Subject: [PATCH 1/2] chore(deps-dev): bump webpack from 5.84.0 to 5.85.0 (#6704) Bumps [webpack](https://github.com/webpack/webpack) from 5.84.0 to 5.85.0. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](https://github.com/webpack/webpack/compare/v5.84.0...v5.85.0) --- updated-dependencies: - dependency-name: webpack dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ec042facaa..71cdf9a041 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "vue-eslint-parser": "9.3.0", "vue-loader": "15.9.8", "vue-template-compiler": "2.6.14", - "webpack": "5.84.0", + "webpack": "5.85.0", "webpack-cli": "5.1.1", "webpack-dev-server": "4.13.3", "webpack-merge": "5.8.0" From a9158a90d5b61eeda90393e9da01516e80658b02 Mon Sep 17 00:00:00 2001 From: Scott Bell Date: Thu, 1 Jun 2023 23:26:14 +0200 Subject: [PATCH 2/2] Support filtering by severity for events tables (#6672) * hide tab if not editing and fix issue where configuration is null * show filters tab if editing * works with dropdown * add a none filter to remove 'filters applied' styling' * pass appropriate comparator * openmct side is ready * clear filter still not working * fix clearing of procedures * add filters * add some basic documentation * add some basic documentation * add some basic documentation * fix grammar issues and convert away from amd pattern * convert to permanent links * refactor: format with prettier * add aria labels for selects --- .../filters/FiltersInspectorViewProvider.js | 12 +- src/plugins/filters/README.md | 53 +++++++++ .../filters/components/FilterField.vue | 52 +++++++-- .../filters/components/FilterObject.vue | 15 ++- .../filters/components/GlobalFilters.vue | 11 ++ .../TableConfigurationViewProvider.js | 105 +++++++++--------- .../components/table-configuration.vue | 29 ++--- 7 files changed, 196 insertions(+), 81 deletions(-) create mode 100644 src/plugins/filters/README.md diff --git a/src/plugins/filters/FiltersInspectorViewProvider.js b/src/plugins/filters/FiltersInspectorViewProvider.js index d71fbd2fa1..16b5029fc1 100644 --- a/src/plugins/filters/FiltersInspectorViewProvider.js +++ b/src/plugins/filters/FiltersInspectorViewProvider.js @@ -49,10 +49,16 @@ define(['./components/FiltersView.vue', 'vue'], function (FiltersView, Vue) { }); }, showTab: function (isEditing) { - const hasPersistedFilters = Boolean(domainObject?.configuration?.filters); - const hasGlobalFilters = Boolean(domainObject?.configuration?.globalFilters); + if (isEditing) { + return true; + } - return hasPersistedFilters || hasGlobalFilters; + const metadata = openmct.telemetry.getMetadata(domainObject); + const metadataWithFilters = metadata + ? metadata.valueMetadatas.filter((value) => value.filters) + : []; + + return metadataWithFilters.length; }, priority: function () { return openmct.priority.DEFAULT; diff --git a/src/plugins/filters/README.md b/src/plugins/filters/README.md new file mode 100644 index 0000000000..321fa30432 --- /dev/null +++ b/src/plugins/filters/README.md @@ -0,0 +1,53 @@ + +# Server side filtering in Open MCT + +## Introduction + +In Open MCT, filters can be constructed to filter out telemetry data on the server side. This is useful for reducing the amount of data that needs to be sent to the client. For example, in [Open MCT for MCWS](https://github.com/NASA-AMMOS/openmct-mcws/blob/e8846d325cc3f659d8ad58d1d24efaafbe2b6bb7/src/constants.js#L115), they can be used to filter realtime data from recorded data. In the [Open MCT YAMCS plugin](https://github.com/akhenry/openmct-yamcs/blob/9c4ed03e23848db3215fdb6a988ba34b445a3989/src/providers/events.js#L44), we can use them to filter incoming event data by severity. + +## Installing the filter plugin + +You'll need to install the filter plugin first. For example: + +```js +openmct.install(openmct.plugins.Filters(['telemetry.plot.overlay', 'table'])); +``` + +will install the filters plugin and have it apply to overlay plots and tables. You can see an example of this in the [Open MCT YAMCS plugin](https://github.com/akhenry/openmct-yamcs/blob/9c4ed03e23848db3215fdb6a988ba34b445a3989/example/index.js#L58). + +## Defining a filter + +To define a filter, you'll need to add a new `filter` property to the domain object's `telemetry` metadata underneath the `values` array. For example, if you have a domain object with a `telemetry` metadata that looks like this: + +```js +{ + key: 'fruit', + name: 'Types of fruit', + filters: [{ + singleSelectionThreshold: true, + comparator: 'equals', + possibleValues: [ + { name: 'Apple', value: 'apple' }, + { name: 'Banana', value: 'banana' }, + { name: 'Orange', value: 'orange' } + ] + }] +} +``` + +This will define a filter that allows an operator to choose one (due to `singleSelectionThreshold` being `true`) of the three possible values. The `comparator` property defines how the filter will be applied to the telemetry data. +Setting `singleSelectionThreshold` to `false` will render the `possibleValues` as a series of checkboxes. Removing the `possibleValues` property will render the filter as a text box, allowing the operator to enter a value to filter on. + +Note that how the filter is interpreted is ultimately decided by the individual telemetry providers. + +## Implementing a filter in a telemetry provider + +Implementing a filter requires two parts: + +- First, one needs to add the filter implementation to the [subscribe](https://github.com/nasa/openmct/blob/5df7971438acb9e8b933edda2aed432b1b8bb27d/src/api/telemetry/TelemetryAPI.js#L366) method in your telemetry provider. The filter will be passed to you in the `options` argument. You can either add the filter to your telemetry subscription request, or filter manually as new messages appears. An example of the latter is [shown in the YAMCS plugin for Open MCT](https://github.com/akhenry/openmct-yamcs/blob/9c4ed03e23848db3215fdb6a988ba34b445a3989/src/providers/events.js#L95). + +- Second, one needs to add the filter implementation to the [request](https://github.com/nasa/openmct/blob/5df7971438acb9e8b933edda2aed432b1b8bb27d/src/api/telemetry/TelemetryAPI.js#L318) method in your telemetry provider. The filter again will be passed to you in the `options` argument. You can either add the filter to your telemetry request, or filter manually after the request is made. An example of the former is [shown in the YAMCS plugin for Open MCT](https://github.com/akhenry/openmct-yamcs/blob/9c4ed03e23848db3215fdb6a988ba34b445a3989/src/providers/historical-telemetry-provider.js#L171). + +## Using filters + +If you installed the plugin to have it apply to `table`, create a Telemetry Table in Open MCT and drag your telemetry object that contains the filter to it. Then click "Edit", and notice the "Filter" tab in the inspector. It allows operator to either select a "Global Filter", or a regular filter. The "Global Filter" will apply for all telemetry objects in the table, while the regular filter will only apply to the telemetry object that it is defined on. \ No newline at end of file diff --git a/src/plugins/filters/components/FilterField.vue b/src/plugins/filters/components/FilterField.vue index d8edc53fff..40daab0a71 100644 --- a/src/plugins/filters/components/FilterField.vue +++ b/src/plugins/filters/components/FilterField.vue @@ -37,14 +37,37 @@ :id="`${filter}filterControl`" class="c-input--flex" type="text" + :aria-label="label" :disabled="useGlobal" :value="persistedValue(filter)" - @change="updateFilterValue($event, filter)" + @change="updateFilterValueFromString($event, filter)" /> + + + -