mirror of
https://github.com/nasa/openmct.git
synced 2025-06-21 16:49:42 +00:00
Pass objectPath as property to LAD rows (#3870)
Includes some code cleanup
This commit is contained in:
@ -43,12 +43,16 @@ export default function LADTableSetViewProvider(openmct) {
|
|||||||
components: {
|
components: {
|
||||||
LadTableSet: LadTableSet
|
LadTableSet: LadTableSet
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
domainObject
|
||||||
|
};
|
||||||
|
},
|
||||||
provide: {
|
provide: {
|
||||||
openmct,
|
openmct,
|
||||||
domainObject,
|
|
||||||
objectPath
|
objectPath
|
||||||
},
|
},
|
||||||
template: '<lad-table-set></lad-table-set>'
|
template: '<lad-table-set :domain-object="domainObject"></lad-table-set>'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
destroy: function (element) {
|
destroy: function (element) {
|
||||||
|
@ -56,7 +56,7 @@ export default {
|
|||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
objectPath: {
|
pathToTable: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
@ -66,20 +66,19 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
let currentObjectPath = this.objectPath.slice();
|
|
||||||
currentObjectPath.unshift(this.domainObject);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
timestamp: undefined,
|
timestamp: undefined,
|
||||||
value: '---',
|
value: '---',
|
||||||
valueClass: '',
|
valueClass: '',
|
||||||
currentObjectPath,
|
|
||||||
unit: ''
|
unit: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
formattedTimestamp() {
|
formattedTimestamp() {
|
||||||
return this.timestamp !== undefined ? this.getFormattedTimestamp(this.timestamp) : '---';
|
return this.timestamp !== undefined ? this.getFormattedTimestamp(this.timestamp) : '---';
|
||||||
|
},
|
||||||
|
objectPath() {
|
||||||
|
return [this.domainObject, ...this.pathToTable];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -182,7 +181,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
showContextMenu(event) {
|
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 allActions = actionCollection.getActionsObject();
|
||||||
let applicableActions = CONTEXT_MENU_ACTIONS.map(key => allActions[key]);
|
let applicableActions = CONTEXT_MENU_ACTIONS.map(key => allActions[key]);
|
||||||
|
|
||||||
|
@ -33,10 +33,10 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<lad-row
|
<lad-row
|
||||||
v-for="item in items"
|
v-for="ladRow in items"
|
||||||
:key="item.key"
|
:key="ladRow.key"
|
||||||
:domain-object="item.domainObject"
|
:domain-object="ladRow.domainObject"
|
||||||
:object-path="objectPath"
|
:path-to-table="objectPath"
|
||||||
:has-units="hasUnits"
|
:has-units="hasUnits"
|
||||||
/>
|
/>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -43,9 +43,10 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<lad-row
|
<lad-row
|
||||||
v-for="telemetryObject in ladTelemetryObjects[ladTable.key]"
|
v-for="ladRow in ladTelemetryObjects[ladTable.key]"
|
||||||
:key="telemetryObject.key"
|
:key="ladRow.key"
|
||||||
:domain-object="telemetryObject.domainObject"
|
:domain-object="ladRow.domainObject"
|
||||||
|
:path-to-table="ladTable.objectPath"
|
||||||
:has-units="hasUnits"
|
:has-units="hasUnits"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@ -60,7 +61,13 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
LadRow
|
LadRow
|
||||||
},
|
},
|
||||||
inject: ['openmct', 'domainObject'],
|
inject: ['openmct', 'objectPath'],
|
||||||
|
props: {
|
||||||
|
domainObject: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
ladTableObjects: [],
|
ladTableObjects: [],
|
||||||
@ -106,6 +113,7 @@ export default {
|
|||||||
let ladTable = {};
|
let ladTable = {};
|
||||||
ladTable.domainObject = domainObject;
|
ladTable.domainObject = domainObject;
|
||||||
ladTable.key = this.openmct.objects.makeKeyString(domainObject.identifier);
|
ladTable.key = this.openmct.objects.makeKeyString(domainObject.identifier);
|
||||||
|
ladTable.objectPath = [domainObject, ...this.objectPath];
|
||||||
|
|
||||||
this.$set(this.ladTelemetryObjects, ladTable.key, []);
|
this.$set(this.ladTelemetryObjects, ladTable.key, []);
|
||||||
this.ladTableObjects.push(ladTable);
|
this.ladTableObjects.push(ladTable);
|
||||||
|
Reference in New Issue
Block a user