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 (8)
{ {
"name": "ui", "name": "ui",
"version": "1.11.7", "version": "1.12.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
"stream-to-string": "^1.2.0", "stream-to-string": "^1.2.0",
"uuid": "^8.3.2", "uuid": "^8.3.2",
"vite-aliases": "^0.9.1", "vite-aliases": "^0.9.1",
"vue": "^2.6.14", "vue": "~2.6.14",
"vue-demi": "^0.12.1", "vue-demi": "^0.12.1",
"vue-i18n": "^8.27.0", "vue-i18n": "^8.27.0",
"vue-multiselect": "^2.1.6", "vue-multiselect": "^2.1.6",
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
"vite": "^2.8.6", "vite": "^2.8.6",
"vite-plugin-vue2": "^2.0.1", "vite-plugin-vue2": "^2.0.1",
"vite-plugin-windicss": "^1.8.3", "vite-plugin-windicss": "^1.8.3",
"vue-template-compiler": "^2.6.14" "vue-template-compiler": "~2.6.14"
}, },
"packageManager": "yarn@3.2.1" "packageManager": "yarn@3.2.1"
} }
...@@ -249,12 +249,14 @@ export const useProjectStore = defineStore({ ...@@ -249,12 +249,14 @@ export const useProjectStore = defineStore({
} }
}, },
async retrieveSubProjects(project: ProjectObject | null) { async getSubProjects(
project: ProjectObject | null
): Promise<ProjectObject[]> {
const notificationStore = useNotificationStore(); const notificationStore = useNotificationStore();
try { try {
if (project && project.id && project.slug) { if (project && project.id && project.slug) {
const apiResponse = await SubProjectApi.subProjectGet(project.id); const apiResponse = await SubProjectApi.subProjectGet(project.id);
this.visitedProjects[project.slug].subProjects = apiResponse.data; return apiResponse.data;
} else { } else {
console.error("Selected project is null or its ID is undefined."); console.error("Selected project is null or its ID is undefined.");
} }
...@@ -262,14 +264,26 @@ export const useProjectStore = defineStore({ ...@@ -262,14 +264,26 @@ export const useProjectStore = defineStore({
// Handle other Status Codes // Handle other Status Codes
notificationStore.postApiErrorNotification(error as AxiosError); notificationStore.postApiErrorNotification(error as AxiosError);
} }
return [];
}, },
async retrieveResources(project: ProjectObject | null) { async retrieveSubProjects(project: ProjectObject | null) {
if (project && project.slug) {
this.visitedProjects[project.slug].subProjects =
await this.getSubProjects(project);
} else {
console.error("Selected project is null or its ID is undefined.");
}
},
async getResources(
project: ProjectObject | null
): Promise<ResourceObject[]> {
const notificationStore = useNotificationStore(); const notificationStore = useNotificationStore();
try { try {
if (project && project.id && project.slug) { if (project && project.id && project.slug) {
const apiResponse = await ProjectApi.projectGetResources(project.id); const apiResponse = await ProjectApi.projectGetResources(project.id);
this.visitedProjects[project.slug].resources = apiResponse.data; return apiResponse.data;
} else { } else {
console.error("Selected project is null or its ID is undefined."); console.error("Selected project is null or its ID is undefined.");
} }
...@@ -277,6 +291,16 @@ export const useProjectStore = defineStore({ ...@@ -277,6 +291,16 @@ export const useProjectStore = defineStore({
// Handle other Status Codes // Handle other Status Codes
notificationStore.postApiErrorNotification(error as AxiosError); notificationStore.postApiErrorNotification(error as AxiosError);
} }
return [];
},
async retrieveResources(project: ProjectObject | null) {
if (project && project.slug) {
const resources = await this.getResources(project);
this.visitedProjects[project.slug].resources = resources;
} else {
console.error("Selected project is null or its ID is undefined.");
}
}, },
async retrieveQuotas(project: ProjectObject | null) { async retrieveQuotas(project: ProjectObject | null) {
......
...@@ -14,13 +14,16 @@ import { defineComponent } from "vue-demi"; ...@@ -14,13 +14,16 @@ import { defineComponent } from "vue-demi";
import useSearchStore from "./store"; import useSearchStore from "./store";
// import the main store // import the main store
import useMainStore from "@/store/index"; import useMainStore from "@/store/index";
// import the project store
import useProjectStore from "@/modules/project/store";
export default defineComponent({ export default defineComponent({
setup() { setup() {
const mainStore = useMainStore(); const mainStore = useMainStore();
const searchStore = useSearchStore(); const searchStore = useSearchStore();
const projectStore = useProjectStore();
return { mainStore, searchStore }; return { mainStore, searchStore, projectStore };
}, },
computed: { computed: {
...@@ -35,8 +38,9 @@ export default defineComponent({ ...@@ -35,8 +38,9 @@ export default defineComponent({
methods: { methods: {
async initialize() { async initialize() {
// do initialization stuff (e.g. API calls, element loading, etc.) if (!this.projectStore.allProjects) {
// ... await this.projectStore.retrieveAllProjects();
}
}, },
}, },
}); });
......
...@@ -17,18 +17,26 @@ ...@@ -17,18 +17,26 @@
></b-form-input> ></b-form-input>
</b-col> </b-col>
<b-col id="selectProjCol" sm="2" align-self="center" class="pl-0"> <b-col id="selectProjCol" sm="2" align-self="center" class="pl-0">
<b-form-select v-model="selectProjValue"> <b-form-select
v-model="selectedProject"
:options="allProjectsOptions"
@change="queryData(searchText)"
>
<template #first> <template #first>
<b-form-select-option :value="null" disabled <b-form-select-option :value="null"
>{{ $t("page.search.allProjects") }} >{{ $t("page.search.allProjects") }}
</b-form-select-option> </b-form-select-option>
</template> </template>
</b-form-select> </b-form-select>
</b-col> </b-col>
<b-col id="selectResCol" sm="2" align-self="center" class="pl-0"> <b-col id="selectResCol" sm="2" align-self="center" class="pl-0">
<b-form-select v-model="selectResValue"> <b-form-select
v-model="selectedResource"
:options="projectResourcesOptions"
@change="queryData(searchText)"
>
<template #first> <template #first>
<b-form-select-option :value="null" disabled <b-form-select-option :value="null"
>{{ $t("page.search.allResources") }} >{{ $t("page.search.allResources") }}
</b-form-select-option> </b-form-select-option>
</template> </template>
...@@ -36,9 +44,16 @@ ...@@ -36,9 +44,16 @@
</b-col> </b-col>
<b-col sm="0" align-self="center" class="text-right p-0"> <b-col sm="0" align-self="center" class="text-right p-0">
<b-button-group> <b-button-group>
<b-button id="searchButton" variant="primary"> <b-button
id="searchButton"
variant="primary"
:disabled="resultsViewLoading"
@click="queryData(searchText)"
>
{{ $t("page.search.search") }} {{ $t("page.search.search") }}
<b-spinner v-if="resultsViewLoading" variant="secondary" />
</b-button> </b-button>
<!-- Uncommented until implemented
<b-dropdown id="searchDropdown" right size="sm" variant="primary"> <b-dropdown id="searchDropdown" right size="sm" variant="primary">
<b-dropdown-item>{{ <b-dropdown-item>{{
$t("page.search.buttonSearch.Item1") $t("page.search.buttonSearch.Item1")
...@@ -47,6 +62,7 @@ ...@@ -47,6 +62,7 @@
$t("page.search.buttonSearch.Item2") $t("page.search.buttonSearch.Item2")
}}</b-dropdown-item> }}</b-dropdown-item>
</b-dropdown> </b-dropdown>
-->
</b-button-group> </b-button-group>
</b-col> </b-col>
</b-row> </b-row>
...@@ -179,6 +195,8 @@ import Sidebar from "./components/Sidebar.vue"; ...@@ -179,6 +195,8 @@ import Sidebar from "./components/Sidebar.vue";
import useSearchStore from "../store"; import useSearchStore from "../store";
// import the main store // import the main store
import useMainStore from "@/store/index"; import useMainStore from "@/store/index";
// import the project store
import useProjectStore from "@/modules/project/store";
import type { import type {
EnhancedOldSearchResult, EnhancedOldSearchResult,
...@@ -186,6 +204,10 @@ import type { ...@@ -186,6 +204,10 @@ import type {
OldSearchCollection, OldSearchCollection,
} from "../types"; } from "../types";
import type { SearchResult } from "@coscine/api-client/dist/types/Coscine.Api.Search"; import type { SearchResult } from "@coscine/api-client/dist/types/Coscine.Api.Search";
import type {
ProjectObject,
ResourceObject,
} from "@coscine/api-client/dist/types/Coscine.Api.Project";
export default defineComponent({ export default defineComponent({
components: { components: {
...@@ -195,17 +217,21 @@ export default defineComponent({ ...@@ -195,17 +217,21 @@ export default defineComponent({
setup() { setup() {
const mainStore = useMainStore(); const mainStore = useMainStore();
const searchStore = useSearchStore(); const searchStore = useSearchStore();
const projectStore = useProjectStore();
return { mainStore, searchStore }; return { mainStore, searchStore, projectStore };
}, },
data() { data() {
return { return {
searchText: "", searchText: "",
selectProjValue: null, selectedProject: null as null | ProjectObject,
selectResValue: null, selectedResource: null as null | ResourceObject,
filterTags: ["Filter 1", "Filter 2", "Filter 3"], projectResources: [] as ResourceObject[],
projectSubProjects: [] as ProjectObject[],
filterTags: [],
resultsViewFields: ["type"], resultsViewFields: ["type"],
resultsViewLoading: true, resultsViewLoading: true,
...@@ -217,6 +243,37 @@ export default defineComponent({ ...@@ -217,6 +243,37 @@ export default defineComponent({
}, },
computed: { computed: {
allProjects(): ProjectObject[] | null {
return this.projectStore.allProjects;
},
allProjectsOptions(): {
value: ProjectObject;
text: string | null | undefined;
}[] {
if (this.allProjects) {
return this.allProjects.map((project) => {
return {
value: project,
text: project.displayName,
};
});
}
return [];
},
projectResourcesOptions(): {
value: ResourceObject;
text: string | null | undefined;
}[] {
if (this.projectResources) {
return this.projectResources.map((resource) => {
return {
value: resource,
text: resource.displayName,
};
});
}
return [];
},
paginationTotalRows(): number { paginationTotalRows(): number {
if (this.searchResults !== null) { if (this.searchResults !== null) {
return this.searchResults.length; return this.searchResults.length;
...@@ -231,17 +288,34 @@ export default defineComponent({ ...@@ -231,17 +288,34 @@ export default defineComponent({
[]; [];
if (this.oldSearchResults !== null) { if (this.oldSearchResults !== null) {
searchResults.push( searchResults.push(
...this.oldSearchResults.Projects.map((project) => { ...this.oldSearchResults.Projects.filter(
(project) =>
!this.selectedProject || this.selectedProject.id === project.Id
).map((project) => {
return { ...project, type: "Project" } as EnhancedOldSearchResult; return { ...project, type: "Project" } as EnhancedOldSearchResult;
}) })
); );
searchResults.push( searchResults.push(
...this.oldSearchResults.Resources.map((resource) => { ...this.oldSearchResults.Resources.filter(
(resource) =>
(!this.selectedProject ||
this.projectResources.some(
(projectResource) => projectResource.id === resource.Id
)) &&
(!this.selectedResource ||
this.selectedResource.id === resource.Id)
).map((resource) => {
return { ...resource, type: "Resource" } as EnhancedOldSearchResult; return { ...resource, type: "Resource" } as EnhancedOldSearchResult;
}) })
); );
searchResults.push( searchResults.push(
...this.oldSearchResults.SubProjects.map((subProject) => { ...this.oldSearchResults.SubProjects.filter(
(subProject) =>
!this.selectedProject ||
this.projectSubProjects.some(
(projectSubProject) => projectSubProject.id === subProject.Id
)
).map((subProject) => {
return { return {
...subProject, ...subProject,
type: "SubProject", type: "SubProject",
...@@ -251,7 +325,14 @@ export default defineComponent({ ...@@ -251,7 +325,14 @@ export default defineComponent({
} }
if (this.semanticSearchResults !== null) { if (this.semanticSearchResults !== null) {
searchResults.push( searchResults.push(
...this.semanticSearchResults.map((result) => { ...this.semanticSearchResults
.filter(
(file) =>
!this.selectedResource ||
!this.selectedResource.id ||
file.graphName?.includes(this.selectedResource.id)
)
.map((result) => {
return { ...result, type: "File" } as EnhancedSearchResult; return { ...result, type: "File" } as EnhancedSearchResult;
}) })
); );
...@@ -267,10 +348,20 @@ export default defineComponent({ ...@@ -267,10 +348,20 @@ export default defineComponent({
searchText() { searchText() {
this.queryData(this.searchText); this.queryData(this.searchText);
}, },
selectedProject() {
this.selectedResource = null;
this.projectResources = [];
this.projectSubProjects = [];
this.retrieveResources();
this.retrieveSubProjects();
},
}, },
mounted() { mounted() {
this.searchText = this.getSearchQuery(); this.searchText = this.getSearchQuery();
this.retrieveResources();
this.retrieveSubProjects();
}, },
methods: { methods: {
...@@ -284,10 +375,32 @@ export default defineComponent({ ...@@ -284,10 +375,32 @@ export default defineComponent({
this.resultsViewLoading = true; this.resultsViewLoading = true;
await Promise.all([ await Promise.all([
this.searchStore.retrieveOldSearchResults(query), this.searchStore.retrieveOldSearchResults(query),
this.searchStore.retrieveSemanticSearchResults(query), this.searchStore.retrieveSemanticSearchResults(
query,
this.selectedProject
),
]); ]);
this.resultsViewLoading = false; this.resultsViewLoading = false;
}, },
async retrieveResources() {
if (this.selectedProject) {
this.projectResources = await this.projectStore.getResources(
this.selectedProject
);
this.selectedResource = null;
} else {
this.projectResources = [];
}
},
async retrieveSubProjects() {
if (this.selectedProject) {
this.projectSubProjects = await this.projectStore.getSubProjects(
this.selectedProject
);
} else {
this.projectSubProjects = [];
}
},
}, },
}); });
</script> </script>
...@@ -314,4 +427,9 @@ export default defineComponent({ ...@@ -314,4 +427,9 @@ export default defineComponent({
.card-body { .card-body {
padding: 0rem; padding: 0rem;
} }
button >>> span.spinner-border {
height: 15px;
width: 15px;
margin-right: 4px;
}
</style> </style>
...@@ -82,6 +82,11 @@ export default defineComponent({ ...@@ -82,6 +82,11 @@ export default defineComponent({
url(): string { url(): string {
if (this.result.type === "File") { if (this.result.type === "File") {
return this.result.graphName ? this.result.graphName : "#"; return this.result.graphName ? this.result.graphName : "#";
} else if (this.result.type === "Resource") {
return this.$router.resolve({
name: "resource-page",
params: { guid: this.result.Id, slug: this.result.Slug },
}).href;
} else { } else {
return this.$router.resolve({ return this.$router.resolve({
name: "project-page", name: "project-page",
......
...@@ -2,6 +2,7 @@ import { defineStore } from "pinia"; ...@@ -2,6 +2,7 @@ import { defineStore } from "pinia";
import { SearchApi, SemanticSearchApi } from "@coscine/api-client"; import { SearchApi, SemanticSearchApi } from "@coscine/api-client";
import type { SearchState } from "./types"; import type { SearchState } from "./types";
import type { ProjectObject } from "@coscine/api-client/dist/types/Coscine.Api.Project";
/* /*
Store variable name is "this.<id>Store" Store variable name is "this.<id>Store"
...@@ -51,9 +52,18 @@ export const useSearchStore = defineStore({ ...@@ -51,9 +52,18 @@ export const useSearchStore = defineStore({
return false; return false;
} }
}, },
async retrieveSemanticSearchResults(query: string): Promise<boolean> { async retrieveSemanticSearchResults(
query: string,
projectObject?: ProjectObject | null
): Promise<boolean> {
try { try {
const response = await SemanticSearchApi.semanticSearchSearch(query); let adaptedQuery = query;
if (projectObject && projectObject.id) {
adaptedQuery = `(belongsToProject: "https://purl.org/coscine/projects/${projectObject.id}") + (${query})`;
}
const response = await SemanticSearchApi.semanticSearchSearch(
adaptedQuery
);
this.semanticSearchResults = response.data; this.semanticSearchResults = response.data;
return true; return true;
} catch { } catch {
......
This diff is collapsed.