Skip to content

Commit

Permalink
Merge branch 'main' into enh-821
Browse files Browse the repository at this point in the history
  • Loading branch information
rmanaem committed Dec 12, 2024
2 parents 48ddbeb + b578fd7 commit a041cdf
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"TermURL": "nb:Age"
},
"Transformation": {
"Label": "integer value",
"Label": "float value",
"TermURL": "nb:FromFloat"
},
"MissingValues": []
Expand Down
21 changes: 19 additions & 2 deletions pages/download.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,21 @@
</b-col>

</b-row>
<b-row align-h="center">
<b-col cols="3">
<b-button
@click="restartAnnotation">
{{ uiText.restartButton }}
</b-button>
</b-col>
</b-row>

</div>

</template>

<script>
import { mapState, mapGetters, mapActions } from "vuex";
import { mapState, mapGetters, mapActions, mapMutations } from "vuex";
import { saveAs } from "file-saver";
import Ajv from "ajv";
import jsonSchema from "@/assets/neurobagel_data_dictionary.schema.json";
Expand Down Expand Up @@ -113,7 +121,8 @@
// Text for UI elements
uiText: {
downloadButton: "Download Annotated Data"
downloadButton: "Download Annotated Data",
restartButton: "Annotate Another Dataset"
},
incompleteAnnotations: [],
Expand Down Expand Up @@ -163,10 +172,18 @@
},
methods: {
...mapMutations([
"resetState"
]),
...mapActions([
"navigateToPage"
]),
restartAnnotation() {
this.resetState();
this.navigateToPage("home");
},
formatJson(p_jsonData) {
if (p_jsonData) {
return JSON.stringify(p_jsonData, null, this.jsonSpacing);
Expand Down
20 changes: 17 additions & 3 deletions store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import Vue from "vue";
import toolTerms from "~/static/toolTerms.json";
import diagnosisTerms from "~/static/diagnosisTerms.json";

export const state = () => ({
// The default state of the store
function getDefaultState() {
return {

// Keeps track of number of annotations made in current run;
// > 0 annotations allows access to the download page
Expand Down Expand Up @@ -151,7 +153,10 @@ export const state = () => ({
})),

columnToToolMap: {}
});
};
}

export const state = () => getDefaultState();

export const getters = {

Expand Down Expand Up @@ -936,5 +941,14 @@ export const mutations = {

// 2. Save the updated annotation in the store
p_state.annotationCount = count;
}
},

resetState(p_state) {
const initialState = getDefaultState();
Object.keys(p_state).forEach((key) => {
if (Object.prototype.hasOwnProperty.call(initialState, key)) {
Vue.set(p_state, key, initialState[key]);
}
});
}
};

0 comments on commit a041cdf

Please sign in to comment.