Skip to content

Commit bf339ab

Browse files
authored
Merge pull request #35 from FAIRsharing/dev
Dev
2 parents 2f3e599 + 34423ba commit bf339ab

26 files changed

+795
-299
lines changed

src/components/Loaders/Loaders.vue

Lines changed: 226 additions & 234 deletions
Large diffs are not rendered by default.
Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,25 @@
11
<template>
22
<div class="mb-6 text-center">
3-
<v-fade-transition v-if="getLoadingStatus">
4-
<div>
5-
<v-overlay
6-
:absolute="false"
7-
:model-value="getLoadingStatus"
8-
class="align-center justify-center"
9-
opacity="0.8"
10-
>
11-
<Loaders />
12-
</v-overlay>
13-
</div>
14-
</v-fade-transition>
153
<v-btn
164
:disabled="!getRecordTypeSelected.length"
175
class="full-width"
186
color="accent"
197
data-testid="applyFilter"
208
max-width="200"
219
min-width="200"
22-
@click="store.fetchAdvancedSearchResults()"
10+
@click="fetchResults()"
2311
>Apply Filter
2412
</v-btn>
2513
</div>
2614
</template>
2715

2816
<script>
2917
import { useAdvancedSearchStore } from "@/stores/advancedSearch.js";
18+
import { generateSelectionQuery } from "@/utils/queryUtil.js";
3019
import { storeToRefs } from "pinia";
31-
import Loaders from "@/components/Loaders/Loaders.vue";
3220
3321
export default {
3422
name: "ApplyFilterButton",
35-
components: { Loaders },
3623
data: () => {
3724
return {
3825
filtersSelected: [],
@@ -41,9 +28,19 @@ export default {
4128
},
4229
setup() {
4330
const store = useAdvancedSearchStore();
44-
const { getFairassistID, getRecordTypeSelected, getLoadingStatus } =
45-
storeToRefs(store);
46-
return { store, getFairassistID, getRecordTypeSelected, getLoadingStatus };
31+
const {
32+
getFairassistID,
33+
getRecordTypeSelected,
34+
getFilterSelected,
35+
getFairassistName,
36+
} = storeToRefs(store);
37+
return {
38+
store,
39+
getFairassistID,
40+
getRecordTypeSelected,
41+
getFilterSelected,
42+
getFairassistName,
43+
};
4744
},
4845
watch: {
4946
getFairassistID(newValue, oldValue) {
@@ -53,5 +50,19 @@ export default {
5350
}
5451
},
5552
},
53+
54+
methods: {
55+
async fetchResults() {
56+
await this.store.fetchAdvancedSearchResults();
57+
this.$router.push({
58+
query: {
59+
search: generateSelectionQuery(
60+
this.getFairassistName,
61+
this.getFilterSelected,
62+
),
63+
},
64+
});
65+
},
66+
},
5667
};
5768
</script>

src/components/Registry/Breadcrumbs/Breadcrumbs.vue

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77
rounded
88
sticky
99
>
10-
<h3 class="d-inline">Search Results For :&nbsp;</h3>
11-
<v-chip
12-
v-for="selection in userSelection"
13-
:keys="selection"
14-
:text="formatString(selection)"
15-
class="ma-1 text-capitalize"
16-
color="primary"
17-
variant="elevated"
18-
/>
10+
<div>
11+
<h3 class="d-inline">Search Results For :&nbsp;</h3>
12+
<v-chip
13+
v-for="selection in userSelection"
14+
:keys="selection"
15+
:text="formatString(selection)"
16+
class="ma-1 text-capitalize"
17+
color="primary"
18+
variant="elevated"
19+
/>
20+
</div>
1921
</v-banner>
2022
</template>
2123
<script>

src/components/Registry/CollapseTreeGraph.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ export default {
4040
return { store };
4141
},
4242
43+
watch: {
44+
fairassistID(newValue, oldValue) {
45+
if (newValue !== oldValue) {
46+
this.store.advancedSearchResponse = [];
47+
}
48+
},
49+
},
50+
4351
mounted() {
4452
this.getGraphData();
4553
},
@@ -52,6 +60,7 @@ export default {
5260
"/search_utils/fairassist_components/" +
5361
this.fairassistID;
5462
const getData = await axios.get(url);
63+
this.store.fairAssistName = getData.data.name;
5564
let divSelected = this.$refs.chartdiv;
5665
d3Graph(divSelected, getData.data);
5766
} catch (error) {

src/components/Registry/FilterComponents/MetricsToolFilter.vue

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<template>
22
<SelectComponent
3+
v-model="model"
34
:disabled="disabled"
45
:format="true"
56
:item-list="toolsList"
67
:item-value="itemValue"
78
:label="labelText"
89
:tool-tip-text="toolTipText"
10+
data-testid="selectComponent"
911
@input="selectedValue"
1012
/>
1113
</template>
@@ -19,10 +21,12 @@ import { storeToRefs } from "pinia";
1921
export default {
2022
name: "MetricsToolFilter",
2123
components: { SelectComponent },
24+
emits: ["input"],
2225
setup() {
2326
const advancedSearchStore = useAdvancedSearchStore();
24-
const { getRecordTypeSelected } = storeToRefs(advancedSearchStore);
25-
return { advancedSearchStore, getRecordTypeSelected };
27+
const { getRecordTypeSelected, getToolsSelected } =
28+
storeToRefs(advancedSearchStore);
29+
return { advancedSearchStore, getRecordTypeSelected, getToolsSelected };
2630
},
2731
data: () => {
2832
return {
@@ -36,6 +40,14 @@ export default {
3640
};
3741
},
3842
computed: {
43+
model: {
44+
get() {
45+
return this.itemSelected;
46+
},
47+
set(value) {
48+
this.$emit("input", value);
49+
},
50+
},
3951
//Disable this filter if benchmark is selected
4052
disabled() {
4153
if (
@@ -57,6 +69,7 @@ export default {
5769
},
5870
mounted() {
5971
this.getTools();
72+
this.fetchOnLoad();
6073
},
6174
methods: {
6275
selectedValue(item) {
@@ -76,6 +89,18 @@ export default {
7689
}
7790
}
7891
},
92+
93+
/**
94+
* Fetch tools from the store on load
95+
*/
96+
fetchOnLoad() {
97+
this.$nextTick(() => {
98+
let filterArr = this.getToolsSelected;
99+
if (filterArr.toolNames && filterArr.toolNames.length) {
100+
this.itemValue = filterArr.toolNames;
101+
}
102+
});
103+
},
79104
},
80105
};
81106
</script>

src/components/Registry/FilterComponents/ObjectTypeFilter.vue

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<template>
22
<SelectComponent
3+
v-model="model"
34
:disabled="disabled"
45
:item-list="getObjectTypes"
56
:item-value="itemValue"
67
:label="labelText"
78
:tool-tip-text="toolTipText"
9+
data-testid="selectComponent"
810
@input="selectedValue"
911
/>
1012
</template>
@@ -17,17 +19,20 @@ import { useAdvancedSearchStore } from "@/stores/advancedSearch.js";
1719
export default {
1820
name: "ObjectTypeFilter",
1921
components: { SelectComponent },
22+
emits: ["input"],
2023
setup() {
2124
const store = useObjectTypesStore();
2225
const advancedSearchStore = useAdvancedSearchStore();
2326
const { getObjectTypes, getLoadingStatus } = storeToRefs(store);
24-
const { getRecordTypeSelected } = storeToRefs(advancedSearchStore);
27+
const { getRecordTypeSelected, getObjectTypeSelected } =
28+
storeToRefs(advancedSearchStore);
2529
return {
2630
store,
2731
getObjectTypes,
2832
getLoadingStatus,
2933
advancedSearchStore,
3034
getRecordTypeSelected,
35+
getObjectTypeSelected,
3136
};
3237
},
3338
data: () => {
@@ -40,6 +45,14 @@ export default {
4045
};
4146
},
4247
computed: {
48+
model: {
49+
get() {
50+
return this.itemSelected;
51+
},
52+
set(value) {
53+
this.$emit("input", value);
54+
},
55+
},
4356
//Disable this filter if benchmark is selected
4457
disabled() {
4558
if (
@@ -65,11 +78,24 @@ export default {
6578
},
6679
mounted() {
6780
this.store.fetchObjectTypes();
81+
this.fetchOnLoad();
6882
},
6983
methods: {
7084
selectedValue(item) {
7185
this.itemSelected = item;
7286
},
87+
88+
/**
89+
* Fetch object types from the store on load
90+
*/
91+
fetchOnLoad() {
92+
this.$nextTick(() => {
93+
let filterArr = this.getObjectTypeSelected;
94+
if (filterArr.objectType && filterArr.objectType.length) {
95+
this.itemValue = filterArr.objectType;
96+
}
97+
});
98+
},
7399
},
74100
};
75101
</script>

src/components/Registry/FilterComponents/OrganisationsFilter.vue

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
<template>
22
<SelectComponent
3+
v-model="model"
34
:item-list="organisationsList"
45
:item-value="itemValue"
56
:label="labelText"
67
:tool-tip-text="toolTipText"
8+
data-testid="selectComponent"
79
@input="selectedValue"
810
/>
911
</template>
1012
<script>
1113
import axios from "axios";
1214
import { useAdvancedSearchStore } from "@/stores/advancedSearch.js";
1315
import SelectComponent from "@/components/Registry/UtilComponents/SelectComponent.vue";
16+
import { storeToRefs } from "pinia";
1417
1518
export default {
1619
name: "OrganisationsFilter",
1720
components: { SelectComponent },
21+
emits: ["input"],
1822
setup() {
1923
const advancedSearchStore = useAdvancedSearchStore();
20-
return { advancedSearchStore };
21-
},
22-
props: {
23-
value: {
24-
type: Array,
25-
default: () => [],
26-
},
24+
const { getOrganisationSelected } = storeToRefs(advancedSearchStore);
25+
return { advancedSearchStore, getOrganisationSelected };
2726
},
2827
data: () => {
2928
return {
@@ -36,7 +35,16 @@ export default {
3635
labelText: "Filter Metrics and/or Benchmarks by Organisation",
3736
};
3837
},
39-
38+
computed: {
39+
model: {
40+
get() {
41+
return this.itemSelected;
42+
},
43+
set(value) {
44+
this.$emit("input", value);
45+
},
46+
},
47+
},
4048
watch: {
4149
itemSelected(newValue) {
4250
if (newValue.length) {
@@ -52,6 +60,7 @@ export default {
5260
5361
mounted() {
5462
this.getOrganisations();
63+
this.fetchOnLoad();
5564
},
5665
5766
methods: {
@@ -71,6 +80,18 @@ export default {
7180
}
7281
}
7382
},
83+
84+
/**
85+
* Fetch organisations from the store on load
86+
*/
87+
fetchOnLoad() {
88+
this.$nextTick(() => {
89+
let filterArr = this.getOrganisationSelected;
90+
if (filterArr.organisations && filterArr.organisations.length) {
91+
this.itemValue = filterArr.organisations;
92+
}
93+
});
94+
},
7495
},
7596
};
7697
</script>

0 commit comments

Comments
 (0)