From a735477103d73b67f6b7847d56f4a75631926f53 Mon Sep 17 00:00:00 2001 From: Carson Davis Date: Wed, 15 Nov 2023 15:05:15 -0600 Subject: [PATCH 1/3] add default configs for the secret server environments --- sde_collections/sinequa_api.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sde_collections/sinequa_api.py b/sde_collections/sinequa_api.py index 2999bd32..0ee6659b 100644 --- a/sde_collections/sinequa_api.py +++ b/sde_collections/sinequa_api.py @@ -21,6 +21,16 @@ "query_name": "query-smd-primary", "base_url": "https://sciencediscoveryengine.nasa.gov", }, + "secret_test": { + "app_name": "nasa-sba-sde", + "query_name": "query-sde-primary", + "base_url": "https://sciencediscoveryengine.test.nasa.gov", + }, + "secret_production": { + "app_name": "nasa-sba-sde", + "query_name": "query-sde-primary", + "base_url": "https://sciencediscoveryengine.nasa.gov", + }, } @@ -54,9 +64,7 @@ def query(self, page: int, collection_config_folder: str = "") -> Any: } if collection_config_folder: - payload["query"]["advanced"][ - "collection" - ] = f"/SMD/{collection_config_folder}/" + payload["query"]["advanced"]["collection"] = f"/SMD/{collection_config_folder}/" response = self.process_response(url, payload) From ecf119a511cf3b762e2e8728ee8199492e48266f Mon Sep 17 00:00:00 2001 From: Carson Davis Date: Wed, 15 Nov 2023 15:06:37 -0600 Subject: [PATCH 2/3] add admin action for importing urls from secret servers --- sde_collections/admin.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sde_collections/admin.py b/sde_collections/admin.py index 86a2973d..dce4fbeb 100644 --- a/sde_collections/admin.py +++ b/sde_collections/admin.py @@ -76,6 +76,16 @@ def import_candidate_urls_production(modeladmin, request, queryset): import_candidate_urls_from_api_caller(modeladmin, request, queryset, "production") +@admin.action(description="Import candidate URLs from Secret Test") +def import_candidate_urls_secret_test(modeladmin, request, queryset): + import_candidate_urls_from_api_caller(modeladmin, request, queryset, "secret_test") + + +@admin.action(description="Import candidate URLs from Secret Production") +def import_candidate_urls_secret_production(modeladmin, request, queryset): + import_candidate_urls_from_api_caller(modeladmin, request, queryset, "secret_production") + + class ExportCsvMixin: def export_as_csv(self, request, queryset): meta = self.model._meta From 6fb89524f2e5661de322b294d1b7c5f9abedfa41 Mon Sep 17 00:00:00 2001 From: Carson Davis Date: Wed, 15 Nov 2023 15:10:24 -0600 Subject: [PATCH 3/3] change folder path from SMD to SDE in the config folder get --- sde_collections/sinequa_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sde_collections/sinequa_api.py b/sde_collections/sinequa_api.py index 0ee6659b..00c59929 100644 --- a/sde_collections/sinequa_api.py +++ b/sde_collections/sinequa_api.py @@ -64,7 +64,7 @@ def query(self, page: int, collection_config_folder: str = "") -> Any: } if collection_config_folder: - payload["query"]["advanced"]["collection"] = f"/SMD/{collection_config_folder}/" + payload["query"]["advanced"]["collection"] = f"/SDE/{collection_config_folder}/" response = self.process_response(url, payload)