Skip to content

Commit 5289170

Browse files
committed
move location of modal
1 parent c152de4 commit 5289170

6 files changed

Lines changed: 22 additions & 179 deletions

File tree

client/src/features/sessionsV2/SessionList/SessionLauncherDisplay.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import type { SessionLauncher } from "../api/sessionLaunchersV2.api";
2424
import { useGetSessionsQuery as useGetSessionsQueryV2 } from "../api/sessionsV2.api";
2525
import UpdateSessionLauncherEnvironmentModal from "../components/SessionModals/UpdateSessionLauncherModal";
2626
import DeleteSessionV2Modal from "../DeleteSessionLauncherModal";
27-
import SessionStartLinkModal from "../SessionView/SessionStartLinkModal";
27+
import SessionLaunchLinkModal from "../SessionView/SessionLaunchLinkModal";
2828
import { SessionView } from "../SessionView/SessionView";
2929
import SessionLauncherCard from "./SessionLauncherCard";
3030
import EnvironmentLogsV2 from "../../../components/LogsV2";
@@ -135,7 +135,7 @@ export function SessionLauncherDisplay({
135135
toggle={toggleDelete}
136136
sessionsLength={filteredSessions?.length}
137137
/>
138-
<SessionStartLinkModal
138+
<SessionLaunchLinkModal
139139
isOpen={isShareLinkOpen}
140140
launcher={launcher}
141141
toggle={toggleShareLink}

client/src/features/sessionsV2/SessionView/SessionLaunchLinkModal.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818

1919
import cx from "classnames";
2020
import { useContext, useEffect, useMemo } from "react";
21-
import { ArrowClockwise, CheckCircle, XLg } from "react-bootstrap-icons";
21+
import {
22+
ArrowClockwise,
23+
CheckCircle,
24+
Link45deg,
25+
XLg,
26+
} from "react-bootstrap-icons";
2227
import {
2328
Controller,
2429
useFieldArray,
@@ -32,6 +37,7 @@ import {
3237
Col,
3338
Form,
3439
FormGroup,
40+
Input,
3541
Label,
3642
Modal,
3743
ModalBody,
@@ -49,8 +55,6 @@ import AppContext from "../../../utils/context/appContext";
4955
import { Project } from "../../projectsV2/api/projectV2.api";
5056
import type { SessionLauncher } from "../api/sessionLaunchersV2.api";
5157

52-
import { Input } from "reactstrap";
53-
5458
interface CustomizeLaunchLinkFormProps {
5559
control: ReturnType<typeof useForm<EnvVariablesCustomizationForm>>["control"];
5660
errors: FieldErrors<EnvVariablesCustomizationForm>;
@@ -408,7 +412,10 @@ export default function SessionLaunchLinkModal({
408412
scrollable
409413
>
410414
<ModalHeader toggle={toggle}>
411-
<div>Share Session launch link for {launcher.name}</div>
415+
<div>
416+
<Link45deg className={cx("bi", "me-1")} /> Share Session launch link
417+
for {launcher.name}
418+
</div>
412419
<div className="fs-6">
413420
Create and share a link that directly launches a Renku session.
414421
</div>

client/src/features/sessionsV2/SessionView/SessionStartLinkModal.tsx

Lines changed: 0 additions & 68 deletions
This file was deleted.

client/src/features/sessionsV2/SessionView/SessionView.tsx

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
Database,
2525
ExclamationTriangleFill,
2626
FileCode,
27-
Link45deg,
2827
Pencil,
2928
} from "react-bootstrap-icons";
3029
import {
@@ -70,10 +69,8 @@ import {
7069
import { DEFAULT_URL } from "../session.constants";
7170
import { SessionV2 } from "../sessionsV2.types";
7271
import EnvironmentCard from "./EnvironmentCard";
73-
import useSessionStartLink from "./useSessionStartLink.hook";
7472
import EnvVariablesCard from "./EnvVariablesCard";
7573
import EnvVariablesModal from "./EnvVariablesModal";
76-
import SessionLaunchLinkModal from "./SessionLaunchLinkModal";
7774

7875
interface SessionCardContentProps {
7976
color: string;
@@ -195,23 +192,6 @@ function getSessionColor(state: string) {
195192
: "dark";
196193
}
197194

198-
function SessionLaunchLink({
199-
launcher,
200-
project,
201-
}: Required<Pick<SessionViewProps, "launcher" | "project">>) {
202-
const { url } = useSessionStartLink({ launcher, project });
203-
return (
204-
<div className="mb-2">
205-
<h4 className="my-auto">
206-
<Link45deg className={cx("bi", "me-1")} />
207-
Session Launch Link
208-
</h4>
209-
<p className="mb-2">A session launch link leads directly to a session.</p>
210-
<CommandCopy command={url.toString()} noMargin />
211-
</div>
212-
);
213-
}
214-
215195
interface SessionViewProps {
216196
id?: string;
217197
isOpen: boolean;
@@ -237,8 +217,6 @@ export function SessionView({
237217
const [isUpdateOpen, setIsUpdateOpen] = useState(false);
238218
const [isModifyResourcesOpen, setModifyResourcesOpen] = useState(false);
239219
const [isEnvVariablesModalOpen, setEnvVariablesModalOpen] = useState(false);
240-
const [isSessionLaunchLinksModalOpen, setSessionLaunchLinksModalOpen] =
241-
useState(false);
242220
const toggle = useCallback(() => {
243221
setIsUpdateOpen((open) => !open);
244222
}, []);
@@ -248,9 +226,6 @@ export function SessionView({
248226
const toggleEnvVariables = useCallback(() => {
249227
setEnvVariablesModalOpen((open) => !open);
250228
}, []);
251-
const toggleSessionLaunchLinks = useCallback(() => {
252-
setSessionLaunchLinksModalOpen((open) => !open);
253-
}, []);
254229
const permissions = useProjectPermissions({ projectId: project.id });
255230
const environment = launcher?.environment;
256231

@@ -558,38 +533,6 @@ export function SessionView({
558533
</div>
559534

560535
<SessionViewSessionSecrets />
561-
{launcher && (
562-
<div className="mb-2">
563-
<div className={cx("d-flex", "justify-content-between", "mb-2")}>
564-
<h4 className="my-auto">
565-
<Link45deg className={cx("bi", "me-1")} />
566-
Session Launch Link
567-
</h4>
568-
<Button
569-
color="outline-primary"
570-
id="define-launch-links-button"
571-
onClick={toggleSessionLaunchLinks}
572-
size="sm"
573-
tabIndex={0}
574-
>
575-
<Pencil className="bi" />
576-
</Button>
577-
<UncontrolledTooltip target="define-launch-links-button">
578-
Define custom launch links
579-
</UncontrolledTooltip>
580-
</div>
581-
<p className="mb-2">
582-
A session launch link leads directly to a session.
583-
</p>
584-
<SessionLaunchLink launcher={launcher} project={project} />
585-
<SessionLaunchLinkModal
586-
isOpen={isSessionLaunchLinksModalOpen}
587-
launcher={launcher}
588-
project={project}
589-
toggle={toggleSessionLaunchLinks}
590-
/>
591-
</div>
592-
)}
593536
{launcher && (
594537
<div>
595538
<div className={cx("d-flex", "justify-content-between", "mb-2")}>

client/src/features/sessionsV2/SessionView/useSessionStartLink.hook.ts

Lines changed: 0 additions & 44 deletions
This file was deleted.

tests/cypress/e2e/projectV2setup.spec.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,11 @@ describe("Customize session environment variables", () => {
651651

652652
cy.wait("@sessionLaunchers");
653653
// check session launcher view and edit session launcher
654-
cy.getDataCy("session-name").click();
655-
cy.get("#define-launch-links-button").click();
654+
cy.getDataCy("session-launcher-item")
655+
.find('[data-cy="button-with-menu-dropdown"]')
656+
.click();
657+
cy.getDataCy("session-launcher-menu-share-link").click();
658+
// cy.get("#define-launch-links-button").click();
656659
// cy.contains(
657660
// "To add environment variables, see the Environment Variables section of the session launcher."
658661
// ).should("be.visible");
@@ -685,8 +688,10 @@ describe("Customize session environment variables", () => {
685688

686689
cy.wait("@sessionLaunchers");
687690
// check session launcher view and edit session launcher
688-
cy.getDataCy("session-name").click();
689-
cy.get("#define-launch-links-button").click();
691+
cy.getDataCy("session-launcher-item")
692+
.find('[data-cy="button-with-menu-dropdown"]')
693+
.click();
694+
cy.getDataCy("session-launcher-menu-share-link").click();
690695
cy.contains(
691696
"To add environment variables, see the Environment Variables section of the session launcher."
692697
).should("be.visible");

0 commit comments

Comments
 (0)