Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

views: allow list view to receive a pid_value #208

Merged
merged 2 commits into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 27 additions & 23 deletions invenio_administration/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,32 +385,36 @@ def get_available_facets(self):
return self.resource.service.config.search.facets
return self.available_facets

def get(self):
"""GET view method."""
def get_context(self, **kwargs):
"""Create details view context."""
search_conf = self.init_search_config()
schema = self.get_service_schema()
serialized_schema = self._schema_to_json(schema)
return self.render(
**{
"search_config": search_conf,
"title": self.title,
"name": self.name,
"resource_schema": serialized_schema,
"fields": self.item_field_list,
"display_search": self.display_search,
"display_create": self.display_create,
"display_edit": self.display_edit,
"display_delete": self.display_delete,
"display_read": self.display_read,
"actions": self.serialize_actions(),
"pid_path": self.pid_path,
"create_ui_endpoint": self.get_create_view_endpoint(),
"list_ui_endpoint": self.get_list_view_endpoint(),
"resource_name": (
self.resource_name if self.resource_name else self.pid_path
),
}
)
pid_value = kwargs.get("pid_value", "")
return {
"search_config": search_conf,
"title": self.title,
"name": self.name,
"resource_schema": serialized_schema,
"fields": self.item_field_list,
"display_search": self.display_search,
"display_create": self.display_create,
"display_edit": self.display_edit,
"display_delete": self.display_delete,
"display_read": self.display_read,
"actions": self.serialize_actions(),
"pid_path": self.pid_path,
"pid_value": pid_value,
"create_ui_endpoint": self.get_create_view_endpoint(),
"list_ui_endpoint": self.get_list_view_endpoint(),
"resource_name": (
self.resource_name if self.resource_name else self.pid_path
),
}

def get(self, **kwargs):
"""GET view method."""
return self.render(**self.get_context(**kwargs))


class AdminResourceViewSet:
Expand Down
Loading