Skip to content

Commit

Permalink
Include submitted query and provider in “result-selection-ready” event (
Browse files Browse the repository at this point in the history
#673)

* include query in search servlet data

* rework to use new store/action instances

* Remove unnecessarily added line

Co-authored-by: Eduardo Pinho <[email protected]>

* remove unnecessary code from requestStore.js

* add provider field to event; rework store content

---------

Co-authored-by: Eduardo Pinho <[email protected]>
  • Loading branch information
tiberio-baptista and Enet4 committed Oct 14, 2023
1 parent 67c7209 commit 46dc5d8
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Reflux from "reflux";
const RequestActions = {
query: Reflux.createAction(),
};
export { RequestActions };
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import * as PropTypes from "prop-types";
import { ResultsSelected } from "../../stores/resultSelected";
import { RequestStore } from "../../stores/requestStore";
import { SearchStore } from "../../stores/searchStore";
import Webcore from "dicoogle-webcore";

Expand Down Expand Up @@ -43,6 +44,7 @@ export default class PluginForm extends React.Component {
node,
"result-selection-ready",
{
"request": RequestStore.get(),
"selected": ResultsSelected.get(),
"search": SearchStore.get()
}
Expand Down
26 changes: 26 additions & 0 deletions dicoogle/src/main/resources/webapp/js/stores/requestStore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import Reflux from "reflux";

import { RequestActions } from "../actions/requestActions";

const RequestStore = Reflux.createStore({
listenables: RequestActions,

init: function() {
this._query = "";
this._provider = "";
},

onQuery: function(query, provider) {
this._query = query
this._provider = provider
},

get: function() {
return {
query: this._query,
provider: this._provider
};
}
});

export { RequestStore };
5 changes: 5 additions & 0 deletions dicoogle/src/main/resources/webapp/js/stores/searchStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { getPatients } from "../handlers/requestHandler";
import { unindex } from "../handlers/requestHandler";
import { remove } from "../handlers/requestHandler";

import { RequestActions } from "../actions/requestActions";

const SearchStore = Reflux.createStore({
listenables: ActionCreators,
init: function() {
Expand All @@ -20,6 +22,9 @@ const SearchStore = Reflux.createStore({

onSearch: function(data) {
var self = this;

RequestActions.query(data.text, data.provider)

getPatients(
data.text,
undefined,
Expand Down

0 comments on commit 46dc5d8

Please sign in to comment.