From d7a48dd6ae94911fedc2aa0d5419e55312ed7975 Mon Sep 17 00:00:00 2001 From: Louis Vichy Date: Tue, 30 Jan 2018 21:15:11 -0500 Subject: [PATCH 1/3] Save imagery-in-progress to the store --- .../src/components/open-image/ImageSeries.vue | 14 +++++++------- .../src/components/open-image/TreeView.vue | 3 +-- interface/frontend/src/store.js | 12 ++++++++++++ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/interface/frontend/src/components/open-image/ImageSeries.vue b/interface/frontend/src/components/open-image/ImageSeries.vue index 10f41d3f..5a0b302e 100644 --- a/interface/frontend/src/components/open-image/ImageSeries.vue +++ b/interface/frontend/src/components/open-image/ImageSeries.vue @@ -110,8 +110,7 @@ + :selectedSeries="selectedUri">
@@ -165,6 +164,7 @@ endpoints: 'endpoints', caseInProgress: 'caseInProgress', caseInProgressIsValid: 'caseInProgressIsValid', + imageInProgress: 'imageInProgress', candidatesExist: 'candidatesExist' }) }, @@ -223,12 +223,12 @@ this.selectCase(case_) } }, - selectSeries (seriesId) { - console.log('selecting ', seriesId) - this.selectedUri = seriesId - }, async startNewCase () { - await this.$store.dispatch('startNewCase', {'uri': this.selectedUri}) + if (!this.imageInProgress.id) { + console.error('No Imagery Selected'); + return; + } + await this.$store.dispatch('startNewCase', {'uri': this.imageInProgress.id}) setTimeout(() => { this.refreshAvailableCases() }, 1000) }, displayName (case_) { diff --git a/interface/frontend/src/components/open-image/TreeView.vue b/interface/frontend/src/components/open-image/TreeView.vue index 22de02e5..2afccfe7 100644 --- a/interface/frontend/src/components/open-image/TreeView.vue +++ b/interface/frontend/src/components/open-image/TreeView.vue @@ -19,7 +19,6 @@ :selectedSeries="selectedSeries" :parent="parent + '/' + model.name" v-on:childSelected="selectSeries" - v-on:selectSeries="selectSeries" >
  • {{ file.name }}
  • @@ -92,7 +91,7 @@ this.$set(this, 'open', !this.open) }, selectSeries: function (seriesId) { - this.$emit('selectSeries', seriesId) + this.$store.dispatch('loadImagery', {'id': seriesId}) }, select: function (file) { // file selected should tell parent series diff --git a/interface/frontend/src/store.js b/interface/frontend/src/store.js index 9de569f8..82dcca23 100644 --- a/interface/frontend/src/store.js +++ b/interface/frontend/src/store.js @@ -13,6 +13,9 @@ const actions = { axios.get(API_ROOT) .then((response) => { commit('GET_ENDPOINTS', response.data) }) }, + loadImagery ({ commit }, { id, caseCreated }) { + commit('SET_IMAGE_IN_PROGRESS', { id, caseCreated }) + }, loadCase ({ commit }, { url }) { axios.get(url) .then((response) => { commit('SET_CASE_IN_PROGRESS', response.data) }) @@ -47,6 +50,9 @@ const actions = { const store = new Vuex.Store({ state: { + // The image chosen by the user, to be made into a case + imageInProgress: {}, + // the case that we are working on, either selected or // created on the open and import page caseInProgress: {}, @@ -55,6 +61,9 @@ const store = new Vuex.Store({ topLevelEndpoints: {} }, getters: { + imageInProgress (state) { + return state.imageInProgress + }, caseInProgress (state) { return state.caseInProgress }, @@ -90,6 +99,9 @@ const store = new Vuex.Store({ GET_ENDPOINTS (state, endpoints) { state.topLevelEndpoints = endpoints }, + SET_IMAGE_IN_PROGRESS (state, _image) { + state.imageInProgress = _image + }, SET_CASE_IN_PROGRESS (state, _case) { state.caseInProgress = _case }, From 49cc24ce6be31a70849ef855ac5490dc9594eed9 Mon Sep 17 00:00:00 2001 From: Louis Vichy Date: Tue, 30 Jan 2018 21:27:41 -0500 Subject: [PATCH 2/3] Bind the store value to the disabled state --- .../frontend/src/components/open-image/ImageSeries.vue | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/interface/frontend/src/components/open-image/ImageSeries.vue b/interface/frontend/src/components/open-image/ImageSeries.vue index 5a0b302e..0cfef4c6 100644 --- a/interface/frontend/src/components/open-image/ImageSeries.vue +++ b/interface/frontend/src/components/open-image/ImageSeries.vue @@ -103,14 +103,13 @@
    -
    + :parent="directories.name">
    @@ -152,7 +151,6 @@ paths: [], state: '' }, - selectedUri: null, showImport: false } }, @@ -225,8 +223,7 @@ }, async startNewCase () { if (!this.imageInProgress.id) { - console.error('No Imagery Selected'); - return; + return console.error('No Imagery Selected') } await this.$store.dispatch('startNewCase', {'uri': this.imageInProgress.id}) setTimeout(() => { this.refreshAvailableCases() }, 1000) From 0663ae38714a1a410cf9d7cf77f5ffc3a0e629b4 Mon Sep 17 00:00:00 2001 From: Louis Vichy Date: Tue, 30 Jan 2018 21:33:14 -0500 Subject: [PATCH 3/3] refactor the buttons. Refer to UX problem in #295 --- .../src/components/open-image/ImageSeries.vue | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/interface/frontend/src/components/open-image/ImageSeries.vue b/interface/frontend/src/components/open-image/ImageSeries.vue index 0cfef4c6..4adadf08 100644 --- a/interface/frontend/src/components/open-image/ImageSeries.vue +++ b/interface/frontend/src/components/open-image/ImageSeries.vue @@ -91,9 +91,19 @@
    - + + + + Import image series for new case +
    @@ -102,11 +112,6 @@
    -
    - -