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