Compare commits

...

23 Commits

Author SHA1 Message Date
07c2b0820a merge tree search implementation for testing purposes 2019-02-20 11:16:48 -08:00
a0d2cd5711 fixes for toolbar not updating on selection change 2019-02-19 10:25:20 -08:00
2d8f58573d force mutation in save-as to trigger indexing 2019-02-15 13:31:28 -08:00
e4e7ecd74e throw an error when user cancels instead of returning false 2019-02-14 12:54:30 -08:00
f148583318 remove Root from path 2019-02-14 11:55:18 -08:00
514896884f fix index undefined error when reordering containers 2019-02-12 13:49:16 -08:00
fc024e583e remove domainObjects from composition when deleting frames and containers, and also fix a bug whereby a user can add domainObject via drag and drop(composition) but because of the lack of containers, it will not be added to the flexible layout 2019-02-12 12:36:39 -08:00
7f2f060417 navigate and edit on create 2019-02-11 14:05:34 -08:00
a94d50226a move search implementation inside mct-tree 2019-02-11 12:46:03 -08:00
6eda100af8 fix anonymous render error in layout 2019-02-11 12:16:54 -08:00
782ee9aa37 fix current Search error 2019-02-11 12:01:50 -08:00
29e94befe8 fix elements search in inspector 2019-02-11 11:59:56 -08:00
24a1e9ba75 fix saveAs in plot image export 2019-02-11 11:51:11 -08:00
edeefe8f2f pin fast-sass-loader version to 1.4.6 2019-02-11 10:12:11 -08:00
d263723a0c Merge branch 'topic-core-refactor' of https://github.com/nasa/openmct into tcr-fixes-2 2019-02-04 13:52:53 -08:00
b74c14b334 get context before passing into mxt-tree 2019-01-31 13:17:01 -08:00
d8f733d424 add no results found message to mct-tree 2019-01-30 14:34:55 -08:00
b39f3fab3f remove unused method 2019-01-30 12:51:11 -08:00
4912188fe4 first working version of search 2019-01-30 12:44:43 -08:00
58048d44b2 fix for preview image overlay 2019-01-25 14:32:17 -08:00
775e93484e add notebook snapshot to preview 2019-01-25 14:15:18 -08:00
0e27234389 Merge branch 'topic-core-refactor' of https://github.com/nasa/openmct into tcr-fixes-2 2019-01-25 13:49:36 -08:00
15d4b1a8e5 prevent default on dragover in dropHint, to allow drop event to fire 2019-01-24 11:59:46 -08:00
12 changed files with 197 additions and 87 deletions

View File

@ -25,7 +25,7 @@
"eventemitter3": "^1.2.0", "eventemitter3": "^1.2.0",
"exports-loader": "^0.7.0", "exports-loader": "^0.7.0",
"express": "^4.13.1", "express": "^4.13.1",
"fast-sass-loader": "^1.4.5", "fast-sass-loader": "1.4.6",
"file-loader": "^1.1.11", "file-loader": "^1.1.11",
"file-saver": "^1.3.8", "file-saver": "^1.3.8",
"git-rev-sync": "^1.4.0", "git-rev-sync": "^1.4.0",

View File

@ -92,16 +92,7 @@ function (
* @memberof platform/commonUI/edit.SaveAction# * @memberof platform/commonUI/edit.SaveAction#
*/ */
SaveAsAction.prototype.perform = function () { SaveAsAction.prototype.perform = function () {
// Discard the current root view (which will be the editing return this.save();
// UI, which will have been pushed atop the Browse UI.)
function returnToBrowse(object) {
if (object) {
object.getCapability("action").perform("navigate");
}
return object;
}
return this.save().then(returnToBrowse);
}; };
/** /**
@ -169,15 +160,17 @@ function (
} }
function saveAfterClone(clonedObject) { function saveAfterClone(clonedObject) {
return domainObject.getCapability("editor").save() return this.openmct.editor.save().then(() => {
.then(resolveWith(clonedObject)); // Force mutation for search indexing
clonedObject.useCapability('mutation', (model) => {
return model;
});
return clonedObject;
})
} }
function finishEditing(clonedObject) { function finishEditing(clonedObject) {
return domainObject.getCapability("editor").finish() return fetchObject(clonedObject.getId())
.then(function () {
return fetchObject(clonedObject.getId());
});
} }
function onSuccess(object) { function onSuccess(object) {
@ -190,7 +183,7 @@ function (
if (reason !== "user canceled") { if (reason !== "user canceled") {
self.notificationService.error("Save Failed"); self.notificationService.error("Save Failed");
} }
return false; throw reason;
} }
return getParent(domainObject) return getParent(domainObject)

View File

@ -65,24 +65,33 @@ define(
CreateAction.prototype.perform = function () { CreateAction.prototype.perform = function () {
var newModel = this.type.getInitialModel(), var newModel = this.type.getInitialModel(),
openmct = this.openmct, openmct = this.openmct,
newObject, newObject;
editAction;
function onSave() {
openmct.editor.save();
}
function onCancel() { function onCancel() {
openmct.editor.cancel(); openmct.editor.cancel();
} }
function navigateAndEdit(object) {
let objectPath = object.getCapability('context').getPath(),
url = '#/browse/' + objectPath
.map(function (o) {
return o && openmct.objects.makeKeyString(o.getId())
})
.join('/');
window.location.href = url;
openmct.editor.edit();
}
newModel.type = this.type.getKey(); newModel.type = this.type.getKey();
newModel.location = this.parent.getId(); newModel.location = this.parent.getId();
newObject = this.parent.useCapability('instantiation', newModel); newObject = this.parent.useCapability('instantiation', newModel);
openmct.editor.edit(); openmct.editor.edit();
editAction = newObject.getCapability("action").getActions("edit")[0]; newObject.getCapability("action").perform("save-as")
newObject.getCapability("action").perform("save-as").then(onSave, onCancel); .then(navigateAndEdit, onCancel)
// TODO: support editing object without saving object first. // TODO: support editing object without saving object first.
// Which means we have to toggle createwizard afterwards. For now, // Which means we have to toggle createwizard afterwards. For now,
// We will disable this. // We will disable this.

View File

@ -29,12 +29,13 @@ define(
function SnapshotPreviewController($scope, openmct) { function SnapshotPreviewController($scope, openmct) {
$scope.previewImage = function (imageUrl) { $scope.previewImage = function (imageUrl) {
let image = document.createElement('img'); let imageDiv = document.createElement('div');
image.src = imageUrl; imageDiv.classList = 'image-main s-image-main';
imageDiv.style.backgroundImage = `url(${imageUrl})`;
let previewImageOverlay = openmct.overlays.overlay( let previewImageOverlay = openmct.overlays.overlay(
{ {
element: image, element: imageDiv,
size: 'large', size: 'large',
buttons: [ buttons: [
{ {

View File

@ -178,8 +178,12 @@ define([
* @method remove * @method remove
*/ */
DefaultCompositionProvider.prototype.remove = function (domainObject, childId) { DefaultCompositionProvider.prototype.remove = function (domainObject, childId) {
// TODO: this needs to be synchronized via mutation. let composition = domainObject.composition.filter(function (child) {
throw new Error('Default Provider does not implement removal.'); return !(childId.namespace === child.namespace &&
childId.key === child.key);
});
this.publicAPI.objects.mutate(domainObject, 'composition', composition);
}; };
/** /**

View File

@ -503,9 +503,27 @@ export default {
this.persist(); this.persist();
}, },
deleteContainer(containerId) { deleteContainer(containerId) {
let container = this.containers.filter(c => c.id === containerId)[0]; let container = this.containers.filter(c => c.id === containerId)[0],
let containerIndex = this.containers.indexOf(container); containerIndex = this.containers.indexOf(container);
/*
remove associated domainObjects from composition
*/
container.frames.forEach(f => {
this.composition.remove({identifier: f.domainObjectIdentifier});
});
this.containers.splice(containerIndex, 1); this.containers.splice(containerIndex, 1);
/*
add a container when there are no containers in the FL,
to prevent user from not being able to add a frame via
drag and drop.
*/
if (this.containers.length === 0) {
this.containers.push(new Container(100));
}
sizeToFill(this.containers); sizeToFill(this.containers);
this.persist(); this.persist();
}, },
@ -545,6 +563,12 @@ export default {
.frames .frames
.filter((f => f.id === frameId))[0]; .filter((f => f.id === frameId))[0];
let frameIndex = container.frames.indexOf(frame); let frameIndex = container.frames.indexOf(frame);
/*
remove associated domainObject from composition
*/
this.composition.remove({identifier: frame.domainObjectIdentifier});
container.frames.splice(frameIndex, 1); container.frames.splice(frameIndex, 1);
sizeToFill(container.frames); sizeToFill(container.frames);
this.persist(containerIndex); this.persist(containerIndex);
@ -617,7 +641,7 @@ export default {
} else { } else {
this.containers.splice(toIndex, 0, container); this.containers.splice(toIndex, 0, container);
} }
this.persist(index); this.persist();
}, },
removeChildObject(identifier) { removeChildObject(identifier) {
let removeIdentifier = this.openmct.objects.makeKeyString(identifier); let removeIdentifier = this.openmct.objects.makeKeyString(identifier);

View File

@ -30,7 +30,7 @@ define(
], ],
function ( function (
html2canvas, html2canvas,
saveAs { saveAs }
) { ) {
/** /**

View File

@ -1,6 +1,10 @@
<template> <template>
<div class="c-elements-pool"> <div class="c-elements-pool">
<Search class="c-elements-pool__search" @input="applySearch"></Search> <Search class="c-elements-pool__search"
:value="currentSearch"
@input="applySearch"
@clear="applySearch">
</Search>
<div class="c-elements-pool__elements"> <div class="c-elements-pool__elements">
<ul class="tree c-tree c-elements-pool__tree" id="inspector-elements-tree" <ul class="tree c-tree c-elements-pool__tree" id="inspector-elements-tree"
v-if="elements.length > 0"> v-if="elements.length > 0">
@ -69,7 +73,8 @@ export default {
return { return {
elements: [], elements: [],
isEditing: this.openmct.editor.isEditing(), isEditing: this.openmct.editor.isEditing(),
parentObject: undefined parentObject: undefined,
currentSearch: ''
} }
}, },
mounted() { mounted() {

View File

@ -22,9 +22,6 @@
handle="after" handle="after"
label="Browse" label="Browse"
collapsable> collapsable>
<div class="l-shell__search">
<search class="c-search--major" ref="shell-search"></search>
</div>
<mct-tree class="l-shell__tree"></mct-tree> <mct-tree class="l-shell__tree"></mct-tree>
</pane> </pane>
<pane class="l-shell__pane-main"> <pane class="l-shell__pane-main">
@ -250,7 +247,6 @@
import ObjectView from '../components/ObjectView.vue'; import ObjectView from '../components/ObjectView.vue';
import MctTemplate from '../legacy/mct-template.vue'; import MctTemplate from '../legacy/mct-template.vue';
import CreateButton from './CreateButton.vue'; import CreateButton from './CreateButton.vue';
import search from '../components/search.vue';
import multipane from './multipane.vue'; import multipane from './multipane.vue';
import pane from './pane.vue'; import pane from './pane.vue';
import BrowseBar from './BrowseBar.vue'; import BrowseBar from './BrowseBar.vue';
@ -293,7 +289,6 @@
ObjectView, ObjectView,
'mct-template': MctTemplate, 'mct-template': MctTemplate,
CreateButton, CreateButton,
search,
multipane, multipane,
pane, pane,
BrowseBar, BrowseBar,
@ -304,31 +299,24 @@
this.openmct.editor.on('isEditing', (isEditing)=>{ this.openmct.editor.on('isEditing', (isEditing)=>{
this.isEditing = isEditing; this.isEditing = isEditing;
}); });
this.openmct.selection.on('change', this.toggleHasToolbar);
}, },
data: function () { data: function () {
return { return {
fullScreen: false, fullScreen: false,
conductorComponent: {}, conductorComponent: undefined,
isEditing: false isEditing: false,
hasToolbar: false
} }
}, },
computed: { computed: {
toolbar() { toolbar() {
let selection = this.openmct.selection.get(); return this.hasToolbar && this.isEditing;
let structure = undefined;
if (!selection[0]) {
structure = [];
} else {
structure = this.openmct.toolbars.get(selection);
}
return this.isEditing && structure.length > 0;
} }
}, },
methods: { methods: {
fullScreenToggle() { fullScreenToggle() {
if (this.fullScreen) { if (this.fullScreen) {
this.fullScreen = false; this.fullScreen = false;
exitFullScreen(); exitFullScreen();
@ -339,6 +327,17 @@
}, },
openInNewTab(event) { openInNewTab(event) {
window.open(window.location.href); window.open(window.location.href);
},
toggleHasToolbar(selection) {
let structure = undefined;
if (!selection[0]) {
structure = [];
} else {
structure = this.openmct.toolbars.get(selection);
}
this.hasToolbar = structure.length > 0;
} }
} }
} }

View File

@ -1,9 +1,20 @@
<template> <template>
<div class="c-tree__wrapper"> <div class="c-tree__wrapper">
<div class="l-shell__search">
<search class="c-search--major" ref="shell-search"
:value="searchValue"
@input="searchTree"
@clear="searchTree">
</search>
</div>
<div
v-if="treeItems.length === 0">
No results found
</div>
<ul class="c-tree"> <ul class="c-tree">
<tree-item v-for="child in children" <tree-item v-for="treeItem in treeItems"
:key="child.id" :key="treeItem.id"
:node="child"> :node="treeItem">
</tree-item> </tree-item>
</ul> </ul>
</div> </div>
@ -125,28 +136,72 @@
<script> <script>
import treeItem from './tree-item.vue' import treeItem from './tree-item.vue'
import search from '../components/search.vue';
export default { export default {
inject: ['openmct'],
name: 'mct-tree',
components: {
search,
treeItem
},
data() { data() {
return { return {
children: [] searchValue: '',
}; allTreeItems: [],
filteredTreeItems: []
}
}, },
inject: ['openmct'], computed: {
mounted: function () { treeItems() {
if (this.searchValue === '') {
return this.allTreeItems;
} else {
return this.filteredTreeItems;
}
}
},
methods: {
getAllChildren() {
this.openmct.objects.get('ROOT') this.openmct.objects.get('ROOT')
.then(root => this.openmct.composition.get(root).load()) .then(root => this.openmct.composition.get(root).load())
.then(children => this.children = children.map((c) => { .then(children => {
this.allTreeItems = children.map(c => {
return { return {
id: this.openmct.objects.makeKeyString(c.identifier), id: this.openmct.objects.makeKeyString(c.identifier),
object: c, object: c,
objectPath: [c] objectPath: [c]
}; };
})) });
});
}, },
name: 'mct-tree', getFilteredChildren() {
components: { this.searchService.query(this.searchValue).then(children => {
treeItem this.filteredTreeItems = children.hits.map(child => {
let objectPath = child.object.getCapability('context')
.getPath().slice(1).map(oldObject => oldObject.useCapability('adapter'))
.reverse(),
object = child.object.useCapability('adapter');
return {
id: this.openmct.objects.makeKeyString(object.identifier),
object,
objectPath
}
});
});
},
searchTree(value) {
this.searchValue = value;
if (this.searchValue !== '') {
this.getFilteredChildren();
}
}
},
mounted() {
this.searchService = this.openmct.$injector.get('searchService');
this.getAllChildren();
} }
} }
</script> </script>

View File

@ -21,15 +21,27 @@
*****************************************************************************/ *****************************************************************************/
<template> <template>
<div class="l-preview-window"> <div class="l-preview-window">
<div class="l-preview-window__object-name l-browse-bar__object-name--w" :class="type.cssClass"> <div class="l-browse-bar">
<div class="l-browse-bar__start">
<div class="l-browse-bar__object-name--w"
:class="type.cssClass">
<span class="l-browse-bar__object-name"> <span class="l-browse-bar__object-name">
{{ domainObject.name }} {{ domainObject.name }}
</span> </span>
<context-menu-drop-down :object-path="objectPath"></context-menu-drop-down> <context-menu-drop-down :object-path="objectPath"></context-menu-drop-down>
</div> </div>
<div class="l-preview-window__object-view">
<div ref="objectView">
</div> </div>
<div class="l-browse-bar__end">
<div class="l-browse-bar__actions">
<button class="l-browse-bar__actions__edit c-button icon-notebook"
title="New Notebook entry"
@click="snapshot">
</button>
</div>
</div>
</div>
<div class="l-preview-window__object-view">
<div ref="objectView"></div>
</div> </div>
</div> </div>
</template> </template>
@ -63,6 +75,7 @@
<script> <script>
import ContextMenuDropDown from '../../ui/components/contextMenuDropDown.vue'; import ContextMenuDropDown from '../../ui/components/contextMenuDropDown.vue';
import NotebookSnapshot from '../utils/notebook-snapshot';
export default { export default {
components: { components: {
@ -72,6 +85,12 @@
'openmct', 'openmct',
'objectPath' 'objectPath'
], ],
methods: {
snapshot() {
let element = document.getElementsByClassName("l-preview-window__object-view")[0];
this.notebookSnapshot.capture(this.domainObject, element);
}
},
data() { data() {
let domainObject = this.objectPath[0]; let domainObject = this.objectPath[0];
let type = this.openmct.types.get(domainObject.type); let type = this.openmct.types.get(domainObject.type);
@ -85,6 +104,7 @@
let viewProvider = this.openmct.objectViews.get(this.domainObject)[0]; let viewProvider = this.openmct.objectViews.get(this.domainObject)[0];
this.view = viewProvider.view(this.domainObject); this.view = viewProvider.view(this.domainObject);
this.view.show(this.$refs.objectView); this.view.show(this.$refs.objectView);
this.notebookSnapshot = new NotebookSnapshot(this.openmct);
}, },
destroy() { destroy() {
this.view.destroy(); this.view.destroy();