changed option folder structure
parent
c40c6b3881
commit
1e17dc47de
|
@ -0,0 +1,24 @@
|
||||||
|
import * as types from "./actionTypes";
|
||||||
|
import api from "./api";
|
||||||
|
import { sendHttpRequest } from "../../../redux/actions/httpActions";
|
||||||
|
|
||||||
|
export function loadForwardOptions(optionId) {
|
||||||
|
return async function(dispatch, getState) {
|
||||||
|
try {
|
||||||
|
const options = getState().options[optionId];
|
||||||
|
if (options && (options.loading || options.loaded)) return;
|
||||||
|
|
||||||
|
dispatch({ type: types.LOAD_FORWARD_OPTIONS_STARTED, id: optionId });
|
||||||
|
const data = await dispatch(
|
||||||
|
sendHttpRequest(api.getForwardOptions(optionId))
|
||||||
|
);
|
||||||
|
dispatch({
|
||||||
|
type: types.LOAD_FORWARD_OPTIONS_SUCCESS,
|
||||||
|
payload: data,
|
||||||
|
id: optionId
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
export const LOAD_FORWARD_OPTIONS_STARTED = "LOAD_FORWARD_OPTIONS_STARTED";
|
||||||
|
export const LOAD_FORWARD_OPTIONS_SUCCESS = "LOAD_FORWARD_OPTIONS_SUCCESS";
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { get } from "../../../api/axiosApi";
|
||||||
|
const baseUrl = `${process.env.REVERSE_PROXY_API_URL}/server`;
|
||||||
|
|
||||||
|
const getForwardOptions = optionId =>
|
||||||
|
get(`${baseUrl}/forward-options/${optionId}`);
|
||||||
|
|
||||||
|
export default {
|
||||||
|
getForwardOptions
|
||||||
|
};
|
|
@ -0,0 +1 @@
|
||||||
|
//ForwardOptions
|
|
@ -11,12 +11,12 @@ import {
|
||||||
Tooltip
|
Tooltip
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import styles from "../../../components/common/styles/tableStyles";
|
import styles from "../../../../../components/common/styles/tableStyles";
|
||||||
import {
|
import {
|
||||||
StyledTableCell,
|
StyledTableCell,
|
||||||
StyledTableRow
|
StyledTableRow
|
||||||
} from "../../../components/common/MaterialTable";
|
} from "../../../../../components/common/MaterialTable";
|
||||||
import ActiveIcon from "../../../components/common/ActiveIcon";
|
import ActiveIcon from "../../../../../components/common/ActiveIcon";
|
||||||
import Typography from "@material-ui/core/Typography";
|
import Typography from "@material-ui/core/Typography";
|
||||||
|
|
||||||
const useStyles = makeStyles(styles);
|
const useStyles = makeStyles(styles);
|
|
@ -2,7 +2,7 @@ import React, { useEffect } from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { bindActionCreators } from "redux";
|
import { bindActionCreators } from "redux";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import { loadForwardOptions } from "../actionCreators";
|
import { loadForwardOptions } from "../../actionCreators";
|
||||||
import ForwardOptionsComponent from "./ForwardOptionsComponent";
|
import ForwardOptionsComponent from "./ForwardOptionsComponent";
|
||||||
|
|
||||||
const ForwardOptionsContainer = ({ actions, forward, options }) => {
|
const ForwardOptionsContainer = ({ actions, forward, options }) => {
|
|
@ -0,0 +1,25 @@
|
||||||
|
import * as types from "./actionTypes";
|
||||||
|
import initialState from "../../../redux/reducers/initialState";
|
||||||
|
|
||||||
|
export function optionsReducer(state = initialState.options, action) {
|
||||||
|
switch (action.type) {
|
||||||
|
case types.LOAD_FORWARD_OPTIONS_STARTED:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
[action.id]: { loading: true, loaded: false }
|
||||||
|
};
|
||||||
|
|
||||||
|
case types.LOAD_FORWARD_OPTIONS_SUCCESS:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
[action.id]: {
|
||||||
|
...action.payload,
|
||||||
|
loading: false,
|
||||||
|
loaded: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
default:
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ import { loadActiveSession } from "../actionCreators";
|
||||||
import { loadSessionForwards } from "../../session/actionCreators";
|
import { loadSessionForwards } from "../../session/actionCreators";
|
||||||
import { getActiveForwards } from "../selectors";
|
import { getActiveForwards } from "../selectors";
|
||||||
import ActiveSessionComponent from "./ActiveSessionComponent";
|
import ActiveSessionComponent from "./ActiveSessionComponent";
|
||||||
import ForwardOptionsDialog from "../../session/components/ForwardOptionsDialog";
|
import ForwardOptionsDialog from "../../forwards/options/components/simple/ForwardOptionsDialog";
|
||||||
|
|
||||||
const ActiveSessionContainer = ({ actions, session, forwards, domain }) => {
|
const ActiveSessionContainer = ({ actions, session, forwards, domain }) => {
|
||||||
const [expanded, setExpanded] = useState(false);
|
const [expanded, setExpanded] = useState(false);
|
||||||
|
|
|
@ -34,24 +34,3 @@ export function loadSessionForwards(sessionId) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadForwardOptions(optionId) {
|
|
||||||
return async function(dispatch, getState) {
|
|
||||||
try {
|
|
||||||
const options = getState().options[optionId];
|
|
||||||
if (options && (options.loading || options.loaded)) return;
|
|
||||||
|
|
||||||
dispatch({ type: types.LOAD_FORWARD_OPTIONS_STARTED, id: optionId });
|
|
||||||
const data = await dispatch(
|
|
||||||
sendHttpRequest(api.getForwardOptions(optionId))
|
|
||||||
);
|
|
||||||
dispatch({
|
|
||||||
type: types.LOAD_FORWARD_OPTIONS_SUCCESS,
|
|
||||||
payload: data,
|
|
||||||
id: optionId
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,6 +3,3 @@ export const LOAD_SERVER_SESSIONS_SUCCESS = "LOAD_SERVER_SESSIONS_SUCCESS";
|
||||||
|
|
||||||
export const LOAD_SESSION_FORWARDS_STARTED = "LOAD_SESSION_FORWARDS_STARTED";
|
export const LOAD_SESSION_FORWARDS_STARTED = "LOAD_SESSION_FORWARDS_STARTED";
|
||||||
export const LOAD_SESSION_FORWARDS_SUCCESS = "LOAD_SESSION_FORWARDS_SUCCESS";
|
export const LOAD_SESSION_FORWARDS_SUCCESS = "LOAD_SESSION_FORWARDS_SUCCESS";
|
||||||
|
|
||||||
export const LOAD_FORWARD_OPTIONS_STARTED = "LOAD_FORWARD_OPTIONS_STARTED";
|
|
||||||
export const LOAD_FORWARD_OPTIONS_SUCCESS = "LOAD_FORWARD_OPTIONS_SUCCESS";
|
|
||||||
|
|
|
@ -5,11 +5,7 @@ const getServerSessions = () => get(`${baseUrl}/sessions`);
|
||||||
const getSessionForwards = sessionId =>
|
const getSessionForwards = sessionId =>
|
||||||
get(`${baseUrl}/session-forwards/${sessionId}`);
|
get(`${baseUrl}/session-forwards/${sessionId}`);
|
||||||
|
|
||||||
const getForwardOptions = optionId =>
|
|
||||||
get(`${baseUrl}/forward-options/${optionId}`);
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
getServerSessions,
|
getServerSessions,
|
||||||
getSessionForwards,
|
getSessionForwards
|
||||||
getForwardOptions
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { connect } from "react-redux";
|
||||||
import { bindActionCreators } from "redux";
|
import { bindActionCreators } from "redux";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import SessionListComponent from "./SessionListComponent";
|
import SessionListComponent from "./SessionListComponent";
|
||||||
import ForwardOptionsDialog from "./ForwardOptionsDialog";
|
import ForwardOptionsDialog from "../../forwards/options/components/simple/ForwardOptionsDialog";
|
||||||
import { loadServerSessions, loadSessionForwards } from "../actionCreators";
|
import { loadServerSessions, loadSessionForwards } from "../actionCreators";
|
||||||
|
|
||||||
const SessionContainer = ({ actions, sessions, forwards }) => {
|
const SessionContainer = ({ actions, sessions, forwards }) => {
|
||||||
|
|
|
@ -35,26 +35,3 @@ export function forwardsReducer(state = initialState.forwards, action) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function optionsReducer(state = initialState.options, action) {
|
|
||||||
switch (action.type) {
|
|
||||||
case types.LOAD_FORWARD_OPTIONS_STARTED:
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
[action.id]: { loading: true, loaded: false }
|
|
||||||
};
|
|
||||||
|
|
||||||
case types.LOAD_FORWARD_OPTIONS_SUCCESS:
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
[action.id]: {
|
|
||||||
...action.payload,
|
|
||||||
loading: false,
|
|
||||||
loaded: true
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
default:
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,9 +3,9 @@ import ajaxStatusReducer from "./ajaxStatusReducer";
|
||||||
import serverReducer from "../../features/server/reducer";
|
import serverReducer from "../../features/server/reducer";
|
||||||
import {
|
import {
|
||||||
sessionsReducer,
|
sessionsReducer,
|
||||||
forwardsReducer,
|
forwardsReducer
|
||||||
optionsReducer
|
|
||||||
} from "../../features/session/reducers";
|
} from "../../features/session/reducers";
|
||||||
|
import { optionsReducer } from "../../features/forwards/options/reducers";
|
||||||
import releaseNotesReducer from "../../features/releaseNotes/reducer";
|
import releaseNotesReducer from "../../features/releaseNotes/reducer";
|
||||||
import frontendSessionReducer from "../../features/frontendSession/reducer";
|
import frontendSessionReducer from "../../features/frontendSession/reducer";
|
||||||
import snackbarReducer from "../../features/snackbar/reducer";
|
import snackbarReducer from "../../features/snackbar/reducer";
|
||||||
|
|
Loading…
Reference in New Issue