Skip to content

Commit 2da420d

Browse files
authored
Merge pull request #28 from code-kern-ai/config
Remove refinery-config
2 parents e5415b3 + 282109b commit 2da420d

File tree

10 files changed

+30
-138
lines changed

10 files changed

+30
-138
lines changed

pages/_app.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { UserManagerWrapper } from "@/util/UserManaged"
21
import "../styles/tailwind.css"
32
import '@/submodules/tailwind-config/global.css';
43
import { theme, globalStyles, ThemeProps } from "@ory/themes"
@@ -24,9 +23,7 @@ function MyApp({ Component, pageProps }: AppProps) {
2423
<div data-testid="app-react">
2524
<ThemeProvider theme={theme}>
2625
<GlobalStyle />
27-
<UserManagerWrapper>
28-
<Component {...pageProps} />
29-
</UserManagerWrapper>
26+
<Component {...pageProps} />
3027
<ToastContainer />
3128
</ThemeProvider>
3229
</div>

pages/login.tsx

+20-69
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { KernLogo } from "@/pkg/ui/Icons"
1212
import { DemoFlow } from "@/pkg/ui/DemoFlow"
1313
import { getValueIdentifier, getValuePassword } from "@/util/helper-functions"
1414
import ory from "@/pkg/sdk"
15-
import { MiscInfo } from "@/services/basic-fetch/misc"
1615

1716
const Login: NextPage = () => {
1817
const [initialFlow, setInitialFlow] = useState<LoginFlow>();
@@ -75,21 +74,6 @@ const Login: NextPage = () => {
7574

7675
const flowData: any = Object.assign({}, initialFlow);
7776

78-
let emailNode = flowData.ui.nodes.find((node: any) => node.meta?.label?.text == "E-Mail");
79-
if (emailNode && MiscInfo.isDemo) {
80-
emailNode.attributes.value = getValueIdentifier(selectedRole);
81-
}
82-
83-
let passwordNode = flowData.ui.nodes.find((node: any) => node.meta?.label?.text == "Password");
84-
if (passwordNode && MiscInfo.isDemo) {
85-
passwordNode.attributes.value = getValuePassword(selectedRole);
86-
}
87-
88-
let submitNode = flowData.ui.nodes.find((node: any) => node.meta?.label?.text == "Sign in");
89-
if (submitNode && MiscInfo.isDemo) {
90-
submitNode.meta.label.text = "Proceed"
91-
}
92-
9377
if (initialFlow.ui.nodes.some((node: any) => node.group === "totp")) {
9478
const totcData = JSON.parse(JSON.stringify(flowData));
9579
totcData.ui.nodes = totcData.ui.nodes.filter((node: any) => node.group == "totp" || node.group == "default");
@@ -120,11 +104,7 @@ const Login: NextPage = () => {
120104
window.location.href = initialFlow?.return_to
121105
return
122106
}
123-
if (MiscInfo.isManaged) {
124-
router.push("/cognition")
125-
} else {
126-
router.push("/refinery/projects")
127-
}
107+
router.push("/cognition")
128108

129109
})
130110
.then(() => { })
@@ -149,60 +129,31 @@ const Login: NextPage = () => {
149129
<div className="app-container">
150130
<KernLogo />
151131
<div id="login">
152-
<h2 className="title">{MiscInfo.isDemo ? 'Proceed with your selected role' : 'Sign in to your account'}</h2>
153-
{!MiscInfo.isDemo ? (
154-
<>{MiscInfo.isManaged ? (
155-
<p className="text-paragraph">Or
156-
<a className="link" data-testid="cta-link" href="/auth/registration"> Register account </a> -
157-
no credit card required!
158-
</p>
159-
) : (<>
160-
<p className="text-paragraph">You don&apos;t have an account yet?
161-
<a className="link" data-testid="cta-link" href="/auth/registration"> Sign up here (local)</a>
162-
</p>
163-
</>)}</>
164-
) : (<></>)}
132+
<h2 className="title">Sign in to your account</h2>
133+
<p className="text-paragraph">Or
134+
<a className="link" data-testid="cta-link" href="/auth/registration"> Register account </a> -
135+
no credit card required!
136+
</p>
165137
<div className="ui-container">
166-
{!MiscInfo.isDemo ? (
167-
<div>
168-
<Flow onSubmit={onSubmit} flow={changedFlow} only="password" />
169-
{oidcFlow ?
170-
<>
171-
<div className="divider-outer"><span className="divider">Or</span></div>
172-
<Flow onSubmit={onSubmit} flow={oidcFlow} only="oidc" />
173-
</> : null}
174-
{totpFlow ?
175-
<>
176-
<Flow onSubmit={onSubmit} flow={totpFlow} only="totp" />
177-
</> : null}
178-
</div>) : (<>
179-
180-
<fieldset>
181-
<span className="typography-h3">
182-
Select role
183-
<span className="required-indicator">*</span>
184-
<select className="typography-h3 select" id="roles" value={selectedRole} onChange={(e: any) => { setSelectedRole(e.target.value); }}>
185-
<option value="engineer">Engineer</option>
186-
<option value="expert">Expert</option>
187-
<option value="annotator">Annotator</option>
188-
</select>
189-
</span>
190-
</fieldset>
191-
<p className="text-description" id="description">
192-
{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.'}
193-
</p>
194-
<p className="text-description" id="sub-description">
195-
{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.'}
196-
</p>
197-
<DemoFlow onSubmit={onSubmit} flow={changedFlow} />
198-
</>)}
138+
<div>
139+
<Flow onSubmit={onSubmit} flow={changedFlow} only="password" />
140+
{oidcFlow ?
141+
<>
142+
<div className="divider-outer"><span className="divider">Or</span></div>
143+
<Flow onSubmit={onSubmit} flow={oidcFlow} only="oidc" />
144+
</> : null}
145+
{totpFlow ?
146+
<>
147+
<Flow onSubmit={onSubmit} flow={totpFlow} only="totp" />
148+
</> : null}
149+
</div>
199150
</div>
200151
<div className="link-container">
201-
{!MiscInfo.isDemo ?
152+
{
202153
!isAccLinkageRequested ?
203154
<a className="link" data-testid="forgot-password" href="/auth/recovery">Forgot your password?</a>
204155
: <a className="link" data-testid="back-to-login" href="/auth/login">Go back to login</a>
205-
: null}
156+
}
206157
</div>
207158
</div>
208159
</div >

pages/registration.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { KernLogo } from "@/pkg/ui/Icons"
88
import ory from "@/pkg/sdk"
99
import { handleFlowError } from "@/pkg/errors"
1010
import { Flow } from "@/pkg"
11-
import { MiscInfo } from "@/services/basic-fetch/misc"
1211
import { prepareNodes } from "@/util/helper-functions"
1312

1413
// Renders the registration page
@@ -107,7 +106,7 @@ const Registration: NextPage = () => {
107106
<div className="app-container">
108107
<KernLogo />
109108
<div id="signup">
110-
<h2 className="title">{MiscInfo.isManaged ? 'Register account' : 'Sign up for a local account'}</h2>
109+
<h2 className="title">Register account</h2>
111110
<div>
112111
<Flow onSubmit={onSubmit} flow={changedFlow} only="password" />
113112
{oidcFlow ?

pkg/ui/Node.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { NodeInput } from "./NodeInput"
1313
import { NodeScript } from "./NodeScript"
1414
import { NodeText } from "./NodeText"
1515
import { FormDispatcher, ValueSetter } from "./helpers"
16-
import { MiscInfo } from "@/services/basic-fetch/misc"
1716

1817

1918
interface Props {
@@ -56,7 +55,7 @@ export const Node = ({
5655
node={node}
5756
disabled={disabled}
5857
attributes={node.attributes}
59-
visible={!MiscInfo.isDemo}
58+
visible={true}
6059
/>
6160
)
6261
}

pkg/ui/NodeInputSubmit.tsx

+5-13
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { getNodeLabel } from "@ory/integrations/ui"
22
import { Button } from "@ory/themes"
33

44
import { NodeInputProps } from "./helpers"
5-
import { MiscInfo } from "@/services/basic-fetch/misc";
65

76

87
export function NodeInputSubmit<T>({
@@ -12,18 +11,11 @@ export function NodeInputSubmit<T>({
1211
}: NodeInputProps) {
1312
return (
1413
<>
15-
{node.meta.label?.text == "Sign up" ? (<>
16-
{MiscInfo.isManaged ? (<>
17-
<div className="info-containter">
18-
<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>
19-
<div>We’ll get back to you as soon as possible.</div>
20-
</div>
21-
</>) : (<>
22-
<div className="info-containter">
23-
<span>This sets up a single-user account on your local machine.</span>
24-
<div> If you want to use a hosted version with GPU acceleration, multi-user capabilities and additional features, check out our hostings.</div>
25-
</div></>)}
26-
</>) : (<> </>)}
14+
{node.meta.label?.text == "Sign up" ?
15+
<div className="info-containter">
16+
<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>
17+
<div>We’ll get back to you as soon as possible.</div>
18+
</div> : <> </>}
2719

2820
<Button
2921
name={attributes.name}

services/basic-fetch/misc.ts

-6
This file was deleted.

util/UserManaged.tsx

-31
This file was deleted.

util/data-fetch.ts

-9
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@ import { FetchType, jsonFetchWrapper } from "@/submodules/javascript-functions/b
33
const BACKEND_BASE_URI = '/refinery-gateway';
44
export const organizationEndpoint = `${BACKEND_BASE_URI}/api/v1/organization`;
55

6-
export function getIsManaged(onResult: (result: any) => void) {
7-
const url = `/is_managed`;
8-
jsonFetchWrapper(url, FetchType.GET, onResult);
9-
}
10-
11-
export function getIsDemo(onResult: (result: any) => void) {
12-
const url = `/is_demo`;
13-
jsonFetchWrapper(url, FetchType.GET, onResult);
14-
}
156

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

0 commit comments

Comments
 (0)