mirror of
https://github.com/nasa/openmct.git
synced 2025-06-06 01:11:41 +00:00
Implemented go to parent (#2264)
This commit is contained in:
parent
931871ff95
commit
abcc5cb023
@ -1,7 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="l-browse-bar">
|
<div class="l-browse-bar">
|
||||||
<div class="l-browse-bar__start">
|
<div class="l-browse-bar__start">
|
||||||
<button class="l-browse-bar__nav-to-parent-button c-click-icon c-click-icon--major icon-pointer-left"></button>
|
<button v-if="hasParent"
|
||||||
|
class="l-browse-bar__nav-to-parent-button c-click-icon c-click-icon--major icon-pointer-left"
|
||||||
|
@click="goToParent"></button>
|
||||||
<div class="l-browse-bar__object-name--w"
|
<div class="l-browse-bar__object-name--w"
|
||||||
:class="type.cssClass">
|
:class="type.cssClass">
|
||||||
<span
|
<span
|
||||||
@ -53,6 +55,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import NotebookSnapshot from '../utils/notebook-snapshot';
|
import NotebookSnapshot from '../utils/notebook-snapshot';
|
||||||
|
const PLACEHOLDER_OBJECT = {};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
inject: ['openmct'],
|
inject: ['openmct'],
|
||||||
@ -95,12 +98,15 @@ import NotebookSnapshot from '../utils/notebook-snapshot';
|
|||||||
snapshot() {
|
snapshot() {
|
||||||
let element = document.getElementsByClassName("l-shell__main-container")[0];
|
let element = document.getElementsByClassName("l-shell__main-container")[0];
|
||||||
this.notebookSnapshot.capture(this.domainObject, element);
|
this.notebookSnapshot.capture(this.domainObject, element);
|
||||||
|
},
|
||||||
|
goToParent(){
|
||||||
|
window.location.hash = this.parentUrl;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
showViewMenu: false,
|
showViewMenu: false,
|
||||||
domainObject: {},
|
domainObject: PLACEHOLDER_OBJECT,
|
||||||
viewKey: undefined,
|
viewKey: undefined,
|
||||||
isEditing: this.openmct.editor.isEditing()
|
isEditing: this.openmct.editor.isEditing()
|
||||||
}
|
}
|
||||||
@ -122,6 +128,15 @@ import NotebookSnapshot from '../utils/notebook-snapshot';
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
hasParent() {
|
||||||
|
return this.domainObject !== PLACEHOLDER_OBJECT &&
|
||||||
|
this.parentUrl !== '#/browse'
|
||||||
|
},
|
||||||
|
parentUrl() {
|
||||||
|
let objectKeyString = this.openmct.objects.makeKeyString(this.domainObject.identifier);
|
||||||
|
let hash = window.location.hash;
|
||||||
|
return hash.slice(0, hash.lastIndexOf('/' + objectKeyString));
|
||||||
|
},
|
||||||
type() {
|
type() {
|
||||||
let objectType = this.openmct.types.get(this.domainObject.type);
|
let objectType = this.openmct.types.get(this.domainObject.type);
|
||||||
if (!objectType) {
|
if (!objectType) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user