From 542c8d5d2f55db42943468897a19d81213b1ff2d Mon Sep 17 00:00:00 2001 From: ivis-miyachi Date: Thu, 27 Aug 2026 20:19:44 +0900 Subject: [PATCH] Fixed display error on the workspace screen.(W2026-31:it029) --- modules/weko-workspace/tests/test_utils.py | 4 ++-- .../weko-workspace/weko_workspace/config.py | 3 +-- .../weko_workspace/workspace_base.html | 10 ++++---- .../weko-workspace/weko_workspace/utils.py | 24 +++++++++---------- .../weko-workspace/weko_workspace/webpack.py | 1 + 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/modules/weko-workspace/tests/test_utils.py b/modules/weko-workspace/tests/test_utils.py index 778aa0a302..7b6358b45f 100644 --- a/modules/weko-workspace/tests/test_utils.py +++ b/modules/weko-workspace/tests/test_utils.py @@ -190,12 +190,12 @@ def test_get_workspace_filterCon(users, users_index, mock_setup, expected_respon ( [], search.TransportError(500, 'Server Error'), - None + [] ), ( [], Exception("Unexpected error"), - None + [] ) ]) def test_get_search_itemlist(app, mock_responses, mock_exception, expected_response): diff --git a/modules/weko-workspace/weko_workspace/config.py b/modules/weko-workspace/weko_workspace/config.py index 26bd147a04..02f8bf12ef 100644 --- a/modules/weko-workspace/weko_workspace/config.py +++ b/modules/weko-workspace/weko_workspace/config.py @@ -21,7 +21,6 @@ """Configuration for weko-workspace.""" from flask_babel import lazy_gettext as _ -from invenio_stats.config import SEARCH_INDEX_PREFIX as index_prefix # Front-end variable definition WEKO_WORKSPACE_BASE_TEMPLATE = 'weko_workspace/workspace_base.html' @@ -288,7 +287,7 @@ } """Mapping of OA status to the OA status in WEKO.""" -WEKO_WORKSPACE_ITEM_SEARCH_INDEX = "{}-weko".format(index_prefix) +WEKO_WORKSPACE_ITEM_SEARCH_INDEX = "weko" """Search index for WEKO workspace item.""" WEKO_WORKSPACE_ITEM_SEARCH_TYPE = "item-v1.0.0" diff --git a/modules/weko-workspace/weko_workspace/templates/weko_workspace/workspace_base.html b/modules/weko-workspace/weko_workspace/templates/weko_workspace/workspace_base.html index 9aed43b206..ad5231b5e4 100644 --- a/modules/weko-workspace/weko_workspace/templates/weko_workspace/workspace_base.html +++ b/modules/weko-workspace/weko_workspace/templates/weko_workspace/workspace_base.html @@ -21,13 +21,13 @@ {%- block css %} - {{ webpack["theme-css.scss"] }} + {{ webpack["theme-css.css"] }} {{ webpack["theme-scss-bootstrap.css"] }} {{ webpack["theme-css-buttons.css"] }} {{ webpack["theme-css-widget.css"] }} {{ webpack["admin_css_weko_admin_quill_snow_css.css"] }} - {{ webpack["workspace_style_css.css"] }} + {{ webpack["workspace_css.css"] }} {%- endblock css %} @@ -38,12 +38,12 @@ {{ webpack["workspace_item_list_js.js"] }} - + {{ webpack["workspace_export.js"] }} {%- endblock js %} diff --git a/modules/weko-workspace/weko_workspace/utils.py b/modules/weko-workspace/weko_workspace/utils.py index 7cc3fa9ac8..722f4da176 100644 --- a/modules/weko-workspace/weko_workspace/utils.py +++ b/modules/weko-workspace/weko_workspace/utils.py @@ -143,7 +143,7 @@ def get_search_itemlist(): size = 10000 search_index = current_app.config["WEKO_WORKSPACE_ITEM_SEARCH_INDEX"] search_obj = RecordsSearch(index=search_index) - search = search_obj.with_preference_param().params(version=True) + search_query = search_obj.with_preference_param().params(version=True) # Set the search query publish_status_match = dsl.Q("terms", publish_status=[ @@ -162,42 +162,42 @@ def get_search_itemlist(): must = [] must.append(dsl.Q("bool", should=shuld)) must.append(dsl.Q("bool", must=dsl.Q("match", relation_version_is_last="true"))) - search = search.filter(dsl.Q("bool", must=must)) - search = search.query(dsl.Q("bool", must=dsl.Q("match_all"))) + search_query = search_query.filter(dsl.Q("bool", must=must)) + search_query = search_query.query(dsl.Q("bool", must=dsl.Q("match_all"))) # Set size / Exclude content field from the source src = { "size": size, "_source": {"excludes": ["content"]} } - search._extra.update(src) + search_query._extra.update(src) # Set sorting - search = search.sort("-control_number") + search_query = search_query.sort("-control_number") # Execute search. Use search_after to retrieve all records records = [] - current_app.logger.debug(f"[workspace] search obj: {search.to_dict()}") - page = search.execute().to_dict() + current_app.logger.debug(f"[workspace] search obj: {search_query.to_dict()}") + page = search_query.execute().to_dict() current_app.logger.debug(f"[workspace] search result: {page}") while page.get('hits', {}).get('hits', []): records.extend(page.get('hits', {}).get('hits', [])) if len(page.get('hits', {}).get('hits', [])) < size: break - search = search.extra(search_after=page.get('hits', {}).get('hits', [])[-1].get('sort')) - current_app.logger.debug(f"[workspace] search obj: {search.to_dict()}") - page = search.execute().to_dict() + search_query = search_query.extra(search_after=page.get('hits', {}).get('hits', [])[-1].get('sort')) + current_app.logger.debug(f"[workspace] search obj: {search_query.to_dict()}") + page = search_query.execute().to_dict() current_app.logger.debug(f"[workspace] search result: {page}") return records except search.TransportError as e: traceback.print_exc() current_app.logger.error(f"Failed to get workflow item list from search: {e} / {search.to_dict()}") - return None + return [] except Exception as e: traceback.print_exc() current_app.logger.error(e) - return None + return [] def get_workspace_status_management(recid: str): diff --git a/modules/weko-workspace/weko_workspace/webpack.py b/modules/weko-workspace/weko_workspace/webpack.py index fb43241be1..09baf7f1bb 100644 --- a/modules/weko-workspace/weko_workspace/webpack.py +++ b/modules/weko-workspace/weko_workspace/webpack.py @@ -8,6 +8,7 @@ "bootstrap3": dict( entry={ "workspace_item_list_js": "./js/weko_workspace/WorkspaceItemList.js", + "workspace_export": "./js/weko_workspace/WorkspaceExport.js", "workspace_css": "./css/weko_workspace/WorkspaceBodyContents.css", "workspace_register_js": "./js/weko_workspace/workspace_register.js", "workspace_style_css": "./css/weko_workspace/style.css",