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

8 through resource search #9

Merged
merged 5 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions afrc/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,8 @@
# override this to permenantly display/hide the language switcher
SHOW_LANGUAGE_SWITCH = len(LANGUAGES) > 1

COLLECTIONS_GRAPHID = ""

# Implement this class to associate custom documents to the ES resource index
# See tests.views.search_tests.TestEsMappingModifier class for example
# ES_MAPPING_MODIFIER_CLASSES = ["afrc.search.es_mapping_modifier.EsMappingModifier"]
Expand Down
11 changes: 5 additions & 6 deletions afrc/src/afrc/Search/SearchPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ watch(queryString, () => {
function updateFilter(componentName: string, value: object) {
console.log(value);
// Test for an empty object
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function isEmpty(value: any) {
function isEmpty(value: unknown) {
if (value === null || value === undefined) {
return true;
}
Expand Down Expand Up @@ -89,7 +88,7 @@ const doQuery = function () {

const qs = new URLSearchParams(queryObj);

fetch(arches.urls.search_results + "?" + qs.toString())
fetch(arches.urls["api-search"] + "?" + qs.toString())
.then((response) => response.json())
.then((data) => {
console.log(data);
Expand Down Expand Up @@ -321,13 +320,13 @@ aside {
gap: 10px;
}
.facet-item {
font-size: 0.7rem;
font-size: 1rem;
padding: 16px;
border: 1px solid #ddd;
text-align: center;
cursor: pointer;
max-width: 11rem;
min-height: 11rem;
max-width: 15rem;
min-height: 15rem;
}
.facet-item.selected {
background-color: #f0f8ff;
Expand Down
28 changes: 21 additions & 7 deletions afrc/src/afrc/Search/components/SearchResultItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,31 @@ function clearResult() {
<img src="https://picsum.photos/160" />
</div>
<div class="result-content">
<h2>{{ props.searchResult._source.displayname }}</h2>
<p class="breadcrumb">
<div class="result-displayname">
{{ props.searchResult._source.displayname }}
</div>
<div class="breadcrumb">
(North and Central America &gt; United States &gt; Missouri &gt;
Greene)
</p>
<p class="scope-note">
</div>
<div class="scope-note">
{{ searchResult._source.displaydescription }}
</p>
</div>
<div class="actions">
<Button
label="...show more"
severity="secondary"
text
size="large"
/>
<Button
label="edit"
severity="secondary"
text
as="a"
target="_blank"
size="large"
icon="pi pi-pen-to-square"
:href="'./' + arches.urls.resource + '/' + searchResult._id"
/>
</div>
Expand All @@ -81,22 +86,31 @@ function clearResult() {
height: 16rem;
overflow: hidden;
padding-inline-start: 10px;
padding: 15px;
}
.result h2 {
margin: 0 0 10px;
font-size: 1.2rem;
}
.result .breadcrumb {
color: #888;
font-size: 0.9rem;
color: #415790;
font-size: 1.1rem;
margin-bottom: 10px;
padding: unset;
}
.result .image-placeholder {
width: 16rem;
height: 16rem;
min-width: 16rem;
background-color: #eee;
}
.result-displayname {
font-size: 1.5rem;
font-weight: bold;
}
.scope-note {
font-size: 1.2rem;
}
.actions {
display: flex;
gap: 10px;
Expand Down
1 change: 1 addition & 0 deletions afrc/templates/arches_urls.htm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
{% block arches_urls %}
{{ block.super }}
<div class="arches-urls"
api-search="{% url 'api-search' %}"
api-settings="{% url 'api-settings' %}"
api-map-data="{% url 'api-map-data' %}"
api-feature-buffer="{% url 'api-feature-buffer' %}"
Expand Down
15 changes: 12 additions & 3 deletions afrc/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,26 @@
from django.conf.urls.i18n import i18n_patterns
from django.urls import include, path, re_path
from afrc.views.settings_api import SettingsAPI
from afrc.views.map_api import MapDataAPI, FeatureBufferAPI, GeoJSONBoundsAPI, ReferenceCollectionMVT
from afrc.views.search_api import SearchAPI
from afrc.views.map_api import (
MapDataAPI,
FeatureBufferAPI,
GeoJSONBoundsAPI,
ReferenceCollectionMVT,
)

urlpatterns = [
# project-level urls
path("api-search", SearchAPI.as_view(), name="api-search"),
path("api-settings", SettingsAPI.as_view(), name="api-settings"),
path("api-map-data", MapDataAPI.as_view(), name="api-map-data"),
path("api-feature-buffer", FeatureBufferAPI.as_view(), name="api-feature-buffer"),
path("api-geojson-bounds", GeoJSONBoundsAPI.as_view(), name="api-geojson-bounds"),
re_path(r"^api-reference-collection-mvt/(?P<zoom>[0-9]+|\{z\})/(?P<x>[0-9]+|\{x\})/(?P<y>[0-9]+|\{y\}).pbf$",
re_path(
r"^api-reference-collection-mvt/(?P<zoom>[0-9]+|\{z\})/(?P<x>[0-9]+|\{x\})/(?P<y>[0-9]+|\{y\}).pbf$",
ReferenceCollectionMVT.as_view(),
name="api-reference-collection-mvt"),
name="api-reference-collection-mvt",
),
]

# Ensure Arches core urls are superseded by project-level urls
Expand Down
Loading
Loading