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",
"exports-loader": "^0.7.0",
"express": "^4.13.1",
"fast-sass-loader": "^1.4.5",
"fast-sass-loader": "1.4.6",
"file-loader": "^1.1.11",
"file-saver": "^1.3.8",
"git-rev-sync": "^1.4.0",

View File

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

View File

@ -65,24 +65,33 @@ define(
CreateAction.prototype.perform = function () {
var newModel = this.type.getInitialModel(),
openmct = this.openmct,
newObject,
editAction;
function onSave() {
openmct.editor.save();
}
newObject;
function onCancel() {
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.location = this.parent.getId();
newObject = this.parent.useCapability('instantiation', newModel);
openmct.editor.edit();
editAction = newObject.getCapability("action").getActions("edit")[0];
newObject.getCapability("action").perform("save-as").then(onSave, onCancel);
newObject.getCapability("action").perform("save-as")
.then(navigateAndEdit, onCancel)
// TODO: support editing object without saving object first.
// Which means we have to toggle createwizard afterwards. For now,
// We will disable this.

View File

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

View File

@ -178,8 +178,12 @@ define([
* @method remove
*/
DefaultCompositionProvider.prototype.remove = function (domainObject, childId) {
// TODO: this needs to be synchronized via mutation.
throw new Error('Default Provider does not implement removal.');
let composition = domainObject.composition.filter(function (child) {
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();
},
deleteContainer(containerId) {
let container = this.containers.filter(c => c.id === containerId)[0];
let containerIndex = this.containers.indexOf(container);
let container = this.containers.filter(c => c.id === containerId)[0],
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);
/*
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);
this.persist();
},
@ -545,6 +563,12 @@ export default {
.frames
.filter((f => f.id === frameId))[0];
let frameIndex = container.frames.indexOf(frame);
/*
remove associated domainObject from composition
*/
this.composition.remove({identifier: frame.domainObjectIdentifier});
container.frames.splice(frameIndex, 1);
sizeToFill(container.frames);
this.persist(containerIndex);
@ -617,7 +641,7 @@ export default {
} else {
this.containers.splice(toIndex, 0, container);
}
this.persist(index);
this.persist();
},
removeChildObject(identifier) {
let removeIdentifier = this.openmct.objects.makeKeyString(identifier);

View File

@ -204,7 +204,7 @@ function ToolbarProvider(openmct) {
addContainer,
toggleFrame ? separator: undefined,
toggleFrame,
deleteFrame || deleteContainer ? separator: undefined,
deleteFrame || deleteContainer ? separator : undefined,
deleteFrame,
deleteContainer
];

View File

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

View File

@ -1,6 +1,10 @@
<template>
<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">
<ul class="tree c-tree c-elements-pool__tree" id="inspector-elements-tree"
v-if="elements.length > 0">
@ -69,7 +73,8 @@ export default {
return {
elements: [],
isEditing: this.openmct.editor.isEditing(),
parentObject: undefined
parentObject: undefined,
currentSearch: ''
}
},
mounted() {

View File

@ -22,9 +22,6 @@
handle="after"
label="Browse"
collapsable>
<div class="l-shell__search">
<search class="c-search--major" ref="shell-search"></search>
</div>
<mct-tree class="l-shell__tree"></mct-tree>
</pane>
<pane class="l-shell__pane-main">
@ -250,7 +247,6 @@
import ObjectView from '../components/ObjectView.vue';
import MctTemplate from '../legacy/mct-template.vue';
import CreateButton from './CreateButton.vue';
import search from '../components/search.vue';
import multipane from './multipane.vue';
import pane from './pane.vue';
import BrowseBar from './BrowseBar.vue';
@ -293,7 +289,6 @@
ObjectView,
'mct-template': MctTemplate,
CreateButton,
search,
multipane,
pane,
BrowseBar,
@ -304,31 +299,24 @@
this.openmct.editor.on('isEditing', (isEditing)=>{
this.isEditing = isEditing;
});
this.openmct.selection.on('change', this.toggleHasToolbar);
},
data: function () {
return {
fullScreen: false,
conductorComponent: {},
isEditing: false
conductorComponent: undefined,
isEditing: false,
hasToolbar: false
}
},
computed: {
toolbar() {
let selection = this.openmct.selection.get();
let structure = undefined;
if (!selection[0]) {
structure = [];
} else {
structure = this.openmct.toolbars.get(selection);
}
return this.isEditing && structure.length > 0;
return this.hasToolbar && this.isEditing;
}
},
methods: {
fullScreenToggle() {
if (this.fullScreen) {
this.fullScreen = false;
exitFullScreen();
@ -339,6 +327,17 @@
},
openInNewTab(event) {
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>
<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">
<tree-item v-for="child in children"
:key="child.id"
:node="child">
<tree-item v-for="treeItem in treeItems"
:key="treeItem.id"
:node="treeItem">
</tree-item>
</ul>
</div>
@ -125,28 +136,72 @@
<script>
import treeItem from './tree-item.vue'
import search from '../components/search.vue';
export default {
data() {
return {
children: []
};
},
inject: ['openmct'],
mounted: function () {
this.openmct.objects.get('ROOT')
.then(root => this.openmct.composition.get(root).load())
.then(children => this.children = children.map((c) => {
return {
id: this.openmct.objects.makeKeyString(c.identifier),
object: c,
objectPath: [c]
};
}))
},
name: 'mct-tree',
components: {
search,
treeItem
},
data() {
return {
searchValue: '',
allTreeItems: [],
filteredTreeItems: []
}
},
computed: {
treeItems() {
if (this.searchValue === '') {
return this.allTreeItems;
} else {
return this.filteredTreeItems;
}
}
},
methods: {
getAllChildren() {
this.openmct.objects.get('ROOT')
.then(root => this.openmct.composition.get(root).load())
.then(children => {
this.allTreeItems = children.map(c => {
return {
id: this.openmct.objects.makeKeyString(c.identifier),
object: c,
objectPath: [c]
};
});
});
},
getFilteredChildren() {
this.searchService.query(this.searchValue).then(children => {
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>

View File

@ -20,19 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
<template>
<div class="l-preview-window">
<div class="l-preview-window__object-name l-browse-bar__object-name--w" :class="type.cssClass">
<span class="l-browse-bar__object-name">
{{ domainObject.name }}
</span>
<context-menu-drop-down :object-path="objectPath"></context-menu-drop-down>
<div class="l-preview-window">
<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">
{{ domainObject.name }}
</span>
<context-menu-drop-down :object-path="objectPath"></context-menu-drop-down>
</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 class="l-preview-window__object-view">
<div ref="objectView">
</div>
</div>
</div>
</template>
</template>
<style lang="scss">
@import '~styles/sass-base';
@ -63,6 +75,7 @@
<script>
import ContextMenuDropDown from '../../ui/components/contextMenuDropDown.vue';
import NotebookSnapshot from '../utils/notebook-snapshot';
export default {
components: {
@ -72,6 +85,12 @@
'openmct',
'objectPath'
],
methods: {
snapshot() {
let element = document.getElementsByClassName("l-preview-window__object-view")[0];
this.notebookSnapshot.capture(this.domainObject, element);
}
},
data() {
let domainObject = this.objectPath[0];
let type = this.openmct.types.get(domainObject.type);
@ -85,6 +104,7 @@
let viewProvider = this.openmct.objectViews.get(this.domainObject)[0];
this.view = viewProvider.view(this.domainObject);
this.view.show(this.$refs.objectView);
this.notebookSnapshot = new NotebookSnapshot(this.openmct);
},
destroy() {
this.view.destroy();