From 76ae21685729fa97fde961d376d16302605de459 Mon Sep 17 00:00:00 2001 From: Bishwas Praveen Date: Tue, 27 Feb 2024 10:29:38 -0600 Subject: [PATCH 1/2] added admin action for lrm dev server --- sde_collections/admin.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sde_collections/admin.py b/sde_collections/admin.py index 45337f21..7f1d3a3a 100644 --- a/sde_collections/admin.py +++ b/sde_collections/admin.py @@ -112,6 +112,11 @@ def import_candidate_urls_lis_server(modeladmin, request, queryset): import_candidate_urls_from_api_caller(modeladmin, request, queryset, "lis_server") +@admin.action(description="Import candidate URLs from LRM Dev Server") +def import_candidate_urls_lrm_dev_server(modeladmin, request, queryset): + import_candidate_urls_from_api_caller(modeladmin, request, queryset, "lrm_dev_server") + + class ExportCsvMixin: def export_as_csv(self, request, queryset): meta = self.model._meta @@ -198,6 +203,7 @@ class CollectionAdmin(admin.ModelAdmin, ExportCsvMixin, UpdateConfigMixin): import_candidate_urls_secret_test, import_candidate_urls_secret_production, import_candidate_urls_lis_server, + import_candidate_urls_lrm_dev_server, ] ordering = ("cleaning_order",) From e1efe74979703b7f3e2ebd43044985bed01002d9 Mon Sep 17 00:00:00 2001 From: Bishwas Praveen Date: Tue, 27 Feb 2024 10:30:07 -0600 Subject: [PATCH 2/2] added lrm dev server info --- sde_collections/sinequa_api.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sde_collections/sinequa_api.py b/sde_collections/sinequa_api.py index 483e21fe..a6163031 100644 --- a/sde_collections/sinequa_api.py +++ b/sde_collections/sinequa_api.py @@ -36,6 +36,11 @@ "query_name": "query-smd-primary", "base_url": "http://sde-xli.nasa-impact.net", }, + "lrm_dev_server": { + "app_name": "nasa-sba-smd", + "query_name": "query-smd-primary", + "base_url": "http://sde-lrm.nasa-impact.net", + }, } @@ -59,6 +64,8 @@ def process_response(self, url: str, payload: dict[str, Any]) -> Any: def query(self, page: int, collection_config_folder: str = "") -> Any: if self.server_name == "lis_server": url = f"{self.base_url}/api/v1/search.query?Password=admin&User=admin" + elif self.server_name == "lrm_dev_server": + url = f"{self.base_url}/api/v1/search.query?Password=QDZ8ASZagUpRCHR&User=lrmdev" else: url = f"{self.base_url}/api/v1/search.query" payload = { @@ -73,9 +80,7 @@ def query(self, page: int, collection_config_folder: str = "") -> Any: } if collection_config_folder: - payload["query"]["advanced"][ - "collection" - ] = f"/SDE/{collection_config_folder}/" + payload["query"]["advanced"]["collection"] = f"/SDE/{collection_config_folder}/" response = self.process_response(url, payload)