diff --git a/client/.eslintrc.json b/client/.eslintrc.json index f3a3d759a..2e39b3a20 100644 --- a/client/.eslintrc.json +++ b/client/.eslintrc.json @@ -168,6 +168,7 @@ "jupyter", "katex", "kernelspec", + "kubernetes", "Keycloak", "Lausanne", "linkify", diff --git a/client/src/components/MoreInfo.tsx b/client/src/components/MoreInfo.tsx new file mode 100644 index 000000000..4ac2738ef --- /dev/null +++ b/client/src/components/MoreInfo.tsx @@ -0,0 +1,52 @@ +/*! + * Copyright 2024 - Swiss Data Science Center (SDSC) + * A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and + * Eidgenössische Technische Hochschule Zürich (ETHZ). + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import cx from "classnames"; +import { ReactNode, useRef } from "react"; +import { InfoCircleFill } from "react-bootstrap-icons"; +import { PopoverBody, UncontrolledPopover } from "reactstrap"; +import LazyRenkuMarkdown from "./markdown/LazyRenkuMarkdown"; + +export function MoreInfo({ + help, + trigger = "hover focus", + children, +}: { + help: string; + trigger?: string; + children?: ReactNode; +}) { + const ref = useRef(null); + + return ( + <> + + + + + + + {children} + + + + ); +} diff --git a/client/src/features/sessionsV2/AddSessionLauncherButton.tsx b/client/src/features/sessionsV2/AddSessionLauncherButton.tsx index f63a5e646..1bdbc23ab 100644 --- a/client/src/features/sessionsV2/AddSessionLauncherButton.tsx +++ b/client/src/features/sessionsV2/AddSessionLauncherButton.tsx @@ -20,8 +20,7 @@ import cx from "classnames"; import { useCallback, useState } from "react"; import { PlusLg } from "react-bootstrap-icons"; import { Button } from "reactstrap"; - -import { Step1AddSessionModal } from "./components/SessionModals/AddSession.tsx"; +import NewSessionLauncherModal from "./components/SessionModals/NewSessionLauncherModal.tsx"; export default function AddSessionLauncherButton({ "data-cy": dataCy, @@ -52,7 +51,7 @@ export default function AddSessionLauncherButton({ )} - + ); } diff --git a/client/src/features/sessionsV2/SessionLauncherFormContent.tsx b/client/src/features/sessionsV2/SessionLauncherFormContent.tsx deleted file mode 100644 index 26f3ad345..000000000 --- a/client/src/features/sessionsV2/SessionLauncherFormContent.tsx +++ /dev/null @@ -1,644 +0,0 @@ -/*! - * Copyright 2024 - Swiss Data Science Center (SDSC) - * A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and - * Eidgenössische Technische Hochschule Zürich (ETHZ). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import cx from "classnames"; -import { useEffect, useMemo, useState } from "react"; -import { SingleValue } from "react-select"; -import { - Control, - Controller, - ControllerRenderProps, - FieldErrors, - FieldNamesMarkedBoolean, - UseFormResetField, - UseFormSetValue, - UseFormWatch, -} from "react-hook-form"; -import { - Card, - CardBody, - Input, - Label, - ListGroup, - ListGroupItem, - Row, -} from "reactstrap"; -import { Globe2 } from "react-bootstrap-icons"; - -import { Loader } from "../../components/Loader"; -import { TimeCaption } from "../../components/TimeCaption"; -import { RtkErrorAlert } from "../../components/errors/RtkErrorAlert"; -import { useGetSessionEnvironmentsQuery } from "./sessionsV2.api"; -import { EnvironmentKind, SessionEnvironment } from "./sessionsV2.types"; -import { WarnAlert } from "../../components/Alert.jsx"; -import { useGetResourcePoolsQuery } from "../dataServices/computeResources.api"; -import { - ResourceClass, - ResourcePool, -} from "../dataServices/dataServices.types"; -import { SessionClassSelectorV2 } from "../session/components/options/SessionClassOption"; - -export interface SessionLauncherForm { - name: string; - description: string; - environment_kind: EnvironmentKind; - environment_id: string; - container_image: string; - default_url: string; - resourceClass: ResourceClass; -} - -/* Edit session launcher */ -interface SessionLauncherFormContentProps { - control: Control; - errors: FieldErrors; - watch: UseFormWatch; - touchedFields: Partial< - Readonly> - >; -} -export default function SessionLauncherFormContent({ - control, - errors, - watch, - touchedFields, -}: SessionLauncherFormContentProps) { - const { - data: environments, - error, - isLoading, - } = useGetSessionEnvironmentsQuery(); - const watchEnvironmentKind = watch("environment_kind"); - - return ( - <> -
- - ( - - )} - rules={{ required: true }} - /> -
Please provide a name
-
-
- - ( -