Skip to content

Commit

Permalink
Merge pull request #39 from oarepo/mirekys/configure-global-search
Browse files Browse the repository at this point in the history
feat(globalsearch): configure globalsearch
  • Loading branch information
mesemus authored Sep 2, 2024
2 parents d284c2a + e60d06b commit 0754b6a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "nrp-devtools"
version = "1.0.8"
version = "1.0.9"
description = "NRP repository development tools"
readme = "README.md"
authors = [{ name = "Miroslav Simek", email = "miroslav.simek@cesnet.cz" }]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ SEARCH_CLIENT_CONFIG = dict(
ca_certs = env.get('INVENIO_OPENSEARCH_CA_CERTS_PATH', None)
)

SEARCH_UI_SEARCH_TEMPLATE = "invenio_search_ui/search.html"
SEARCH_UI_SEARCH_VIEW = 'global_search_ui.search_without_slash'

# TODO(mesemus): should be managed by model builder
# https://linear.app/ducesnet/issue/BE-427/register-model-to-global-search
GLOBAL_SEARCH_MODELS = []

# Cache
# --------------
INVENIO_CACHE_TYPE="redis"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies = [
"oarepo-runtime",
"oarepo-ui",
"python-dotenv",
"oarepo-global-search",
{% if cookiecutter.use_oarepo_vocabularies -%}
"oarepo-vocabularies",
{%- endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ Contains generated models.
## Creating models

```bash
nrp model add <model-name> --config <custom config> \
--use <custom model>[:<jsonpath>] \
--no-input
nrp model create <model-name>
```

Will create a new model. You can provide your own oarepo.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from oarepo_ui.resources.config import TemplatePageUIResourceConfig
from oarepo_ui.resources.resource import TemplatePageUIResource
from flask import redirect


class ComponentsResourceConfig(TemplatePageUIResourceConfig):
Expand All @@ -10,4 +11,12 @@ class ComponentsResourceConfig(TemplatePageUIResourceConfig):

def create_blueprint(app):
"""Register blueprint for this resource."""
# TODO: Hacky solution to avoid error in invenio-communities where link is hardcoded
# they promised to correct this soon
app.add_url_rule(
"/fake-link",
endpoint="invenio_app_rdm_users.communities",
view_func=lambda: redirect("/me/communities/"),
)

return TemplatePageUIResource(ComponentsResourceConfig()).as_blueprint()

0 comments on commit 0754b6a

Please sign in to comment.