Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
closes #134
Browse files Browse the repository at this point in the history
  • Loading branch information
cglewis committed Apr 16, 2020
1 parent 9cd1cc2 commit ba33251
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ui/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Grid, Button } from 'semantic-ui-react';
import { startFetchResults, stopFetchResults } from "epics/auto-fetch-results-epic"
import { fetchResults } from 'epics/fetch-results-epic'
import { fetchToolStatus } from 'epics/fetch-status-epic'
import { fetchTools } from 'epics/fetch-tools-epic'
import { setSessionId, getResults, getToolStatuses } from 'domain/data';

import './App.css';
Expand Down Expand Up @@ -47,6 +48,7 @@ class App extends React.Component {
fetchResults = () => {
console.log("Peasant Burnination initiated...");
this.props.fetchResults({ 'sessionId': this.state.sessionId });
this.props.fetchTools();
console.log("Peasant Burnination complete!");
}

Expand All @@ -59,6 +61,7 @@ class App extends React.Component {
console.log("This House Oldification complete")
}


render() {
return (
<>
Expand Down Expand Up @@ -107,6 +110,7 @@ const mapDispatchToProps = {
setSessionId,
fetchResults,
fetchToolStatus,
fetchTools,
startFetchResults,
stopFetchResults,
};
Expand Down
14 changes: 13 additions & 1 deletion ui/src/components/table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { connect } from "react-redux";
import { Tab, Icon, Label } from 'semantic-ui-react';
import './Table.css';

import { getResults, getToolStatuses } from 'domain/data';
import { getResults, getToolStatuses, getTools } from 'domain/data';

const customStyles = {
rows: {
Expand Down Expand Up @@ -78,6 +78,16 @@ class Table extends React.Component{
renderTool = (item, type) => {
const id = item.id;
const value = item.tool;

console.log(this.props.tools);
for(const tool of this.props.tools){
if(tool.name == value && tool.viewableOutput == false) {
return(
<p>This tool does not generate results.</p>
)
}
}

const url = `/${type}/${this.props.sessionId}/${id}/${value}`
return(
<p key={id + ":" +value}>
Expand Down Expand Up @@ -133,9 +143,11 @@ const mapStateToProps = (state, ownProps) => {

const results = getResults(state);
const toolStatuses = getToolStatuses(state);
const tools = getTools(state);
return{
rows: results.rows || [],
statuses: toolStatuses || {},
tools: tools || [],
}
};

Expand Down
14 changes: 13 additions & 1 deletion ui/src/domain/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const defaultState = {
const setSessionId = createAction("SET_SESSION_ID");
const setResults = createAction("SET_RESULTS");
const setToolStatus = createAction("SET_TOOL_STATUS");
const setTools = createAction("SET_TOOLS");

// REDUCERS
const reducer = handleActions(
Expand All @@ -29,6 +30,10 @@ const reducer = handleActions(
state.results.rows = resultRows
return { ...state};
},
[setTools]: (state, { payload }) => {
state.tools = payload;
return { ...state};
},
[setToolStatus]: (state, { payload }) => {
if(!state.toolStatus) state.toolStatus ={};

Expand Down Expand Up @@ -65,6 +70,10 @@ const _getToolStatuses = (toolStatuses, toolId) => {
return status;
}

const _getTools = (tools) => {
return tools;
}

// SELECTORS
const getResults = (state) => {
return _getResults(state.data.results);
Expand All @@ -75,7 +84,10 @@ const getToolStatus = (state, toolId) => {
const getToolStatuses = (state) => {
return _getToolStatuses(state.data.toolStatus || {}, null)
}
const getTools = (state) => {
return _getTools(state.data.tools || [], null)
}

export default reducer;

export { setSessionId, setResults, getResults, setToolStatus, getToolStatus, getToolStatuses }
export { setSessionId, setResults, setTools, getResults, setToolStatus, getToolStatus, getToolStatuses, getTools }
2 changes: 2 additions & 0 deletions ui/src/epics/root-epic.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import autoFetchResultsEpic from "epics/auto-fetch-results-epic"
import fetchResultsEpic from './fetch-results-epic';
import fetchToolStatusEpic from './fetch-status-epic';
import fetchToolResultsEpic from './fetch-tool-results-epic';
import fetchToolsEpic from './fetch-tools-epic';

const rootEpic = combineEpics(
autoFetchResultsEpic,
fetchResultsEpic,
fetchToolStatusEpic,
fetchToolResultsEpic,
fetchToolsEpic,
);

export default rootEpic;

0 comments on commit ba33251

Please sign in to comment.