mirror of
https://github.com/nasa/openmct.git
synced 2025-04-13 22:23:13 +00:00
Inspector location (#2317)
* working original location - todo link location * remove link location for now * remove legacy getPath and implement new getOriginalPath API call * simplify getOriginalPath, and use path to calculate parent paths in location.vue
This commit is contained in:
parent
bcbf244fd2
commit
df53af7b4d
@ -226,7 +226,20 @@ define([
|
||||
(identifier.namespace === identifiers[0].namespace &&
|
||||
identifier.key === identifiers[0].key);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ObjectAPI.prototype.getOriginalPath = function (identifier, path = []) {
|
||||
return this.get(identifier).then((domainObject) => {
|
||||
path.push(domainObject);
|
||||
let location = domainObject.location;
|
||||
|
||||
if (location) {
|
||||
return this.getOriginalPath(utils.parseKeyString(location), path);
|
||||
} else {
|
||||
return path;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Uniquely identifies a domain object.
|
||||
|
@ -2,24 +2,37 @@
|
||||
<div class="c-properties c-properties--location">
|
||||
<div class="c-properties__header" title="The location of this linked object.">Location</div>
|
||||
<ul class="c-properties__section">
|
||||
<li class="c-properties__row">
|
||||
<div class="c-properties__label">This Link</div>
|
||||
<div class="c-properties__value">TODO</div>
|
||||
</li>
|
||||
<li class="c-properties__row">
|
||||
<li class="c-properties__row" v-if="originalPath.length">
|
||||
<div class="c-properties__label">Original</div>
|
||||
<div class="c-properties__value">TODO</div>
|
||||
<ul class="c-properties__value">
|
||||
<li v-for="pathObject in orderedOriginalPath"
|
||||
:key="pathObject.key">
|
||||
<object-label
|
||||
:domainObject="pathObject.domainObject"
|
||||
:objectPath="pathObject.objectPath">
|
||||
</object-label>
|
||||
<span class="c-disclosure-triangle"></span>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import ObjectLabel from '../components/ObjectLabel.vue';
|
||||
|
||||
export default {
|
||||
inject: ['openmct'],
|
||||
components: {
|
||||
ObjectLabel
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
domainObject: {}
|
||||
domainObject: {},
|
||||
originalPath: [],
|
||||
keyString: ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -30,12 +43,39 @@ export default {
|
||||
this.openmct.selection.off('change', this.updateSelection);
|
||||
},
|
||||
methods: {
|
||||
setOriginalPath(path) {
|
||||
this.originalPath = path.slice(1,-1).map((domainObject, index, pathArray) => {
|
||||
let key = this.openmct.objects.makeKeyString(domainObject.identifier);
|
||||
return {
|
||||
domainObject,
|
||||
key,
|
||||
objectPath: pathArray.slice(index)
|
||||
}
|
||||
});
|
||||
},
|
||||
updateSelection(selection) {
|
||||
if (selection.length === 0) {
|
||||
this.domainObject = {};
|
||||
this.originalLocation = [];
|
||||
return;
|
||||
}
|
||||
|
||||
this.domainObject = selection[0].context.item;
|
||||
|
||||
let keyString = this.openmct.objects.makeKeyString(this.domainObject.identifier);
|
||||
|
||||
if (this.keyString !== keyString) {
|
||||
this.keyString = keyString;
|
||||
this.originalPath = [];
|
||||
|
||||
this.openmct.objects.getOriginalPath(this.keyString)
|
||||
.then(this.setOriginalPath);
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
orderedOriginalPath() {
|
||||
return this.originalPath.reverse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user