mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
rowyRun localhost option
This commit is contained in:
@@ -73,6 +73,7 @@ interface ProjectContextProps {
|
||||
route: RunRoute;
|
||||
body?: any;
|
||||
params?: string[];
|
||||
localhost?: boolean;
|
||||
}) => Promise<any>;
|
||||
}
|
||||
|
||||
@@ -187,15 +188,17 @@ export const ProjectContextProvider: React.FC = ({ children }) => {
|
||||
route,
|
||||
body,
|
||||
params,
|
||||
localhost = false,
|
||||
}: {
|
||||
route: RunRoute;
|
||||
body?: any;
|
||||
params?: string[];
|
||||
localhost?: boolean;
|
||||
}) => {
|
||||
const { method, path } = route;
|
||||
let url =
|
||||
//'http://localhost:8080'
|
||||
settings.doc.rowyRunUrl + path;
|
||||
let url = `${
|
||||
localhost ? "http://localhost:8080" : settings.doc.rowyRunUrl
|
||||
}${path}`;
|
||||
if (params && params.length > 0) url = url + "/" + params.join("/");
|
||||
const response = await fetch(url, {
|
||||
method: method, // *GET, POST, PUT, DELETE, etc.
|
||||
|
||||
@@ -11,13 +11,10 @@ import {
|
||||
Tab,
|
||||
LinearProgress,
|
||||
MenuItem,
|
||||
Switch,
|
||||
FormControlLabel,
|
||||
} from "@mui/material";
|
||||
import SparkIcon from "@mui/icons-material/OfflineBoltOutlined";
|
||||
import { useConfirmation } from "components/ConfirmationDialog";
|
||||
|
||||
import SnackbarProgress, {
|
||||
ISnackbarProgressRef,
|
||||
} from "components/SnackbarProgress";
|
||||
import { useProjectContext } from "@src/contexts/ProjectContext";
|
||||
import { RunRoutes } from "@src/constants/runRoutes";
|
||||
|
||||
@@ -26,6 +23,7 @@ export default function TestView() {
|
||||
const { requestConfirmation } = useConfirmation();
|
||||
const { enqueueSnackbar, closeSnackbar } = useSnackbar();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [localhost, setLocalhost] = useState(false);
|
||||
const { rowyRun } = useProjectContext();
|
||||
const [result, setResult] = useState<any>({});
|
||||
|
||||
@@ -50,6 +48,7 @@ export default function TestView() {
|
||||
method,
|
||||
path,
|
||||
},
|
||||
localhost,
|
||||
});
|
||||
setResult(resp);
|
||||
setLoading(false);
|
||||
@@ -63,6 +62,17 @@ export default function TestView() {
|
||||
)}
|
||||
|
||||
<Container style={{ margin: "24px 0 200px" }}>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Switch
|
||||
size="medium"
|
||||
onClick={() => {
|
||||
setLocalhost(!localhost);
|
||||
}}
|
||||
/>
|
||||
}
|
||||
label="Localhost?"
|
||||
/>
|
||||
<TextField
|
||||
label="Defined Route"
|
||||
select
|
||||
|
||||
Reference in New Issue
Block a user