Skip to content

Commit

Permalink
Merge pull request #511 from NASA-IMPACT/510-update-webapp-to-use-new…
Browse files Browse the repository at this point in the history
…-secret-servers-for-url-import

510 update webapp to use new secret servers for url import
  • Loading branch information
code-geek authored Nov 15, 2023
2 parents 6ae9824 + 6fb8952 commit 54140f6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
10 changes: 10 additions & 0 deletions sde_collections/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 11 additions & 3 deletions sde_collections/sinequa_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
}


Expand Down Expand Up @@ -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"/SDE/{collection_config_folder}/"

response = self.process_response(url, payload)

Expand Down

0 comments on commit 54140f6

Please sign in to comment.