diff --git a/dicoogle/src/main/resources/webapp/js/components/search/advancedSearch.js b/dicoogle/src/main/resources/webapp/js/components/search/advancedSearch.js deleted file mode 100644 index d326f2a32..000000000 --- a/dicoogle/src/main/resources/webapp/js/components/search/advancedSearch.js +++ /dev/null @@ -1,343 +0,0 @@ -import React from "react"; -import ReactDOM from "react-dom"; -import createReactClass from "create-react-class"; -import { SearchStore } from "../../stores/searchStore"; -import { ActionCreators } from "../../actions/searchActions"; -import { SearchResult } from "./searchResult"; - -// TODO this component needs to be refactored: -// - it should not perform React renders -// - it should delegate the actual search to the parent component - -const AdvancedSearch = createReactClass({ - getInitialState: function() { - return { label: "login" }; - }, - - render: function() { - var managementInstance = ( -
-
-
-
-
-
Patient Name
- -
-
-
Patient ID
- -
-
-
Patient Gender
-
-
- All{" "} - -
-
- Male{" "} - -
-
- Female{" "} - -
-
-
-
-
Instituition Name
- -
-
-
Physician
- -
-
-
Operator Name
- -
-
-
-
-
Modality
-
-
-
- -
-
- -
-
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-
-
-
Date
- -
-
-
- -
-
- ); - return managementInstance; - }, - componentWillMount: function() { - // Subscribe to the store. - this.unsubscribe = SearchStore.listen(this._onChange); - }, - componentWillUnmount() { - this.unsubscribe(); - }, - - _onChange: function(data) { - console.log(data); - }, - onSearchClicked: function() { - console.log("SEARCH CLICKED"); - //NAME - var patientName = document.getElementById("patient_name").value; - var query = "PatientName: " + this.checkEmpty(patientName); //TODO FINISH - - //GENDER - var gender; - if (document.getElementById("gender_male").checked) { - gender = " AND PatientSex:M"; - } else if (document.getElementById("gender_female").checked) { - gender = " AND PatientSex:F"; - } else { - gender = ""; - } - query = query + gender; - //ID - var patientId = document.getElementById("patient_id").value; - if (this.checkEmpty(patientId) !== "*") - query = query + " AND PatientID: " + this.checkEmpty(patientId); - //Instituition - var instituition = document.getElementById("instituition").value; - if (this.checkEmpty(instituition) !== "*") - query = query + " AND InstitutionName: " + this.checkEmpty(instituition); - //Pshysician - var physician = document.getElementById("physician").value; - if (this.checkEmpty(physician) !== "*") - query = - query + " AND PerformingPhysicianName: " + this.checkEmpty(physician); - //OperatorName - var OperatorName = document.getElementById("OperatorName").value; - if (this.checkEmpty(OperatorName) !== "*") - query = query + " AND OperatorName: " + this.checkEmpty(OperatorName); - /////// - - var mods = document.querySelector(".modalities"); - var mods_checked = Array.prototype.slice.call( - mods.querySelectorAll("input") - ); - - var modalities = ""; - mods_checked.forEach(function(element) { - //console.log(element.checked); - if (element.checked) { - modalities = modalities + " " + element.name; - } - }); - - if (modalities !== "") { - modalities = " AND Modality: (" + modalities + ")"; - query = query + modalities; - } - - //DATE - let date = document.getElementById("datepicker").value; // format: YYYYMMDD - if (date !== "") { - query = query + " AND StudyDate:[" + date + " TO " + date + "]"; - } - - var providerEl = document.getElementById("providersList"); - var selectedId = providerEl.selectedIndex; - var provider = ""; - if (selectedId === 0) { - provider = "all"; - } else { - provider = providerEl.options[selectedId].text; - } - - /////// - var params = { text: query, keyword: true, other: true, provider }; - - ReactDOM.render( - , - document.getElementById("container") - ); - }, - checkEmpty: function(text) { - if (text.length === 0) return "*"; - else return text; - }, - fix2: function(n) { - return n < 10 ? "0" + n : n; - } -}); - -export { AdvancedSearch }; - -window.action = ActionCreators; diff --git a/dicoogle/src/main/resources/webapp/js/components/search/searchView.jsx b/dicoogle/src/main/resources/webapp/js/components/search/searchView.jsx index 641566c06..ea8da3cdf 100644 --- a/dicoogle/src/main/resources/webapp/js/components/search/searchView.jsx +++ b/dicoogle/src/main/resources/webapp/js/components/search/searchView.jsx @@ -6,7 +6,6 @@ import Autosuggest from "react-autosuggest"; import { ActionCreators } from "../../actions/searchActions"; import { ProvidersStore } from "../../stores/providersStore"; import { ProvidersActions } from "../../actions/providersActions"; -import { AdvancedSearch } from "../search/advancedSearch"; import { SearchResult } from "../search/searchResult"; import { DimFields } from "../../constants/dimFields"; import { getUrlVars } from "../../utils/url"; @@ -24,7 +23,6 @@ const Search = createReactClass({ let fields = DimFields.map(field => ({ value: field, label: field })); return { label: "login", - searchState: "simple", providers: [], selectedProviders: [], queryText: "", @@ -83,35 +81,22 @@ const Search = createReactClass({ })); let selectionButtons = ( -
-
-
- -
-
-
); - let simpleSearchInstance = ( + let searchInstance = (