- Pagination arrow color fixed according to page

- Data type showed in suggestions corrected according to user-friendly values
This commit is contained in:
Porras-Bernardez 2024-09-03 12:53:02 +02:00
parent 7953b3c09c
commit 826c5b8c4e
5 changed files with 46 additions and 7 deletions

View File

@ -104,7 +104,7 @@ const prevClick = () => {
<span v-if="props.data.currentPage <= 1" aria-disabled="true" aria-label="Previous"> <span v-if="props.data.currentPage <= 1" aria-disabled="true" aria-label="Previous">
<span <span
aria-disabled="true" aria-disabled="true"
class="bg-gray-300 cursor-not-allowed opacity-50 relative inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default rounded-l-md leading-5" class="bg-gray-300 cursor-not-allowed opacity-30 relative inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default rounded-l-md leading-5"
aria-hidden="true" aria-hidden="true"
> >
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20"> <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
@ -147,7 +147,8 @@ const prevClick = () => {
</template> </template>
</template> --> </template> -->
<!-- next button -->
<!-- next button ----------------------------------------------------------------------------- -->
<!-- v-bind:href="nextPageLink" --> <!-- v-bind:href="nextPageLink" -->
<a <a
v-if="props.data.currentPage < props.data.lastPage" v-if="props.data.currentPage < props.data.lastPage"
@ -168,7 +169,7 @@ const prevClick = () => {
<span v-else aria-disabled="true" aria-label="Next"> <span v-else aria-disabled="true" aria-label="Next">
<span <span
aria-disabled="true" aria-disabled="true"
class="bg-gray-300 cursor-not-allowed relative inline-flex items-center px-2 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default rounded-r-md leading-5" class="opacity-30 bg-gray-300 cursor-not-allowed relative inline-flex items-center px-2 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default rounded-r-md leading-5"
aria-hidden="true" aria-hidden="true"
> >
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20"> <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">

View File

@ -57,7 +57,7 @@ export default class ActiveFacetCategory extends Vue {
* If the category alias is Data Type, the name of the items is set * If the category alias is Data Type, the name of the items is set
* NOTE: This could be corrected directly in the index * NOTE: This could be corrected directly in the index
*/ */
filterItemsAlias(categoryAlias: string): string { getFilterItemsAlias(categoryAlias: string): string {
console.log(categoryAlias); console.log(categoryAlias);
if (categoryAlias === ("data type") || categoryAlias === ("language")) { if (categoryAlias === ("data type") || categoryAlias === ("language")) {
/** /**

View File

@ -4,7 +4,7 @@
<label v-bind:for="categoryAlias" class="css-label"> <label v-bind:for="categoryAlias" class="css-label">
<span>{{ categoryAlias + ": " }}</span> <span>{{ categoryAlias + ": " }}</span>
<!-- <a v-if="filterItems && filterItems.length > 0" class="gsaterm">{{ filterItems.join(" | ") }}</a> --> <!-- <a v-if="filterItems && filterItems.length > 0" class="gsaterm">{{ filterItems.join(" | ") }}</a> -->
<a v-if="filterItems && filterItems.length > 0" class="gsaterm">{{ filterItemsAlias(categoryAlias) }}</a> <a v-if="filterItems && filterItems.length > 0" class="gsaterm">{{ getFilterItemsAlias(categoryAlias) }}</a>
</label> </label>
</div> </div>
</template> </template>

View File

@ -193,7 +193,26 @@ export default class VsInput extends Vue {
const sanitizedValue = DOMPurify.sanitize(result.highlight); const sanitizedValue = DOMPurify.sanitize(result.highlight);
// Replacing the predefined format for highlights given by OpenSearch from <em> emphasys to <b> bold // Replacing the predefined format for highlights given by OpenSearch from <em> emphasys to <b> bold
const replacedValue = sanitizedValue.replace(/<em>/g, '<b>').replace(/<\/em>/g, '</b>'); const replacedValue = sanitizedValue.replace(/<em>/g, '<b>').replace(/<\/em>/g, '</b>');
return `${replacedValue} <em>| ${result.type}</em>`; // return `${replacedValue} <em>| ${result.type}</em>`;
return `${replacedValue} <em>| ${this.getTypeAlias(result.type)}</em>`;
}
/**
* The alias for the result type will be set depending on the name of the type.
* This will allow to display the customised terms instead of the values currently used in the OpenSearch index.
* TODO: This should be corrected directly in the index
*/
getTypeAlias(type: string): string {
switch (type) {
case "author":
return "creator";
case "subjects":
return "keyword";
case "doctype":
return "data type";
default:
return type;
}
} }
/** /**

View File

@ -74,12 +74,31 @@ export default class SearchViewComponent extends Vue {
if (typeof this.searchTerm === "string") { if (typeof this.searchTerm === "string") {
return this.searchTerm; return this.searchTerm;
} else if (this.searchTerm instanceof Suggestion) { } else if (this.searchTerm instanceof Suggestion) {
return this.searchTerm.value + " (" + this.searchTerm.type + ")"; return this.searchTerm.value + " (" + this.getTypeAlias(this.searchTerm.type) + ")";
// return this.searchTerm.value + " (" + this.searchTerm.type + ")";
} else { } else {
return ""; return "";
} }
} }
/**
* The alias for the search term type will be set depending on the name of the type.
* This will allow to display the customised terms instead of the values currently used in the OpenSearch index.
* TODO: This should be corrected directly in the index
*/
getTypeAlias(type: string): string {
switch (type) {
case "author":
return "creator";
case "subjects":
return "keyword";
case "doctype":
return "data type";
default:
return type;
}
}
// Method to check if a search term is present // Method to check if a search term is present
hasSearchTerm(): boolean { hasSearchTerm(): boolean {
if (typeof this.searchTerm === "string" && this.searchTerm !== "") { if (typeof this.searchTerm === "string" && this.searchTerm !== "") {