Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 2.11.0-privacyPolicy
  • APIv2
  • Docs/Setup
  • Experiment/fix-debugging
  • Experimental/Heinrichs-cypress
  • Feature/xxxx-turnOffDataPub
  • Fix/xxxx-ToS400Error
  • Fix/xxxx-migrateLogin
  • Fix/xxxx-tokenUploadButton
  • Hotfix/0038-correctDownload
  • Hotfix/1917-PublicFilesVisibility
  • Hotfix/1963-fixOrganizationField
  • Hotfix/2015-PublicFilesVisibility
  • Hotfix/2130-uiv2ContactChange
  • Hotfix/2144-invitationCall
  • Hotfix/2150-fixUpload
  • Hotfix/2160-userOrgsInst
  • Hotfix/2190-requiredFieldsForUserProfile
  • Hotfix/2196-RCVTableTranslation
  • Hotfix/2212-fixFiles
  • Hotfix/2226-userProfileSaveButton
  • Hotfix/2232-dependencyFix
  • Hotfix/2233-fixMe
  • Hotfix/2258-saveButtonWorksAsExpected
  • Hotfix/2296-selectedValuesNotReturned
  • Hotfix/2308-defaultLicense
  • Hotfix/2335-fixingSearchRCV
  • Hotfix/2353-dropShape
  • Hotfix/2370-fixDeleteButton
  • Hotfix/2378-linkedFix
  • Hotfix/2379-filesDragAndDrop
  • Hotfix/2382-guestStillBuggy
  • Hotfix/2384-guestsAndLinked
  • Hotfix/2427-adminTrouble
  • Hotfix/2459-EncodingPath
  • Hotfix/2465-orcidLink
  • Hotfix/2465-orcidLink-v1.25.1
  • Hotfix/2504-formGen
  • Hotfix/2541-resCreate
  • Hotfix/2601-correctMetadataIdentity
  • Hotfix/2611-feedback
  • Hotfix/2618-turtle
  • Hotfix/2681-validationErrors
  • Hotfix/2684-correctEncoding
  • Hotfix/2684-fixSubMetadata
  • Hotfix/2713-validateEntryName
  • Hotfix/2734-allowEmptyLicense
  • Hotfix/2765-encodingAgain
  • Hotfix/2852-adaptTextForToSUi
  • Hotfix/2853-optimizationV4
  • Hotfix/2943-reloadingResources
  • Hotfix/2943-searchHighlighting
  • Hotfix/2957-styleAndUpgrade
  • Hotfix/2971-fixTextInDataPub
  • Hotfix/2989-cookieLength
  • Hotfix/662-keepSidebarExpanded
  • Hotfix/xxxx-correctLinking
  • Hotfix/xxxx-folderRecursive
  • Hotfix/xxxx-fullscreenCss
  • Hotfix/xxxx-homepageDisplay
  • Hotfix/xxxx-liveReleaseFixes
  • Hotfix/xxxx-partnerProjects
  • Hotfix/xxxx-workingFileIndex
  • Issue/1782-structualDataIntegration
  • Issue/1792-newMetadataStructure
  • Issue/1822-coscineUIv2App
  • Issue/1824-componentsUIv2
  • Issue/1824-routerAdditions
  • Issue/1825-codeQualityPipelines
  • Issue/1833-newLogin
  • Issue/1843-multipleFilesValidation
  • Issue/1860-searchScoping
  • Issue/1861-searchMetadata
  • Issue/1862-searchFacets
  • Issue/1863-paginationForSearch
  • Issue/1926-userProfile
  • Issue/1927-projectAppMigration
  • Issue/1928-sidebarmenuAddition
  • Issue/1929-vuexToPinia
  • Issue/1938-internalHandling
  • Issue/1951-quotaImplementation
  • Issue/1953-owlImports
  • Issue/1957-resourceAppMigration
  • Issue/1957-resourceAppMigrationNew
  • Issue/1962-SearchAppUI2
  • Issue/1964-tokenExpiryUIv2
  • Issue/1965-userListMigration
  • Issue/1970-breadcrumbs
  • Issue/1971-projectEditCreateMigration
  • Issue/1972-homeDepot
  • Issue/1974-shibbolethLogout
  • Issue/1976-resouceCreationVaildEmail
  • Issue/1979-supportAdminUIv2Migration
  • Issue/1980-userManagement
  • Issue/1985-adaptSidebar
  • Issue/2002-migrateResourceCreate
  • Issue/2003-resourceSettings
  • Issue/2008-quotaManagement
  • Issue/2011-pathConfig
  • Issue/2016-BannerMigration
  • 1.28.0-pilot
  • v1.0.0
  • v1.1.0
  • v1.10.0
  • v1.10.1
  • v1.10.2
  • v1.10.3
  • v1.11.0
  • v1.11.1
  • v1.11.2
  • v1.11.3
  • v1.11.4
  • v1.11.5
  • v1.11.6
  • v1.11.7
  • v1.12.0
  • v1.13.0
  • v1.14.0
  • v1.14.1
  • v1.14.2
  • v1.14.3
  • v1.15.0
  • v1.15.1
  • v1.16.0
  • v1.16.1
  • v1.16.2
  • v1.16.3
  • v1.17.0
  • v1.17.1
  • v1.17.2
  • v1.18.0
  • v1.18.1
  • v1.19.0
  • v1.2.0
  • v1.20.0
  • v1.20.1
  • v1.20.2
  • v1.20.3
  • v1.20.4
  • v1.20.5
  • v1.21.0
  • v1.22.0
  • v1.22.1
  • v1.22.2
  • v1.23.0
  • v1.23.1
  • v1.23.2
  • v1.23.3
  • v1.23.4
  • v1.23.5
  • v1.23.6
  • v1.23.6-patch-2417-2427
  • v1.24.0
  • v1.24.1
  • v1.25.0
  • v1.25.1
  • v1.26.0
  • v1.26.1
  • v1.27.0
  • v1.27.1
  • v1.27.1-pilot
  • v1.28.0
  • v1.29.0
  • v1.29.1
  • v1.29.2
  • v1.3.0
  • v1.30.0
  • v1.30.1
  • v1.30.2
  • v1.31.0
  • v1.32.0
  • v1.4.0
  • v1.4.1
  • v1.5.0
  • v1.6.0
  • v1.6.1
  • v1.6.2
  • v1.7.0
  • v1.8.0
  • v1.8.1
  • v1.8.2
  • v1.9.0
  • v2.0.0
  • v2.1.0
  • v2.10.0
  • v2.10.1
  • v2.11.0
  • v2.12.0
  • v2.12.1
  • v2.12.2
  • v2.12.3
  • v2.12.4
  • v2.12.5
  • v2.13.0
  • v2.13.1
  • v2.13.2
  • v2.13.3
  • v2.13.4
  • v2.14.0
  • v2.15.0
200 results

Target

Select target project
  • coscine/frontend/apps/ui
1 result
Select Git revision
  • 2.11.0-privacyPolicy
  • APIv2
  • Docs/Setup
  • Experiment/fix-debugging
  • Experimental/Heinrichs-cypress
  • Feature/xxxx-turnOffDataPub
  • Fix/xxxx-ToS400Error
  • Fix/xxxx-migrateLogin
  • Fix/xxxx-tokenUploadButton
  • Hotfix/0038-correctDownload
  • Hotfix/1917-PublicFilesVisibility
  • Hotfix/1963-fixOrganizationField
  • Hotfix/2015-PublicFilesVisibility
  • Hotfix/2130-uiv2ContactChange
  • Hotfix/2144-invitationCall
  • Hotfix/2150-fixUpload
  • Hotfix/2160-userOrgsInst
  • Hotfix/2190-requiredFieldsForUserProfile
  • Hotfix/2196-RCVTableTranslation
  • Hotfix/2212-fixFiles
  • Hotfix/2226-userProfileSaveButton
  • Hotfix/2232-dependencyFix
  • Hotfix/2233-fixMe
  • Hotfix/2258-saveButtonWorksAsExpected
  • Hotfix/2296-selectedValuesNotReturned
  • Hotfix/2308-defaultLicense
  • Hotfix/2335-fixingSearchRCV
  • Hotfix/2353-dropShape
  • Hotfix/2370-fixDeleteButton
  • Hotfix/2378-linkedFix
  • Hotfix/2379-filesDragAndDrop
  • Hotfix/2382-guestStillBuggy
  • Hotfix/2384-guestsAndLinked
  • Hotfix/2427-adminTrouble
  • Hotfix/2459-EncodingPath
  • Hotfix/2465-orcidLink
  • Hotfix/2465-orcidLink-v1.25.1
  • Hotfix/2504-formGen
  • Hotfix/2541-resCreate
  • Hotfix/2601-correctMetadataIdentity
  • Hotfix/2611-feedback
  • Hotfix/2618-turtle
  • Hotfix/2681-validationErrors
  • Hotfix/2684-correctEncoding
  • Hotfix/2684-fixSubMetadata
  • Hotfix/2713-validateEntryName
  • Hotfix/2734-allowEmptyLicense
  • Hotfix/2765-encodingAgain
  • Hotfix/2852-adaptTextForToSUi
  • Hotfix/2853-optimizationV4
  • Hotfix/2943-reloadingResources
  • Hotfix/2943-searchHighlighting
  • Hotfix/2957-styleAndUpgrade
  • Hotfix/2971-fixTextInDataPub
  • Hotfix/2989-cookieLength
  • Hotfix/662-keepSidebarExpanded
  • Hotfix/xxxx-correctLinking
  • Hotfix/xxxx-folderRecursive
  • Hotfix/xxxx-fullscreenCss
  • Hotfix/xxxx-homepageDisplay
  • Hotfix/xxxx-liveReleaseFixes
  • Hotfix/xxxx-partnerProjects
  • Hotfix/xxxx-workingFileIndex
  • Issue/1782-structualDataIntegration
  • Issue/1792-newMetadataStructure
  • Issue/1822-coscineUIv2App
  • Issue/1824-componentsUIv2
  • Issue/1824-routerAdditions
  • Issue/1825-codeQualityPipelines
  • Issue/1833-newLogin
  • Issue/1843-multipleFilesValidation
  • Issue/1860-searchScoping
  • Issue/1861-searchMetadata
  • Issue/1862-searchFacets
  • Issue/1863-paginationForSearch
  • Issue/1926-userProfile
  • Issue/1927-projectAppMigration
  • Issue/1928-sidebarmenuAddition
  • Issue/1929-vuexToPinia
  • Issue/1938-internalHandling
  • Issue/1951-quotaImplementation
  • Issue/1953-owlImports
  • Issue/1957-resourceAppMigration
  • Issue/1957-resourceAppMigrationNew
  • Issue/1962-SearchAppUI2
  • Issue/1964-tokenExpiryUIv2
  • Issue/1965-userListMigration
  • Issue/1970-breadcrumbs
  • Issue/1971-projectEditCreateMigration
  • Issue/1972-homeDepot
  • Issue/1974-shibbolethLogout
  • Issue/1976-resouceCreationVaildEmail
  • Issue/1979-supportAdminUIv2Migration
  • Issue/1980-userManagement
  • Issue/1985-adaptSidebar
  • Issue/2002-migrateResourceCreate
  • Issue/2003-resourceSettings
  • Issue/2008-quotaManagement
  • Issue/2011-pathConfig
  • Issue/2016-BannerMigration
  • 1.28.0-pilot
  • v1.0.0
  • v1.1.0
  • v1.10.0
  • v1.10.1
  • v1.10.2
  • v1.10.3
  • v1.11.0
  • v1.11.1
  • v1.11.2
  • v1.11.3
  • v1.11.4
  • v1.11.5
  • v1.11.6
  • v1.11.7
  • v1.12.0
  • v1.13.0
  • v1.14.0
  • v1.14.1
  • v1.14.2
  • v1.14.3
  • v1.15.0
  • v1.15.1
  • v1.16.0
  • v1.16.1
  • v1.16.2
  • v1.16.3
  • v1.17.0
  • v1.17.1
  • v1.17.2
  • v1.18.0
  • v1.18.1
  • v1.19.0
  • v1.2.0
  • v1.20.0
  • v1.20.1
  • v1.20.2
  • v1.20.3
  • v1.20.4
  • v1.20.5
  • v1.21.0
  • v1.22.0
  • v1.22.1
  • v1.22.2
  • v1.23.0
  • v1.23.1
  • v1.23.2
  • v1.23.3
  • v1.23.4
  • v1.23.5
  • v1.23.6
  • v1.23.6-patch-2417-2427
  • v1.24.0
  • v1.24.1
  • v1.25.0
  • v1.25.1
  • v1.26.0
  • v1.26.1
  • v1.27.0
  • v1.27.1
  • v1.27.1-pilot
  • v1.28.0
  • v1.29.0
  • v1.29.1
  • v1.29.2
  • v1.3.0
  • v1.30.0
  • v1.30.1
  • v1.30.2
  • v1.31.0
  • v1.32.0
  • v1.4.0
  • v1.4.1
  • v1.5.0
  • v1.6.0
  • v1.6.1
  • v1.6.2
  • v1.7.0
  • v1.8.0
  • v1.8.1
  • v1.8.2
  • v1.9.0
  • v2.0.0
  • v2.1.0
  • v2.10.0
  • v2.10.1
  • v2.11.0
  • v2.12.0
  • v2.12.1
  • v2.12.2
  • v2.12.3
  • v2.12.4
  • v2.12.5
  • v2.13.0
  • v2.13.1
  • v2.13.2
  • v2.13.3
  • v2.13.4
  • v2.14.0
  • v2.15.0
200 results
Show changes
Commits on Source (13)
Showing
with 225 additions and 96 deletions
{
"name": "ui",
"version": "1.24.1",
"version": "1.25.0",
"private": true,
"scripts": {
"dev": "vite",
......@@ -13,7 +13,7 @@
"coverage": "vitest run --coverage"
},
"dependencies": {
"@coscine/api-client": "^2.9.2",
"@coscine/api-client": "^2.10.0",
"@coscine/form-generator": "^3.1.2",
"@pinia/testing": "^0.0.14",
"@rdfjs-elements/formats-pretty": "^0.5.1",
......
......@@ -34,6 +34,11 @@
</b-popover>
</div>
</template>
<!-- Hint Text -->
<div id="hint" class="small text-muted">
<slot name="hint" />
</div>
</b-form-group>
</template>
......
......@@ -7,7 +7,7 @@
>
<b-navbar-nav>
<!-- Coscine -->
<b-nav-item :href="$t('nav.url.extrasHelp').toString()" target="_blank">
<b-nav-item :href="$t('nav.url.coscine').toString()" target="_blank">
<u>{{ $t("nav.coscine") }}</u>
</b-nav-item>
<div class="vl" />
......
......@@ -4,19 +4,26 @@
<!-- Coscine Logo -->
<b-navbar-brand id="coscineLogo">
<!-- Added conditional navigation to avoid navigation guard errors in the console -->
<RouterLink :to="isLoggedIn ? { name: 'home' } : ''">
<RouterLink v-if="isLoggedIn" :to="{ name: 'home' }">
<img
alt="Coscine Logo"
src="@/assets/svg/coscine_white.svg"
class="mx-3"
/>
</RouterLink>
<b-link v-else :href="$t('nav.url.coscine').toString()">
<img
alt="Coscine Logo"
src="@/assets/svg/coscine_white.svg"
class="mx-3"
/>
</b-link>
</b-navbar-brand>
<b-navbar-toggle target="nav-collapse" class="b-0" />
<b-collapse id="nav-collapse" is-nav>
<!-- Search Bar -->
<b-navbar-nav v-if="isLoggedIn" class="ml-auto px-2">
<b-navbar-nav v-if="searchBarVisibility" class="ml-auto px-2">
<b-nav-form @submit.stop.prevent="triggerSearch">
<b-input-group size="sm" class="searchBar">
<template #prepend>
......@@ -167,6 +174,12 @@ export default defineComponent({
isLoggedIn(): boolean {
return this.loginStore.isLoggedIn;
},
searchBarVisibility(): boolean {
if (this.isLoggedIn && this.$route.name !== "search") {
return true;
}
return false;
},
user(): null | UserObject {
return this.userStore.user;
},
......
......@@ -26,6 +26,7 @@ export default {
extrasDisclaimer:
"https://git.rwth-aachen.de/coscine/docs/public/terms/-/blob/master/PrivacyPolicy.md",
extrasImprint: "https://www.coscine.de/imprint/",
coscine: "https://www.coscine.de/",
},
} as VueI18n.LocaleMessageObject,
......
......@@ -26,6 +26,7 @@ export default {
extrasDisclaimer:
"https://git.rwth-aachen.de/coscine/docs/public/terms/-/blob/master/PrivacyPolicy.md",
extrasImprint: "https://www.coscine.de/en/imprint/",
coscine: "https://www.coscine.de/en/",
},
} as VueI18n.LocaleMessageObject,
......
......@@ -314,8 +314,8 @@ export default defineComponent({
},
created() {
// Load list of Enabled Resource Types if not present
if (this.resourceStore.enabledResourceTypes === null) {
// Load list of all Resource Types if not present
if (this.resourceStore.resourceTypes === null) {
this.resourceStore.retrieveResourceTypes();
}
},
......
......@@ -95,10 +95,7 @@ export default defineComponent({
) {
this.projectStore.retrieveInvitations(this.project);
}
// Load list of Enabled Resource Types if not present
if (this.resourceStore.enabledResourceTypes === null) {
await this.resourceStore.retrieveResourceTypes();
}
await this.resourceStore.retrieveEnabledResourceTypes(this.project);
},
},
});
......
......@@ -57,6 +57,30 @@
v-model="selectedResourceType.iDisplayName"
disabled
/>
<!-- Hint -->
<template #hint>
<!-- Logged in with ORCID -->
<i18n
v-if="externalUser"
path="page.createResource.configuration.labels.hintTextORCiD"
tag="span"
>
<template #userProfile>
<b-link :to="{ name: 'userprofile' }">
{{ $t("breadcrumbs.user.profile") }}
</b-link>
</template>
</i18n>
<!-- Logged in with SSO -->
<span v-else>
{{
$t("page.createResource.configuration.labels.hintTextSSO", {
organizationName: organizations[0],
})
}}
</span>
</template>
</CoscineFormGroup>
<!-- Resource Description -->
......@@ -128,6 +152,8 @@ import type {
ResourceTypeObject,
} from "@coscine/api-client/dist/types/Coscine.Api.Resources";
import type { LabeledResourceObject, ResourceTypeOption } from "../../types";
import useUserStore from "@/modules/user/store";
import type { OrganizationObject } from "@coscine/api-client/dist/types/Coscine.Api.Organization";
export default defineComponent({
components: {
......@@ -156,8 +182,9 @@ export default defineComponent({
const mainStore = useMainStore();
const projectStore = useProjectStore();
const resourceStore = useResourceStore();
const userStore = useUserStore();
return { mainStore, projectStore, resourceStore };
return { mainStore, projectStore, resourceStore, userStore };
},
data() {
......@@ -171,6 +198,24 @@ export default defineComponent({
isOwner(): boolean | undefined {
return this.projectStore.currentUserRoleIsOwner;
},
organizations(): string[] {
if (this.userMemberships) {
return this.userMemberships
.filter((organization) => !(organization.url?.indexOf("#") !== -1)) // If does contain "#" it's a sub level organization, otherwise top level
.map((org) => (org.displayName ? org.displayName : "")) // Extract organization display name, could contain empty strings
.filter((n) => n); // Filter out empty strings, if any;
}
return [];
},
organizationsSet(): boolean {
return this.organizations && this.organizations.length > 0;
},
externalUser(): boolean {
return !this.organizationsSet;
},
userMemberships(): null | OrganizationObject[] {
return this.userStore.userProfile.userMemberships;
},
resourceTypes(): LabeledResourceObject[] | null {
const labeledResourceTypes: LabeledResourceObject[] = [];
const resourceTypes = this.resourceStore.enabledResourceTypes;
......
......@@ -20,6 +20,10 @@ export default {
"Für weitere Informationen zu Ressourcentypen siehe",
resourceTypePopoverUrl:
"https://docs.coscine.de/de/rdm/resources/about/",
hintTextSSO:
"Die von Ihnen erstellbaren Ressourcentypen werden durch Ihre Zugehörigkeit zu Organisation {organizationName} beeinflusst. Bedienen Sie das Dropdown-Menü, um die für Sie verfügbaren Optionen zu sehen.",
hintTextORCiD:
"Die von Ihnen erstellbaren Ressourcentypen werden durch Ihre Zugehörigkeit zu einer Organisation beeinflusst. Verknüpfen Sie Ihr Organisationskonto unter {userProfile}, um mehr Optionen zu sehen",
},
popover: {
title: "Quota nicht ausreichend",
......
......@@ -20,6 +20,10 @@ export default {
resourceTypePopover: "For more information on resource types see",
resourceTypePopoverUrl:
"https://docs.coscine.de/en/rdm/resources/about/",
hintTextSSO:
"The resource types you can create are impacted by your affiliation with {organizationName}. Check the dropdown menu to see the options available to you.",
hintTextORCiD:
"The resource types you can create are impacted by your affiliation. Merge your organization account under {userProfile} to make more options available to you",
},
popover: {
title: "Quota not sufficient",
......
......@@ -191,7 +191,7 @@ export default defineComponent({
}
// Load list of Enabled Resource Types if not present
if (this.resourceStore.enabledResourceTypes === null) {
await this.resourceStore.retrieveResourceTypes();
await this.resourceStore.retrieveEnabledResourceTypes(this.project);
}
// Load Project Visibilities if not present
if (this.projectStore.visibilities === null) {
......
......@@ -17,7 +17,6 @@ import type {
Project,
ResourceObject,
ResourceQuotaReturnObject,
ResourceTypeInformation,
} from "@coscine/api-client/dist/types/Coscine.Api.Resources";
import type { Route } from "vue-router/types/router";
import type { BilingualLabels } from "@coscine/api-client/dist/types/Coscine.Api.Metadata";
......@@ -48,6 +47,7 @@ export const useResourceStore = defineStore({
classes: {},
currentId: null,
resourceTypes: null,
enabledResourceTypes: null,
visitedResources: {},
}),
......@@ -84,14 +84,6 @@ export const useResourceStore = defineStore({
return null;
}
},
enabledResourceTypes(): ResourceTypeInformation[] | null {
if (this.resourceTypes) {
return this.resourceTypes.filter((rt) => rt.isEnabled);
} else {
return null;
}
},
},
/*
--------------------------------------------------------------------------------------
......@@ -205,6 +197,24 @@ export const useResourceStore = defineStore({
}
},
async retrieveEnabledResourceTypes(project: ProjectObject | null) {
const notificationStore = useNotificationStore();
try {
if (project && project.id) {
const apiResponse =
await ResourceTypeApi.resourceTypeGetEnabledResourceTypesAll(
project.id
);
this.enabledResourceTypes = apiResponse.data;
} else {
console.error("Selected project is null or its ID is undefined.");
}
} catch (error) {
// Handle other Status Codes
notificationStore.postApiErrorNotification(error as AxiosError);
}
},
async retrieveResourceTypes() {
const notificationStore = useNotificationStore();
try {
......
......@@ -64,5 +64,6 @@ export interface ResourceState {
classes: { [className: string]: BilingualLabels };
currentId: string | null;
resourceTypes: ResourceTypeInformation[] | null;
enabledResourceTypes: ResourceTypeInformation[] | null;
visitedResources: { [slug: string]: VisitedResourceObject };
}
......@@ -29,6 +29,16 @@ export default {
return true;
}
}
const typeQueryString = "/@type=metadata";
if (graphName.indexOf(typeQueryString) !== -1) {
const urlEnd = graphName.substring(
0,
graphName.indexOf(typeQueryString)
);
if (urlEnd.endsWith(filterPath)) {
return true;
}
}
}
return false;
});
......
......@@ -41,7 +41,8 @@ export default defineComponent({
if (!this.resourceStore.allResources) {
await this.resourceStore.retrieveAllResources();
}
if (!this.resourceStore.enabledResourceTypes) {
// Load list of all Resource Types if not present
if (!this.resourceStore.resourceTypes) {
await this.resourceStore.retrieveResourceTypes();
}
},
......
......@@ -16,7 +16,7 @@ export default {
Item2: "Eintrag 2",
},
all: "Alle Einträge",
none: "Alle Einträge",
metadata: "Dateien",
resource: "Ressourcen",
project: "Projekte",
......
......@@ -16,7 +16,7 @@ export default {
Item2: "Item2",
},
all: "All Entries",
none: "All Entries",
metadata: "Files",
resource: "Resources",
project: "Projects",
......
......@@ -5,8 +5,10 @@
<b-row id="mainRow" class="m-0">
<!-- Sidebar -->
<Sidebar
:results="resultsForTable"
@filter="assignResultsFilter($event)"
:is-loading="resultsViewLoading"
@queryWithCategory="
queryData(searchText, selectedPage, paginationPageSize, $event)
"
/>
<b-col
......@@ -184,7 +186,12 @@
</b-row>
<!-- Pagination -->
<b-row class="text-right" align-v="center" no-gutters>
<b-row
v-if="!resultsViewLoading"
class="text-right"
align-v="center"
no-gutters
>
<b-col align-self="center" class="p-0" />
<b-col align-self="center" class="p-0">
<b-pagination
......@@ -222,8 +229,12 @@ import useResourceStore from "@/modules/resource/store";
import type { ProjectObject } from "@coscine/api-client/dist/types/Coscine.Api.Project";
import type { ResourceObject } from "@coscine/api-client/dist/types/Coscine.Api.Resources";
import type { ItemSearchResult } from "@coscine/api-client/dist/types/Coscine.Api.Search";
import { Pagination } from "../types";
import type {
CategoryFilter,
ItemSearchResult,
} from "@coscine/api-client/dist/types/Coscine.Api.Search";
import { CategoryFilters, type Pagination } from "../types";
import type { Dictionary } from "vue-router/types/router";
export default defineComponent({
components: {
......@@ -248,7 +259,6 @@ export default defineComponent({
projectSubProjects: [] as ProjectObject[],
filterTags: [],
filteredResults: [] as ItemSearchResult[],
resultsViewFields: ["type"],
resultsViewLoading: true,
......@@ -337,10 +347,6 @@ export default defineComponent({
this.retrieveSubProjects();
},
// resultsForTable() {
// this.assignResultsFilter();
// },
selectedPage() {
this.queryData(
this.searchText,
......@@ -362,7 +368,6 @@ export default defineComponent({
this.searchText = this.getSearchQuery();
this.retrieveResources();
this.retrieveSubProjects();
this.assignResultsFilter();
},
methods: {
......@@ -389,15 +394,47 @@ export default defineComponent({
const query = Object.fromEntries(urlSearchParams.entries());
return query !== null ? decodeURIComponent(query.q) : "";
},
async queryData(query: string, pageNumber: number, pageSize: number) {
getCategoryQuery() {
const urlSearchParams = new URLSearchParams(window.location.search);
const query = Object.fromEntries(urlSearchParams.entries());
return query &&
query.filter &&
decodeURIComponent(query.filter) !== "undefined"
? (decodeURIComponent(query.filter) as CategoryFilter)
: undefined;
},
async queryData(
query: string,
pageNumber: number,
pageSize: number,
category: CategoryFilter | undefined = undefined
) {
this.resultsViewLoading = true;
// attach search query, resulting in "/search?q=<searchTerm>"
this.$router.push({ name: "search", query: { q: query } });
// If we load the page, we have to respect the filter
if (!category) {
category = this.getCategoryQuery();
}
let q = { q: query } as Dictionary<string>;
if (category && category !== CategoryFilters.None) {
q = { q: query, filter: category };
}
this.$router.push({
name: "search",
query: q,
});
// attach search query, resulting in "/search?q=<searchTerm>
await this.searchStore.retrieveSearchResults(
query,
pageNumber,
pageSize,
this.selectedProject
this.selectedProject,
category
);
this.resultsViewLoading = false;
},
......@@ -420,13 +457,6 @@ export default defineComponent({
this.projectSubProjects = [];
}
},
assignResultsFilter(content: ItemSearchResult[] | null = null) {
if (content) {
this.filteredResults = content;
} else {
this.filteredResults = this.resultsForTable;
}
},
},
});
</script>
......
<template>
<b-col class="pl-0">
<!-- Side Bar Container Card -->
<b-card id="sidebarContainer">
<b-list-group>
<!-- Side Bar Button List -->
<b-list-group v-if="!isLoading && resultTypes && resultTypes.length > 0">
<!-- Side Bar Content -->
<b-list-group-item
v-for="(entry, key) in resultTypes"
:key="key"
v-for="category in resultTypes"
:key="category.Name"
button
:active="entry.item === selectedFilter"
@click="assignResultsFilter(entry.item)"
:active="category.Name === selectedFilter"
:disabled="category.Count === 0"
hover
@click="assignResultsFilter(category)"
>
<b-row align-v="center" no-gutters>
<b-col>
<!-- Search Result Type Label -->
<span>
{{ $t(`page.search.${entry.item.toLowerCase()}`) }}
{{ $t(`page.search.${category.Name.toLowerCase()}`) }}
</span>
</b-col>
<b-col md="auto">
<!-- Total Count Badge -->
<b-badge
class="float-right"
:variant="entry.item === selectedFilter ? 'light' : 'primary'"
:variant="
category.Name === selectedFilter
? 'light'
: category.Count > 0
? 'secondary'
: 'light'
"
>
{{ entry.count }}
{{ category.Count }}
</b-badge>
</b-col>
</b-row>
</b-list-group-item>
</b-list-group>
<!-- Side Bar Skeleton -->
<b-list-group v-else>
<b-list-group-item v-for="key in 4" :key="key">
<b-skeleton animation="wave" width="85%" />
</b-list-group-item>
</b-list-group>
</b-card>
</b-col>
</template>
<script lang="ts">
import { defineComponent, type PropType } from "vue";
import { defineComponent } from "vue";
// import the store for current module
import useSearchStore from "../../store";
// import the main store
import useMainStore from "@/store/index";
import type { ItemSearchResult } from "@coscine/api-client/dist/types/Coscine.Api.Search";
import { type Category, CategoryFilters } from "../../types";
import type { CategoryFilter } from "@coscine/api-client/dist/types/Coscine.Api.Search/api";
export default defineComponent({
props: {
results: {
type: Array as PropType<ItemSearchResult[]>,
required: true,
isLoading: {
default: true,
type: Boolean,
},
},
emits: {
filter: (_: ItemSearchResult[]) => true,
queryWithCategory: (_: CategoryFilter) => true,
},
setup() {
const mainStore = useMainStore();
const searchStore = useSearchStore();
......@@ -59,52 +81,37 @@ export default defineComponent({
data() {
return {
filterStringAll: "All", // Don't overwrite
filteredResults: [] as ItemSearchResult[],
selectedFilter: null as string | null,
selectedFilter: CategoryFilters.None as CategoryFilter,
};
},
computed: {
resultTypes(): { item: string; count: number }[] {
const types = [] as { item: string; count: number }[];
if (this.results) {
types.push({ item: this.filterStringAll, count: this.results.length });
const foundTypes = this.results
.flatMap((n) => n.type)
.filter((v, i, a) => a.indexOf(v) === i) as string[];
if (foundTypes) {
foundTypes.forEach((t) => {
types.push({
item: t,
count: this.results.filter((n) => n.type === t).length,
});
});
}
resultTypes(): Category[] | null {
if (this.searchStore.pagination?.Categories) {
return this.searchStore.pagination.Categories;
} else {
return null;
}
return types;
},
},
watch: {
results() {
this.assignResultsFilter();
},
filteredResults() {
this.$emit("filter", this.filteredResults);
},
mounted() {
this.selectedFilter = this.getCategoryQuery();
},
methods: {
assignResultsFilter(type: string | null = null) {
if (type && type !== this.filterStringAll) {
this.selectedFilter = type;
this.filteredResults = this.results.filter((e) => e.type === type);
} else {
this.selectedFilter = this.filterStringAll;
this.filteredResults = this.results;
}
assignResultsFilter(category: Category) {
this.selectedFilter = category.Name;
this.$emit("queryWithCategory", category.Name);
},
getCategoryQuery() {
const urlSearchParams = new URLSearchParams(window.location.search);
const query = Object.fromEntries(urlSearchParams.entries());
return query &&
query.filter &&
decodeURIComponent(query.filter) !== "undefined"
? (decodeURIComponent(query.filter) as CategoryFilter)
: CategoryFilters.None;
},
},
});
......