diff --git a/src/actions/incidentActions.js b/src/actions/incidentActions.js index 6b611f7..25a1bae 100644 --- a/src/actions/incidentActions.js +++ b/src/actions/incidentActions.js @@ -144,7 +144,7 @@ const postIncidentFetchArgs = (ticketId, ticketSystem) => { ] } -export const updateIncidentCreationInput = (input) => ({ +export const updateTicketNavigationInput = (input, history) => ({ type: UPDATE_INCIDENT_CREATION_INPUT, input }) diff --git a/src/components/Home.js b/src/components/Home.js index 161825b..3c65bfd 100644 --- a/src/components/Home.js +++ b/src/components/Home.js @@ -6,16 +6,18 @@ export const Home = ({ ticket }) => { if (ticket && ticket.originId) { return } - return + return null } export const mapStateToProps = (state) => { // this gross thing finds all actual tickets, omitting the refresh metadata, and then picks the most recently visited one out // the sort function works because the dates are UTC and thus lexically sortable to start with return { - ticket: (state.tickets && state.tickets.map) ? Object.values(state.tickets.map).filter(ticket => ticket && ticket.lastRefresh) - .sort((a, b) => { return (a.lastRefresh > b.lastRefresh) ? -1 : 1 })[0] - : undefined + ticket: (state.tickets && state.tickets.map) + ? Object.values(state.tickets.map) + .filter(ticket => ticket && ticket.lastRefresh) + .sort((a, b) => { return (a.lastRefresh > b.lastRefresh) ? -1 : 1 })[0] + : undefined } } diff --git a/src/components/Search/CreateIncident.js b/src/components/Incident/GoToTicket.js similarity index 50% rename from src/components/Search/CreateIncident.js rename to src/components/Incident/GoToTicket.js index 2bbf2cf..fd1a9d6 100644 --- a/src/components/Search/CreateIncident.js +++ b/src/components/Incident/GoToTicket.js @@ -3,46 +3,54 @@ import PropTypes from 'prop-types' import { connect } from 'react-redux' import { TextField } from 'material-ui' import FlatButtonStyled from 'components/elements/FlatButtonStyled' -import { updateIncidentCreationInput } from 'actions/incidentActions' +import { updateTicketNavigationInput } from 'actions/incidentActions' +import Paper from 'material-ui/Paper' -export const onSubmit = (input, history, dispatch) => () => { +export const onSubmit = (input, history) => () => { if (input) { - dispatch(updateIncidentCreationInput('')) - history.push(/tickets/ + input) + history.push('/tickets/' + input) } } -export const CreateIncident = ({input, creationError, history, dispatch}) =>