Skip to content

Commit 0c7ffa4

Browse files
committed
Remove isDemo & isManaged
1 parent dc2474c commit 0c7ffa4

File tree

19 files changed

+41
-503
lines changed

19 files changed

+41
-503
lines changed

src/components/models-download/ModelsDownload.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { selectModelsDownloaded, setModelsDownloaded } from "@/src/reduxStore/states/pages/models-downloaded";
22
import { ModelsDownloaded, ModelsDownloadedStatus } from "@/src/types/components/models-downloaded/models-downloaded";
33
import { Tooltip } from "@nextui-org/react";
4-
import { IconAlertTriangleFilled, IconArrowLeft, IconBan, IconCheckbox, IconCircleCheckFilled, IconExternalLink, IconLoader, IconPlus, IconTrash } from "@tabler/icons-react";
4+
import { IconAlertTriangleFilled, IconArrowLeft, IconCircleCheckFilled, IconExternalLink, IconLoader, IconPlus, IconTrash } from "@tabler/icons-react";
55
import { useRouter } from "next/router";
66
import { useCallback, useEffect } from "react";
77
import { useDispatch, useSelector } from "react-redux";
88
import LoadingIcon from "../shared/loading/LoadingIcon";
99
import { openModal, setModalStates } from "@/src/reduxStore/states/modal";
1010
import { ModalEnum } from "@/src/types/shared/modal";
11-
import { selectIsAdmin, selectIsManaged, selectOrganizationId } from "@/src/reduxStore/states/general";
11+
import { selectIsAdmin, selectOrganizationId } from "@/src/reduxStore/states/general";
1212
import { timer } from "rxjs";
1313
import { TOOLTIPS_DICT } from "@/src/util/tooltip-constants";
1414
import AddModelDownloadModal from "./AddModelDownloadModal";
@@ -20,8 +20,6 @@ import { Application, CurrentPage } from "@/submodules/react-components/hooks/we
2020
export default function ModelsDownload() {
2121
const router = useRouter();
2222
const dispatch = useDispatch();
23-
24-
const isManaged = useSelector(selectIsManaged);
2523
const isAdmin = useSelector(selectIsAdmin);
2624
const modelsDownloaded = useSelector(selectModelsDownloaded);
2725

@@ -139,7 +137,6 @@ export default function ModelsDownload() {
139137
<div className="grid grid-cols-1 lg:grid-cols-2 gap-2 mt-1 align-top">
140138
<div>
141139
<button onClick={() => dispatch(openModal(ModalEnum.ADD_MODEL_DOWNLOAD))}
142-
disabled={!isManaged}
143140
className={`mr-1 inline-flex items-center px-2.5 py-2 border border-gray-300 shadow-sm text-xs font-semibold rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none cursor-pointer disabled:cursor-not-allowed disabled:opacity-50`}>
144141
<IconPlus className="h-4 w-4 mr-1" />
145142
Add new model

src/components/projects/ProjectCard.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { selectIsAdmin, selectIsDemo, selectUser } from "@/src/reduxStore/states/general";
1+
import { selectIsAdmin, selectUser } from "@/src/reduxStore/states/general";
22
import { closeModal, setModalStates } from "@/src/reduxStore/states/modal";
33
import { removeFromAllProjectsById } from "@/src/reduxStore/states/project";
44
import { Project, ProjectCardProps, ProjectStatus } from "@/src/types/components/projects/projects-list";
@@ -16,7 +16,6 @@ export default function ProjectCard(props: ProjectCardProps) {
1616
const router = useRouter();
1717
const dispatch = useDispatch();
1818

19-
const isDemo = useSelector(selectIsDemo);
2019
const isAdmin = useSelector(selectIsAdmin);
2120
const user = useSelector(selectUser);
2221

@@ -56,7 +55,7 @@ export default function ProjectCard(props: ProjectCardProps) {
5655
<Tooltip content={props.project.user.firstName && props.project.user.lastName ? props.project.user.mail : ''} placement="bottom" color="invert" className="cursor-auto">
5756
<span className="text-sm text-gray-900">{props.project.user.firstName && props.project.user.lastName ? props.project.user.firstName + ' ' + props.project.user.lastName : UNKNOWN_USER}</span>
5857
</Tooltip>
59-
{!isDemo && isAdmin && <>
58+
{isAdmin && <>
6059
<span className="text-sm text-gray-500">on</span>
6160
<span className="text-sm text-gray-900 ">{props.project.date}</span>
6261
<span className="text-sm text-gray-500">at</span>

src/components/projects/ProjectsList.tsx

Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { selectInactiveOrganization, selectIsDemo, selectIsManaged, selectOrganizationId, selectUser, setComments } from "@/src/reduxStore/states/general"
1+
import { selectInactiveOrganization, selectOrganizationId, selectUser, setComments } from "@/src/reduxStore/states/general"
22
import { selectAllProjects, setAllProjects } from "@/src/reduxStore/states/project";
33
import { Project, ProjectStatistics } from "@/src/types/components/projects/projects-list";
44
import { percentRoundString } from "@/submodules/javascript-functions/general";
@@ -15,20 +15,17 @@ import { setDataSlices, setFullSearchStore, setSearchGroupsStore } from "@/src/r
1515
import { SearchGroup } from "@/submodules/javascript-functions/enums/enums";
1616
import { useWebsocket } from "@/submodules/react-components/hooks/web-socket/useWebsocket";
1717
import { getAllProjects } from "@/src/services/base/project";
18-
import { addUserToOrganization, createOrganization, getCanCreateLocalOrg, getOverviewStats } from "@/src/services/base/organization";
18+
import { getOverviewStats } from "@/src/services/base/organization";
1919
import { Application, CurrentPage } from "@/submodules/react-components/hooks/web-socket/constants";
2020

2121
export default function ProjectsList() {
2222
const dispatch = useDispatch();
2323

2424
const organizationInactive = useSelector(selectInactiveOrganization);
25-
const isManaged = useSelector(selectIsManaged);
26-
const isDemo = useSelector(selectIsDemo);
2725
const projects = useSelector(selectAllProjects);
2826
const user = useSelector(selectUser);
2927

3028
const [projectStatisticsById, setProjectStatisticsById] = useState({});
31-
const [canCreateOrg, setCanCreateOrg] = useState(false);
3229
const [dataLoaded, setDataLoaded] = useState(false);
3330

3431
useEffect(() => {
@@ -47,8 +44,6 @@ export default function ProjectsList() {
4744
if (!organizationInactive) {
4845
refetchProjectsAndPostProcess();
4946
refetchStatsAndPostProcess();
50-
} else {
51-
createDefaultOrg();
5247
}
5348
}, [organizationInactive, user]);
5449

@@ -75,25 +70,6 @@ export default function ProjectsList() {
7570
});
7671
}
7772

78-
function createDefaultOrg() {
79-
if (isManaged || isDemo) {
80-
setDataLoaded(true);
81-
return;
82-
}
83-
getCanCreateLocalOrg(res => {
84-
const canCreate = res.data["canCreateLocalOrg"]
85-
setCanCreateOrg(canCreate);
86-
if (!canCreate) return;
87-
const localhostOrg = "localhost";
88-
createOrganization(localhostOrg, () => {
89-
addUserToOrganization(user.mail, localhostOrg, () => {
90-
location.reload();
91-
setDataLoaded(true);
92-
});
93-
})
94-
});
95-
}
96-
9773
const handleWebsocketNotification = useCallback((msgParts: string[]) => {
9874
if (['project_created', 'project_deleted', 'project_update'].includes(msgParts[1])) {
9975
refetchProjectsAndPostProcess();
@@ -126,7 +102,7 @@ export default function ProjectsList() {
126102
<main className="mt-16 mx-auto px-4 sm:mt-24 sm:px-6 lg:mt-32">
127103
<div className="lg:grid lg:grid-cols-12 lg:gap-8">
128104
<div className="sm:text-center md:mx-auto lg:col-span-6 lg:text-left">
129-
{isManaged ? (<div>
105+
<div>
130106
<div className="text-gray-500 font-semibold text-base uppercase">You&apos;re now on the waitlist!
131107
</div>
132108
<div className="font-extrabold text-gray-900 text-5xl mt-1">
@@ -138,30 +114,12 @@ export default function ProjectsList() {
138114
className="underline cursor-pointer">here</span></a>.
139115
</div>
140116
<div className="text-gray-500 mt-5">
141-
In the meantime, feel free to take a look at a product demo or check out our&nbsp;
117+
In the meantime, feel free to take a look at our&nbsp;
142118
<a href="https://docs.kern.ai/" target="_blank"><span
143119
className="underline cursor-pointer">documentation</span></a>. If you have any
144120
questions, contact us any time.
145121
</div>
146-
</div>) : (
147-
<div>
148-
{canCreateOrg ? (<div className="text-gray-500 font-semibold text-base uppercase">
149-
Preparing your account. Please reload the page.
150-
</div>) : (<div className="text-gray-500 font-semibold text-base uppercase">
151-
Maximum number of users reached. Please look into our managed version.</div>)}
152-
153-
<div className="font-normal text-xl text-gray-500 mt-5">
154-
{canCreateOrg ? (<span>
155-
In the meantime, feel free to take a look at a product demo or check out our
156-
<a href="https://docs.kern.ai/" target="_blank"><span
157-
className="underline cursor-pointer">documentation</span></a>. If you have
158-
any
159-
questions, you can reach out to us.
160-
</span>) : (<span> If you are interested in working with multiple users take a look at our <a
161-
href="./users"><span className="underline cursor-pointer">options</span></a></span>)}
162-
</div>
163-
</div>
164-
)}
122+
</div>
165123
</div>
166124
<YoutubeIntroduction />
167125
</div>

src/components/projects/projectId/data-browser/modals/DataSliceInfoModal.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Modal from "@/src/components/shared/modal/Modal";
2-
import { selectIsManaged } from "@/src/reduxStore/states/general";
32
import { closeModal, selectModal } from "@/src/reduxStore/states/modal";
43
import { setDisplayUserRole } from "@/src/reduxStore/states/pages/labeling";
54
import { ModalEnum } from "@/src/types/shared/modal";
@@ -16,7 +15,6 @@ export default function DataSliceInfoModal() {
1615
const router = useRouter();
1716
const dispatch = useDispatch();
1817

19-
const isManaged = useSelector(selectIsManaged);
2018
const modalSliceInfo = useSelector(selectModal(ModalEnum.DATA_SLICE_INFO));
2119

2220
function testLink(link) {
@@ -39,12 +37,10 @@ export default function DataSliceInfoModal() {
3937
{value.substring(value.startsWith("https") ? 8 : 7)}</span>
4038
</Tooltip>
4139
</div>
42-
<Tooltip content={TOOLTIPS_DICT.DATA_BROWSER.ONLY_MANAGED} color="invert" placement="right" className="mt-3">
43-
<button onClick={() => testLink(value + '?pos=1&type=DATA_SLICE')} disabled={!isManaged}
44-
className="opacity-100 w-40 bg-indigo-700 text-white text-xs leading-4 font-semibold px-4 py-2 rounded-md cursor-pointer hover:bg-indigo-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed">
45-
View as expert
46-
</button>
47-
</Tooltip>
40+
<button onClick={() => testLink(value + '?pos=1&type=DATA_SLICE')}
41+
className="opacity-100 w-40 bg-indigo-700 text-white text-xs leading-4 font-semibold px-4 py-2 rounded-md cursor-pointer hover:bg-indigo-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed">
42+
View as expert
43+
</button>
4844
</div>) : (<div className="flex flex-grow justify-between gap-8 text-sm">
4945
<p>{key}</p>
5046
<p>{value}</p>

src/components/projects/projectId/heuristics/HeuristicsHeader.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Loading } from "@nextui-org/react";
2-
import { selectIsManaged, selectOrganizationId } from '@/src/reduxStore/states/general';
2+
import { selectOrganizationId } from '@/src/reduxStore/states/general';
33
import { openModal, selectModal } from '@/src/reduxStore/states/modal';
44
import { selectHeuristicsAll, setHeuristicType } from '@/src/reduxStore/states/pages/heuristics';
55
import { selectLabelingTasksAll } from '@/src/reduxStore/states/pages/settings';
@@ -30,7 +30,6 @@ export default function HeuristicsHeader(props: HeuristicsHeaderProps) {
3030
const dispatch = useDispatch();
3131
const router = useRouter();
3232

33-
const isManaged = useSelector(selectIsManaged);
3433
const projectId = useSelector(selectProjectId);
3534
const heuristics = useSelector(selectHeuristicsAll);
3635
const labelingTasks = useSelector(selectLabelingTasksAll);

src/components/projects/projectId/settings/embeddings/Embeddings.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import LoadingIcon from "@/src/components/shared/loading/LoadingIcon";
2-
import { selectIsManaged, selectOrganizationId } from "@/src/reduxStore/states/general";
3-
import { closeModal, openModal, setModalStates } from "@/src/reduxStore/states/modal";
2+
import { selectOrganizationId } from "@/src/reduxStore/states/general";
3+
import { openModal, setModalStates } from "@/src/reduxStore/states/modal";
44
import { selectAttributes, selectEmbeddings } from "@/src/reduxStore/states/pages/settings";
55
import { selectProjectId } from "@/src/reduxStore/states/project";
66
import { Embedding, EmbeddingState, EmbeddingType } from "@/src/types/components/projects/projectId/settings/embeddings";
@@ -24,7 +24,6 @@ export default function Embeddings(props: { refetchEmbeddings: () => void }) {
2424
const router = useRouter();
2525

2626
const attributes = useSelector(selectAttributes);
27-
const isManaged = useSelector(selectIsManaged);
2827
const embeddings = useSelector(selectEmbeddings);
2928
const projectId = useSelector(selectProjectId);
3029

@@ -176,8 +175,8 @@ export default function Embeddings(props: { refetchEmbeddings: () => void }) {
176175
Generate embedding
177176
</button>
178177
</Tooltip>
179-
<Tooltip content={!isManaged ? TOOLTIPS_DICT.PROJECT_SETTINGS.EMBEDDINGS.HOSTED_VERSION : TOOLTIPS_DICT.PROJECT_SETTINGS.EMBEDDINGS.NAVIGATE_MODELS_DOWNLOADED} color="invert" placement="right">
180-
<button disabled={!isManaged} onClick={() => router.push('/models-download')}
178+
<Tooltip content={TOOLTIPS_DICT.PROJECT_SETTINGS.EMBEDDINGS.NAVIGATE_MODELS_DOWNLOADED} color="invert" placement="right">
179+
<button onClick={() => router.push('/models-download')}
181180
className={`"ml-1 inline-block items-center px-2.5 py-1.5 border border-gray-300 shadow-sm text-xs font-semibold rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none cursor-pointer disabled:cursor-not-allowed disabled:opacity-50`}>
182181
<IconArrowAutofitDown className="h-5 w-5 inline-block mr-1" />
183182
See downloaded models

src/components/shared/header/Header.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { selectCurrentPage, selectDisplayIconComments, selectIsDemo, selectIsManaged, selectOrganization, selectUser, setNotifications } from "@/src/reduxStore/states/general";
1+
import { selectCurrentPage, selectDisplayIconComments, selectOrganization, selectUser, setNotifications } from "@/src/reduxStore/states/general";
22
import { UserRole } from "@/src/types/shared/sidebar";
33
import { Tooltip } from "@nextui-org/react";
44
import { useEffect, useState } from "react";
@@ -24,8 +24,6 @@ export default function Header() {
2424
const router = useRouter();
2525
const dispatch = useDispatch();
2626

27-
const isDemo = useSelector(selectIsDemo);
28-
const isManaged = useSelector(selectIsManaged);
2927
const currentPage = useSelector(selectCurrentPage);
3028
const organization = useSelector(selectOrganization);
3129
const user = useSelector(selectUser);
@@ -72,16 +70,10 @@ export default function Header() {
7270
return (
7371
<header className="sticky top-0 z-50 w-full">
7472
<div className="relative z-10 flex-shrink-0 h-16 bg-white border-b border-gray-200 shadow-sm flex justify-between items-center">
75-
{isDemo ? (<div className="absolute top-0 left-0 right-0 bottom-0 flex items-center justify-center pointer-events-none">
76-
<span className="inline-flex items-center px-2 py-0.5 rounded font-medium bg-red-100 text-red-800">
77-
<IconPlayCard className="w-6 h-6 mr-2" />
78-
Demo Playground - Everything will be reset on the hour
79-
</span>
80-
</div>) : (<></>)}
8173
<div className="flex items-center">
8274
{currentPage == CurrentPage.PROJECTS || currentPage == CurrentPage.USERS ? (<div className="ml-4 text-gray-500 text-sm font-normal">
8375
{!organizationInactive && <> Welcome, <span className="font-semibold text-gray-900">{user?.firstName}</span>! See your projects at <span className="font-semibold text-gray-900">{organization?.name}</span>.</>}
84-
{organizationInactive && <> Welcome, <span className="font-semibold text-gray-900">{user?.firstName}</span>! {!isManaged ? 'Switch to your main account to continue labeling...' : 'You are currently on the waitlist.'}
76+
{organizationInactive && <> Welcome, <span className="font-semibold text-gray-900">{user?.firstName}</span>! You are currently on the waitlist.
8577
</>}
8678
</div>) : (<></>)}
8779
{currentPage == CurrentPage.NEW_PROJECT && <div className="ml-4 text-gray-500 text-sm font-normal">
@@ -96,7 +88,7 @@ export default function Header() {
9688
{currentPage == CurrentPage.CONFIG && <div className="ml-4 text-gray-500 text-sm font-normal">
9789
{!organizationInactive && user && <>Welcome, <span className="font-semibold text-gray-900">{user?.firstName}</span>! Change your app configuration <span className="font-semibold text-gray-900">here</span>.</>}
9890
{organizationInactive && <>Welcome, <span className="font-semibold text-gray-900">{user?.firstName}</span>!
99-
{!isManaged ? 'Switch to your main account to continue labeling...' : 'You are currently on the waitlist.'}</>}
91+
You are currently on the waitlist.</>}
10092
</div>}
10193
</div>
10294
<div className="flex flex-row flex-nowrap items-center">
@@ -107,7 +99,7 @@ export default function Header() {
10799
</Tooltip>
108100
</a>
109101
</div>
110-
{(user?.role == UserRole.ENGINEER && isManaged) ? (
102+
{(user?.role == UserRole.ENGINEER) ? (
111103
<div className="flex items-center justify-center">
112104
<a href="/refinery/users" onClick={(e: any) => { e.preventDefault(); dispatch(setProjectIdSampleProject(null)); router.push(`/users`) }}
113105
className="flex mr-6">

0 commit comments

Comments
 (0)