Skip to content

Commit 861f86d

Browse files
authored
Merge pull request #553 from broadinstitute/gene-pg-biolink
Gene pg biolink
2 parents 412d0b0 + 12cbe4b commit 861f86d

File tree

4 files changed

+448
-301
lines changed

4 files changed

+448
-301
lines changed

src/components/DiseaseGroupSelect.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
>
77
<option
88
v-for="group in visibleDiseaseGroups"
9-
:value="group.name"
109
:key="group.name"
10+
:value="group.name"
1111
>
1212
{{ group.description }}
1313
</option>
@@ -27,17 +27,16 @@ Vue.use(IconsPlugin);
2727
import "bootstrap/dist/css/bootstrap.css";
2828
import "bootstrap-vue/dist/bootstrap-vue.css";
2929
30-
export default Vue.component("disease-group-select", {
30+
export default Vue.component("DiseaseGroupSelect", {
3131
props: ["diseaseGroups"],
3232
3333
data() {
3434
return {
3535
diseaseGroup:
3636
this.$store.getters["bioPortal/diseaseGroup"].portalGroup ||
3737
null,
38-
selectedPortal: "",
38+
selectedPortal: "",
3939
};
40-
4140
},
4241
4342
computed: {

src/components/NCATS/old/PredicateTable.vue

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
<template>
22
<b-row no-gutters>
33
<b-card-body :title="title">
4-
<criterion-list-group class="eglt-table-wrapper">
4+
<div class="eglt-table-wrapper">
55
<div class="filtering-ui-wrapper container-fluid">
66
<div class="row filtering-ui-content">
77
<div class="col filter-col-md">
88
<div class="label">Search</div>
9-
<input class="col filter-col-md form-control" v-model="filterString"/>
9+
<input
10+
v-model="filterString"
11+
class="col filter-col-md form-control"
12+
debounce="500"
13+
/>
1014
</div>
1115
</div>
1216
</div>
13-
</criterion-list-group>
17+
</div>
1418
<div class="text-right mt-2 mb-2">
1519
<data-download
1620
:data="geneInfo"
@@ -26,6 +30,7 @@
2630
:current-page="currentPage"
2731
:filter="filterString"
2832
small
33+
@filtered="onFiltered"
2934
>
3035
<!-- Custom rendering for known special cases -->
3136
<template #cell(id)="data">
@@ -73,7 +78,7 @@
7378

7479
<b-pagination
7580
v-model="currentPage"
76-
:total-rows="geneInfo.length"
81+
:total-rows="totalRows"
7782
:per-page="perPage"
7883
:aria-controls="id"
7984
size="sm"
@@ -103,13 +108,14 @@ export default Vue.component("TranslatorPredicateTable", {
103108
},
104109
data() {
105110
return {
106-
id: this.geneSymbol + this.fields + this.title,
111+
id: this.geneSymbol + this.field + this.title,
107112
currentPage: 1,
108113
perPage: 10,
109114
rawGeneInfo: [],
110115
myFilter: (id) => true,
111116
context: null,
112117
filterString: "",
118+
totalRows: 0,
113119
};
114120
},
115121
computed: {
@@ -119,25 +125,28 @@ export default Vue.component("TranslatorPredicateTable", {
119125
);
120126
},
121127
fields() {
122-
return Array.from(
123-
new Set(
124-
this.geneInfo.reduce(
125-
(acc, item) => acc.concat(...Object.keys(item)),
126-
[]
128+
return (
129+
Array.from(
130+
new Set(
131+
this.geneInfo.reduce(
132+
(acc, item) => acc.concat(...Object.keys(item)),
133+
[]
134+
)
127135
)
128136
)
129-
)
130-
.sort((a, b) => {
131-
const sortMap = { id: 0, source: 1 };
132-
if (a === "id") {
133-
return -1;
134-
} else if (b === "id") {
135-
return 1;
136-
}
137-
})
138-
.filter(
139-
(el) => !["evidence", "gocategory", "category"].includes(el)
140-
);
137+
.sort((a, b) => {
138+
const sortMap = { id: 0, source: 1 };
139+
if (a === "id") {
140+
return -1;
141+
} else if (b === "id") {
142+
return 1;
143+
}
144+
})
145+
.filter(
146+
(el) =>
147+
!["evidence", "gocategory", "category"].includes(el)
148+
) || []
149+
);
141150
},
142151
tableFields() {
143152
return this.fields.map((key) => ({
@@ -178,7 +187,7 @@ export default Vue.component("TranslatorPredicateTable", {
178187
},
179188
async created() {
180189
this.context = await fetch(
181-
"https://raw.githubusercontent.com/biolink/biolink-model/master/context.jsonld"
190+
"https://raw.githubusercontent.com/biolink/biolink-model/master/project/jsonld/biolink_model.context.jsonld"
182191
)
183192
.then((response) => response.json())
184193
.then((json) => json["@context"]);
@@ -247,6 +256,11 @@ export default Vue.component("TranslatorPredicateTable", {
247256
return cellValue;
248257
}
249258
},
259+
onFiltered(filteredItems) {
260+
// Trigger pagination to update the number of buttons/pages due to filtering
261+
this.totalRows = filteredItems.length;
262+
this.currentPage = 1;
263+
},
250264
},
251265
});
252266
</script>

0 commit comments

Comments
 (0)