mirror of
https://github.com/nasa/openmct.git
synced 2025-01-19 19:27:07 +00:00
Added save/cancel
This commit is contained in:
parent
296d9f5acd
commit
19bdf743fc
@ -22,8 +22,7 @@
|
||||
<div ng-init="
|
||||
editBtns = [{ cssclass: 'save',title: 'Save' },{ cssclass: 'cancel',title: 'Discard Changes', action:'cancelEditing' }];
|
||||
"></div>
|
||||
<span ng-controller="BrowseObjectController"
|
||||
mct-before-unload="getUnloadWarning()">
|
||||
<span ng-controller="BrowseObjectController">
|
||||
<!--<a class="s-btn"
|
||||
style="opacity: 0.9; position:absolute; right: 250px; z-index: 100"
|
||||
ng-class="{ major:!editMode }"
|
||||
@ -92,12 +91,12 @@
|
||||
|
||||
|
||||
|
||||
<!-- <mct-representation key="'edit-action-buttons'"
|
||||
<mct-representation key="'edit-action-buttons'"
|
||||
mct-object="domainObject"
|
||||
class='flex-elem conclude-editing'>
|
||||
</mct-representation>-->
|
||||
</mct-representation>
|
||||
<!-- from edit-action-buttons.html -->
|
||||
<span class='flex-elem conclude-editing'>
|
||||
<!-- <span class='flex-elem conclude-editing'>
|
||||
<span ng-repeat="btn in editBtns">
|
||||
<a class='s-btn t-{{btn.cssclass}}'
|
||||
title='{{btn.title}}'
|
||||
@ -105,7 +104,7 @@
|
||||
ng-class="{ major: $index === 0 }">
|
||||
<span class="title-label">{{btn.title}}</span>
|
||||
</a>
|
||||
</span>
|
||||
</span> -->
|
||||
</span>
|
||||
|
||||
</div>
|
||||
|
@ -67,7 +67,7 @@
|
||||
"implementation": "actions/SaveAction.js",
|
||||
"name": "Save",
|
||||
"description": "Save changes made to these objects.",
|
||||
"depends": [ "$location", "urlService" ],
|
||||
"depends": [ "$location", "urlService", "navigationService" ],
|
||||
"priority": "mandatory"
|
||||
},
|
||||
{
|
||||
@ -76,7 +76,7 @@
|
||||
"implementation": "actions/CancelAction.js",
|
||||
"name": "Cancel",
|
||||
"description": "Discard changes made to these objects.",
|
||||
"depends": [ "$location", "urlService" ]
|
||||
"depends": [ "$location", "urlService", "navigationService" ]
|
||||
}
|
||||
],
|
||||
"policies": [
|
||||
|
@ -33,10 +33,11 @@ define(
|
||||
* @memberof platform/commonUI/edit
|
||||
* @implements {Action}
|
||||
*/
|
||||
function CancelAction($location, urlService, context) {
|
||||
function CancelAction($location, urlService, navigationService, context) {
|
||||
this.domainObject = context.domainObject;
|
||||
this.$location = $location;
|
||||
this.urlService = urlService;
|
||||
this.navigationService = navigationService;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -48,7 +49,8 @@ define(
|
||||
CancelAction.prototype.perform = function () {
|
||||
var domainObject = this.domainObject,
|
||||
$location = this.$location,
|
||||
urlService = this.urlService;
|
||||
urlService = this.urlService,
|
||||
self = this;
|
||||
|
||||
// Look up the object's "editor.completion" capability;
|
||||
// this is introduced by EditableDomainObject which is
|
||||
@ -67,10 +69,11 @@ define(
|
||||
// Discard the current root view (which will be the editing
|
||||
// UI, which will have been pushed atop the Browise UI.)
|
||||
function returnToBrowse() {
|
||||
$location.path($location.path(urlService.urlForLocation(
|
||||
return self.navigationService.setNavigation(self.domainObject.getDomainObject());
|
||||
/*$location.path($location.path(urlService.urlForLocation(
|
||||
"browse",
|
||||
domainObject
|
||||
)));
|
||||
)));*/
|
||||
}
|
||||
|
||||
return doCancel(getEditorCapability())
|
||||
|
@ -34,10 +34,11 @@ define(
|
||||
* @implements {Action}
|
||||
* @memberof platform/commonUI/edit
|
||||
*/
|
||||
function SaveAction($location, urlService, context) {
|
||||
function SaveAction($location, urlService, navigationService, context) {
|
||||
this.domainObject = (context || {}).domainObject;
|
||||
this.$location = $location;
|
||||
this.urlService = urlService;
|
||||
this.navigationService = navigationService;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -50,7 +51,8 @@ define(
|
||||
SaveAction.prototype.perform = function () {
|
||||
var domainObject = this.domainObject,
|
||||
$location = this.$location,
|
||||
urlService = this.urlService;
|
||||
urlService = this.urlService,
|
||||
self = this;
|
||||
|
||||
// Invoke any save behavior introduced by the editor capability;
|
||||
// this is introduced by EditableDomainObject which is
|
||||
@ -61,12 +63,14 @@ define(
|
||||
}
|
||||
|
||||
// Discard the current root view (which will be the editing
|
||||
// UI, which will have been pushed atop the Browise UI.)
|
||||
// UI, which will have been pushed atop the Browse UI.)
|
||||
function returnToBrowse() {
|
||||
return $location.path(urlService.urlForLocation(
|
||||
|
||||
return self.navigationService.setNavigation(self.domainObject.getDomainObject());
|
||||
/*return $location.path(urlService.urlForLocation(
|
||||
"browse",
|
||||
domainObject
|
||||
));
|
||||
));*/
|
||||
}
|
||||
|
||||
return doSave().then(returnToBrowse);
|
||||
|
@ -42,8 +42,8 @@ define(
|
||||
* composition should be modified as a result of the drop.
|
||||
*/
|
||||
function DropGesture(dndService, $q, navigationService, element, domainObject) {
|
||||
var editableDomainObject = domainObject instanceof EditableDomainObject ? domainObject : new EditableDomainObject(domainObject, $q),
|
||||
actionCapability = editableDomainObject.getCapability('action'),
|
||||
var actionCapability = domainObject.getCapability('action'),
|
||||
editableDomainObject,
|
||||
action; // Action for the drop, when it occurs
|
||||
|
||||
function broadcastDrop(id, event) {
|
||||
@ -70,6 +70,11 @@ define(
|
||||
}
|
||||
|
||||
function dragOver(e) {
|
||||
//Refresh domain object on each dragOver to catch external
|
||||
// updates to the model
|
||||
editableDomainObject = domainObject instanceof EditableDomainObject ? domainObject : new EditableDomainObject(domainObject, $q);
|
||||
actionCapability = editableDomainObject.getCapability('action');
|
||||
|
||||
var event = (e || {}).originalEvent || e,
|
||||
selectedObject = dndService.getData(
|
||||
GestureConstants.MCT_EXTENDED_DRAG_TYPE
|
||||
|
Loading…
Reference in New Issue
Block a user