-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds welcome page & pull / build buttons
### What does this PR do? * Updates the welcome / empty screen page so there is no more empty descriptions * Adds a build / pull button for a test iamge * Added API for opening an eternal link * If pulling for more than 5 seconds, show a warning ### Screenshot / video of UI <!-- If this PR is changing UI, please include screenshots or screencasts showing the difference --> ### What issues does this PR fix or reference? <!-- Include any related issues from Podman Desktop repository (or from another issue tracker). --> Closes #150 ### How to test this PR? <!-- Please explain steps to reproduce --> Go to the welcome page with no builds, click on the pull / build buttons. Signed-off-by: Charlie Drage <[email protected]>
- Loading branch information
Showing
7 changed files
with
254 additions
and
18 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
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
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 |
---|---|---|
@@ -1,9 +1,114 @@ | ||
<script lang="ts"> | ||
import EmptyScreen from './upstream/EmptyScreen.svelte'; | ||
import BootcIcon from './BootcIcon.svelte'; | ||
import BootcSelkie from './BootcSelkie.svelte'; | ||
import Link from './upstream/Link.svelte'; | ||
import { faArrowCircleDown, faCube } from '@fortawesome/free-solid-svg-icons'; | ||
import Button from './upstream/Button.svelte'; | ||
import { onMount, tick } from 'svelte'; | ||
import { bootcClient, rpcBrowser } from '../api/client'; | ||
import { Messages } from '/@shared/src/messages/Messages'; | ||
import { router } from 'tinro'; | ||
let pullInProgress = false; | ||
let imageExists = false; | ||
let displayDisclaimer = false; | ||
let bootcAvailableImages: any[] = []; | ||
const exampleImage = 'quay.io/bootc-extension/httpd:latest'; | ||
const bootcImageBuilderSite = 'https://github.com/osbuild/bootc-image-builder'; | ||
const bootcSite = 'https://containers.github.io/bootc/'; | ||
const centosBootcSite = 'https://github.com/CentOS/centos-bootc'; | ||
const extensionSite = 'https://github.com/containers/podman-desktop-extension-bootc'; | ||
async function gotoBuild(): Promise<void> { | ||
// Split the image name to get the image name and tag | ||
// and go to /build/:image/:tag | ||
// this will pre-select the image and tag in the build screen | ||
const [image, tag] = exampleImage.split(':'); | ||
router.goto(`/build/${encodeURIComponent(image)}/${encodeURIComponent(tag)}`); | ||
} | ||
async function pullExampleImage() { | ||
pullInProgress = true; | ||
displayDisclaimer = false; | ||
bootcClient.pullImage(exampleImage); | ||
// After 5 seconds, check if pull is still in progress and display disclaimer if true | ||
setTimeout(async () => { | ||
if (pullInProgress) { | ||
displayDisclaimer = true; | ||
await tick(); // Ensure UI updates to reflect the new state | ||
} | ||
}, 5000); | ||
} | ||
onMount(async () => { | ||
bootcAvailableImages = await bootcClient.listBootcImages(); | ||
return rpcBrowser.subscribe(Messages.MSG_IMAGE_PULL_UPDATE, async msg => { | ||
if (msg.image === exampleImage) { | ||
pullInProgress = !msg.success; | ||
if (!pullInProgress) { | ||
displayDisclaimer = false; // Ensure disclaimer is removed when not in progress | ||
} | ||
} | ||
// Update the list of available images after a successful pull | ||
if (msg.success) { | ||
bootcAvailableImages = await bootcClient.listBootcImages(); | ||
} | ||
}); | ||
}); | ||
// Each time bootcAvailableImages updates, check if 'quay.io/bootc-extension/httpd' is in RepoTags | ||
$: { | ||
if (bootcAvailableImages && bootcAvailableImages.some(image => image.RepoTags.includes(exampleImage))) { | ||
imageExists = true; | ||
} | ||
} | ||
</script> | ||
|
||
<EmptyScreen | ||
icon="{BootcIcon}" | ||
title="No bootable container builds found" | ||
message="Start your first build by clicking the 'Build' button" /> | ||
<div class="flex w-full h-full justify-center items-center"> | ||
<div class="flex flex-col h-full items-center text-center space-y-3"> | ||
<!-- Bootable Container Icon --> | ||
<div class="text-gray-700 py-2"> | ||
<svelte:component this="{BootcSelkie}" size="120" /> | ||
</div> | ||
|
||
<h1 class="text-xl pb-4">Welcome to Bootable Containers</h1> | ||
|
||
<p class="text-gray-700 pb-4 max-w-xl"> | ||
Bootable Containers builds an entire bootable OS from your container image. Utilizing the technology of a | ||
<Link externalRef="{centosBootcSite}">compatible image</Link>, <Link externalRef="{bootcImageBuilderSite}" | ||
>bootc-image-builder</Link | ||
>, and <Link externalRef="{bootcSite}">bootc</Link>, your container image is transformed into a bootable disk | ||
image. | ||
</p> | ||
|
||
<p class="text-gray-700 pb-1 max-w-xl"> | ||
Create your first disk image by {imageExists ? 'building' : 'pulling'} the <Link | ||
externalRef="{`https://${exampleImage}`}">example container image</Link | ||
>: | ||
</p> | ||
|
||
<!-- Build / pull buttons --> | ||
{#if imageExists} | ||
<Button on:click="{() => gotoBuild()}" icon="{faCube}" aria-label="Build image" title="Build" | ||
>Build {exampleImage}</Button> | ||
{:else} | ||
<Button | ||
on:click="{() => pullExampleImage()}" | ||
icon="{faArrowCircleDown}" | ||
inProgress="{pullInProgress}" | ||
aria-label="Pull image" | ||
title="Pull image">Pull {exampleImage}</Button> | ||
{/if} | ||
{#if displayDisclaimer} | ||
<p class="text-amber-500 text-xs">The file size of the image is over 1.5GB and may take a while to download.</p> | ||
{/if} | ||
|
||
<p class="text-gray-700 pt-8 max-w-xl"> | ||
Want to learn more including building your own Containerfile? Check out the <Link externalRef="{extensionSite}" | ||
>extension documentation</Link | ||
>. | ||
</p> | ||
</div> | ||
</div> |
Large diffs are not rendered by default.
Oops, something went wrong.
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