Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Inspector Tabs] Updates #7987

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e196958
added getTypes to types api, modifying which tabs are shown, working …
jvigliotta Dec 20, 2024
128f482
moving hasNumericTelemetry to an api method
jvigliotta Dec 20, 2024
1326693
updated types api to return all types, updated annotations api to ret…
jvigliotta Dec 20, 2024
cded8fc
not sure if scatter plots are annotatable
jvigliotta Dec 20, 2024
bac8c80
added annotation tab conditions
jvigliotta Dec 30, 2024
3cba87d
clean up the new hasNumericTelemetry method in the telemetry api
jvigliotta Dec 30, 2024
cc99f19
moving to canView, since that is where the logic should be
jvigliotta Dec 31, 2024
0912f5f
anytime a selection is updated, select the first (top priority) tab
jvigliotta Jan 7, 2025
59f855a
Merge branch 'mct-7442' into mct-7959
jvigliotta Jan 15, 2025
ffa6ea6
Changes for tabs visibility and priority
charlesh88 Jan 16, 2025
9f1cac5
Changes for tabs visibility and priority
charlesh88 Jan 16, 2025
f199ce5
Changes for tabs visibility and priority
charlesh88 Jan 16, 2025
b09b9e0
Changes for tabs visibility and priority
charlesh88 Jan 16, 2025
97292d4
update selection views on edit state change
jvigliotta Jan 16, 2025
e7eb070
adding edit listener to inspector tabs component as well
jvigliotta Jan 16, 2025
7cd1517
intitializing display layouts with objectStyles properties, so styles…
jvigliotta Jan 16, 2025
4202de9
initialize and backfill object styles config prop for flex layouts
jvigliotta Jan 16, 2025
f4f010a
if editing and styles tab is selected and it exists for the next item…
jvigliotta Jan 16, 2025
3527e4e
Changes for tabs visibility and priority
charlesh88 Jan 17, 2025
087fbd3
Changes for tabs visibility and priority
charlesh88 Jan 17, 2025
1934aea
Show Annotations for Overlay and Stacked p
jvigliotta Jan 22, 2025
567aa69
fix error in lad table config component
jvigliotta Jan 22, 2025
f7d78c1
Properties tab should not show for non-domain objects
jvigliotta Jan 22, 2025
1d4353b
Notebook should only show Annotations tab when an entry is selected, …
jvigliotta Jan 22, 2025
91a9fa5
make sure older objects not initialized with object styles are checked
jvigliotta Jan 23, 2025
175befa
initalize tables with objectStyles
jvigliotta Jan 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/helper/planningUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export async function createTimelistWithPlanAndSetActivityInProgress(page, planJ
await page.getByRole('button', { name: 'Edit Object' }).click();

// Find the display properties section in the inspector
await page.getByRole('tab', { name: 'View Properties' }).click();
await page.getByRole('tab', { name: 'Config' }).click();
// Switch to expanded view and save the setting
await page.getByLabel('Display Style').selectOption({ label: 'Expanded' });

Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/functional/planning/timelist.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ test("View a timelist in expanded view, verify all the activities are displayed
await page.getByRole('button', { name: 'Edit Object' }).click();

// Find the display properties section in the inspector
await page.getByRole('tab', { name: 'View Properties' }).click();
await page.getByRole('tab', { name: 'Config' }).click();
// Switch to expanded view and save the setting
await page.getByLabel('Display Style').selectOption({ label: 'Expanded' });

Expand Down
8 changes: 4 additions & 4 deletions e2e/tests/functional/plugins/lad/lad.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ test.describe('Testing LAD table configuration', () => {
test('in edit mode, LAD Tables provide ability to hide columns', async ({ page }) => {
// Edit LAD table
await page.getByLabel('Edit Object').click();
await page.getByRole('tab', { name: 'LAD Table Configuration' }).click();
await page.getByRole('tab', { name: 'Config' }).click();

// make sure headers are visible initially
await expect(page.getByRole('columnheader', { name: 'Timestamp', exact: true })).toBeVisible();
Expand Down Expand Up @@ -114,7 +114,7 @@ test.describe('Testing LAD table configuration', () => {

// Edit LAD table
await page.getByLabel('Edit Object').click();
await page.getByRole('tab', { name: 'LAD Table Configuration' }).click();
await page.getByRole('tab', { key: 'lad-table-configuration' }).click();

// show timestamp column
await page.getByLabel('Timestamp', { exact: true }).check();
Expand Down Expand Up @@ -142,7 +142,7 @@ test.describe('Testing LAD table configuration', () => {

// Edit LAD table
await page.getByLabel('Edit Object').click();
await page.getByRole('tab', { name: 'LAD Table Configuration' }).click();
await page.getByRole('tab', { key: 'lad-table-configuration' }).click();

// show units, type, and WATCH columns
await page.getByLabel('Units').check();
Expand Down Expand Up @@ -182,7 +182,7 @@ test.describe('Testing LAD table configuration', () => {

// Edit LAD table
await page.getByLabel('Edit Object').click();
await page.getByRole('tab', { name: 'LAD Table Configuration' }).click();
await page.getByRole('tab', { key: 'lad-table-configuration' }).click();

// make sure Sine Wave headers are visible initially too
await expect(page.getByRole('columnheader', { name: 'Timestamp', exact: true })).toBeVisible();
Expand Down
21 changes: 21 additions & 0 deletions src/api/annotation/AnnotationAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export default class AnnotationAPI extends EventEmitter {
this.availableTags = {};
this.namespaceToSaveAnnotations = '';
this.#targetComparatorMap = new Map();
this.annotatableTypes = [];

this.ANNOTATION_TYPES = ANNOTATION_TYPES;
this.ANNOTATION_TYPE = ANNOTATION_TYPE;
Expand All @@ -115,6 +116,17 @@ export default class AnnotationAPI extends EventEmitter {
domainObject.annotationType = domainObject.annotationType || 'plotspatial';
}
});

this.openmct.on('start', () => {
const types = this.openmct.types.getTypes();
const typeKeys = Object.keys(types);

typeKeys.forEach((key) => {
if (types[key].definition.annotatable) {
this.annotatableTypes.push(key);
}
});
});
}
/**
* Creates an annotation on a given domain object (e.g., a plot) and a set of targets (e.g., telemetry objects)
Expand Down Expand Up @@ -582,4 +594,13 @@ export default class AnnotationAPI extends EventEmitter {
_.isEqual(targets, otherTargets)
);
}

/**
* Checks if the given type is annotatable
* @param {string} type The type to check
* @returns {boolean} Returns true if the type is annotatable
*/
isAnnotatableType(type) {
return this.annotatableTypes.some((annotatableType) => annotatableType === type);
}
}
27 changes: 27 additions & 0 deletions src/api/telemetry/TelemetryAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,33 @@ export default class TelemetryAPI {
return value;
}

/**
* Determines whether a domain object has numeric telemetry data.
* A domain object has numeric telemetry if it:
* 1. Has a telemetry property
* 2. Has telemetry metadata with domain values (like timestamps)
* 3. Has range values (measurements) where at least one is numeric
*
* @method hasNumericTelemetry
* @param {import('openmct').DomainObject} domainObject The domain object to check
* @returns {boolean} True if the object has numeric telemetry, false otherwise
*/
hasNumericTelemetry(domainObject) {
if (!Object.prototype.hasOwnProperty.call(domainObject, 'telemetry')) {
return false;
}

const metadata = this.openmct.telemetry.getMetadata(domainObject);
const rangeValues = metadata.valuesForHints(['range']);
const domains = metadata.valuesForHints(['domain']);

return (
domains.length > 0 &&
rangeValues.length > 0 &&
!rangeValues.every((value) => value.format === 'string')
);
}

/**
* Generates a numeric hash value for an options object. The hash is consistent
* for equivalent option objects regardless of property order.
Expand Down
11 changes: 11 additions & 0 deletions src/api/types/TypeRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ export default class TypeRegistry {
get(typeKey) {
return this.types[typeKey] || UNKNOWN_TYPE;
}
/**
* List all registered types.
* @returns {Type[]} all registered types
*/
getTypes() {
return this.types;
}
/**
* Import legacy types.
* @param {TypeDefinition[]} types the types to import
*/
importLegacyTypes(types) {
types
.filter((t) => this.get(t.key) === UNKNOWN_TYPE)
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/LADTable/LADTableConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ export default class LADTableConfiguration extends EventEmitter {
}

getConfiguration() {
const configuration = this.domainObject.configuration || {};
configuration.hiddenColumns = configuration.hiddenColumns || {};
const configuration = this.domainObject.configuration ?? {};
configuration.hiddenColumns = configuration.hiddenColumns ?? {};
configuration.isFixedLayout = configuration.isFixedLayout ?? true;
configuration.objectStyles = configuration.objectStyles ?? {};

return configuration;
}
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/LADTable/LADTableConfigurationViewProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
export default function LADTableConfigurationViewProvider(openmct) {
return {
key: 'lad-table-configuration',
name: 'LAD Table Configuration',
name: 'Config',
canView(selection) {
if (selection.length !== 1 || selection[0].length === 0) {
return false;
Expand Down Expand Up @@ -61,7 +61,7 @@
_destroy = destroy;
},
priority() {
return 1;
return openmct.editor.isEditing() ? openmct.priority.HIGH + 1 : openmct.priority.DEFAULT;

Check warning on line 64 in src/plugins/LADTable/LADTableConfigurationViewProvider.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/LADTable/LADTableConfigurationViewProvider.js#L64

Added line #L64 was not covered by tests
},
destroy() {
if (_destroy) {
Expand Down
50 changes: 25 additions & 25 deletions src/plugins/LADTable/components/LadTableConfiguration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,24 @@

<template>
<div class="c-inspect-properties">
<template v-if="isEditing">
<div class="c-inspect-properties__header">Table Column Visibility</div>
<ul class="c-inspect-properties__section">
<li v-for="(title, key) in headers" :key="key" class="c-inspect-properties__row">
<div class="c-inspect-properties__label" title="Show or hide column">
<label :for="key + 'ColumnControl'">{{ title }}</label>
</div>
<div class="c-inspect-properties__value">
<input
:id="key + 'ColumnControl'"
type="checkbox"
:checked="configuration.hiddenColumns[key] !== true"
@change="toggleColumn(key)"
/>
</div>
</li>
</ul>
</template>
<template v-else>
<div class="c-inspect-properties__header">LAD Table Configuration</div>
<div class="c-inspect-properties__row--span-all">Only available in edit mode.</div>
</template>
<div class="c-inspect-properties__header">Table Column Visibility</div>
<ul class="c-inspect-properties__section">
<li v-for="(title, key) in headers" :key="key" class="c-inspect-properties__row">
<div class="c-inspect-properties__label" title="Show or hide column">
<label :for="key + 'ColumnControl'">{{ title }}</label>
</div>
<div class="c-inspect-properties__value">
<input
:id="key + 'ColumnControl'"
type="checkbox"
v-if="isEditing"
:checked="configuration.hiddenColumns[key] !== true"
@change="toggleColumn(key)"
/>
<span v-if="!isEditing && configuration.hiddenColumns[key] !== true">Visible</span>
</div>
</li>
</ul>
</div>
</template>

Expand All @@ -62,7 +58,8 @@
isEditing: this.openmct.editor.isEditing(),
configuration: ladTableConfiguration.getConfiguration(),
items: [],
ladTableObjects: []
ladTableObjects: [],
ladTelemetryObjects: {}
};
},
computed: {
Expand Down Expand Up @@ -150,11 +147,14 @@
this.ladTableObjects.push(ladTable);

const composition = this.openmct.composition.get(ladTable.domainObject);

composition.on('add', this.addItem);
composition.on('remove', this.removeItem);

Check warning on line 151 in src/plugins/LADTable/components/LadTableConfiguration.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/LADTable/components/LadTableConfiguration.vue#L150-L151

Added lines #L150 - L151 were not covered by tests
composition.load();

this.compositions.push({
composition
composition,
addCallback: this.addItem,
removeCallback: this.removeItem
});
},
removeLadTable(identifier) {
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/LADTable/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
cssClass: 'icon-tabular-lad',
initialize(domainObject) {
domainObject.composition = [];
domainObject.configuration = {

Check warning on line 42 in src/plugins/LADTable/plugin.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/LADTable/plugin.js#L42

Added line #L42 was not covered by tests
objectStyles: {}
};
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function BarGraphInspectorViewProvider(openmct) {
_destroy = destroy;
},
priority: function () {
return openmct.priority.HIGH + 1;
return openmct.editor.isEditing() ? openmct.priority.HIGH + 1 : openmct.priority.DEFAULT;
},
destroy: function () {
if (_destroy) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function ScatterPlotInspectorViewProvider(openmct) {
_destroy = destroy;
},
priority: function () {
return openmct.priority.HIGH + 1;
return openmct.editor.isEditing() ? openmct.priority.HIGH + 1 : openmct.priority.DEFAULT;
},
destroy: function () {
if (_destroy) {
Expand Down
7 changes: 7 additions & 0 deletions src/plugins/conditionWidget/components/ConditionWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ export default {
},
mounted() {
if (this.domainObject) {
if (!this.domainObject.configuration) {
// older versions didn't initialize configuration
this.domainObject.configuration = {
objectStyles: {}
};
}

this.listenToConditionSetChanges();
}
},
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/conditionWidget/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ export default function plugin() {
creatable: true,
cssClass: 'icon-condition-widget',
initialize(domainObject) {
domainObject.configuration = {};
domainObject.configuration = {
objectStyles: {}
};
domainObject.label = 'Condition Widget';
domainObject.conditionalLabel = '';
domainObject.url = '';
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/displayLayout/AlphanumericFormatViewProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ class AlphanumericFormatView {
}

priority() {
return 1;
return this.openmct.editor.isEditing()
? this.openmct.priority.DEFAULT
: this.openmct.priority.LOW;
}

destroy() {
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/displayLayout/DisplayLayoutType.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export default function DisplayLayoutType() {
domainObject.composition = [];
domainObject.configuration = {
items: [],
layoutGrid: [10, 10]
layoutGrid: [10, 10],
objectStyles: {}
};
},
form: [
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/displayLayout/components/AlphanumericFormat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,16 @@
</div>
<div class="c-inspect-properties__value">
<input
v-if="isEditing"
id="telemetryPrintfFormat"
type="text"
:disabled="!isEditing"
:value="telemetryFormat"
:placeholder="nonMixedFormat ? '' : 'Mixed'"
@change="formatTelemetry"
/>
<template v-if="!isEditing && telemetryFormat?.length">
{{ telemetryFormat }}
</template>
</div>
</li>
</ul>
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/displayLayout/components/DisplayLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ export default {
this.composition.load();
this.gridDimensions = [this.$el.offsetWidth, this.$el.scrollHeight];

// Initialize objectStyles if it doesn't exist for older versions
if (!this.domainObject.configuration.objectStyles) {
this.domainObject.configuration.objectStyles = {};
}

this.unObserveItems = this.openmct.objects.observe(
this.domainObject,
'configuration.items',
Expand Down
9 changes: 0 additions & 9 deletions src/plugins/filters/FiltersInspectorViewProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ export default class FiltersInspectorViewProvider {
let openmct = this.openmct;
let _destroy = null;

const domainObject = selection?.[0]?.[0]?.context?.item;

return {
show: function (element) {
const { destroy } = mount(
Expand All @@ -69,13 +67,6 @@ export default class FiltersInspectorViewProvider {
if (isEditing) {
return true;
}

const metadata = openmct.telemetry.getMetadata(domainObject);
const metadataWithFilters = metadata
? metadata.valueMetadatas.filter((value) => value.filters)
: [];

return metadataWithFilters.length;
},
priority: function () {
return openmct.priority.DEFAULT;
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/filters/components/FiltersView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
@update-filters="persistFilters"
/>
</ul>
<span v-else>
This view doesn't include any parameters that have configured filter criteria.
</span>
</template>

<script>
Expand Down
Loading
Loading