mirror of
https://github.com/nasa/openmct.git
synced 2025-04-15 06:56:43 +00:00
Merge pull request #727 from nasa/open377
[Search] Index directly on mutation
This commit is contained in:
commit
abd5913f02
@ -121,9 +121,13 @@ define([
|
||||
provider = this;
|
||||
|
||||
mutationTopic.listen(function (mutatedObject) {
|
||||
var id = mutatedObject.getId();
|
||||
provider.indexedIds[id] = false;
|
||||
provider.scheduleForIndexing(id);
|
||||
var status = mutatedObject.getCapability('status');
|
||||
if (!status || !status.get('editing')) {
|
||||
provider.index(
|
||||
mutatedObject.getId(),
|
||||
mutatedObject.getModel()
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -99,12 +99,19 @@ define([
|
||||
.toHaveBeenCalledWith(jasmine.any(Function));
|
||||
});
|
||||
|
||||
it('reschedules indexing when mutation occurs', function () {
|
||||
it('re-indexes when mutation occurs', function () {
|
||||
var mockDomainObject =
|
||||
jasmine.createSpyObj('domainObj', ['getId']);
|
||||
jasmine.createSpyObj('domainObj', [
|
||||
'getId',
|
||||
'getModel',
|
||||
'getCapability'
|
||||
]),
|
||||
testModel = { some: 'model' };
|
||||
mockDomainObject.getId.andReturn("some-id");
|
||||
mockDomainObject.getModel.andReturn(testModel);
|
||||
spyOn(provider, 'index').andCallThrough();
|
||||
mutationTopic.listen.mostRecentCall.args[0](mockDomainObject);
|
||||
expect(provider.scheduleForIndexing).toHaveBeenCalledWith('some-id');
|
||||
expect(provider.index).toHaveBeenCalledWith('some-id', testModel);
|
||||
});
|
||||
|
||||
it('starts indexing roots', function () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user