@@ -135,15 +135,15 @@ <h1 class="page-title">Source: components/Records/Record/Collections.vue</h1>
135
135
color="accent3"
136
136
slider-color="accent3"
137
137
class="mb-5"
138
- :hide-slider="tabsData.tabs[Object.keys(tabsData.tabs)[tabsData.selectedTab]].data.length===0"
138
+ :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"
139
139
>
140
140
<v-tab
141
141
v-for="(tabName,tabIndex) in Object.keys(tabsData.tabs)"
142
142
:key="tabName+'_'+tabIndex"
143
- :disabled="tabsData.tabs[tabName].data.length===0"
143
+ :disabled="tabName === 'conforming_resources' ? !currentRecord['fairsharingRecord'].savedSearches.length : tabsData.tabs[tabName].data.length===0"
144
144
@change="selectedValues=null"
145
145
>
146
- {{ cleanString(tabName) }} ({{ tabsData.tabs[tabName].count }})
146
+ {{ cleanString(tabName) }} ({{ tabName === 'conforming_resources' ? currentRecord['fairsharingRecord'].savedSearches.length : tabsData.tabs[tabName].count }})
147
147
</v-tab>
148
148
</v-tabs>
149
149
<!-- tab content -->
@@ -156,7 +156,12 @@ <h1 class="page-title">Source: components/Records/Record/Collections.vue</h1>
156
156
v-for="(tabItem,tabItemIndex) in filterList"
157
157
:key="tabItem+'_'+tabItemIndex"
158
158
>
159
+ <SavedSearches
160
+ v-if="tabItem.type === 'conforming_resources'"
161
+ />
162
+
159
163
<v-virtual-scroll
164
+ v-else
160
165
:items="tabItem.data"
161
166
height="400"
162
167
item-height="130"
@@ -210,6 +215,7 @@ <h1 class="page-title">Source: components/Records/Record/Collections.vue</h1>
210
215
<script>
211
216
import {mapState} from "vuex";
212
217
218
+ import SavedSearches from '@/components/Records/Record/GeneralInfo/SavedSearches'
213
219
import SectionTitle from '@/components/Records/Record/SectionTitle';
214
220
import RecordStatus from "@/components/Records/Shared/RecordStatus";
215
221
import recordRelationShipsDefinitions from "@/data/RecordRelationShipsDefinitions.json";
@@ -221,6 +227,7 @@ <h1 class="page-title">Source: components/Records/Record/Collections.vue</h1>
221
227
components: {
222
228
RecordStatus,
223
229
SectionTitle,
230
+ SavedSearches
224
231
},
225
232
mixins: [stringUtils, recordTabUtils],
226
233
props:{
@@ -238,12 +245,42 @@ <h1 class="page-title">Source: components/Records/Record/Collections.vue</h1>
238
245
tabs: {
239
246
in_collections: {relation: 'collects', data: [], count:0}
240
247
}
241
- }
248
+ },
242
249
}
243
250
},
244
251
computed: {
245
252
...mapState("record", ["currentRecord"]),
246
253
},
254
+ watch:{
255
+ currentRecord() {
256
+ let _module = this
257
+ Object.keys(_module.tabsData.tabs).forEach(tabName => {
258
+ //Update the count of the conforming resources after unlinking saved search
259
+ if (tabName === 'conforming_resources') {
260
+ _module.tabsData.tabs[tabName].count = _module.currentRecord['fairsharingRecord'].savedSearches.length;
261
+ }
262
+ //If no saved search is available in conforming resources tab
263
+ if(!_module.currentRecord['fairsharingRecord'].savedSearches.length) {
264
+ //If no conforming resources is available then shift focus to Related Policies tab
265
+ if(tabName === "related_policies") {
266
+ if(_module.tabsData.tabs[tabName].data.length) {
267
+ this.tabsData.selectedTab = 1
268
+ }
269
+ }
270
+ //If no related policies is available then shift focus to In collections tab
271
+ else if(tabName === "in_collections") {
272
+ if(_module.tabsData.tabs[tabName].data.length) {
273
+ this.tabsData.selectedTab = 0
274
+ }
275
+ }
276
+ //If nothing is available make all tabs section disabled with its initial value i.e null
277
+ else {
278
+ this.selectedValues = null
279
+ }
280
+ }
281
+ })
282
+ }
283
+ },
247
284
methods: {
248
285
/** Dynamically sets data for each tabs based on the data received from recordAssociations and reverseAssociations*/
249
286
prepareTabsData() {
@@ -255,6 +292,12 @@ <h1 class="page-title">Source: components/Records/Record/Collections.vue</h1>
255
292
data: [],
256
293
count:0
257
294
}
295
+ _module.tabsData.tabs.conforming_resources = {
296
+ registry: ['Policy'],
297
+ data: [],
298
+ count:0,
299
+ type:'conforming_resources'
300
+ }
258
301
}
259
302
else {
260
303
_module.tabsData.tabs.in_policies = {
@@ -282,6 +325,13 @@ <h1 class="page-title">Source: components/Records/Record/Collections.vue</h1>
282
325
)
283
326
_module.tabsData.tabs[tabName].count = _module.tabsData.tabs[tabName].data.length;
284
327
}
328
+ //Save searches for the policy
329
+ else if (tabName === 'conforming_resources') {
330
+ _module.tabsData.tabs[tabName].data =
331
+ _module.currentRecord['fairsharingRecord'].savedSearches
332
+
333
+ _module.tabsData.tabs[tabName].count = _module.currentRecord['fairsharingRecord'].savedSearches.length;
334
+ }
285
335
// All incoming collections.
286
336
else {
287
337
_module.tabsData.tabs[tabName].data = _module.prepareAssociations(
@@ -357,7 +407,7 @@ <h4 class="modal-title">Search results</h4>
357
407
< span class ="jsdoc-message ">
358
408
Documentation generated by < a href ="https://github.com/jsdoc3/jsdoc "> JSDoc 4.0.3</ a >
359
409
360
- on Fri Aug 2nd 2024
410
+ on Thu Aug 29th 2024
361
411
362
412
using the < a href ="https://github.com/docstrap/docstrap "> DocStrap template</ a > .
363
413
</ span >
0 commit comments