Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 1 addition & 4 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -24,9 +23,7 @@ function MyApp({ Component, pageProps }: AppProps) {
<div data-testid="app-react">
<ThemeProvider theme={theme}>
<GlobalStyle />
<UserManagerWrapper>
<Component {...pageProps} />
</UserManagerWrapper>
<Component {...pageProps} />
<ToastContainer />
</ThemeProvider>
</div>
Expand Down
89 changes: 20 additions & 69 deletions pages/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<LoginFlow>();
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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(() => { })
Expand All @@ -149,60 +129,31 @@ const Login: NextPage = () => {
<div className="app-container">
<KernLogo />
<div id="login">
<h2 className="title">{MiscInfo.isDemo ? 'Proceed with your selected role' : 'Sign in to your account'}</h2>
{!MiscInfo.isDemo ? (
<>{MiscInfo.isManaged ? (
<p className="text-paragraph">Or
<a className="link" data-testid="cta-link" href="/auth/registration"> Register account </a> -
no credit card required!
</p>
) : (<>
<p className="text-paragraph">You don&apos;t have an account yet?
<a className="link" data-testid="cta-link" href="/auth/registration"> Sign up here (local)</a>
</p>
</>)}</>
) : (<></>)}
<h2 className="title">Sign in to your account</h2>
<p className="text-paragraph">Or
<a className="link" data-testid="cta-link" href="/auth/registration"> Register account </a> -
no credit card required!
</p>
<div className="ui-container">
{!MiscInfo.isDemo ? (
<div>
<Flow onSubmit={onSubmit} flow={changedFlow} only="password" />
{oidcFlow ?
<>
<div className="divider-outer"><span className="divider">Or</span></div>
<Flow onSubmit={onSubmit} flow={oidcFlow} only="oidc" />
</> : null}
{totpFlow ?
<>
<Flow onSubmit={onSubmit} flow={totpFlow} only="totp" />
</> : null}
</div>) : (<>

<fieldset>
<span className="typography-h3">
Select role
<span className="required-indicator">*</span>
<select className="typography-h3 select" id="roles" value={selectedRole} onChange={(e: any) => { setSelectedRole(e.target.value); }}>
<option value="engineer">Engineer</option>
<option value="expert">Expert</option>
<option value="annotator">Annotator</option>
</select>
</span>
</fieldset>
<p className="text-description" id="description">
{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.'}
</p>
<p className="text-description" id="sub-description">
{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.'}
</p>
<DemoFlow onSubmit={onSubmit} flow={changedFlow} />
</>)}
<div>
<Flow onSubmit={onSubmit} flow={changedFlow} only="password" />
{oidcFlow ?
<>
<div className="divider-outer"><span className="divider">Or</span></div>
<Flow onSubmit={onSubmit} flow={oidcFlow} only="oidc" />
</> : null}
{totpFlow ?
<>
<Flow onSubmit={onSubmit} flow={totpFlow} only="totp" />
</> : null}
</div>
</div>
<div className="link-container">
{!MiscInfo.isDemo ?
{
!isAccLinkageRequested ?
<a className="link" data-testid="forgot-password" href="/auth/recovery">Forgot your password?</a>
: <a className="link" data-testid="back-to-login" href="/auth/login">Go back to login</a>
: null}
}
</div>
</div>
</div >
Expand Down
3 changes: 1 addition & 2 deletions pages/registration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -107,7 +106,7 @@ const Registration: NextPage = () => {
<div className="app-container">
<KernLogo />
<div id="signup">
<h2 className="title">{MiscInfo.isManaged ? 'Register account' : 'Sign up for a local account'}</h2>
<h2 className="title">Register account</h2>
<div>
<Flow onSubmit={onSubmit} flow={changedFlow} only="password" />
{oidcFlow ?
Expand Down
3 changes: 1 addition & 2 deletions pkg/ui/Node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -56,7 +55,7 @@ export const Node = ({
node={node}
disabled={disabled}
attributes={node.attributes}
visible={!MiscInfo.isDemo}
visible={true}
/>
)
}
Expand Down
18 changes: 5 additions & 13 deletions pkg/ui/NodeInputSubmit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>({
Expand All @@ -12,18 +11,11 @@ export function NodeInputSubmit<T>({
}: NodeInputProps) {
return (
<>
{node.meta.label?.text == "Sign up" ? (<>
{MiscInfo.isManaged ? (<>
<div className="info-containter">
<span>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.</span>
<div>We’ll get back to you as soon as possible.</div>
</div>
</>) : (<>
<div className="info-containter">
<span>This sets up a single-user account on your local machine.</span>
<div> If you want to use a hosted version with GPU acceleration, multi-user capabilities and additional features, check out our hostings.</div>
</div></>)}
</>) : (<> </>)}
{node.meta.label?.text == "Sign up" ?
<div className="info-containter">
<span>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.</span>
<div>We’ll get back to you as soon as possible.</div>
</div> : <> </>}

<Button
name={attributes.name}
Expand Down
6 changes: 0 additions & 6 deletions services/basic-fetch/misc.ts

This file was deleted.

31 changes: 0 additions & 31 deletions util/UserManaged.tsx

This file was deleted.

9 changes: 0 additions & 9 deletions util/data-fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@ import { FetchType, jsonFetchWrapper } from "@/submodules/javascript-functions/b
const BACKEND_BASE_URI = '/refinery-gateway';
export const organizationEndpoint = `${BACKEND_BASE_URI}/api/v1/organization`;

export function getIsManaged(onResult: (result: any) => void) {
const url = `/is_managed`;
jsonFetchWrapper(url, FetchType.GET, onResult);
}

export function getIsDemo(onResult: (result: any) => void) {
const url = `/is_demo`;
jsonFetchWrapper(url, FetchType.GET, onResult);
}

export function getUserInfoExtended(onResult: (result: any) => void) {
const finalUrl = `${organizationEndpoint}/get-user-info-extended`;
Expand Down