mirror of
https://github.com/nasa/openmct.git
synced 2025-04-11 05:10:21 +00:00
[New Edit Mode] Code style fixes
JSLint error
This commit is contained in:
parent
d78bd9fd51
commit
f300b99b7b
@ -75,7 +75,9 @@ define(
|
||||
// urlService.urlForLocation used to adjust current
|
||||
// path to new, addressed, path based on
|
||||
// domainObject
|
||||
$location.path(urlService.urlForLocation("browse", domainObject.hasCapability('editor') ? domainObject.getOriginalObject() : domainObject));
|
||||
$location.path(urlService.urlForLocation("browse",
|
||||
domainObject.hasCapability('editor') ?
|
||||
domainObject.getOriginalObject() : domainObject));
|
||||
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,10 @@
|
||||
/*global define,Promise*/
|
||||
|
||||
define(
|
||||
['../../../representation/src/gestures/GestureConstants',
|
||||
'../../edit/src/objects/EditableDomainObject'],
|
||||
[
|
||||
'../../../representation/src/gestures/GestureConstants',
|
||||
'../../edit/src/objects/EditableDomainObject'
|
||||
],
|
||||
function (GestureConstants, EditableDomainObject) {
|
||||
"use strict";
|
||||
|
||||
@ -50,17 +52,15 @@ define(
|
||||
((domainObject && domainObject.useCapability('view')) || [])
|
||||
.forEach(selectViewIfMatching);
|
||||
}
|
||||
//$scope.editMode = domainObject.hasCapability('editor') ?
|
||||
// true : false;
|
||||
navigatedObject = domainObject;
|
||||
}
|
||||
|
||||
function updateQueryParam(viewKey) {
|
||||
var unlisten,
|
||||
priorRoute = $route.current,
|
||||
editMode = $scope.domainObject && $scope.domainObject.hasCapability('editor');
|
||||
isEditMode = $scope.domainObject && $scope.domainObject.hasCapability('editor');
|
||||
|
||||
if (viewKey && !editMode) {
|
||||
if (viewKey && !isEditMode) {
|
||||
$location.search('view', viewKey);
|
||||
unlisten = $scope.$on('$locationChangeSuccess', function () {
|
||||
// Checks path to make sure /browse/ is at front
|
||||
|
@ -25,9 +25,11 @@
|
||||
* Module defining CreateAction. Created by vwoeltje on 11/10/14.
|
||||
*/
|
||||
define(
|
||||
['./CreateWizard',
|
||||
'uuid',
|
||||
'../../../edit/src/objects/EditableDomainObject'],
|
||||
[
|
||||
'./CreateWizard',
|
||||
'uuid',
|
||||
'../../../edit/src/objects/EditableDomainObject'
|
||||
],
|
||||
function (CreateWizard, uuid, EditableDomainObject) {
|
||||
"use strict";
|
||||
|
||||
|
@ -98,9 +98,15 @@ define(
|
||||
|
||||
editableObject.getCapability("status").set("editing", false);
|
||||
|
||||
return nonrecursive ?
|
||||
resolvePromise(doMutate()).then(doPersist).then(function(){self.cancel();}) :
|
||||
resolvePromise(cache.saveAll());
|
||||
if (nonrecursive) {
|
||||
return resolvePromise(doMutate())
|
||||
.then(doPersist)
|
||||
.then(function(){
|
||||
self.cancel();
|
||||
});
|
||||
} else {
|
||||
return resolvePromise(cache.saveAll());
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -108,7 +108,6 @@ define(
|
||||
this.key = (representation || {}).key;
|
||||
// Track the represented object
|
||||
this.domainObject = representedObject;
|
||||
this.scope.editMode = representedObject.hasCapability("editor");
|
||||
|
||||
// Ensure existing watches are released
|
||||
this.destroy();
|
||||
|
@ -58,27 +58,33 @@ define(
|
||||
return domainObject.getCapability('status').get('editing');
|
||||
}
|
||||
|
||||
function hasEditableParent(domainObject){
|
||||
function hasEditableAncestor(domainObject){
|
||||
return domainObject.hasCapability('context') &&
|
||||
domainObject.getCapability('context').getPath().reduce(
|
||||
function(previous, domainObject){
|
||||
return domainObject.getCapability('status').get('editing') || previous;
|
||||
}, false);
|
||||
domainObject
|
||||
.getCapability('context')
|
||||
.getPath()
|
||||
.some(function isEditable (ancestor){
|
||||
return ancestor.getCapability('status').get('editing');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform an action. This will find and perform the
|
||||
* first matching action available for the specified
|
||||
* context or key.
|
||||
* Retrieve the actions applicable to the domain object in the given
|
||||
* context.
|
||||
*
|
||||
* @param {ActionContext|string} context the context in which
|
||||
* to perform the action; this is passed along to
|
||||
* the action service to match against available
|
||||
* to assess the applicability of the available actions; this is
|
||||
* passed along to the action service to match against available
|
||||
* actions. The "domainObject" field will automatically
|
||||
* be populated with the domain object that exposed
|
||||
* this capability. If given as a string, this will
|
||||
* be taken as the "key" field to match against
|
||||
* specific actions.
|
||||
*
|
||||
* Additionally, this function will limit the actions
|
||||
* available for an object in Edit Mode
|
||||
* @returns {Array<Action>} The actions applicable to this domain
|
||||
* object in the given context
|
||||
* @memberof platform/core.ActionCapability#
|
||||
*/
|
||||
ActionCapability.prototype.getActions = function (context) {
|
||||
@ -93,7 +99,7 @@ define(
|
||||
actionContext.domainObject = this.domainObject;
|
||||
|
||||
actions = this.actionService.getActions(actionContext) || [];
|
||||
if (isEditable(this.domainObject) || hasEditableParent(this.domainObject)){
|
||||
if (isEditable(this.domainObject) || hasEditableAncestor(this.domainObject)){
|
||||
return actions.filter(function(action){
|
||||
return DISALLOWED_ACTIONS.indexOf(action.getMetadata().key) === -1;
|
||||
});
|
||||
|
@ -46,7 +46,7 @@ define(
|
||||
longTouchTime = 500,
|
||||
parameters = element && element.attr('parameters') && $parse(element.attr('parameters'))();
|
||||
|
||||
function suppressMenu(){
|
||||
function suppressMenu() {
|
||||
return parameters
|
||||
&& parameters.suppressMenuOnEdit
|
||||
&& navigationService.getNavigation()
|
||||
|
@ -45,7 +45,7 @@ define(
|
||||
function DropGesture(dndService, $q, navigationService, objectService, instantiate, typeService, element, domainObject) {
|
||||
var actionCapability = domainObject.getCapability('action'),
|
||||
editableDomainObject,
|
||||
scope = element && element.scope && element.scope(),
|
||||
scope = element.scope && element.scope(),
|
||||
action; // Action for the drop, when it occurs
|
||||
|
||||
function broadcastDrop(id, event) {
|
||||
@ -83,7 +83,8 @@ define(
|
||||
|
||||
function shouldCreateVirtualPanel(domainObject){
|
||||
return domainObject.useCapability('view').filter(function (view){
|
||||
return (view.key==='plot' || view.key==='scrolling') && domainObject.getModel().type!== 'telemetry.panel';
|
||||
return (view.key === 'plot' || view.key === 'scrolling')
|
||||
&& domainObject.getModel().type !== 'telemetry.panel';
|
||||
}).length > 0;
|
||||
}
|
||||
|
||||
@ -91,7 +92,13 @@ define(
|
||||
//Refresh domain object on each dragOver to catch external
|
||||
// updates to the model
|
||||
//Don't use EditableDomainObject for folders, allow immediate persistence
|
||||
editableDomainObject = domainObject.hasCapability('editor') || domainObject.getModel().type==='folder' ? domainObject : new EditableDomainObject(domainObject, $q);
|
||||
if (domainObject.hasCapability('editor') ||
|
||||
domainObject.getModel().type==='folder') {
|
||||
editableDomainObject = domainObject;
|
||||
} else {
|
||||
editableDomainObject = new EditableDomainObject(domainObject, $q);
|
||||
}
|
||||
|
||||
actionCapability = editableDomainObject.getCapability('action');
|
||||
|
||||
var event = (e || {}).originalEvent || e,
|
||||
@ -136,12 +143,11 @@ define(
|
||||
newPanel.getCapability('composition').add(id);
|
||||
});
|
||||
|
||||
newPanel.getCapability('location').setPrimaryLocation(base.getCapability('location').getContextualLocation());
|
||||
newPanel.getCapability('location')
|
||||
.setPrimaryLocation(base.getCapability('location')
|
||||
.getContextualLocation());
|
||||
|
||||
//var virtualPanel = new EditableDomainObject(newPanel, $q);
|
||||
//virtualPanel.setOriginalObject(base);
|
||||
newPanel.setOriginalObject(base);
|
||||
//return virtualPanel;
|
||||
return newPanel;
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user