-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fleet UI: Surface download URL for Fleet-maintained app when adding (#…
- Loading branch information
1 parent
fcf4f97
commit 9b70a2c
Showing
12 changed files
with
179 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Fleet UI: Surfaced download URL for Fleet-maintained app when adding the software to Fleet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
frontend/components/TableContainer/DataTable/PlatformCell/PlatformCell.tests.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
...ained/FleetMaintainedAppDetailsPage/AddFleetAppSoftwareModal/AddFleetAppSoftwareModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...ntained/FleetMaintainedAppDetailsPage/FleetAppDetailsModal/FleetAppDetailsModal.tests.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from "react"; | ||
import { screen } from "@testing-library/react"; | ||
import { noop } from "lodash"; | ||
import { createCustomRenderer } from "test/test-utils"; | ||
|
||
import FleetAppDetailsModal from "./FleetAppDetailsModal"; | ||
|
||
describe("FleetAppDetailsModal", () => { | ||
const defaultProps = { | ||
name: "Test App", | ||
platform: "macOS", | ||
version: "1.0.0", | ||
url: "https://example.com/app", | ||
onCancel: noop, | ||
}; | ||
|
||
it("renders modal with correct title", () => { | ||
const render = createCustomRenderer(); | ||
|
||
render(<FleetAppDetailsModal {...defaultProps} />); | ||
|
||
const modalTitle = screen.getByText("Software details"); | ||
expect(modalTitle).toBeInTheDocument(); | ||
}); | ||
|
||
it("displays correct app details", () => { | ||
const render = createCustomRenderer(); | ||
|
||
render(<FleetAppDetailsModal {...defaultProps} />); | ||
|
||
expect(screen.getByText("Name")).toBeInTheDocument(); | ||
expect(screen.getByText("Test App")).toBeInTheDocument(); | ||
expect(screen.getByText("Platform")).toBeInTheDocument(); | ||
expect(screen.getByText("macOS")).toBeInTheDocument(); | ||
expect(screen.getByText("Version")).toBeInTheDocument(); | ||
expect(screen.getByText("1.0.0")).toBeInTheDocument(); | ||
expect(screen.getByText("URL")).toBeInTheDocument(); | ||
expect( | ||
screen.getAllByText("https://example.com/app").length | ||
).toBeGreaterThan(0); // Tooltip renders text twice causing use of toBeInTheDocument to fail | ||
}); | ||
|
||
it("does not render URL field when url prop is not provided", () => { | ||
const render = createCustomRenderer(); | ||
const propsWithoutUrl = { ...defaultProps, url: undefined }; | ||
|
||
render(<FleetAppDetailsModal {...propsWithoutUrl} />); | ||
|
||
expect(screen.queryByText("URL")).not.toBeInTheDocument(); | ||
}); | ||
}); |
57 changes: 57 additions & 0 deletions
57
...eetMaintained/FleetMaintainedAppDetailsPage/FleetAppDetailsModal/FleetAppDetailsModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React from "react"; | ||
|
||
import Modal from "components/Modal"; | ||
import DataSet from "components/DataSet"; | ||
import TooltipWrapper from "components/TooltipWrapper"; | ||
import TooltipTruncatedText from "components/TooltipTruncatedText"; | ||
import Button from "components/buttons/Button"; | ||
|
||
const baseClass = "fleet-app-details-modal"; | ||
|
||
interface IFleetAppDetailsModalProps { | ||
name: string; | ||
platform: string; | ||
version: string; | ||
url?: string; | ||
onCancel: () => void; | ||
} | ||
|
||
const TOOLTIP_MESSAGE = | ||
"Fleet downloads the package from the URL and stores it. Hosts download it from Fleet before install."; | ||
|
||
const FleetAppDetailsModal = ({ | ||
name, | ||
platform, | ||
version, | ||
url, | ||
onCancel, | ||
}: IFleetAppDetailsModalProps) => { | ||
return ( | ||
<Modal className={baseClass} title="Software details" onExit={onCancel}> | ||
<> | ||
<div className={`${baseClass}__modal-content`}> | ||
<DataSet title="Name" value={name} /> | ||
<DataSet title="Platform" value={platform} /> | ||
<DataSet title="Version" value={version} /> | ||
{url && ( | ||
<DataSet | ||
title={ | ||
<TooltipWrapper tipContent={TOOLTIP_MESSAGE}> | ||
URL | ||
</TooltipWrapper> | ||
} | ||
value={<TooltipTruncatedText value={url} />} | ||
/> | ||
)} | ||
</div> | ||
<div className="modal-cta-wrap"> | ||
<Button onClick={onCancel} variant="brand"> | ||
Done | ||
</Button> | ||
</div> | ||
</> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default FleetAppDetailsModal; |
12 changes: 12 additions & 0 deletions
12
...e/SoftwareFleetMaintained/FleetMaintainedAppDetailsPage/FleetAppDetailsModal/_styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.fleet-app-details-modal { | ||
&__modal-content { | ||
display: flex; | ||
column-gap: $pad-xxlarge; | ||
row-gap: $pad-xlarge; | ||
flex-wrap: wrap; | ||
} | ||
|
||
.react-tooltip { | ||
min-width: 120px; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...dPage/SoftwareFleetMaintained/FleetMaintainedAppDetailsPage/FleetAppDetailsModal/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from "./FleetAppDetailsModal"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters