Skip to content

fix: display error when a build fails on template editor #16210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions site/src/components/GlobalSnackbar/GlobalSnackbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const GlobalSnackbar: FC = () => {
<ErrorIcon css={styles.errorIcon} />
)}

<div css={{ maxWidth: 670 }}>
<div className="max-w-[670px] flex flex-col">
<span css={styles.messageTitle}>{notificationMsg.msg}</span>

{notificationMsg.additionalMsgs?.map((msg, index) => (
Expand Down Expand Up @@ -104,7 +104,10 @@ const styles = {
fontWeight: 600,
},
messageSubtitle: {
marginTop: 12,
marginTop: 4,
"&:first-letter": {
textTransform: "uppercase",
},
},
errorIcon: (theme) => ({
color: theme.palette.error.contrastText,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Button from "@mui/material/Button";
import ButtonGroup from "@mui/material/ButtonGroup";
import IconButton from "@mui/material/IconButton";
import Tooltip from "@mui/material/Tooltip";
import { getErrorDetail, getErrorMessage } from "api/errors";
import type {
ProvisionerJobLog,
Template,
Expand All @@ -26,6 +27,7 @@ import {
TopbarDivider,
TopbarIconButton,
} from "components/FullPageLayout/Topbar";
import { displayError } from "components/GlobalSnackbar/utils";
import { Loader } from "components/Loader/Loader";
import { linkToTemplate, useLinks } from "modules/navigation";
import { ProvisionerAlert } from "modules/provisioners/ProvisionerAlert";
Expand Down Expand Up @@ -132,8 +134,15 @@ export const TemplateVersionEditor: FC<TemplateVersionEditorProps> = ({
const availableProvisioners = templateVersion.matched_provisioners?.available;

const triggerPreview = useCallback(async () => {
await onPreview(fileTree);
setSelectedTab("logs");
try {
await onPreview(fileTree);
setSelectedTab("logs");
} catch (error) {
displayError(
getErrorMessage(error, "Error on previewing the template"),
getErrorDetail(error),
);
}
}, [fileTree, onPreview]);

// Stop ctrl+s from saving files and make ctrl+enter trigger a preview.
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy