[Search] Don't index objects being edited

https://github.com/nasa/openmctweb/pull/727#issuecomment-195570183
This commit is contained in:
Victor Woeltjen 2016-03-11 14:54:08 -08:00
parent 2d305415b3
commit 107ecfe687
2 changed files with 12 additions and 4 deletions

View File

@ -121,9 +121,13 @@ define([
provider = this;
mutationTopic.listen(function (mutatedObject) {
var id = mutatedObject.getId(),
model = mutatedObject.getModel();
provider.index(id, model);
var status = mutatedObject.getCapability('status');
if (!status || !status.get('editing')) {
provider.index(
mutatedObject.getId(),
mutatedObject.getModel()
);
}
});
};

View File

@ -101,7 +101,11 @@ define([
it('re-indexes when mutation occurs', function () {
var mockDomainObject =
jasmine.createSpyObj('domainObj', ['getId', 'getModel']),
jasmine.createSpyObj('domainObj', [
'getId',
'getModel',
'getCapability'
]),
testModel = { some: 'model' };
mockDomainObject.getId.andReturn("some-id");
mockDomainObject.getModel.andReturn(testModel);