diff --git a/dicoogle/src/main/resources/webapp/js/actions/transferActions.js b/dicoogle/src/main/resources/webapp/js/actions/transferActions.js index b926b898a..77a3f1617 100644 --- a/dicoogle/src/main/resources/webapp/js/actions/transferActions.js +++ b/dicoogle/src/main/resources/webapp/js/actions/transferActions.js @@ -1,7 +1,17 @@ import Reflux from "reflux"; + +export const get = Reflux.createAction(); +export const set = Reflux.createAction(); +export const selectAll = Reflux.createAction(); +export const unSelectAll = Reflux.createAction(); +export const selectAllSOP = Reflux.createAction(); +export const unSelectAllSOP = Reflux.createAction(); + export const TransferActions = { - get: Reflux.createAction(), - set: Reflux.createAction(), - selectAll: Reflux.createAction(), - unSelectAll: Reflux.createAction() + get, + set, + selectAll, + unSelectAll, + selectAllSOP, + unSelectAllSOP, }; diff --git a/dicoogle/src/main/resources/webapp/js/components/management/transferOptionsView.js b/dicoogle/src/main/resources/webapp/js/components/management/transferOptionsView.js index 554be3aea..723eabd03 100644 --- a/dicoogle/src/main/resources/webapp/js/components/management/transferOptionsView.js +++ b/dicoogle/src/main/resources/webapp/js/components/management/transferOptionsView.js @@ -1,33 +1,54 @@ import React from "react"; -import createReactClass from "create-react-class"; import { TransferStore } from "../../stores/transferStore"; -import { TransferActions } from "../../actions/transferActions"; +import * as TransferActions from "../../actions/transferActions"; -const TransferOptionsView = createReactClass({ - getInitialState() { +/** + * @typedef {Object} SOPClassTransferRecord + * @property {string} uid + * @property {string} sop_name + * @property {Array} options + */ + +/** + * @typedef {Object} TransferSyntaxRecord + * @property {string} uid + * @property {string} sop_name + */ + +class TransferOptionsView extends React.Component { + + constructor(props) { + super(props); this.selectAllOn = true; - return { - data: [], + this.selectSOPOn = true; + this.state = { + /** @type {{data: Array}} */ + data: {}, status: "loading", selectedIndex: 0 }; - }, - componentDidMount() { - console.log("componentdidmount: get"); + + this._onChange = this._onChange.bind(this); + this.handleSelectSop = this.handleSelectSop.bind(this); + this.handleSelectAll = this.handleSelectAll.bind(this); + this.onSopSelected = this.onSopSelected.bind(this); + } + componentDidMount() { TransferActions.get(); - }, + } + componentWillMount() { // Subscribe to the store. - console.log("subscribe listener"); this.unsubscribe = TransferStore.listen(this._onChange); - }, + } + componentWillUnmount() { this.unsubscribe(); - }, + } + _onChange(data) { - //console.log(data); if (!data.success) { this.props.showToastMessage("error", { title: "Error", @@ -38,7 +59,8 @@ const TransferOptionsView = createReactClass({ } this.setState({ data: data, status: "done" }); - }, + } + render() { if (this.state.status === "loading") { return ( @@ -50,9 +72,8 @@ const TransferOptionsView = createReactClass({ ); } - var array = this.state.data; - console.log("array", array); - var options = array.data[this.state.selectedIndex].options.map( + let array = this.state.data.data; + let options = array[this.state.selectedIndex].options.map( (item, index) => { return (
@@ -64,14 +85,14 @@ const TransferOptionsView = createReactClass({ checked={item.value} onChange={this.handleChange.bind(this, item.name, index)} /> - {item.name} + {item.name} -- {item.uid}
); } ); - var sopclasses = array.data.map((item, index) => { + var sopclasses = array.map((item, index) => { return (