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

Update webapp to use new secret servers for url import #511

Merged
Merged
Show file tree
Hide file tree
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
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