+
+
import ContextMenuDropDown from '../../ui/components/contextMenuDropDown.vue';
+ import ViewSwitcher from '../../ui/layout/ViewSwitcher.vue';
import NotebookSnapshot from '../utils/notebook-snapshot';
export default {
components: {
- ContextMenuDropDown
+ ContextMenuDropDown,
+ ViewSwitcher
},
inject: [
'openmct',
'objectPath'
],
+ computed: {
+ views() {
+ return this
+ .openmct
+ .objectViews
+ .get(this.domainObject);
+ },
+ currentView() {
+ return this.views.filter(v => v.key === this.viewKey)[0] || {};
+ }
+ },
methods: {
snapshot() {
let element = document.getElementsByClassName("l-preview-window__object-view")[0];
this.notebookSnapshot.capture(this.domainObject, element);
+ },
+ clear() {
+ if (this.view) {
+ this.view.destroy();
+ this.$refs.objectView.innerHTML = '';
+ }
+ delete this.view;
+ delete this.viewContainer;
+ },
+ setView(view) {
+ this.clear();
+
+ this.viewKey = view.key;
+ this.viewContainer = document.createElement('div');
+ this.viewContainer.classList.add('c-object-view','u-contents');
+ this.$refs.objectView.append(this.viewContainer);
+
+ this.view = this.currentView.view(this.domainObject, false, this.objectPath);
+ this.view.show(this.viewContainer, false);
}
},
data() {
@@ -103,13 +140,13 @@
return {
domainObject: domainObject,
type: type,
- notebookEnabled: false
+ notebookEnabled: false,
+ viewKey: undefined
};
},
mounted() {
- let viewProvider = this.openmct.objectViews.get(this.domainObject)[0];
- this.view = viewProvider.view(this.domainObject);
- this.view.show(this.$refs.objectView, false);
+ let view = this.openmct.objectViews.get(this.domainObject)[0];
+ this.setView(view);
if (this.openmct.types.get('notebook')) {
this.notebookSnapshot = new NotebookSnapshot(this.openmct);
diff --git a/src/ui/preview/PreviewAction.js b/src/ui/preview/PreviewAction.js
index 9a12c3e7bc..2310a6aca1 100644
--- a/src/ui/preview/PreviewAction.js
+++ b/src/ui/preview/PreviewAction.js
@@ -28,6 +28,7 @@ export default class PreviewAction {
* Metadata
*/
this.name = 'Preview';
+ this.key = 'preview';
this.description = 'Preview in large dialog';
this.cssClass = 'icon-eye-open';
diff --git a/src/ui/preview/ViewHistoricalDataAction.js b/src/ui/preview/ViewHistoricalDataAction.js
new file mode 100644
index 0000000000..5fa094f664
--- /dev/null
+++ b/src/ui/preview/ViewHistoricalDataAction.js
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * Open MCT, Copyright (c) 2014-2018, United States Government
+ * as represented by the Administrator of the National Aeronautics and Space
+ * Administration. All rights reserved.
+ *
+ * Open MCT is licensed under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ * Open MCT includes source code licensed under additional open source
+ * licenses. See the Open Source Licenses file (LICENSES.md) included with
+ * this source code distribution or the Licensing information page available
+ * at runtime from the About dialog for additional information.
+ *****************************************************************************/
+
+import PreviewAction from './PreviewAction';
+
+export default class ViewHistoricalDataAction extends PreviewAction {
+ constructor(openmct) {
+ super(openmct);
+
+ this.name = 'View Historical Data';
+ this.key = 'viewHistoricalData';
+ this.description = 'View Historical Data in a Table or Plot';
+ this.cssClass = 'icon-eye-open';
+ this.hideInDefaultMenu = true;
+ }
+}
diff --git a/src/ui/preview/plugin.js b/src/ui/preview/plugin.js
index 8a124918af..d368751d1d 100644
--- a/src/ui/preview/plugin.js
+++ b/src/ui/preview/plugin.js
@@ -20,9 +20,11 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import PreviewAction from './PreviewAction.js';
+import ViewHistoricalDataAction from './ViewHistoricalDataAction';
export default function () {
return function (openmct) {
openmct.contextMenu.registerAction(new PreviewAction(openmct));
- }
+ openmct.contextMenu.registerAction(new ViewHistoricalDataAction(openmct));
+ };
}
diff --git a/src/ui/registries/ViewRegistry.js b/src/ui/registries/ViewRegistry.js
index 85dddb683c..b8a754b1c4 100644
--- a/src/ui/registries/ViewRegistry.js
+++ b/src/ui/registries/ViewRegistry.js
@@ -223,11 +223,11 @@ define(['EventEmitter'], function (EventEmitter) {
/**
* Provide a view of this object.
*
- * When called by Open MCT, this may include additional arguments
- * which are on the path to the object to be viewed; for instance,
- * when viewing "A Folder" within "My Items", this method will be
- * invoked with "A Folder" (as a domain object) as the first argument,
- * and "My Items" as the second argument.
+ * When called by Open MCT, the following arguments will be passed to it:
+ * @param {object} domainObject - the domainObject that the view is provided for
+ * @param {boolean} isEditing - A boolean value indicating wether openmct is in a global edit mode
+ * @param {array} objectPath - The current contextual object path of the view object
+ * eg current domainObject is located under MyItems which is under Root
*
* @method view
* @memberof module:openmct.ViewProvider#
diff --git a/src/ui/router/Browse.js b/src/ui/router/Browse.js
index 22a74ff679..04dc1fad9b 100644
--- a/src/ui/router/Browse.js
+++ b/src/ui/router/Browse.js
@@ -8,6 +8,7 @@ define([
let navigateCall = 0;
let browseObject;
let unobserve = undefined;
+ let currentObjectPath;
openmct.router.route(/^\/browse\/?$/, navigateToFirstChildOfRoot);
@@ -26,7 +27,9 @@ define([
});
function viewObject(object, viewProvider) {
- openmct.layout.$refs.browseObject.show(object, viewProvider.key, true);
+ currentObjectPath = openmct.router.path;
+
+ openmct.layout.$refs.browseObject.show(object, viewProvider.key, true, currentObjectPath);
openmct.layout.$refs.browseBar.domainObject = object;
openmct.layout.$refs.browseBar.viewKey = viewProvider.key;
}