Skip to content

Commit

Permalink
feat(#458): Merging upstream updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tholulomo committed Aug 9, 2024
2 parents f64a2eb + aeed7f9 commit b15d2ac
Show file tree
Hide file tree
Showing 19 changed files with 719 additions and 225 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ package-lock.json
**/**/*.log

# Fuseki
mockDB/old-fuseki/
mockDB/fuseki/shiro.ini
mockDB/fuseki/backups/
mockDB/fuseki/databases/
Expand All @@ -39,7 +40,10 @@ mockDB/fuseki/log4j2.properties
mockDB/materialsmine_backup/
mockDB/fuseki/files/
mockDB/fuseki/
<<<<<<< HEAD
mockDB/old-fuseki/
=======
>>>>>>> aeed7f9992460ee97924129c5deb1bc0ae161abf

#Sync DB
mockDB/restore/mongodump/
Expand Down
136 changes: 68 additions & 68 deletions app/src/components/ChartGallery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@
</template>

<script>
import spinner from '@/components/Spinner'
import pagination from '@/components/explorer/Pagination'
import Dialog from '@/components/Dialog.vue'
import defaultImg from '@/assets/img/rdf_flyer.svg'
import { toChartId } from '@/modules/vega-chart'
import { mapGetters, mapActions, mapMutations } from 'vuex'
import reducer from '@/mixins/reduce'
import explorerQueryParams from '@/mixins/explorerQueryParams'
import spinner from '@/components/Spinner';
import pagination from '@/components/explorer/Pagination';
import Dialog from '@/components/Dialog.vue';
import defaultImg from '@/assets/img/rdf_flyer.svg';
import { toChartId } from '@/modules/vega-chart';
import { mapGetters, mapActions, mapMutations } from 'vuex';
import reducer from '@/mixins/reduce';
import explorerQueryParams from '@/mixins/explorerQueryParams';
export default {
name: 'ChartGallery',
Expand All @@ -160,7 +160,7 @@ export default {
default: () => false
}
},
data () {
data() {
return {
loading: false,
loadError: false,
Expand All @@ -172,7 +172,7 @@ export default {
title: 'Test'
},
dialogLoading: false
}
};
},
components: {
pagination,
Expand All @@ -194,11 +194,11 @@ export default {
totalFavorites: 'explorer/gallery/totalFavorites',
missingCharts: 'explorer/gallery/missingCharts'
}),
galleryChartItems () {
galleryChartItems() {
if (!this.isFavourite) {
return this.items
return this.items;
} else {
return this.favoriteChartItems
return this.favoriteChartItems;
}
}
},
Expand All @@ -209,129 +209,129 @@ export default {
'fetchFavoriteCharts'
]),
...mapMutations({ toggleDialogBox: 'setDialogBox' }),
renderDialog (title, type, result, minWidth) {
renderDialog(title, type, result, minWidth) {
this.dialog = {
title,
type,
minWidth,
chart: result
}
this.toggleDialogBox()
};
this.toggleDialogBox();
},
async deleteChart (chart, retry = false) {
async deleteChart(chart, retry = false) {
try {
if (!this.isAdmin) return // temporary safeguard
if (!this.isAdmin) return; // temporary safeguard
// Retry is a flag to determine if the function is called from retry action
if (!retry) {
this.dialogLoading = true
this.dialogLoading = true;
}
await this.$store.dispatch(
'explorer/curation/deleteEntityNanopub',
chart.identifier
)
);
await this.$store.dispatch('explorer/curation/deleteEntityES', {
identifier: chart.identifier,
type: 'charts'
})
await this.loadItems()
});
await this.loadItems();
if (!retry) {
this.toggleDialogBox()
this.dialogLoading = false
this.toggleDialogBox();
this.dialogLoading = false;
}
return
return;
} catch (error) {
if (!retry) {
this.toggleDialogBox()
this.dialogLoading = false
this.toggleDialogBox();
this.dialogLoading = false;
}
this.$store.commit('setSnackbar', {
message: error || 'Something went wrong',
action: () => this.deleteChart(chart, true)
})
});
}
},
editChart (chart) {
editChart(chart) {
return this.$router.push(
`/explorer/chart/editor/edit/${this.getChartId(chart)}`
)
);
},
async bookmark (chart) {
await this.bookmarkChart({ chart })
async bookmark(chart) {
await this.bookmarkChart({ chart });
},
async localSearchMethod () {
await this.loadItems(this.pageNumber)
async localSearchMethod() {
await this.loadItems(this.pageNumber);
},
async loadItems (page = 1) {
async loadItems(page = 1) {
try {
this.loading = true
await this.$store.dispatch('explorer/gallery/loadItems', { page })
this.loading = false
this.loading = true;
await this.$store.dispatch('explorer/gallery/loadItems', { page });
this.loading = false;
} catch (error) {
this.$store.commit('setSnackbar', {
message: error || 'Something went wrong',
action: () => this.loadItems(page)
})
return (this.loading = false)
});
return (this.loading = false);
}
},
getChartId (chart) {
return toChartId(chart.identifier)
getChartId(chart) {
return toChartId(chart.identifier);
},
formatMissingFavouriteText () {
const message = `${this.missingCharts.length} out of your favourite charts `
formatMissingFavouriteText() {
const message = `${this.missingCharts.length} out of your favourite charts `;
return this.missingCharts.length === 1
? `${message}is no longer available and has been removed from your favourite list.`
: `${message}are no longer available and have been removed from your favourite list.`
: `${message}are no longer available and have been removed from your favourite list.`;
},
checkAndRenderDialog () {
if (!this.missingCharts.length) return null
else this.renderDialog('Missing Charts', 'missingChart', '', 80)
checkAndRenderDialog() {
if (!this.missingCharts.length) return null;
else this.renderDialog('Missing Charts', 'missingChart', '', 80);
},
async loadFavorites () {
this.loading = true
async loadFavorites() {
this.loading = true;
if (!this.favoriteChartItems.length) {
await this.fetchFavoriteCharts(false)
await this.fetchFavoriteCharts(false);
}
this.loading = false
return this.checkAndRenderDialog()
this.loading = false;
return this.checkAndRenderDialog();
},
async loadRegularCharts () {
const query = this.$route.query
async loadRegularCharts() {
const query = this.$route.query;
if (query?.page) {
await this.loadParams(this.$route.query, false)
await this.loadParams(this.$route.query, false);
} else {
await this.loadItems()
await this.loadItems();
}
}
},
async mounted () {
async mounted() {
if (this.isFavourite) {
await this.loadFavorites()
await this.loadFavorites();
} else {
return await this.loadRegularCharts()
return await this.loadRegularCharts();
}
},
watch: {
newChartExist () {
newChartExist() {
if (!this.isFavourite) {
this.$store.commit('explorer/curation/setNewChartExist', false)
return this.loadItems()
this.$store.commit('explorer/curation/setNewChartExist', false);
return this.loadItems();
}
},
dialogBoxActive () {
dialogBoxActive() {
if (this.dialogBoxActive === false && this.isFavourite) {
this.$store.commit('explorer/gallery/setMissingCharts', [], {
root: true
})
});
}
}
},
created () {
created() {
this.$store.commit('setAppHeaderInfo', {
icon: '',
name: this.sender
})
});
}
}
};
</script>
13 changes: 9 additions & 4 deletions app/src/components/LoginRequired.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<template>
<div class="page-not-found">
<i class="material-icons page-not-found-header u--padding-zero" >lock_person</i>
<i class="material-icons page-not-found-header u--padding-zero"
>lock_person</i
>
<h2 class="u_margin-bottom-small">Login required</h2>
<p>The page you are trying to access requires authentication.
Would you like to <a>log in</a> or return to the
<router-link to=""><a @click="$router.go(-1)">previous page</a></router-link>?
<p>
The page you are trying to access requires authentication. Would you like
to <a href="/secure">log in</a> or return to the
<router-link to=""
><a @click="$router.go(-1)">previous page</a></router-link
>?
</p>
</div>
</template>
10 changes: 7 additions & 3 deletions app/src/components/nanomine/HeroHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@
</li>
<li class="u_margin-right-small">
<div class="nav_menu--container">
<a class="u--default-size nav_menu--handler" href="#">Curate</a>
<div class="nav_menu--siblings">
<a
class="u--default-size nav_menu--handler"
href="/explorer/curate"
>Curate</a
>
<!-- <div class="nav_menu--siblings">
<a
href="/explorer/curate/spreadsheet"
class="nav_menu--siblings-lists"
Expand All @@ -95,7 +99,7 @@
class="nav_menu--siblings-lists"
><a>Create Chart</a></router-link
>
</div>
</div> -->
</div>
</li>
<li class="u_margin-right-small">
Expand Down
2 changes: 1 addition & 1 deletion app/src/modules/vega-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ async function loadChart (chartUri) {
const rows = results.bindings

if (rows.length < 1) {
throw new Error(`No chart found for uri: ${chartUrl}`)
throw new Error(`No data found for the specified chart URI: ${chartUrl}`)
}

return await readChartSparqlRow(rows[0])
Expand Down
23 changes: 20 additions & 3 deletions app/src/pages/explorer/Curate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,32 @@
<md-icon class="explorer_page-nav-card_icon"
>done_outline</md-icon
>
<span class="explorer_page-nav-card_text"
>Submit with SDD</span
>
<span class="explorer_page-nav-card_text">Submit SDD</span>
<p class="md-layout-item_para md-layout-item_para_fl">
Submit files that use a semantic data dictionary (SDD).
</p>
</div>
</router-link>
</div>
<div class="md-layout-item md-layout-item_card">
<router-link
to="/explorer/curate/xml"
v-slot="{ navigate, href }"
custom
>
<div
class="teams_container explorer_page-nav-card md-layout-item_card"
:href="href"
@click="navigate"
>
<md-icon class="explorer_page-nav-card_icon">upload</md-icon>
<span class="explorer_page-nav-card_text">Upload an XML</span>
<p class="md-layout-item_para md-layout-item_para_fl">
Directly upload XML files.
</p>
</div>
</router-link>
</div>
<!-- Extra Div causes misalignment and has no known use -->
<!-- <div class="md-layout-item md-layout-item_card">
</div> -->
Expand Down
12 changes: 7 additions & 5 deletions app/src/pages/explorer/chart/editor/Chart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ export default {
querySparql(vm.chart.query)
.then(this.onQuerySuccess)
.then((this.loading = false))
.catch((this.loading = false))
},
onQuerySuccess (results) {
this.results = results
},
onSpecJsonError () {
// console.log('bad', arguments)
},
async onNewVegaView (view) {
const blob = await view
Expand Down Expand Up @@ -215,10 +215,12 @@ export default {
this.actionType = 'Restore Chart'
this.reloadRestored()
}
getChartPromise.then((chart) => {
this.chart = chart
return this.getSparqlData()
})
getChartPromise
.then((chart) => {
this.chart = chart
return this.getSparqlData()
})
.catch((this.loading = false))
},
async reloadRestored () {
// 1. Fetch backup from mongo
Expand Down
Loading

0 comments on commit b15d2ac

Please sign in to comment.