Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT(#508): Using time server for cron jobs #511

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ resfulservice/.nyc_output
old_services
venv/
__pycache__/
sparqlqueries.html
4 changes: 2 additions & 2 deletions app/src/modules/whyis-dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,11 @@ function buildDistrLd (fileList) {

// Note: When testing SDD linking locally enable below logic and comment above if statement
// if (fileList[x]?.status === 'complete') {
// distrLDs[x]['@id'] = fileList[x].uri
// distrLDs[x]['@id'] = fileList[x].uri;
// } else {
// distrLDs[x]['@id'] = `http://restful:3001/${
// fileList[x].filename?.split('/api/')?.[1]
// }`
// }`;
// }
})
return distrLDs
Expand Down
1,333 changes: 886 additions & 447 deletions app/src/pages/explorer/curate/sdd/SddForm.vue

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions app/src/pages/explorer/dataset/Dataset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,8 @@ export default {
dataset: 'explorer/getCurrentDataset',
thumbnail: 'explorer/getDatasetThumbnail',
orcidData: 'explorer/curation/getOrcidData',
rorData: 'explorer/curation/getRorData'
rorData: 'explorer/curation/getRorData',
routeInfo: 'getRouteInfo'
}),
doi () {
if (this.dataset?.[this.datasetFields.doi]) {
Expand Down Expand Up @@ -436,7 +437,13 @@ export default {
})
},
navBack () {
this.$router.back()
// Note: A check to go back to gallery after curating a dataset
const { from } = this.routeInfo
if (from.name === 'CurateSDD') {
this.$router.push('/explorer/curate')
} else {
this.$router.back()
}
},
nav_to_tab (e) {
Object.keys(this.tabbed_content).forEach((el) => {
Expand Down
188 changes: 113 additions & 75 deletions app/src/pages/explorer/dataset/DatasetGallery.vue
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
<template>
<div class="gallery">
<div class="section_loader" v-if="loading">
<spinner
:loading="loading"
text='Loading Datasets'
/>
<spinner :loading="loading" text="Loading Datasets" />
</div>
<div
class="utility-roverflow"
v-else
>

<div class="utility-roverflow u--margin-toplg">
<div class="search_box card-icon-container u--margin-toplg">
<form class="form">
<div class="search_box_form">
<div class="form__group search_box_form-item-1">
<input type="text" ref="search_input" class="form__input form__input--flat"
placeholder="Search Datasets" name="search" id="search"
required v-model.lazy="searchWord" />
<label htmlFor="search" class="form__label search_box_form_label">Search Datasets</label>
<div class="utility-roverflow" v-else>
<div class="utility-roverflow u--margin-toplg">
<div class="search_box card-icon-container u--margin-toplg">
<form class="form">
<div class="search_box_form">
<div class="form__group search_box_form-item-1">
<input
type="text"
ref="search_input"
class="form__input form__input--flat"
placeholder="Search Datasets"
name="search"
id="search"
required
v-model.lazy="searchWord"
/>
<label
htmlFor="search"
class="form__label search_box_form_label"
>Search Datasets</label
>
</div>
</div>
</div>
<div class="form__group search_box_form-item-2 explorer_page-nav u--margin-neg">
<!-- <div class="form__field md-field">
<div
class="form__group search_box_form-item-2 explorer_page-nav u--margin-neg"
>
<!-- <div class="form__field md-field">
<select class="form__select"
v-model="filter" name="filter" id="filter">
<option value="" disabled selected hidden>Filter by...</option>
Expand All @@ -34,36 +40,31 @@
<option value="user">Curating User</option>
</select>
</div> -->
<button
type="submit"
class="btn btn--primary btn--noradius search_box_form_btn mid-first-li display-text u--margin-pos"
@click.prevent="submitSearch()"
>
Search Datasets
</button>
<button v-if="searchEnabled"
type="submit"
class="btn btn--primary btn--noradius search_box_form_btn mid-first-li display-text u--margin-pos"
@click.prevent="customReset()"
>
Clear Search
</button>
</div>
</form>
<button
type="submit"
class="btn btn--primary btn--noradius search_box_form_btn mid-first-li display-text u--margin-pos"
@click.prevent="submitSearch()"
>
Search Datasets
</button>
<button
v-if="searchEnabled"
type="submit"
class="btn btn--primary btn--noradius search_box_form_btn mid-first-li display-text u--margin-pos"
@click.prevent="customReset()"
>
Clear Search
</button>
</div>
</form>
</div>
</div>
</div>
<div class="u_content__result">
<!-- TODO TIME TO RESULT -->
<span class="u_color utility-navfont" id="css-adjust-navfont">
<span v-if="total === 0">
No results
</span>
<span v-else-if="total === 1">
1 result
</span>
<span v-else>
About {{total}} results
</span>
<span v-if="total === 0"> No results </span>
<span v-else-if="total === 1"> 1 result </span>
<span v-else> About {{ total }} results </span>
</span>
</div>
<template v-if="!!items && !!items.length">
Expand All @@ -74,25 +75,39 @@
class="btn--animated gallery-item"
>
<div class="u_gridicon u_gridbg">
<a download :href="(optionalChaining(() => result.distribution))">
<md-icon class="u_color_white" style="font-size: 14px !important"
<a download :href="optionalChaining(() => result.distribution)">
<md-icon
class="u_color_white"
style="font-size: 14px !important"
>
download</md-icon
>
download</md-icon>
</a>
<div v-if="isAuth && isAdmin" @click.prevent="editDataset(result)">
<div
v-if="isAuth && isAdmin"
@click.prevent="editDataset(result)"
>
<md-icon class="u_color_white">edit</md-icon>
</div>
<div v-if="isAuth && isAdmin" @click.prevent="renderDialog('Delete Dataset?', 'delete', result, 80)">
<div
v-if="isAuth && isAdmin"
@click.prevent="
renderDialog('Delete Dataset?', 'delete', result, 80)
"
>
<md-icon class="u_color_white">delete_outline</md-icon>
</div>
</div>
<router-link v-if="result.identifier" :to="{ name: 'DatasetVisualizer', params: { id: getDatasetId(result) }}">
<router-link
v-if="result.identifier"
:to="{
name: 'DatasetVisualizer',
params: { id: getDatasetId(result) }
}"
>
<md-card-media-cover md-solid>
<md-card-media v-if="result.thumbnail" md-ratio="4:3">
<img
:src="result.thumbnail"
:alt="result.label"
>
<img :src="result.thumbnail" :alt="result.label" />
</md-card-media>
<md-card-media v-else md-ratio="4:3" class="u--bg-grey">
</md-card-media>
Expand All @@ -101,7 +116,9 @@
<span class="md-subheading">
<strong>{{ result.label }}</strong>
</span>
<span class="md-body-1">{{ reduceDescription(result.description, 15) }}</span>
<span class="md-body-1">{{
reduceDescription(result.description, 15)
}}</span>
</md-card-header>
</md-card-area>
</md-card-media-cover>
Expand All @@ -114,43 +131,53 @@
@go-to-page="loadPrevNextImage($event)"
/>
</template>
<div class="utility-roverflow u_centralize_text u_margin-top-med"
<div
class="utility-roverflow u_centralize_text u_margin-top-med"
v-else-if="page > totalPages && totalPages > 0"
>
<h3 class="visualize_header-h3 u_margin-top-med">Invalid page number,
<a @click.prevent=loadPrevNextImage(totalPages)>return to page {{totalPages}}?</a>
<h3 class="visualize_header-h3 u_margin-top-med">
Invalid page number,
<a @click.prevent="loadPrevNextImage(totalPages)"
>return to page {{ totalPages }}?</a
>
</h3>
</div>
<div class="utility-roverflow u_centralize_text u_margin-top-med section_loader" v-else>
<div
class="utility-roverflow u_centralize_text u_margin-top-med section_loader"
v-else
>
<h1 class="visualize_header-h1 u_margin-top-med">No Datasets Found</h1>
</div>
</div>
<dialogbox :active="dialogBoxActive" :minWidth="dialog.minWidth">
<template v-slot:title>{{dialog.title}}</template>
<template v-slot:title>{{ dialog.title }}</template>
<template v-slot:content>
<div v-if="dialog.type=='delete'">
<div v-if="dialog.type == 'delete'">
<md-content v-if="dialog.dataset">
<div> This will permanently remove the dataset <b>{{dialog.dataset.label}}</b> </div>
with identifier <b>{{dialog.dataset.identifier}}</b> and any associated files.
<div>
This will permanently remove the dataset
<b>{{ dialog.dataset.label }}</b>
</div>
with identifier <b>{{ dialog.dataset.identifier }}</b> and any
associated files.
</md-content>
</div>
<div v-if="dialogLoading">
<spinner
:loading="dialogLoading"
text='Deleting Chart'
/>
<spinner :loading="dialogLoading" text="Deleting Dataset" />
</div>
</template>
<template v-slot:actions>
<span v-if="dialog.type=='delete' && dialog.dataset">
<span v-if="dialog.type == 'delete' && dialog.dataset">
<md-button @click.native.prevent="toggleDialogBox">
No, cancel
</md-button>
<md-button @click.native.prevent="deleteDataset(dialog.dataset)">
Yes, delete.
</md-button>
</span>
<md-button v-else @click.native.prevent="toggleDialogBox">Close</md-button>
<md-button v-else @click.native.prevent="toggleDialogBox"
>Close</md-button
>
</template>
</dialogbox>
</div>
Expand Down Expand Up @@ -221,17 +248,26 @@ export default {
async deleteDataset (dataset) {
if (!this.isAdmin) return // temporary safeguard
this.dialogLoading = true
await this.$store.dispatch('explorer/curation/deleteEntityNanopub', dataset.identifier)
await this.$store.dispatch(
'explorer/curation/deleteEntityNanopub',
dataset.identifier
)
await this.$store.dispatch('explorer/curation/deleteEntityES', {
identifier: dataset.identifier,
type: 'datasets'
})
await this.$store.dispatch('explorer/curation/deleteEntityFiles', {
distribution: dataset?.distribution ?? null,
thumbnail: dataset?.thumbnail ?? null
})
this.toggleDialogBox()
this.dialogLoading = false
await this.loadItems()
},
editDataset (dataset) {
return this.$router.push(`/explorer/curate/sdd/edit/${this.getDatasetId(dataset)}`)
return this.$router.push(
`/explorer/curate/sdd/edit/${this.getDatasetId(dataset)}`
)
},
downloadFiles (item) {
if (item.distribution) {
Expand All @@ -250,7 +286,9 @@ export default {
async loadItems (page = 1) {
this.loading = true
try {
await this.$store.dispatch('explorer/sddDatasets/loadDatasets', { page })
await this.$store.dispatch('explorer/sddDatasets/loadDatasets', {
page
})
} catch (error) {
this.$store.commit('setSnackbar', {
message: error || 'Something went wrong',
Expand Down
2 changes: 2 additions & 0 deletions app/src/pages/explorer/xml/YamlLoader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,5 @@ export default {
}
}
</script>

prefix = nanomine.org uri =
5 changes: 4 additions & 1 deletion app/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const router = new VueRouter({
}
})

router.beforeEach(async function (to, _, next) {
router.beforeEach(async function (to, from, next) {
if (to.meta.requiresAuth && !store.getters['auth/isAuthenticated']) {
if (!store.getters['auth/isAuthenticated']) {
store.commit(
Expand All @@ -96,13 +96,16 @@ router.beforeEach(async function (to, _, next) {

await store.dispatch('auth/tryLogin')
if (store.getters['auth/isAuthenticated']) {
store.commit('setRouteInfo', { to, from })
return next()
}
}
next('')
} else if (to.meta.requiresUnauth && store.getters.auth.isAuthenticated) {
store.commit('setRouteInfo', { to, from })
next()
} else {
store.commit('setRouteInfo', { to, from })
next()
}
})
Expand Down
Loading
Loading