mirror of
https://github.com/nasa/openmct.git
synced 2025-06-27 11:32:13 +00:00
Compare commits
23 Commits
code-cover
...
tcr-fixes-
Author | SHA1 | Date | |
---|---|---|---|
07c2b0820a | |||
a0d2cd5711 | |||
2d8f58573d | |||
e4e7ecd74e | |||
f148583318 | |||
514896884f | |||
fc024e583e | |||
7f2f060417 | |||
a94d50226a | |||
6eda100af8 | |||
782ee9aa37 | |||
29e94befe8 | |||
24a1e9ba75 | |||
edeefe8f2f | |||
d263723a0c | |||
b74c14b334 | |||
d8f733d424 | |||
b39f3fab3f | |||
4912188fe4 | |||
58048d44b2 | |||
775e93484e | |||
0e27234389 | |||
15d4b1a8e5 |
@ -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",
|
||||||
|
@ -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)
|
||||||
|
@ -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.
|
||||||
|
@ -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: [
|
||||||
{
|
{
|
||||||
|
@ -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);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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);
|
||||||
|
@ -30,7 +30,7 @@ define(
|
|||||||
],
|
],
|
||||||
function (
|
function (
|
||||||
html2canvas,
|
html2canvas,
|
||||||
saveAs
|
{ saveAs }
|
||||||
) {
|
) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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() {
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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>
|
||||||
|
@ -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();
|
||||||
|
Reference in New Issue
Block a user