mirror of
https://github.com/nasa/openmct.git
synced 2025-06-02 23:50:49 +00:00
Fixed JSLint errors
This commit is contained in:
parent
4fbf547bfc
commit
4b7287e51e
@ -19,7 +19,7 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*global define,Promise*/
|
/*global define,Promise, confirm*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This bundle implements Browse mode.
|
* This bundle implements Browse mode.
|
||||||
@ -52,6 +52,13 @@ define(
|
|||||||
($route.current.params.ids || DEFAULT_PATH).split("/")
|
($route.current.params.ids || DEFAULT_PATH).split("/")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
function isDirty(){
|
||||||
|
var editorCapability = $scope.navigatedObject &&
|
||||||
|
$scope.navigatedObject.getCapability("editor"),
|
||||||
|
hasChanges = editorCapability && editorCapability.dirty();
|
||||||
|
return hasChanges;
|
||||||
|
}
|
||||||
|
|
||||||
function updateRoute(domainObject) {
|
function updateRoute(domainObject) {
|
||||||
var priorRoute = $route.current,
|
var priorRoute = $route.current,
|
||||||
// Act as if params HADN'T changed to avoid page reload
|
// Act as if params HADN'T changed to avoid page reload
|
||||||
@ -72,6 +79,15 @@ define(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Callback for updating the in-scope reference to the object
|
||||||
|
// that is currently navigated-to.
|
||||||
|
function setNavigation(domainObject) {
|
||||||
|
$scope.navigatedObject = domainObject;
|
||||||
|
$scope.treeModel.selectedObject = domainObject;
|
||||||
|
navigationService.setNavigation(domainObject);
|
||||||
|
updateRoute(domainObject);
|
||||||
|
}
|
||||||
|
|
||||||
function setSelectedObject(domainObject) {
|
function setSelectedObject(domainObject) {
|
||||||
if (domainObject !== $scope.navigatedObject && isDirty() && !confirm(CONFIRM_MSG)) {
|
if (domainObject !== $scope.navigatedObject && isDirty() && !confirm(CONFIRM_MSG)) {
|
||||||
$scope.treeModel.selectedObject = $scope.navigatedObject;
|
$scope.treeModel.selectedObject = $scope.navigatedObject;
|
||||||
@ -83,15 +99,6 @@ define(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback for updating the in-scope reference to the object
|
|
||||||
// that is currently navigated-to.
|
|
||||||
function setNavigation(domainObject) {
|
|
||||||
$scope.navigatedObject = domainObject;
|
|
||||||
$scope.treeModel.selectedObject = domainObject;
|
|
||||||
navigationService.setNavigation(domainObject);
|
|
||||||
updateRoute(domainObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
function navigateTo(domainObject) {
|
function navigateTo(domainObject) {
|
||||||
|
|
||||||
// Check if an object has been navigated-to already...
|
// Check if an object has been navigated-to already...
|
||||||
@ -159,18 +166,11 @@ define(
|
|||||||
selectedObject: navigationService.getNavigation()
|
selectedObject: navigationService.getNavigation()
|
||||||
};
|
};
|
||||||
|
|
||||||
function isDirty(){
|
|
||||||
var editorCapability = $scope.navigatedObject &&
|
|
||||||
$scope.navigatedObject.getCapability("editor"),
|
|
||||||
hasChanges = editorCapability && editorCapability.dirty();
|
|
||||||
return hasChanges;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.beforeUnloadWarning = function() {
|
$scope.beforeUnloadWarning = function() {
|
||||||
return isDirty() ?
|
return isDirty() ?
|
||||||
"Unsaved changes will be lost if you leave this page." :
|
"Unsaved changes will be lost if you leave this page." :
|
||||||
undefined;
|
undefined;
|
||||||
}
|
};
|
||||||
|
|
||||||
// Listen for changes in navigation state.
|
// Listen for changes in navigation state.
|
||||||
navigationService.addListener(setNavigation);
|
navigationService.addListener(setNavigation);
|
||||||
|
@ -78,11 +78,11 @@ define(
|
|||||||
|
|
||||||
$scope.cancelEditing = function() {
|
$scope.cancelEditing = function() {
|
||||||
navigationService.setNavigation($scope.domainObject.getDomainObject());
|
navigationService.setNavigation($scope.domainObject.getDomainObject());
|
||||||
}
|
};
|
||||||
|
|
||||||
$scope.doAction = function (action){
|
$scope.doAction = function (action){
|
||||||
$scope[action] && $scope[action]();
|
return $scope[action] && $scope[action]();
|
||||||
}
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ define(
|
|||||||
this.$location = $location;
|
this.$location = $location;
|
||||||
this.injectObjectService = function(){
|
this.injectObjectService = function(){
|
||||||
this.objectService = $injector.get("objectService");
|
this.objectService = $injector.get("objectService");
|
||||||
}
|
};
|
||||||
this.urlService = urlService;
|
this.urlService = urlService;
|
||||||
this.navigationService = navigationService;
|
this.navigationService = navigationService;
|
||||||
this.policyService = policyService;
|
this.policyService = policyService;
|
||||||
@ -55,7 +55,7 @@ define(
|
|||||||
this.injectObjectService();
|
this.injectObjectService();
|
||||||
}
|
}
|
||||||
return this.objectService;
|
return this.objectService;
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save changes and conclude editing.
|
* Save changes and conclude editing.
|
||||||
@ -71,12 +71,14 @@ define(
|
|||||||
self = this;
|
self = this;
|
||||||
|
|
||||||
function resolveWith(object){
|
function resolveWith(object){
|
||||||
return function() {return object};
|
return function() {
|
||||||
|
return object;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function doWizardSave(parent) {
|
function doWizardSave(parent) {
|
||||||
var context = domainObject.getCapability("context");
|
var context = domainObject.getCapability("context"),
|
||||||
var wizard = new CreateWizard(domainObject.useCapability('type'), parent, self.policyService, domainObject.getModel());
|
wizard = new CreateWizard(domainObject.useCapability('type'), parent, self.policyService, domainObject.getModel());
|
||||||
|
|
||||||
function mergeObjects(fromObject, toObject){
|
function mergeObjects(fromObject, toObject){
|
||||||
Object.keys(fromObject).forEach(function(key) {
|
Object.keys(fromObject).forEach(function(key) {
|
||||||
@ -114,7 +116,7 @@ define(
|
|||||||
return self.$q.all(composees.map(function (composee) {
|
return self.$q.all(composees.map(function (composee) {
|
||||||
return object.getCapability('composition').add(composee);
|
return object.getCapability('composition').add(composee);
|
||||||
})).then(resolveWith(object));
|
})).then(resolveWith(object));
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,35 +128,26 @@ define(
|
|||||||
function composeNewObject(object){
|
function composeNewObject(object){
|
||||||
if (self.$q.when(object.hasCapability('composition') && domainObject.hasCapability('composition'))) {
|
if (self.$q.when(object.hasCapability('composition') && domainObject.hasCapability('composition'))) {
|
||||||
return getAllComposees(domainObject)
|
return getAllComposees(domainObject)
|
||||||
.then(addComposeesToObject(object))
|
.then(addComposeesToObject(object));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return self.dialogService
|
return self.dialogService
|
||||||
.getUserInput(wizard.getFormStructure(), wizard.getInitialFormValue())
|
.getUserInput(wizard.getFormStructure(), wizard.getInitialFormValue())
|
||||||
.then(buildObjectFromInput, doNothing)
|
.then(buildObjectFromInput, doNothing);
|
||||||
//.then(composeNewObject)
|
|
||||||
//.then(object.getCapability("persistence"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function persistObject(object){
|
function persistObject(object){
|
||||||
|
return ((object.hasCapability('editor') && object.getCapability('editor').save(true)) ||
|
||||||
return (object.hasCapability('editor') && object.getCapability('editor').save(true) || object.getCapability('persistence').persist())
|
object.getCapability('persistence').persist())
|
||||||
.then(resolveWith(object));
|
|
||||||
/*
|
|
||||||
if (object.hasCapability('editor')){
|
|
||||||
return object.getCapability('editor').save(true)
|
|
||||||
.then(resolveWith(object));
|
.then(resolveWith(object));
|
||||||
} else {
|
|
||||||
return object.useCapability(persistence);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchObject(objectId){
|
function fetchObject(objectId){
|
||||||
return self.getObjectService().getObjects([objectId]).then(function(objects){
|
return self.getObjectService().getObjects([objectId]).then(function(objects){
|
||||||
return objects[objectId];
|
return objects[objectId];
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getParent(object){
|
function getParent(object){
|
||||||
@ -182,7 +175,9 @@ define(
|
|||||||
// on user selection
|
// on user selection
|
||||||
.then(locateObjectInParent)
|
.then(locateObjectInParent)
|
||||||
.then(persistObject)
|
.then(persistObject)
|
||||||
.then(function(){return fetchObject(domainObject.getId());})
|
.then(function(){
|
||||||
|
return fetchObject(domainObject.getId());
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
return domainObject.getCapability("editor").save()
|
return domainObject.getCapability("editor").save()
|
||||||
.then(resolveWith(domainObject.getOriginalObject()));
|
.then(resolveWith(domainObject.getOriginalObject()));
|
||||||
|
@ -99,7 +99,7 @@ define(
|
|||||||
editableObject.getCapability("status").set("editing", false);
|
editableObject.getCapability("status").set("editing", false);
|
||||||
|
|
||||||
return nonrecursive ?
|
return nonrecursive ?
|
||||||
resolvePromise(doMutate()).then(doPersist).then(function(){self.cancel()}) :
|
resolvePromise(doMutate()).then(doPersist).then(function(){self.cancel();}) :
|
||||||
resolvePromise(cache.saveAll());
|
resolvePromise(cache.saveAll());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -33,10 +33,11 @@ define(
|
|||||||
*/
|
*/
|
||||||
function ElementsController($scope) {
|
function ElementsController($scope) {
|
||||||
function filterBy(text){
|
function filterBy(text){
|
||||||
if (typeof text === 'undefined')
|
if (typeof text === 'undefined') {
|
||||||
return $scope.searchText;
|
return $scope.searchText;
|
||||||
else
|
} else {
|
||||||
$scope.searchText = text;
|
$scope.searchText = text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$scope.filterBy = filterBy;
|
$scope.filterBy = filterBy;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ define(
|
|||||||
function ContextMenuGesture($timeout, $parse, agentService, navigationService, element, domainObject) {
|
function ContextMenuGesture($timeout, $parse, agentService, navigationService, element, domainObject) {
|
||||||
var isPressing,
|
var isPressing,
|
||||||
longTouchTime = 500,
|
longTouchTime = 500,
|
||||||
parameters = element && element.attr('parameters') && $parse(element.attr('parameters'))()
|
parameters = element && element.attr('parameters') && $parse(element.attr('parameters'))();
|
||||||
|
|
||||||
function suppressMenu(){
|
function suppressMenu(){
|
||||||
return parameters
|
return parameters
|
||||||
|
@ -72,7 +72,7 @@ define(
|
|||||||
|
|
||||||
function shouldCreateVirtualPanel(domainObject){
|
function shouldCreateVirtualPanel(domainObject){
|
||||||
return domainObject.useCapability('view').filter(function (view){
|
return domainObject.useCapability('view').filter(function (view){
|
||||||
return view.key==='plot' && domainObject.getModel().type!== 'telemetry.panel'
|
return view.key==='plot' && domainObject.getModel().type!== 'telemetry.panel';
|
||||||
}).length > 0;
|
}).length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,13 +112,13 @@ define(
|
|||||||
type = typeService.getType(typeKey),
|
type = typeService.getType(typeKey),
|
||||||
model = type.getInitialModel(),
|
model = type.getInitialModel(),
|
||||||
id = uuid(),
|
id = uuid(),
|
||||||
newPanel = undefined;
|
newPanel;
|
||||||
|
|
||||||
model.type = typeKey;
|
model.type = typeKey;
|
||||||
newPanel = new EditableDomainObject(instantiate(model, id), $q);
|
newPanel = new EditableDomainObject(instantiate(model, id), $q);
|
||||||
|
|
||||||
[base.getId(), overlayId].forEach(function(id){
|
[base.getId(), overlayId].forEach(function(id){
|
||||||
newPanel.getCapability('composition').add(id)
|
newPanel.getCapability('composition').add(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
newPanel.getCapability('location').setPrimaryLocation(base.getCapability('location').getContextualLocation());
|
newPanel.getCapability('location').setPrimaryLocation(base.getCapability('location').getContextualLocation());
|
||||||
@ -146,7 +146,7 @@ define(
|
|||||||
// the change.
|
// the change.
|
||||||
if (id) {
|
if (id) {
|
||||||
if (shouldCreateVirtualPanel(domainObject)){
|
if (shouldCreateVirtualPanel(domainObject)){
|
||||||
editableDomainObject = createVirtualPanel(domainObject, id)
|
editableDomainObject = createVirtualPanel(domainObject, id);
|
||||||
navigationService.setNavigation(editableDomainObject);
|
navigationService.setNavigation(editableDomainObject);
|
||||||
broadcastDrop(id, event);
|
broadcastDrop(id, event);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user