Skip to content

Commit

Permalink
Merge branch 'release/release-1.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
vabishaa committed Jun 18, 2024
2 parents f45788b + 42cf1c0 commit e61f227
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 33 deletions.
99 changes: 69 additions & 30 deletions components/DiscoverySourcesTable.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
<template>
<template>
<v-container>
<v-row no-gutters justify="center" align="center">
<v-col cols="12" v-for="(source, index) in sources" :key="index">
<v-card :href="source.resourceHomePage" target="_blank" class="low-opacity-without-hover" tile outlined width="100%">
<v-list-item three-line>
<v-list-item-content>
<v-list-item-title class="text-h5 mb-1">
<v-tooltip bottom>
<div v-if="source.queryable">
<v-tooltip v-if="availabilityResults[source.id]?.numberOfSuccessfulResponses <= 0 && availabilityResults[source.id]?.numberOfTests >= 0" bottom>
<template v-slot:activator="{ on, attrs }">
<v-icon
small
color="red"
v-bind="attrs"
v-on="on"
>mdi-connection</v-icon>
</template>
<span>The source is actively not connected to the VP.</span>
</v-tooltip>
<v-tooltip v-else bottom>
<template v-slot:activator="{ on, attrs }">
<v-icon
small
Expand All @@ -17,9 +29,9 @@
</template>
<span>The source is actively connected to the VP.</span>
</v-tooltip>
<h3 v-if="!source.logo && !logos[source.resourceName]"> {{ source.resourceName }}</h3>
<v-img v-if="logos[source.resourceName]" :src="logos[source.resourceName]" contain max-width="180px" max-height="150px" />
<v-img v-if="!logos[source.resourceName] && source.logo" :src="source.logo" contain max-width="180px" max-height="150px" />
</div>
<v-img v-if="source.logo" :src="source.logo" contain max-width="180px" max-height="150px" />
<h5> {{ source.resourceName }}</h5>
</v-list-item-title>
<v-list-item-subtitle class="mb-1">{{ source.resourceDescription }}</v-list-item-subtitle>
</v-list-item-content>
Expand All @@ -28,6 +40,23 @@
height="150px"
>
<v-row justify="end">
<v-col v-if="source.queryable" class="flex-grow-0">
<v-tooltip bottom>
<template v-slot:activator="{ on, attrs }">
<v-chip
class="mr-3"
color="lightblue"
label
outlined
v-bind="attrs"
v-on="on"
>
VpContentDiscovery
</v-chip>
</template>
<span>The source is queryable via the VP Portal.</span>
</v-tooltip>
</v-col>
<v-col v-if="source.resourceType.length > 1 || source.resourceType.includes('CATALOG')" class="flex-grow-0">
<v-tooltip bottom>
<template v-slot:activator="{ on, attrs }">
Expand Down Expand Up @@ -103,23 +132,6 @@
<span>Biosamples repository</span>
</v-tooltip>
</v-col>
<v-col v-if="source.queryable" class="flex-grow-0">
<v-tooltip bottom>
<template v-slot:activator="{ on, attrs }">
<v-chip
class="mr-3"
color="lightblue"
label
outlined
v-bind="attrs"
v-on="on"
>
VpContentDiscovery
</v-chip>
</template>
<span>The source is queryable via the VP Portal.</span>
</v-tooltip>
</v-col>
</v-row>
</v-list-item-avatar>
</v-list-item>
Expand All @@ -141,7 +153,6 @@ v-avatar {
margin: 0 10px;
height: 20px;
}
.low-opacity-without-hover {
opacity: 0.9;
&:hover {
Expand All @@ -161,25 +172,53 @@ export default {
// 'BBMRI-Eric': require('../assets/images/logo/resources/bbmri-logo.png'),
// 'Orphanet': require('../assets/images/logo/resources/img_4.png'),
// 'Cellosaurus': require('../assets/images/logo/resources/cellosaurus-logo.png'),
'WikiPathways': require('../assets/images/logo/resources/img_5.png'),
//'WikiPathways': require('../assets/images/logo/resources/img_5.png'),
// 'hPSCreg': require('../assets/images/logo/resources/img_3.png'),
// 'EuRRECa': require('../assets/images/logo/resources/eurreca-logo.png'),
// 'Genturis': require('../assets/images/logo/resources/Genturis.png'),
// 'DDP': require('../assets/images/logo/resources/img_1.png'),
},
sources: []
sources: [],
period: 3,
availabilityResults:{},
}
},
methods: {
async fetchSources () {
await this.$axios.$get('/api/v1/resources')
.then(function (res) {
this.sources = res
}.bind(this))
async fetchSources() {
try {
this.sources = await this.$axios.$get('/api/v1/resources');
} catch (error) {
console.error(error);
throw error;
}
},
async checkAllAvailabilities() {
try {
const promises = this.sources.map(source => this.availability(source.id, 3));
const results = await Promise.all(promises);
this.availabilityResults = results.reduce((acc, result, index) => {
acc[this.sources[index].id] = result;
return acc;
}, {});
} catch (error) {
console.error(error);
throw error;
}
},
async availability(resourceId, period) {
try {
const res = await this.$axios.$get(`/api/v1/monitoring?resourceId=${resourceId}&periodInDays=${period}`);
return res;
} catch (error) {
console.error(error);
throw error;
}
}
},
beforeMount() {
this.fetchSources()
.then(() => this.checkAllAvailabilities());
}
}
</script>
3 changes: 1 addition & 2 deletions components/Flashcards.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default {

<template>
<div class="flashcards-h2">
<v-carousel hide-delimiter-background cycle show-arrows-on-hover>
<v-carousel hide-delimiters cycle show-arrows-on-hover>
<v-carousel-item v-for="(item, i) in items" :key="i">
<div class="flashcard-image-container">
<v-img :src="item.src" alt="Flashcard" contain class="flashcard-image" />
Expand All @@ -59,7 +59,6 @@ export default {
margin: 0.5rem;
}
}
.v-carousel-item {
width: 100%;
height: 100%;
Expand Down
47 changes: 46 additions & 1 deletion components/search/DiscoverySearchResults.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export default {
resourceInfoDialog: {
show: false,
resourceInfo: null
}
},
negotiatorRedirectUrl: ''
}
},
mounted() {
Expand Down Expand Up @@ -89,6 +90,34 @@ export default {
},
resourceHasResponseToBeListed (result) {
return !result || !result.content || !result.content.response || !result.content.response.resultSets[0].results;
},
fetchNegotiator () {
const url = 'https://negotiator.acc.bbmri-eric.eu/api/v3/requests';
let idObjects = '';
this.searchResults.forEach((resource) => {
if (resource.resourceName === "BBMRI-ERIC Directory"){
resource.content.response.resultSets[0].results.forEach(result => {
let idObject = '{"id": "' + result.id + '"},';
idObjects = idObjects + idObject;
});
}
});
//final solution
const data = '{ "url": "https://vp.ejprarediseases.org/", "humanReadable": "", "resources": [' + idObjects.substring(0,idObjects.length-1) + '] }';
this.$axios.$post(url, JSON.parse(data))
.then(response => {
this.negotiatorRedirectUrl = response.redirectUrl;
//console.log(this.negotiatorUrl)
window.open(this.negotiatorRedirectUrl, '_blank');
})
.catch((error) => {
if( error.response ){
alert(error.response.data.status + " " + error.response.data.title + " : " + error.response.data.detail); // => the response payload
}
});
}
}
}
Expand Down Expand Up @@ -138,6 +167,11 @@ export default {
<div class="eph-results">
{{ result.content.responseSummary.numTotalResults }} result(s)
</div>
<div>
<div v-for="(filters, warningKey) in result.content?.info?.warnings" :key="warningKey">
<div v-for="(filter, index) in filters" :key="index">Ignored filters: {{ filter }}</div>
</div>
</div>
</v-expansion-panel-header>
<v-expansion-panel-content
v-if="result && result.content &&
Expand All @@ -147,6 +181,12 @@ export default {
<SearchResultContent
:resultContent="result.content.response.resultSets[0].results"
/>
<v-btn v-if="result?.resourceName === 'BBMRI-ERIC Directory'"
class="white--text me-2 "
variant="flat"
color="#1f3863"
@click="fetchNegotiator"
>Negotiator</v-btn>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
Expand Down Expand Up @@ -191,6 +231,11 @@ export default {
<div class="eph-results">
{{ result.content.responseSummary.numTotalResults }} result(s)
</div>
<div>
<div v-for="(filters, warningKey) in result.content?.info?.warnings" :key="warningKey">
<div v-for="(filter, index) in filters" :key="index">Ignored filters: {{ filter }}</div>
</div>
</div>
<v-tooltip
v-if="!loggedIn"
bottom
Expand Down

0 comments on commit e61f227

Please sign in to comment.