Skip to content

Commit

Permalink
#393: basic template for errors in provenance.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Mulholland committed Mar 28, 2018
1 parent 8ecc93d commit b4a4093
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
22 changes: 18 additions & 4 deletions src/renderer/partials/ProvenanceProperties.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@
<span class="provenance-preview-icon glyphicon" :class="buttonIconClass"/>{{buttonText}}
</button>
</span>
<div v-if="isPreview" v-html="markText" class="col-sm-9" id="preview" />
<textarea v-else v-model="provenance" :placeholder="placeholder" rows="25" cols="55" class="form-control input-sm col-sm-9" id="description" />
<template v-if="isPreview">
<div v-html="markProvenanceText" class="col-sm-9" id="provenance-preview" />
<div v-html="markErrorsText" class="col-sm-9" id="provenance-errors-preview" />
</template>
<template v-else>
<textarea v-model="provenance" :placeholder="placeholder" rows="25" cols="55" class="form-control input-sm col-sm-9" id="provenance-description" />
<textarea v-model="provenanceErrors" rows="10" cols="55" class="form-control input-sm col-sm-9" id="provenance-errors" />
</template>
</div>
</div>
</form>
Expand All @@ -32,9 +38,12 @@ export default {
...mapGetters([
'getProvenance'
]),
markText() {
markProvenanceText() {
return markdown().render(this.provenance)
},
markErrorsText() {
return markdown().render(this.provenanceErrors)
},
buttonIconClass() {
return this.isPreview ? 'glyphicon-pencil' : 'glyphicon-search'
},
Expand All @@ -44,10 +53,14 @@ export default {
},
methods: {
...mapMutations([
'pushProvenance'
'pushProvenance', 'removeProvenanceErrors'
]),
togglePreview: function() {
this.isPreview = !this.isPreview
},
addErrorsToProvenance: function() {
// this.pushProvenanceErrors(errors)
this.provenanceErrors = this.getProvenance.errors
}
},
watch: {
Expand All @@ -62,6 +75,7 @@ export default {
return {
isPreview: false,
provenance: '',
provenanceErrors: '',
placeholder: `Short description of the dataset (the first sentence and first paragraph should be extractable to provide short standalone descriptions)
### Why was the dataset created?
Expand Down
8 changes: 7 additions & 1 deletion src/renderer/store/modules/hots.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const state = {
hotTabs: {},
packageProperties: {},
provenanceProperties: { markdown: '' }
provenanceProperties: { markdown: '', errors: '' }
}

const tableFields = ['encoding', 'format', 'mediatype', 'missingValues', 'name', 'path', 'profile', 'sources', 'title', 'primaryKeys', 'description', 'licenses']
Expand Down Expand Up @@ -135,6 +135,12 @@ const mutations = {
pushProvenance(state, value) {
_.set(state.provenanceProperties, 'markdown', value)
},
pushProvenanceErrors(state, value) {
_.set(state.provenanceProperties, 'errors', value)
},
removeProvenanceErrors(state, key) {
_.set(state.provenanceProperties, 'errors', '')
},
pushHotTab(state, hotTab) {
let hotId = hotTab.hotId
if (!hotId) {
Expand Down
8 changes: 5 additions & 3 deletions static/css/provenanceprops.styl
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#provenanceProperties
#description
#provenance-description
#provenance-errors
background-color #fff
width 100%
border 1px solid #ccc
#preview
@extend #provenanceProperties #description
#provenance-preview
#provenance-errors-preview
@extend #provenanceProperties #provenance-description
min-height: 14px
.provenance-preview-icon
margin-right 5px

0 comments on commit b4a4093

Please sign in to comment.