Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/cloud/improve post process #384

Merged
merged 15 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions frontend/build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"files": {
"main.css": "/static/css/main.341bf264.css",
"main.js": "/static/js/main.0f19d410.js",
"main.js": "/static/js/main.1302c9fb.js",
"static/js/47.145ba9bc.chunk.js": "/static/js/47.145ba9bc.chunk.js",
"static/media/logo.png": "/static/media/logo.e44efe3246aecc6d6219.png",
"index.html": "/index.html",
"main.341bf264.css.map": "/static/css/main.341bf264.css.map",
"main.0f19d410.js.map": "/static/js/main.0f19d410.js.map",
"main.1302c9fb.js.map": "/static/js/main.1302c9fb.js.map",
"47.145ba9bc.chunk.js.map": "/static/js/47.145ba9bc.chunk.js.map"
},
"entrypoints": [
"static/css/main.341bf264.css",
"static/js/main.0f19d410.js"
"static/js/main.1302c9fb.js"
]
}
}
2 changes: 1 addition & 1 deletion frontend/build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/static/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="manifest" href="/static/manifest.json"/><title>OptiNiSt</title><script defer="defer" src="/static/js/main.0f19d410.js"></script><link href="/static/css/main.341bf264.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/static/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="manifest" href="/static/manifest.json"/><title>OptiNiSt</title><script defer="defer" src="/static/js/main.1302c9fb.js"></script><link href="/static/css/main.341bf264.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ import Workspaces from "pages/Workspace"
import Workspace from "pages/Workspace/Workspace"
import { getModeStandalone } from "store/slice/Standalone/StandaloneActions"
import {
selectLoadingMode,
selectLoading,
selectModeStandalone,
} from "store/slice/Standalone/StandaloneSeclector"
import { AppDispatch } from "store/store"

const App: FC = () => {
const dispatch = useDispatch<AppDispatch>()
const isStandalone = useSelector(selectModeStandalone)
const loading = useSelector(selectLoadingMode)
const loading = useSelector(selectLoading)
const getMode = () => {
dispatch(getModeStandalone())
.unwrap()
Expand All @@ -45,7 +45,7 @@ const App: FC = () => {
}, [])

return loading ? (
<Loading />
<Loading loading={true} />
) : (
<SnackbarProvider
maxSnack={5}
Expand Down
13 changes: 7 additions & 6 deletions frontend/src/components/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Layout = ({ children }: { children?: ReactNode }) => {
const dispatch = useDispatch<AppDispatch>()
const isStandalone = useSelector(selectModeStandalone)

const [loading, setLoadingAuth] = useState(
const [loading, setLoading] = useState(
!isStandalone && authRequiredPathRegex.test(location.pathname),
)

Expand All @@ -37,7 +37,7 @@ const Layout = ({ children }: { children?: ReactNode }) => {

const checkAuth = async () => {
if (user) {
if (loading) setLoadingAuth(false)
if (loading) setLoading(false)
return
}
const token = getToken()
Expand All @@ -52,16 +52,17 @@ const Layout = ({ children }: { children?: ReactNode }) => {
} catch {
navigate("/login", { replace: true })
} finally {
if (loading) setLoadingAuth(false)
if (loading) setLoading(false)
}
}

if (loading) return <Loading />

return isStandalone || authRequiredPathRegex.test(location.pathname) ? (
<AuthedLayout>{children}</AuthedLayout>
) : (
<UnauthedLayout>{children}</UnauthedLayout>
<>
<Loading loading={loading} />
<UnauthedLayout>{children}</UnauthedLayout>
</>
)
}

Expand Down
6 changes: 6 additions & 0 deletions frontend/src/components/Workspace/Experiment/Experiment.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { memo } from "react"
import { useSelector } from "react-redux"

import Loading from "components/common/Loading"
import { ExperimentTable } from "components/Workspace/Experiment/ExperimentTable"
import { CONTENT_HEIGHT } from "const/Layout"
import { selectLoading } from "store/slice/Experiments/ExperimentsSelectors"

const Experiment = memo(function Experiment() {
const loading = useSelector(selectLoading)

return (
<div style={{ display: "flex" }}>
<main
Expand All @@ -15,6 +20,7 @@ const Experiment = memo(function Experiment() {
}}
>
<ExperimentTable />
<Loading loading={loading} />
</main>
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Workspace/FlowChart/FlowChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const FlowChart = memo(function FlowChart(props: UseRunPipelineReturnType) {
horizontal: "left",
}}
>
<div style={{ margin: 8, whiteSpace: "pre-wrap"}}>
<div style={{ margin: 8, whiteSpace: "pre-wrap" }}>
<FormHelperText error={true}>
{messageError.message}
</FormHelperText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
import "reactflow/dist/style.css"

import "style/flow.css"
import Loading from "components/common/Loading"
import {
DND_ITEM_TYPE_SET,
TreeItemCollectedProps,
Expand All @@ -42,6 +43,7 @@ import {
selectFlowEdges,
selectFlowNodes,
selectFlowPosition,
selectLoading,
} from "store/slice/FlowElement/FlowElementSelectors"
import {
editFlowNodePositionById,
Expand All @@ -63,6 +65,7 @@ export const ReactFlowComponent = memo(function ReactFlowComponent(
const flowNodes = useSelector(selectFlowNodes)
const flowEdges = useSelector(selectFlowEdges)
const edges = flowEdges.filter((item) => !isNode(item)) as Edge<NodeData>[]
const loading = useSelector(selectLoading)
const dispatch = useDispatch()

const onConnect = (params: Connection | Edge) => {
Expand Down Expand Up @@ -168,6 +171,7 @@ export const ReactFlowComponent = memo(function ReactFlowComponent(
</ReactFlow>
</div>
</ReactFlowProviderComponent>
<Loading loading={loading} />
</div>
)
})
2 changes: 1 addition & 1 deletion frontend/src/components/Workspace/PopupShare.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ const PopupShare = ({
</Button>
</DialogActions>
</DialogCustom>
{loading ? <Loading /> : null}
<Loading loading={loading} />
</Box>
)
}
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/components/Workspace/Visualize/VisualizeItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Loading from "components/common/Loading"
import { useMouseDragHandler } from "components/utils/MouseDragUtil"
import { DisplayDataItem } from "components/Workspace/Visualize/DisplayDataItem"
import { FilePathSelect } from "components/Workspace/Visualize/FilePathSelect"
import { selectLoadingVisualize } from "store/slice/DisplayData/DisplayDataSelectors"
import { selectLoading } from "store/slice/DisplayData/DisplayDataSelectors"
import {
DATA_TYPE,
DATA_TYPE_SET,
Expand Down Expand Up @@ -64,15 +64,15 @@ export const VisualizeItem = memo(function VisualizeItem({

const { size, onMouseDownX, onMouseDownY, onMouseDownXY } =
useItemDragResize(itemId)
const loading = useSelector(selectLoadingVisualize)
const loading = useSelector(selectLoading)
const [roiFilePath, setRoiFilePath] = useState("")
return (
<Box
sx={{ m: 1, display: "flex", flexDirection: "row", position: "relative" }}
>
{loading && roiFilePath.includes("/cell_roi.json") ? (
<Loading position={"absolute"} />
) : null}
{loading && roiFilePath.includes("_roi.json") && (
<Loading loading={true} position={"absolute"} />
)}
<Box
sx={{
display: "flex",
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/common/DeleteConfirmModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ type DeleteConfirmModalProps = {
onSubmit: () => void
titleSubmit: string
description: string
isLoading?: boolean
loading?: boolean
}
const DeleteConfirmModal: FC<DeleteConfirmModalProps> = ({
onClose,
open,
onSubmit,
isLoading,
loading,
titleSubmit,
description,
}) => {
Expand Down Expand Up @@ -67,7 +67,7 @@ const DeleteConfirmModal: FC<DeleteConfirmModalProps> = ({
</Button>
</DialogActions>
</Dialog>
{isLoading ? <Loading /> : null}
<Loading loading={loading} />
</>
)
}
Expand Down
11 changes: 7 additions & 4 deletions frontend/src/components/common/Loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ import { Box, keyframes, styled } from "@mui/material"

type Props = {
position?: "fixed" | "absolute"
loading: boolean | undefined
}

const Loading = ({ position = "fixed" }: Props) => {
const Loading = ({ position = "fixed", loading }: Props) => {
return (
<LoaderWrapper position={position}>
<Loader />
</LoaderWrapper>
loading && (
<LoaderWrapper position={position}>
<Loader />
</LoaderWrapper>
)
)
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Account/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ const Account = () => {
Delete Account
</Button>
</BoxFlex>
{loading ? <Loading /> : null}
<Loading loading={loading} />
</AccountWrapper>
)
}
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/pages/AccountManager/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const ModalComponent = ({
const [formData, setFormData] = useState<{ [key: string]: string }>(
dataEdit || initState,
)
const [isDisabled, setIsDisabled] = useState(false)
const [isFormDisabled, setIsFormDisabled] = useState(false)
const [errors, setErrors] = useState<{ [key: string]: string }>(initState)

const validateEmail = (value: string): string => {
Expand Down Expand Up @@ -182,18 +182,18 @@ const ModalComponent = ({

const onSubmit = async (e: MouseEvent<HTMLButtonElement>) => {
e.preventDefault()
setIsDisabled(true)
setIsFormDisabled(true)
const newErrors = validateForm()
if (Object.keys(newErrors).some((key) => !!newErrors[key])) {
setErrors(newErrors)
setIsDisabled(false)
setIsFormDisabled(false)
return
}
try {
await onSubmitEdit(dataEdit?.id, formData)
setOpenModal(false)
} finally {
setIsDisabled(false)
setIsFormDisabled(false)
}
}
const onCancel = () => {
Expand Down Expand Up @@ -259,14 +259,14 @@ const ModalComponent = ({
</Button>
<Button
variant={"contained"}
disabled={isDisabled}
disabled={isFormDisabled}
onClick={(e) => onSubmit(e)}
>
Ok
</Button>
</ButtonModal>
</ModalBox>
{isDisabled ? <Loading /> : null}
<Loading loading={isFormDisabled} />
</Modal>
)
}
Expand Down Expand Up @@ -783,7 +783,7 @@ const AccountManager = () => {
dataEdit={dataEdit}
/>
) : null}
{loading ? <Loading /> : null}
<Loading loading={loading} />
</AccountManagerWrapper>
)
}
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/pages/Login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Login = () => {
const navigate = useNavigate()
const dispatch: AppDispatch = useDispatch()

const [isLoading, setIsLoading] = useState(false)
const [loading, setLoading] = useState(false)
const [errors, setErrors] = useState<{ [key: string]: string }>({
email: "",
password: "",
Expand All @@ -26,7 +26,7 @@ const Login = () => {
event.preventDefault()
const errorCheck = validateSubmit()
if (errorCheck) return
setIsLoading(true)
setLoading(true)
dispatch(login(values))
.unwrap()
.then(async (_) => {
Expand All @@ -37,7 +37,7 @@ const Login = () => {
setErrors({ email: "Email or password is wrong", password: "" })
})
.finally(() => {
setIsLoading(false)
setLoading(false)
})
}

Expand Down Expand Up @@ -114,7 +114,7 @@ const Login = () => {
</Stack>
</FormSignUp>
</LoginContent>
{isLoading && <Loading />}
<Loading loading={loading} />
</LoginWrapper>
)
}
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/pages/ResetPassword/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { regexEmail } from "const/Auth"

const ResetPassword = () => {
const navigate = useNavigate()
const [isLoading, setIsLoading] = useState(false)
const [loading, setLoading] = useState(false)
const [errors, setErrors] = useState<{ [key: string]: string }>({
email: "",
})
Expand All @@ -22,7 +22,7 @@ const ResetPassword = () => {

const errorCheck = validateSubmit()
if (errors.email || errorCheck) return
setIsLoading(true)
setLoading(true)
try {
await sendResetPasswordMailApi(encodeURIComponent(values.email))
setTimeout(() => {
Expand All @@ -35,7 +35,7 @@ const ResetPassword = () => {
alert("Email does not exists!")
}, 300)
} finally {
setIsLoading(false)
setLoading(false)
}
}

Expand Down Expand Up @@ -95,7 +95,7 @@ const ResetPassword = () => {
</Stack>
</FormSignUp>
</LoginContent>
{isLoading && <Loading />}
<Loading loading={loading} />
</LoginWrapper>
)
}
Expand Down
Loading
Loading