Skip to content

fix: let workspace pages download partial logs for unhealthy workspaces #13761

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 19 commits into from
Jul 3, 2024
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
fix: update styles for unavailable logs
  • Loading branch information
Parkreiner committed Jul 2, 2024
commit fa06515a869c20f05f4790eac37008c110bbc140
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { useTheme, type Interpolation, type Theme } from "@emotion/react";
import Skeleton from "@mui/material/Skeleton";
import ErrorIcon from "@mui/icons-material/ErrorOutline";

Check failure on line 3 in site/src/pages/WorkspacePage/WorkspaceActions/DownloadLogsDialog.tsx

View workflow job for this annotation

GitHub Actions / lint

`@mui/icons-material/ErrorOutline` import should occur before import of `@mui/material/Skeleton`

Check failure on line 3 in site/src/pages/WorkspacePage/WorkspaceActions/DownloadLogsDialog.tsx

View workflow job for this annotation

GitHub Actions / lint

`@mui/icons-material/ErrorOutline` import should occur before import of `@mui/material/Skeleton`
import { saveAs } from "file-saver";
import JSZip from "jszip";
import { type FC, useMemo, useState, useRef, useEffect } from "react";
import { UseQueryOptions, useQueries, useQuery } from "react-query";

Check failure on line 7 in site/src/pages/WorkspacePage/WorkspaceActions/DownloadLogsDialog.tsx

View workflow job for this annotation

GitHub Actions / lint

Import "UseQueryOptions" is only used as types

Check failure on line 7 in site/src/pages/WorkspacePage/WorkspaceActions/DownloadLogsDialog.tsx

View workflow job for this annotation

GitHub Actions / lint

Import "UseQueryOptions" is only used as types
import { agentLogs, buildLogs } from "api/queries/workspaces";
import type {
Workspace,
Expand All @@ -16,7 +17,7 @@
} from "components/Dialogs/ConfirmDialog/ConfirmDialog";
import { displayError } from "components/GlobalSnackbar/utils";
import { Stack } from "components/Stack/Stack";
import { ErrorAlert } from "components/Alert/ErrorAlert";

Check failure on line 20 in site/src/pages/WorkspacePage/WorkspaceActions/DownloadLogsDialog.tsx

View workflow job for this annotation

GitHub Actions / lint

`components/Alert/ErrorAlert` import should occur before import of `components/Dialogs/ConfirmDialog/ConfirmDialog`

Check failure on line 20 in site/src/pages/WorkspacePage/WorkspaceActions/DownloadLogsDialog.tsx

View workflow job for this annotation

GitHub Actions / lint

`components/Alert/ErrorAlert` import should occur before import of `components/Dialogs/ConfirmDialog/ConfirmDialog`

const BLOB_SIZE_UNITS = ["B", "KB", "MB", "GB", "TB"] as const;

Expand Down Expand Up @@ -194,6 +195,7 @@
}>;

const DownloadingItem: FC<DownloadingItemProps> = ({ file, giveUpTimeMs }) => {
const theme = useTheme();
const [isWaiting, setIsWaiting] = useState(true);
useEffect(() => {
if (giveUpTimeMs === undefined || file.blob !== undefined) {
Expand All @@ -211,14 +213,28 @@

return (
<li css={styles.listItem}>
<span css={styles.listItemPrimary}>{file.name}</span>
<span
css={[
styles.listItemPrimary,
!isWaiting && { color: theme.palette.text.disabled },
]}
>
{file.name}
</span>

<span css={styles.listItemSecondary}>
{file.blob ? (
humanBlobSize(file.blob.size)
) : isWaiting ? (
<Skeleton variant="text" width={48} height={12} />
) : (
<p css={styles.notAvailableText}>N/A</p>
<div css={styles.notAvailableText}>
<span aria-hidden>
<ErrorIcon fontSize={"inherit"} />

Check failure on line 233 in site/src/pages/WorkspacePage/WorkspaceActions/DownloadLogsDialog.tsx

View workflow job for this annotation

GitHub Actions / lint

Curly braces are unnecessary here

Check failure on line 233 in site/src/pages/WorkspacePage/WorkspaceActions/DownloadLogsDialog.tsx

View workflow job for this annotation

GitHub Actions / lint

Curly braces are unnecessary here
</span>

<p>N/A</p>
</div>
)}
</span>
</li>
Expand Down Expand Up @@ -261,6 +277,20 @@
},

notAvailableText: (theme) => ({
color: theme.palette.error.main,
display: "flex",
flexFlow: "row nowrap",
alignItems: "center",
columnGap: "4px",

"& > span": {
maxHeight: "fit-content",
display: "flex",
alignItems: "center",
color: theme.palette.error.light,
},

"& > p": {
opacity: "80%",
},
}),
} satisfies Record<string, Interpolation<Theme>>;
Loading