Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Commit

Permalink
fix: change class proposals count available on count and pouches
Browse files Browse the repository at this point in the history
  • Loading branch information
vhf committed Dec 17, 2019
1 parent f99fb9b commit af845a1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
26 changes: 11 additions & 15 deletions components/fallback/PouchBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,18 @@
v-show="type === 'container'"
class="class-box-level-item">
<span class="class-box-label">
Object{{ classesCount === 1 ? '' : 's' }}
</span>
<span class="class-box-value">
{{ classesCount }}
{{ classesCount }} Object{{ classesCount === 1 ? '' : 's' }}
</span>
</div>
<client-only>
<template v-if="!isProposal">
<div
v-for="key in Object.keys(proposalCount)"
:key="key"
v-show="proposalCount[key]"
v-show="proposalCount[key] && proposalTypes.includes(key)"
class="class-box-level-item">
<span class="class-box-label">
{{ proposalType[key] }} Proposal{{ proposalCount[key] === 1 ? '' : 's' }}
</span>
<span class="class-box-value">
{{ proposalCount[key] }}
{{ proposalCount[key] }} {{ proposalTypeLabels[key] }} Proposal{{ proposalCount[key] === 1 ? '' : 's' }}
</span>
</div>
</template>
Expand Down Expand Up @@ -109,13 +103,15 @@ export default {
iriToId
},
data () {
const proposalTypeLabels = {
newClass: 'New Class',
newProperty: 'New Property',
changeClass: 'Change Class',
changeProperty: 'Change Property'
}
return {
proposalType: {
newClass: 'New Class',
newProperty: 'New Property',
changeClass: 'Change Class',
changeProperty: 'Change Property'
}
proposalTypeLabels,
proposalTypes: Object.keys(proposalTypeLabels)
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion pages/_.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<!-- layout-objects-list -->
<div
v-if="$termIRI.creativeWork.equals(objectType)"
v-if="displayStructure"
v-show="dataReady">
<section class="container layout-objects-list-head">
<h1 class="main-title">
Expand Down Expand Up @@ -154,6 +154,9 @@ export default {
},
computed: {
...graphGetters(['ontology', 'structure', 'structureTree']),
displayStructure () {
return this.$termIRI.creativeWork.equals(this.objectType)
},
isObjectList () {
return this.$termIRI && this.$termIRI.creativeWork.equals(this.objectType)
},
Expand Down
4 changes: 4 additions & 0 deletions plugins/libs/rdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,14 @@ export default ({ app, store }, inject) => {
changeProperty: 0
}
const mergeProposalCounts = (a, b) => {
if (b.added) {
return
}
a.newClass += b.newClass
a.newProperty += b.newProperty
a.changeClass += b.changeClass
a.changeProperty += b.changeProperty
b.added = true
}

const forest = Object.keys(nodes)
Expand Down
7 changes: 3 additions & 4 deletions store/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,15 @@ export const actions = {
},

async [RELOAD_DATASET] ({ commit, dispatch, state, rootState }) {
await dispatch(COUNT_PROPOSALS)
commit('rebuildStructureTree')

try {
const { version } = await this.app.$axios.$get('/api/version')
if (version === state.version) {
return true
}

const { ontologyDataset, structureDataset } = await fetchDataset(rootState.config)
if (state.ontologySerialized !== serialize(ontologyDataset) || state.structureSerialized !== serialize(structureDataset)) {
await dispatch(COUNT_PROPOSALS)
commit('ontologyInit', ontologyDataset)
commit('structureInit', structureDataset)
commit('rebuildStructureTree')
Expand All @@ -118,7 +117,7 @@ export const actions = {
const proposalType = proposalObject[proposalObject[0].proposalType]

if (proposalType === 'Class' && isEdit) {
iri = iri || originalIri
iri = originalIri || iri
}
if (!acc[iri]) {
acc[iri] = {
Expand Down

0 comments on commit af845a1

Please sign in to comment.