Skip to content

Commit 1deff5e

Browse files
authored
refine: update style of environment variables in launcher offcanvas (#3672)
1 parent dc3f5ee commit 1deff5e

3 files changed

Lines changed: 48 additions & 57 deletions

File tree

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

Lines changed: 19 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818

1919
import cx from "classnames";
20-
import { Card, CardBody, Col, Row, Table } from "reactstrap";
20+
import { Col, ListGroup, ListGroupItem, Row } from "reactstrap";
2121

2222
import type { SessionLauncher } from "../api/sessionLaunchersV2.api";
2323

@@ -35,49 +35,23 @@ export default function EnvVariablesCard({
3535
}
3636

3737
return (
38-
<Card data-cy="env-variables-card" className={cx("border")}>
39-
<CardBody className={cx("d-flex", "flex-column")}>
40-
<Row>
41-
<Col
42-
xs={12}
43-
className={cx(
44-
"d-flex",
45-
"flex-wrap",
46-
"flex-sm-nowrap",
47-
"align-items-start",
48-
"justify-content-between",
49-
"pb-2",
50-
"gap-2"
51-
)}
52-
>
53-
<Table size="sm">
54-
<tbody>
55-
{envVariables.map((env) => (
56-
<EnvVariableRow
57-
key={env.name}
58-
env={env.name}
59-
value={env.value}
60-
/>
61-
))}
62-
</tbody>
63-
</Table>
64-
</Col>
65-
</Row>
66-
</CardBody>
67-
</Card>
68-
);
69-
}
70-
71-
interface EnvRowParameterProps {
72-
env: string;
73-
value: string | null | undefined;
74-
}
75-
76-
function EnvVariableRow({ env, value }: EnvRowParameterProps) {
77-
return (
78-
<tr>
79-
<th scope="row">{env}</th>
80-
<td>{value ?? ""}</td>
81-
</tr>
38+
<ListGroup data-cy="env-variables-card">
39+
{envVariables.map(({ name, value }) => (
40+
<ListGroupItem key={`env-var-${name}`}>
41+
<Row data-cy="env-var-row">
42+
<Col
43+
xs={6}
44+
className={cx("fw-bold", "text-break")}
45+
data-cy="env-var-name"
46+
>
47+
{name}
48+
</Col>
49+
<Col xs={6} className="text-break" data-cy="env-var-value">
50+
{value ?? ""}
51+
</Col>
52+
</Row>
53+
</ListGroupItem>
54+
))}
55+
</ListGroup>
8256
);
8357
}

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { skipToken } from "@reduxjs/toolkit/query";
1919
import cx from "classnames";
2020
import { ReactNode, useCallback, useMemo, useState } from "react";
2121
import {
22+
Braces,
2223
CircleFill,
2324
Clock,
2425
Database,
@@ -559,8 +560,18 @@ export function SessionView({
559560
)}
560561
{launcher && (
561562
<div>
562-
<div className={cx("d-flex", "justify-content-between", "mb-2")}>
563-
<h4 className="my-auto">Environment Variables</h4>
563+
<div
564+
className={cx(
565+
"d-flex",
566+
"align-items-center",
567+
"justify-content-between",
568+
"mb-2"
569+
)}
570+
>
571+
<h4 className={cx("mb-0", "me-2")}>
572+
<Braces className={cx("me-1", "bi")} />
573+
Environment Variables
574+
</h4>
564575
<PermissionsGuard
565576
disabled={null}
566577
enabled={

tests/cypress/e2e/projectV2setup.spec.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,14 @@ describe("Set up project components", () => {
201201
cy.wait("@sessionLaunchers");
202202
// check session launcher view and edit session launcher
203203
cy.getDataCy("session-name").click();
204-
cy.getDataCy("env-variables-card").within(() => {
205-
cy.get("tr").should("have.length", 2);
206-
cy.get("tr").first().should("contain.text", "VAR_1");
207-
cy.get("tr").last().should("contain.text", "VAR_2");
208-
});
204+
cy.getDataCy("env-variables-card")
205+
.scrollIntoView()
206+
.should("be.visible")
207+
.within(() => {
208+
cy.getDataCy("env-var-row").should("have.length", 2);
209+
cy.getDataCy("env-var-name").first().should("contain.text", "VAR_1");
210+
cy.getDataCy("env-var-name").last().should("contain.text", "VAR_2");
211+
});
209212
cy.get("#modify-env-variables-button").click();
210213
// TEST bad input
211214
cy.getDataCy("env-variables-input_0-name").clear().type("RENKU VALUE");
@@ -283,11 +286,14 @@ describe("Set up project components", () => {
283286
cy.wait("@sessionLaunchers");
284287
// check session launcher view and edit session launcher
285288
cy.getDataCy("session-name").click();
286-
cy.getDataCy("env-variables-card").within(() => {
287-
cy.get("tr").should("have.length", 2);
288-
cy.get("tr").first().should("contain.text", "VAR_1");
289-
cy.get("tr").last().should("contain.text", "VAR_2");
290-
});
289+
cy.getDataCy("env-variables-card")
290+
.scrollIntoView()
291+
.should("be.visible")
292+
.within(() => {
293+
cy.getDataCy("env-var-row").should("have.length", 2);
294+
cy.getDataCy("env-var-name").first().should("contain.text", "VAR_1");
295+
cy.getDataCy("env-var-name").last().should("contain.text", "VAR_2");
296+
});
291297
cy.get("#modify-env-variables-button").click();
292298
// TEST bad input
293299
cy.getDataCy("env-variables-input_0-name").clear().type("RENKU VALUE");

0 commit comments

Comments
 (0)