From 3ca133c782e34c62219d62ae41fc1e0f6680198f Mon Sep 17 00:00:00 2001 From: Andrew Henry Date: Tue, 11 May 2021 18:58:17 -0700 Subject: [PATCH] Pass objectPath as property to LAD rows (#3870) Includes some code cleanup --- src/plugins/LADTable/LADTableSetViewProvider.js | 8 ++++++-- src/plugins/LADTable/components/LADRow.vue | 11 +++++------ src/plugins/LADTable/components/LADTable.vue | 8 ++++---- src/plugins/LADTable/components/LadTableSet.vue | 16 ++++++++++++---- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/plugins/LADTable/LADTableSetViewProvider.js b/src/plugins/LADTable/LADTableSetViewProvider.js index 1ac4e10897..6e19c7066a 100644 --- a/src/plugins/LADTable/LADTableSetViewProvider.js +++ b/src/plugins/LADTable/LADTableSetViewProvider.js @@ -43,12 +43,16 @@ export default function LADTableSetViewProvider(openmct) { components: { LadTableSet: LadTableSet }, + data() { + return { + domainObject + }; + }, provide: { openmct, - domainObject, objectPath }, - template: '' + template: '' }); }, destroy: function (element) { diff --git a/src/plugins/LADTable/components/LADRow.vue b/src/plugins/LADTable/components/LADRow.vue index 7132b4f8e2..26c85a94e5 100644 --- a/src/plugins/LADTable/components/LADRow.vue +++ b/src/plugins/LADTable/components/LADRow.vue @@ -56,7 +56,7 @@ export default { type: Object, required: true }, - objectPath: { + pathToTable: { type: Array, required: true }, @@ -66,20 +66,19 @@ export default { } }, data() { - let currentObjectPath = this.objectPath.slice(); - currentObjectPath.unshift(this.domainObject); - return { timestamp: undefined, value: '---', valueClass: '', - currentObjectPath, unit: '' }; }, computed: { formattedTimestamp() { return this.timestamp !== undefined ? this.getFormattedTimestamp(this.timestamp) : '---'; + }, + objectPath() { + return [this.domainObject, ...this.pathToTable]; } }, mounted() { @@ -182,7 +181,7 @@ export default { }; }, showContextMenu(event) { - let actionCollection = this.openmct.actions.get(this.currentObjectPath, this.getView()); + let actionCollection = this.openmct.actions.get(this.objectPath, this.getView()); let allActions = actionCollection.getActionsObject(); let applicableActions = CONTEXT_MENU_ACTIONS.map(key => allActions[key]); diff --git a/src/plugins/LADTable/components/LADTable.vue b/src/plugins/LADTable/components/LADTable.vue index aea1cd4314..ca967d37cd 100644 --- a/src/plugins/LADTable/components/LADTable.vue +++ b/src/plugins/LADTable/components/LADTable.vue @@ -33,10 +33,10 @@ diff --git a/src/plugins/LADTable/components/LadTableSet.vue b/src/plugins/LADTable/components/LadTableSet.vue index 05ccdd87a1..129a9c3d07 100644 --- a/src/plugins/LADTable/components/LadTableSet.vue +++ b/src/plugins/LADTable/components/LadTableSet.vue @@ -43,9 +43,10 @@ @@ -60,7 +61,13 @@ export default { components: { LadRow }, - inject: ['openmct', 'domainObject'], + inject: ['openmct', 'objectPath'], + props: { + domainObject: { + type: Object, + required: true + } + }, data() { return { ladTableObjects: [], @@ -106,6 +113,7 @@ export default { let ladTable = {}; ladTable.domainObject = domainObject; ladTable.key = this.openmct.objects.makeKeyString(domainObject.identifier); + ladTable.objectPath = [domainObject, ...this.objectPath]; this.$set(this.ladTelemetryObjects, ladTable.key, []); this.ladTableObjects.push(ladTable);