Skip to content

Commit

Permalink
Merge pull request #2299 from FAIRsharing/saved-search-2140
Browse files Browse the repository at this point in the history
Saved search 2140
  • Loading branch information
prakhyatox authored Aug 29, 2024
2 parents 7b060f8 + dac38c8 commit e362761
Show file tree
Hide file tree
Showing 122 changed files with 9,161 additions and 1,069 deletions.
2 changes: 1 addition & 1 deletion documentation/html/ExternalRESTClients.html
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a>

on Fri Aug 2nd 2024
on Thu Aug 29th 2024

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion documentation/html/GraphQLClient.html
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a>

on Fri Aug 2nd 2024
on Thu Aug 29th 2024

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion documentation/html/RESTClient.html
Original file line number Diff line number Diff line change
Expand Up @@ -8895,7 +8895,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a>

on Fri Aug 2nd 2024
on Thu Aug 29th 2024

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion documentation/html/Static.html
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a>

on Fri Aug 2nd 2024
on Thu Aug 29th 2024

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion documentation/html/classes.list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2771,7 +2771,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a>

on Fri Aug 2nd 2024
on Thu Aug 29th 2024

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
60 changes: 55 additions & 5 deletions documentation/html/components_Records_Record_Collections.vue.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ <h1 class="page-title">Source: components/Records/Record/Collections.vue</h1>
color="accent3"
slider-color="accent3"
class="mb-5"
:hide-slider="tabsData.tabs[Object.keys(tabsData.tabs)[tabsData.selectedTab]].data.length===0"
:hide-slider="tabsData.tabs[Object.keys(tabsData.tabs)[tabsData.selectedTab]].type === 'conforming_resources'? !currentRecord['fairsharingRecord'].savedSearches.length : tabsData.tabs[Object.keys(tabsData.tabs)[tabsData.selectedTab]].data.length===0"
>
&lt;v-tab
v-for="(tabName,tabIndex) in Object.keys(tabsData.tabs)"
:key="tabName+'_'+tabIndex"
:disabled="tabsData.tabs[tabName].data.length===0"
:disabled="tabName === 'conforming_resources' ? !currentRecord['fairsharingRecord'].savedSearches.length : tabsData.tabs[tabName].data.length===0"
@change="selectedValues=null"
>
{{ cleanString(tabName) }} ({{ tabsData.tabs[tabName].count }})
{{ cleanString(tabName) }} ({{ tabName === 'conforming_resources' ? currentRecord['fairsharingRecord'].savedSearches.length : tabsData.tabs[tabName].count }})
&lt;/v-tab>
&lt;/v-tabs>
&lt;!-- tab content -->
Expand All @@ -156,7 +156,12 @@ <h1 class="page-title">Source: components/Records/Record/Collections.vue</h1>
v-for="(tabItem,tabItemIndex) in filterList"
:key="tabItem+'_'+tabItemIndex"
>
&lt;SavedSearches
v-if="tabItem.type === 'conforming_resources'"
/>

&lt;v-virtual-scroll
v-else
:items="tabItem.data"
height="400"
item-height="130"
Expand Down Expand Up @@ -210,6 +215,7 @@ <h1 class="page-title">Source: components/Records/Record/Collections.vue</h1>
&lt;script>
import {mapState} from "vuex";

import SavedSearches from '@/components/Records/Record/GeneralInfo/SavedSearches'
import SectionTitle from '@/components/Records/Record/SectionTitle';
import RecordStatus from "@/components/Records/Shared/RecordStatus";
import recordRelationShipsDefinitions from "@/data/RecordRelationShipsDefinitions.json";
Expand All @@ -221,6 +227,7 @@ <h1 class="page-title">Source: components/Records/Record/Collections.vue</h1>
components: {
RecordStatus,
SectionTitle,
SavedSearches
},
mixins: [stringUtils, recordTabUtils],
props:{
Expand All @@ -238,12 +245,42 @@ <h1 class="page-title">Source: components/Records/Record/Collections.vue</h1>
tabs: {
in_collections: {relation: 'collects', data: [], count:0}
}
}
},
}
},
computed: {
...mapState("record", ["currentRecord"]),
},
watch:{
currentRecord() {
let _module = this
Object.keys(_module.tabsData.tabs).forEach(tabName => {
//Update the count of the conforming resources after unlinking saved search
if (tabName === 'conforming_resources') {
_module.tabsData.tabs[tabName].count = _module.currentRecord['fairsharingRecord'].savedSearches.length;
}
//If no saved search is available in conforming resources tab
if(!_module.currentRecord['fairsharingRecord'].savedSearches.length) {
//If no conforming resources is available then shift focus to Related Policies tab
if(tabName === "related_policies") {
if(_module.tabsData.tabs[tabName].data.length) {
this.tabsData.selectedTab = 1
}
}
//If no related policies is available then shift focus to In collections tab
else if(tabName === "in_collections") {
if(_module.tabsData.tabs[tabName].data.length) {
this.tabsData.selectedTab = 0
}
}
//If nothing is available make all tabs section disabled with its initial value i.e null
else {
this.selectedValues = null
}
}
})
}
},
methods: {
/** Dynamically sets data for each tabs based on the data received from recordAssociations and reverseAssociations*/
prepareTabsData() {
Expand All @@ -255,6 +292,12 @@ <h1 class="page-title">Source: components/Records/Record/Collections.vue</h1>
data: [],
count:0
}
_module.tabsData.tabs.conforming_resources = {
registry: ['Policy'],
data: [],
count:0,
type:'conforming_resources'
}
}
else {
_module.tabsData.tabs.in_policies = {
Expand Down Expand Up @@ -282,6 +325,13 @@ <h1 class="page-title">Source: components/Records/Record/Collections.vue</h1>
)
_module.tabsData.tabs[tabName].count = _module.tabsData.tabs[tabName].data.length;
}
//Save searches for the policy
else if (tabName === 'conforming_resources') {
_module.tabsData.tabs[tabName].data =
_module.currentRecord['fairsharingRecord'].savedSearches

_module.tabsData.tabs[tabName].count = _module.currentRecord['fairsharingRecord'].savedSearches.length;
}
// All incoming collections.
else {
_module.tabsData.tabs[tabName].data = _module.prepareAssociations(
Expand Down Expand Up @@ -357,7 +407,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a>

on Fri Aug 2nd 2024
on Thu Aug 29th 2024

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
Loading

0 comments on commit e362761

Please sign in to comment.