Code commenting

This commit is contained in:
Porras-Bernardez 2024-09-16 12:57:26 +02:00
parent 50ab318854
commit 8e3f4fa88e
4 changed files with 161 additions and 240 deletions

View file

@ -61,16 +61,14 @@ export default class SearchViewComponent extends Vue {
// };
private open: OpenSettings = {
core: OPEN_CORE, //"rdr_data", // SOLR.core;
host: OPEN_HOST, //"tethys.at",
core: OPEN_CORE,
host: OPEN_HOST, //"https://catalog.geosphere.at",
};
private error = "";
// Computed property to get search term as string
get stringSearchTerm(): string {
// console.log("stringSearchTerm:", this.searchTerm);
get stringSearchTerm(): string {
if (typeof this.searchTerm === "string") {
return this.searchTerm;
} else if (this.searchTerm instanceof Suggestion) {
@ -109,9 +107,6 @@ export default class SearchViewComponent extends Vue {
return false;
}
}
// getKeyName(value: string) {
// return Object.entries(Suggestion).find(([key, val]) => val === value)?.[0];
// }
// Method to get enum key by enum value
getEnumKeyByEnumValue<T extends { [index: string]: string }>(myEnum: T, enumValue: string): keyof T | null {
@ -122,9 +117,6 @@ export default class SearchViewComponent extends Vue {
// Lifecycle hook: executed before the component is mounted
beforeMount(): void {
// console.log("beforeMount!");
// this.rdrAPI = new DatasetService();
// Trigger search based on provided display and type props
if (this.display != "" && this.type != undefined) {
const enumKey: "Title" | "Author" | "Subject" | "Doctype" | null = this.getEnumKeyByEnumValue(SearchType, this.type);

View file

@ -1,95 +1,37 @@
<template>
<div id="page_style" class="rows site-content page__style page__description" autocomplete="off">
<!-- Search input section -->
<div class="container-fluid banner mz-5">
<vs-input v-bind:propDisplay="searchTerm" v-bind:placeholder="'Enter your search term...'" @search-change="onSearch"></vs-input>
</div>
<!-- <div class="column is-half is-offset-one-quarter" style="padding-top: 0; margin-top: 0">
<div v-if="results.length > 0" class="result-list-info">
<div v-if="hasSearchTerm()" class="resultheader">
Your search term {{ "'" + stringSearchTerm + "'" }} yielded <strong>{{ numFound }}</strong> results:
</div>
</div>
<div v-else-if="results.length == 0">
<div class="resultheader">
Your search yielded
<strong> 0</strong> results:
</div>
</div>
</div> -->
<!-- ASK ELNAZ! ------------------------------------------------------------------------------------------------- -->
<!-- Results area on top of the list of publications -->
<div class="columns">
<!-- Left sidebar section. Empty, just to keep simetry -->
<div id="id-side-bar" class="column is-4 sidebar_column" style="padding-top: 0rem; padding-right: 1.5rem; padding-left: 1.5rem">
</div>
<!-- Results section -->
<div class="col col-8 column is-8 results_column" style="padding-top: 0.5rem; padding-right: 1rem; padding-left: 1rem; padding-bottom: 0rem;">
<!-- <div v-if="results.length > 0" class="result-list-info">
<div v-if="hasSearchTerm()" class="resultheader">
Your search term {{ "'" + stringSearchTerm + "'" }} yielded <strong>{{ numFound }}</strong> results:
</div>
</div> -->
<!-- Option 1: Enclose in a Colored Box -->
<!-- <div v-if="results.length > 0" class="result-list-info">
<div v-if="hasSearchTerm()" class="bg-blue-50 border-l-4 border-blue-400 p-4">
<p class="text-sm text-blue-700">
Your search term <span class="font-semibold">{{ "'" + stringSearchTerm + "'" }}</span> yielded <strong>{{ numFound }}</strong> results:
</p>
</div>
</div> -->
<!-- Option 2: Use a Notice/Alert Style -->
<!--
<div v-if="results.length > 0" class="result-list-info">
<div v-if="hasSearchTerm()" class="bg-yellow-100 border border-yellow-300 text-yellow-800 px-4 py-3 rounded-md" role="alert">
<span class="block sm:inline">Your search term <span class="font-semibold">{{ "'" + stringSearchTerm + "'" }}</span> yielded <strong>{{ numFound }}</strong> results:</span>
</div>
</div>
-->
<!-- Option 3: Highlight with a Callout -->
<!-- Display results if any -->
<div v-if="results.length > 0" class="result-list-info">
<div v-if="hasSearchTerm()" class="p-1 mb-0 text-sm bg-[#d8f4f7] rounded-lg" role="alert">
<span class="font-medium pl-5">Your search term</span> <span class="font-semibold">{{ "'" + stringSearchTerm + "'" }}</span> yielded <strong>{{ numFound }}</strong> results:
</div>
</div>
<!-- Option 4: Bold with Underline -->
<!--
<div v-if="results.length > 0" class="result-list-info">
<div v-if="hasSearchTerm()" class="text-lg font-bold underline text-gray-800">
Your search term <span class="font-semibold">{{ "'" + stringSearchTerm + "'" }}</span> yielded <strong>{{ numFound }}</strong> results:
</div>
</div>
-->
<!-- Display message if no results found -->
<div v-else-if="results.length == 0">
<div class="p-1 mb-0 text-sm bg-[#d8f4f7] rounded-lg" role="alert">
<span class="font-medium pl-5">Your search yielded <strong> 0</strong> results:</span>
<!-- Your search yielded
<strong> 0</strong> results: -->
<span class="font-medium pl-5">Your search yielded <strong> 0</strong> results.</span>
</div>
</div>
<!-- <div v-else-if="results.length == 0">
<div class="resultheader">
Your search yielded
<strong> 0</strong> results:
</div>
</div> -->
</div>
</div>
<!-- Area with the list of facets (left) and list of publications (right) -->
<div class="columns">
<!-- Sidebar with facets -->
<div id="id-side-bar" class="column is-4 sidebar_column" style="padding-top: 0.5rem; padding-right: 1.5rem; padding-left: 1.5rem">
<div id="externals" class="">
<div v-for="(facetItems, key, index) in facets" v-bind:key="index" name="external_card" style="margin-bottom: 0px">
@ -98,10 +40,11 @@
</div>
</div>
<!-- Main results section with pagination and active filters -->
<div class="col col-8 column is-8 results_column" style="padding-top: 0.5rem; padding-right: 1rem; padding-left: 1rem">
<div v-if="activeFilterCategories && Object.keys(activeFilterCategories).length > 0" class="column">
<span v-for="(values, key, index) in activeFilterCategories" v-bind:key="index" class="active-filter-items">
<!-- {{ values }} {{key}} {{index }} -->
<!-- Active filter categories -->
<active-facet-category
v-bind:filterItems="values"
v-bind:categoryName="key"
@ -110,18 +53,17 @@
</span>
</div>
<div class="results">
<!-- pagination before search results -->
<!-- Pagination before search results -->
<PaginationComponent class="mb-5" v-bind:data="pagination" @menu-click="onMenuClick"></PaginationComponent>
<!-- Results section -->
<vs-result v-bind:datasets="results"></vs-result>
<!-- pagination after serach results -->
<!-- Pagination after search results -->
<PaginationComponent class="mt-5" v-bind:data="pagination" @menu-click="onMenuClick"></PaginationComponent>
</div>
</div>
<!-- <PaginationComponent v-bind:data="pagination"></PaginationComponent> -->
</div>
<!-- Partner logos section -->
<div class="container-fluid">
<!-- <div class="columns is-mobile partner-logos"> -->
<div class="columns">
@ -165,4 +107,4 @@ export default SearchViewComponent;
import "@/index.css";
</script>
<style scoped></style>
<style scoped></style>