Conversation
na9da
left a comment
There was a problem hiding this comment.
Hi @zoran995 - looks great.
One small thing I noticed is we do a cast here to access a property not part of the interface:
terriajs/lib/ReactViews/ExplorerWindow/Tabs/DataCatalogTab.tsx
Lines 57 to 62 in 2d6577e
We should maybe make it part of the interface or traits instead.
| new CatalogSearchProvider( | ||
| "catalog-search-provider", | ||
| terria, | ||
| terria.searchBarModel.minCharacters | ||
| ); |
There was a problem hiding this comment.
Suggestion: I know we have done this elsewhere in the past but it might be a good idea to stick with standard Constructor parameters for models? Using custom constructor parameters is fine if the model is always initialised manually but if at some point we do automatic initialisation from some config, it could create problems.
One other pattern to make creating the instance easier would be to define a static method like CatalogSearchProvider.fromOptions({minCharacters})
| searchProvider: CatalogSearchProviderMixin.Instance | undefined; | ||
|
|
There was a problem hiding this comment.
Can this be undefined if always intialised in constructor?
What this PR does
Fixes #
Move the catalogue search provider from
SearchBarModelto theCatalogclass. I always felt that the catalogue search provider doesn't belong in SearchBarModel, but at the time I was writing it, I wasn't aware ofCatalog, so it stayed in the model.Test me
How should reviewers test this? (Hint: If you want to provide a test catalog item, create a Gist of its catalog JSON, add its url and your branch name to this url:
http://ci.terria.io/<branch name>/#clean&<raw url of your gist>, and then paste that in the body of this PR)Checklist
doc/.