Commit bc2c1cb4 authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

added reload and delete option for each loaded data item

parent e3a8aeb0
......@@ -7,7 +7,7 @@
v-for="item in items">
<div class="data-entry-header"
:data-state="item.state"
@click="toggleDataEntryBody(item.message, $event)">
@click="toggleDataEntryBody($event)">
<span class="cross" v-if="item.state === 'FAILURE'">&#xd7</span>
<input type="checkbox"
:id="'data-check-' + item.data_id"
......@@ -15,14 +15,14 @@
v-model="selectedIDs"
v-if="item.state === 'SUCCESS'"/>
<label :for="'data-check-' + item.data_id">
{{ item.description }}
{{ item.label }}
</label>
</div>
<div class="data-entry-body" :data-state="item.state">
<div class="action-btns">
<button class="reload-btn">&#8635</button>
<button class="delete-btn">&#215</button><br/>
<button class="reload-btn" @click="reloadData(item.data_id)">&#8635</button>
<button class="delete-btn" @click="deleteData(item.data_id)">&#215</button><br/>
</div>
{{ item.message }}
</div>
......@@ -69,15 +69,13 @@
}
},
methods: {
toggleDataEntryBody (message, $event) {
if (message) {
const $header = $($event.currentTarget)
const $content = $header.next()
$content.slideToggle(500)
}
toggleDataEntryBody ($event) {
const $header = $($event.currentTarget)
const $content = $header.next()
$content.slideToggle(500)
},
reloadData (dataID) {
window.alert('Not implemented, yet.')
store.getters.requestManager.reloadData({dataID})
},
deleteData (dataID) {
store.getters.requestManager.deleteData({dataID})
......@@ -107,19 +105,20 @@
overflow: hidden;
text-overflow: ellipsis;
width: 98%;
cursor: pointer;
}
.data-entry-header label {
width: 80%
width: 80%;
pointer-events: none;
}
.data-entry-header:nth-child(odd)[data-state="SUCCESS"] {
}
.data-entry-header[data-state="FAILURE"], .data-entry-header[data-state="FAILURE"] * {
.data-entry-header[data-state="FAILURE"] {
background-color: #ffcbcb;
cursor: pointer;
}
.data-entry-header[data-state="PENDING"] {
......
......@@ -19,6 +19,11 @@ class FractalJS {
this._chartManager.setChart({chart, selector})
}
// noinspection JSMethodCanBeStatic
clearCache () {
store.state.requestManager.deleteAllData()
}
// noinspection JSMethodCanBeStatic
setSubsets (...subsets) {
store.dispatch('setSubsets', subsets)
......
import axios from 'axios'
import store from '../store/store'
export default class {
constructor ({handler, thisBaseURL, fractalisBaseURL, getAuth}) {
......@@ -22,6 +23,12 @@ export default class {
})
}
reloadData ({dataID}) {
const dataItem = store.getters.data.find(d => d.data_id === dataID)
const descriptors = [dataItem.descriptor]
this.createData({descriptors})
}
getDataStatusByParams ({descriptor}) {
const params = JSON.stringify({server: this._thisBaseURL, descriptor})
return this._axios.get(`/data/${params}`)
......@@ -39,6 +46,10 @@ export default class {
return this._axios.delete(`/data/${dataID}`)
}
deleteAllData () {
return this._axios.delete('/data')
}
createAnalysis ({job_name, args}) {
return this._axios.post('/analytics', {job_name, args})
}
......
......@@ -17,7 +17,7 @@
thisBaseURL: 'http://10.79.2.192:8080',
fractalisBaseURL: 'http://127.0.0.1:5000',
getAuth () {
return credentials
return credentials1
}
})
fjs.loadData([
......@@ -25,7 +25,7 @@
data_type: 'Enum',
data_set: 'denopa.clinical_baseline',
projection: 'Geschlecht',
get description () {
get label () {
return `${this.projection} (${this.data_set})`
}
},
......@@ -33,7 +33,7 @@
data_type: 'Integer',
data_set: 'denopa.clinical_baseline',
projection: 'a_Alter',
get description () {
get label () {
return `${this.projection} (${this.data_set})`
}
},
......@@ -41,7 +41,7 @@
data_type: 'Double',
data_set: 'denopa.clinical_baseline',
projection: 'a_AESD_I_mean',
get description () {
get label () {
return `${this.projection} (${this.data_set})`
}
},
......@@ -49,7 +49,7 @@
data_type: 'Enum',
data_set: 'foo',
projection: 'baraaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
get description () {
get label () {
return `${this.projection} (${this.data_set})`
}
}
......
......@@ -13,9 +13,9 @@ describe('DataBox', () => {
it('renders 3 checkboxes for 3 elements in data', () => {
store.state.data = [
{data_type: 'numeric', description: ''},
{data_type: 'numeric', description: ''},
{data_type: 'numeric', description: ''}
{data_type: 'numeric', label: ''},
{data_type: 'numeric', label: ''},
{data_type: 'numeric', label: ''}
]
const Component = Vue.extend(DataBox)
const propsData = {dataType: 'numeric', header: ''}
......@@ -25,8 +25,8 @@ describe('DataBox', () => {
it('only renders checkboxes for data with correct type', () => {
store.state.data = [
{data_type: 'numeric', description: ''},
{data_type: 'categoric', description: ''},
{data_type: 'numeric', label: ''},
{data_type: 'categoric', label: ''},
]
const Component = Vue.extend(DataBox)
const propsData = {dataType: 'numeric', header: ''}
......@@ -36,8 +36,8 @@ describe('DataBox', () => {
it('checkboxes are linked to data', () => {
store.state.data = [
{data_type: 'numeric', description: '', data_id: 'A'},
{data_type: 'numeric', description: '', data_id: ''}
{data_type: 'numeric', label: '', data_id: 'A'},
{data_type: 'numeric', label: '', data_id: ''}
]
const Component = Vue.extend(DataBox)
const propsData = {dataType: 'numeric', header: ''}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment