mirror of
https://github.com/nasa/openmct.git
synced 2025-02-21 09:52:04 +00:00
Fixed jslint issues
This commit is contained in:
parent
b73f9fc19e
commit
863c3f1720
@ -222,7 +222,7 @@ define(
|
|||||||
* functions to dismiss or minimize
|
* functions to dismiss or minimize
|
||||||
*/
|
*/
|
||||||
NotificationService.prototype.info = function (model) {
|
NotificationService.prototype.info = function (model) {
|
||||||
var notificationModel = typeof model === "string" ? {title: model} : model
|
var notificationModel = typeof model === "string" ? {title: model} : model;
|
||||||
notificationModel.autoDismiss = notificationModel.autoDismiss || true;
|
notificationModel.autoDismiss = notificationModel.autoDismiss || true;
|
||||||
notificationModel.severity = "info";
|
notificationModel.severity = "info";
|
||||||
return this.notify(notificationModel);
|
return this.notify(notificationModel);
|
||||||
|
@ -68,7 +68,7 @@ define(
|
|||||||
this.dialog = this.dialogService.showBlockingMessage({
|
this.dialog = this.dialogService.showBlockingMessage({
|
||||||
title: "Preparing to copy objects",
|
title: "Preparing to copy objects",
|
||||||
unknownProgress: true,
|
unknownProgress: true,
|
||||||
severity: "info",
|
severity: "info"
|
||||||
});
|
});
|
||||||
} else if (phase.toLowerCase() === "copying") {
|
} else if (phase.toLowerCase() === "copying") {
|
||||||
this.dialogService.dismiss();
|
this.dialogService.dismiss();
|
||||||
@ -84,7 +84,7 @@ define(
|
|||||||
this.notification.model.title = ["Copied ", processed, "of ",
|
this.notification.model.title = ["Copied ", processed, "of ",
|
||||||
totalObjects, "objects"].join(" ");
|
totalObjects, "objects"].join(" ");
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the CopyAction. The CopyAction uses the default behaviour of
|
* Executes the CopyAction. The CopyAction uses the default behaviour of
|
||||||
@ -100,18 +100,18 @@ define(
|
|||||||
self.notification.dismiss();
|
self.notification.dismiss();
|
||||||
self.notificationService.info("Copying complete.");
|
self.notificationService.info("Copying complete.");
|
||||||
},
|
},
|
||||||
function error(error){
|
function error(errorDetails){
|
||||||
self.$log.error("Error copying objects. ", error);
|
self.$log.error("Error copying objects. ", errorDetails);
|
||||||
//Show more general error message
|
//Show more general error message
|
||||||
self.notificationService.notify({
|
self.notificationService.notify({
|
||||||
title: "Error copying objects.",
|
title: "Error copying objects.",
|
||||||
severity: "error",
|
severity: "error",
|
||||||
hint: error.message
|
hint: errorDetails.message
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
function notification(notification){
|
function notification(details){
|
||||||
self.progress(notification.phase, notification.totalObjects, notification.processed);
|
self.progress(details.phase, details.totalObjects, details.processed);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -93,7 +93,7 @@ define(
|
|||||||
id: uuid(),
|
id: uuid(),
|
||||||
model: makeClone(originalObject.getModel()),
|
model: makeClone(originalObject.getModel()),
|
||||||
persistenceSpace: originalParent.getCapability('persistence')
|
persistenceSpace: originalParent.getCapability('persistence')
|
||||||
}
|
};
|
||||||
delete modelClone.model.composition;
|
delete modelClone.model.composition;
|
||||||
delete modelClone.model.persisted;
|
delete modelClone.model.persisted;
|
||||||
delete modelClone.model.modified;
|
delete modelClone.model.modified;
|
||||||
@ -123,7 +123,7 @@ define(
|
|||||||
return modelClone;
|
return modelClone;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
return copy(domainObject, parent).then(function(domainObjectClone){
|
return copy(domainObject, parent).then(function(domainObjectClone){
|
||||||
//If the domain object being cloned is not a link, set its
|
//If the domain object being cloned is not a link, set its
|
||||||
@ -133,7 +133,7 @@ define(
|
|||||||
}
|
}
|
||||||
return clones;
|
return clones;
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will persist a list of {@link objectClones}. It will persist all
|
* Will persist a list of {@link objectClones}. It will persist all
|
||||||
@ -152,13 +152,13 @@ define(
|
|||||||
clone.model.persisted = self.now();
|
clone.model.persisted = self.now();
|
||||||
return self.persistenceService.createObject(clone.persistenceSpace, clone.id, clone.model)
|
return self.persistenceService.createObject(clone.persistenceSpace, clone.id, clone.model)
|
||||||
.then(function(){
|
.then(function(){
|
||||||
progress && progress({phase: "copying", totalObjects: objectClones.length, processed: ++persisted});
|
return progress && progress({phase: "copying", totalObjects: objectClones.length, processed: ++persisted});
|
||||||
});
|
});
|
||||||
})).then(function(){
|
})).then(function(){
|
||||||
return objectClones
|
return objectClones;
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will add a list of clones to the specified parent's composition
|
* Will add a list of clones to the specified parent's composition
|
||||||
@ -177,12 +177,12 @@ define(
|
|||||||
|
|
||||||
return self.persistenceService
|
return self.persistenceService
|
||||||
.updateObject(parentClone.persistenceSpace, parentClone.id, parentClone.model)
|
.updateObject(parentClone.persistenceSpace, parentClone.id, parentClone.model)
|
||||||
.then(function(){return parent.getCapability("composition").add(parentClone.id)})
|
.then(function(){return parent.getCapability("composition").add(parentClone.id);})
|
||||||
.then(function(){return parent.getCapability("persistence").persist()})
|
.then(function(){return parent.getCapability("persistence").persist();})
|
||||||
.then(function(){return parentClone});
|
.then(function(){return parentClone;});
|
||||||
// Ensure the clone of the original domainObject is returned
|
// Ensure the clone of the original domainObject is returned
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a duplicate of the object tree starting at domainObject to
|
* Creates a duplicate of the object tree starting at domainObject to
|
||||||
@ -207,7 +207,7 @@ define(
|
|||||||
"Tried to copy objects without validating first."
|
"Tried to copy objects without validating first."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
return CopyService;
|
return CopyService;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/*global define,describe,beforeEach,it,jasmine,expect */
|
/*global define,describe,beforeEach,it,jasmine,expect,spyOn */
|
||||||
|
|
||||||
define(
|
define(
|
||||||
[
|
[
|
||||||
@ -101,10 +101,9 @@ define(
|
|||||||
);
|
);
|
||||||
|
|
||||||
abstractComposePromise.then.andCallFake(function(success, error, notify){
|
abstractComposePromise.then.andCallFake(function(success, error, notify){
|
||||||
notify(progress);
|
notify(progress);
|
||||||
success();
|
success();
|
||||||
}
|
});
|
||||||
)
|
|
||||||
|
|
||||||
locationServicePromise.then.andCallFake(function(callback){
|
locationServicePromise.then.andCallFake(function(callback){
|
||||||
callback(newParent);
|
callback(newParent);
|
||||||
|
@ -137,7 +137,8 @@ define(
|
|||||||
copyResult,
|
copyResult,
|
||||||
copyFinished,
|
copyFinished,
|
||||||
persistObjectPromise,
|
persistObjectPromise,
|
||||||
parentPersistenceCapability;
|
parentPersistenceCapability,
|
||||||
|
resolvedValue;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
creationService = jasmine.createSpyObj(
|
creationService = jasmine.createSpyObj(
|
||||||
@ -167,18 +168,16 @@ define(
|
|||||||
mockNow = jasmine.createSpyObj("mockNow", ["now"]);
|
mockNow = jasmine.createSpyObj("mockNow", ["now"]);
|
||||||
mockNow.now.andCallFake(function(){
|
mockNow.now.andCallFake(function(){
|
||||||
return 1234;
|
return 1234;
|
||||||
})
|
});
|
||||||
|
|
||||||
var resolvedValue;
|
|
||||||
|
|
||||||
mockDeferred = jasmine.createSpyObj('mockDeferred', ['notify', 'resolve']);
|
mockDeferred = jasmine.createSpyObj('mockDeferred', ['notify', 'resolve']);
|
||||||
mockDeferred.notify.andCallFake(function(notification){});
|
mockDeferred.notify.andCallFake(function(notification){});
|
||||||
mockDeferred.resolve.andCallFake(function(value){resolvedValue = value})
|
mockDeferred.resolve.andCallFake(function(value){resolvedValue = value;});
|
||||||
mockDeferred.promise = {
|
mockDeferred.promise = {
|
||||||
then: function(callback){
|
then: function(callback){
|
||||||
return synchronousPromise(callback(resolvedValue));
|
return synchronousPromise(callback(resolvedValue));
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
mockQ = jasmine.createSpyObj('mockQ', ['when', 'all', 'reject', 'defer']);
|
mockQ = jasmine.createSpyObj('mockQ', ['when', 'all', 'reject', 'defer']);
|
||||||
mockQ.when.andCallFake(synchronousPromise);
|
mockQ.when.andCallFake(synchronousPromise);
|
||||||
@ -330,8 +329,8 @@ define(
|
|||||||
|
|
||||||
it("copies object and children in a bottom-up" +
|
it("copies object and children in a bottom-up" +
|
||||||
" fashion", function () {
|
" fashion", function () {
|
||||||
expect(mockPersistenceService.createObject.calls[0].args[2].name).toEqual(childObject.model.name)
|
expect(mockPersistenceService.createObject.calls[0].args[2].name).toEqual(childObject.model.name);
|
||||||
expect(mockPersistenceService.createObject.calls[1].args[2].name).toEqual(object.model.name)
|
expect(mockPersistenceService.createObject.calls[1].args[2].name).toEqual(object.model.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns a promise", function () {
|
it("returns a promise", function () {
|
||||||
@ -355,7 +354,7 @@ define(
|
|||||||
Preserves links
|
Preserves links
|
||||||
*/
|
*/
|
||||||
it ("correctly locates cloned objects", function() {
|
it ("correctly locates cloned objects", function() {
|
||||||
expect(mockPersistenceService.createObject.calls[0].args[2].location).toEqual(mockPersistenceService.createObject.calls[1].args[1])
|
expect(mockPersistenceService.createObject.calls[0].args[2].location).toEqual(mockPersistenceService.createObject.calls[1].args[1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user