From 920ea61e80d169fe548437020a09d988a577bd8e Mon Sep 17 00:00:00 2001 From: JWittmeyer Date: Thu, 14 Nov 2024 09:33:02 +0100 Subject: [PATCH 1/3] Removes managed & demo indicators & requests --- pages/_app.tsx | 5 +- pages/login.tsx | 89 ++++++++------------------------- pages/registration.tsx | 3 +- pkg/ui/Node.tsx | 3 +- pkg/ui/NodeInputSubmit.tsx | 18 ++----- services/basic-fetch/misc.ts | 6 --- submodules/javascript-functions | 2 +- submodules/react-components | 2 +- util/UserManaged.tsx | 31 ------------ 9 files changed, 30 insertions(+), 129 deletions(-) delete mode 100644 services/basic-fetch/misc.ts delete mode 100644 util/UserManaged.tsx diff --git a/pages/_app.tsx b/pages/_app.tsx index 145e649..96e8c82 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -1,4 +1,3 @@ -import { UserManagerWrapper } from "@/util/UserManaged" import "../styles/tailwind.css" import '@/submodules/tailwind-config/global.css'; import { theme, globalStyles, ThemeProps } from "@ory/themes" @@ -24,9 +23,7 @@ function MyApp({ Component, pageProps }: AppProps) {
- - - +
diff --git a/pages/login.tsx b/pages/login.tsx index 7a766e2..636f9cb 100644 --- a/pages/login.tsx +++ b/pages/login.tsx @@ -12,7 +12,6 @@ import { KernLogo } from "@/pkg/ui/Icons" import { DemoFlow } from "@/pkg/ui/DemoFlow" import { getValueIdentifier, getValuePassword } from "@/util/helper-functions" import ory from "@/pkg/sdk" -import { MiscInfo } from "@/services/basic-fetch/misc" const Login: NextPage = () => { const [initialFlow, setInitialFlow] = useState(); @@ -75,21 +74,6 @@ const Login: NextPage = () => { const flowData: any = Object.assign({}, initialFlow); - let emailNode = flowData.ui.nodes.find((node: any) => node.meta?.label?.text == "E-Mail"); - if (emailNode && MiscInfo.isDemo) { - emailNode.attributes.value = getValueIdentifier(selectedRole); - } - - let passwordNode = flowData.ui.nodes.find((node: any) => node.meta?.label?.text == "Password"); - if (passwordNode && MiscInfo.isDemo) { - passwordNode.attributes.value = getValuePassword(selectedRole); - } - - let submitNode = flowData.ui.nodes.find((node: any) => node.meta?.label?.text == "Sign in"); - if (submitNode && MiscInfo.isDemo) { - submitNode.meta.label.text = "Proceed" - } - if (initialFlow.ui.nodes.some((node: any) => node.group === "totp")) { const totcData = JSON.parse(JSON.stringify(flowData)); totcData.ui.nodes = totcData.ui.nodes.filter((node: any) => node.group == "totp" || node.group == "default"); @@ -120,11 +104,7 @@ const Login: NextPage = () => { window.location.href = initialFlow?.return_to return } - if (MiscInfo.isManaged) { - router.push("/cognition") - } else { - router.push("/refinery/projects") - } + router.push("/cognition") }) .then(() => { }) @@ -149,60 +129,31 @@ const Login: NextPage = () => {
-

{MiscInfo.isDemo ? 'Proceed with your selected role' : 'Sign in to your account'}

- {!MiscInfo.isDemo ? ( - <>{MiscInfo.isManaged ? ( -

Or - Register account - - no credit card required! -

- ) : (<> -

You don't have an account yet? - Sign up here (local) -

- )} - ) : (<>)} +

Sign in to your account

+

Or + Register account - + no credit card required! +

- {!MiscInfo.isDemo ? ( -
- - {oidcFlow ? - <> -
Or
- - : null} - {totpFlow ? - <> - - : null} -
) : (<> - -
- - Select role - * - - -
-

- {selectedRole === 'engineer' ? 'Administers the project and works on programmatic tasks such as labeling automation or filter settings.' : selectedRole === 'expert' ? 'Working on reference manual labels, which can be used by the engineering team to estimate the data quality.' : 'Working on manual labels as if they were heuristics. They can be switched on/off by the engineering team, so that the engineers can in - or exclude them during weak supervision.'} -

-

- {selectedRole === 'engineer' ? 'They have access to all features of the application, including the Python SDK.' : selectedRole === 'expert' ? 'They have access to the labeling view only.' : 'They have access to a task-minimized labeling view only. Engineers can revoke their access to the labeling view.'} -

- - )} +
+ + {oidcFlow ? + <> +
Or
+ + : null} + {totpFlow ? + <> + + : null} +
- {!MiscInfo.isDemo ? + { !isAccLinkageRequested ? Forgot your password? : Go back to login - : null} + }
diff --git a/pages/registration.tsx b/pages/registration.tsx index d9c08b7..1df3d75 100644 --- a/pages/registration.tsx +++ b/pages/registration.tsx @@ -8,7 +8,6 @@ import { KernLogo } from "@/pkg/ui/Icons" import ory from "@/pkg/sdk" import { handleFlowError } from "@/pkg/errors" import { Flow } from "@/pkg" -import { MiscInfo } from "@/services/basic-fetch/misc" import { prepareNodes } from "@/util/helper-functions" // Renders the registration page @@ -107,7 +106,7 @@ const Registration: NextPage = () => {
-

{MiscInfo.isManaged ? 'Register account' : 'Sign up for a local account'}

+

Register account

{oidcFlow ? diff --git a/pkg/ui/Node.tsx b/pkg/ui/Node.tsx index f921355..80bf5fe 100644 --- a/pkg/ui/Node.tsx +++ b/pkg/ui/Node.tsx @@ -13,7 +13,6 @@ import { NodeInput } from "./NodeInput" import { NodeScript } from "./NodeScript" import { NodeText } from "./NodeText" import { FormDispatcher, ValueSetter } from "./helpers" -import { MiscInfo } from "@/services/basic-fetch/misc" interface Props { @@ -56,7 +55,7 @@ export const Node = ({ node={node} disabled={disabled} attributes={node.attributes} - visible={!MiscInfo.isDemo} + visible={true} /> ) } diff --git a/pkg/ui/NodeInputSubmit.tsx b/pkg/ui/NodeInputSubmit.tsx index 37bc7b2..331c7b3 100644 --- a/pkg/ui/NodeInputSubmit.tsx +++ b/pkg/ui/NodeInputSubmit.tsx @@ -2,7 +2,6 @@ import { getNodeLabel } from "@ory/integrations/ui" import { Button } from "@ory/themes" import { NodeInputProps } from "./helpers" -import { MiscInfo } from "@/services/basic-fetch/misc"; export function NodeInputSubmit({ @@ -12,18 +11,11 @@ export function NodeInputSubmit({ }: NodeInputProps) { return ( <> - {node.meta.label?.text == "Sign up" ? (<> - {MiscInfo.isManaged ? (<> -
- Once you register for an account, we’ll set up an organization for you - this is a manual step, but it usually only takes minutes. -
We’ll get back to you as soon as possible.
-
- ) : (<> -
- This sets up a single-user account on your local machine. -
If you want to use a hosted version with GPU acceleration, multi-user capabilities and additional features, check out our hostings.
-
)} - ) : (<> )} + {node.meta.label?.text == "Sign up" ? +
+ Once you register for an account, we’ll set up an organization for you - this is a manual step, but it usually only takes minutes. +
We’ll get back to you as soon as possible.
+
: <> }