- Notifications
You must be signed in to change notification settings - Fork927
fix(site): retry and debug passing build parameters options#12384
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
9 commits Select commitHold shift + click to select a range
cf51f13
Chosmetic changes
BrunoQuaresma1bbe8d0
Support build parameters on retry and debug actions
BrunoQuaresmaae3f3f0
Extract retry button
BrunoQuaresmac3a8dd9
Extract debug button
BrunoQuaresma5858c8d
Add story for checking debug
BrunoQuaresma642e475
Fix workspace tests warnings
BrunoQuaresmaa9e122f
Add tests for retry with build parameters
BrunoQuaresma7d245c5
Add test for debug
BrunoQuaresma79673eb
Fix test errors
BrunoQuaresmaFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
9 changes: 6 additions & 3 deletionssite/src/components/FullPageLayout/Sidebar.tsx
This file contains hidden or 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
34 changes: 10 additions & 24 deletionssite/src/pages/WorkspacePage/Workspace.tsx
This file contains hidden or 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
4 changes: 4 additions & 0 deletionssite/src/pages/WorkspacePage/WorkspaceActions/BuildParametersPopover.tsx
This file contains hidden or 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
24 changes: 3 additions & 21 deletionssite/src/pages/WorkspacePage/WorkspaceActions/Buttons.tsx
This file contains hidden or 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
54 changes: 54 additions & 0 deletionssite/src/pages/WorkspacePage/WorkspaceActions/DebugButton.stories.tsx
This file contains hidden or 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,54 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import { DebugButton } from "./DebugButton"; | ||
import { MockWorkspace } from "testHelpers/entities"; | ||
import { userEvent, waitFor, within, expect } from "@storybook/test"; | ||
const meta: Meta<typeof DebugButton> = { | ||
title: "pages/WorkspacePage/DebugButton", | ||
component: DebugButton, | ||
}; | ||
export default meta; | ||
type Story = StoryObj<typeof DebugButton>; | ||
export const Default: Story = {}; | ||
export const WithBuildParameters: Story = { | ||
args: { | ||
enableBuildParameters: true, | ||
workspace: MockWorkspace, | ||
}, | ||
parameters: { | ||
queries: [ | ||
{ | ||
key: ["workspace", MockWorkspace.id, "parameters"], | ||
data: { templateVersionRichParameters: [], buildParameters: [] }, | ||
}, | ||
], | ||
}, | ||
}; | ||
export const WithOpenBuildParameters: Story = { | ||
args: { | ||
enableBuildParameters: true, | ||
workspace: MockWorkspace, | ||
}, | ||
parameters: { | ||
queries: [ | ||
{ | ||
key: ["workspace", MockWorkspace.id, "parameters"], | ||
data: { templateVersionRichParameters: [], buildParameters: [] }, | ||
}, | ||
], | ||
}, | ||
play: async ({ canvasElement, step }) => { | ||
const screen = within(canvasElement); | ||
await step("open popover", async () => { | ||
await userEvent.click(screen.getByTestId("build-parameters-button")); | ||
await waitFor(() => | ||
expect(screen.getByText("Build Options")).toBeInTheDocument(), | ||
); | ||
}); | ||
}, | ||
}; |
47 changes: 47 additions & 0 deletionssite/src/pages/WorkspacePage/WorkspaceActions/DebugButton.tsx
This file contains hidden or 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,47 @@ | ||
import ButtonGroup from "@mui/material/ButtonGroup"; | ||
import DebugIcon from "@mui/icons-material/BugReportOutlined"; | ||
import { type FC } from "react"; | ||
import type { Workspace } from "api/typesGenerated"; | ||
import { BuildParametersPopover } from "./BuildParametersPopover"; | ||
import { TopbarButton } from "components/FullPageLayout/Topbar"; | ||
import { ActionButtonProps } from "./Buttons"; | ||
type DebugButtonProps = Omit<ActionButtonProps, "loading"> & { | ||
workspace: Workspace; | ||
enableBuildParameters: boolean; | ||
}; | ||
export const DebugButton: FC<DebugButtonProps> = ({ | ||
handleAction, | ||
workspace, | ||
enableBuildParameters, | ||
}) => { | ||
const mainAction = ( | ||
<TopbarButton startIcon={<DebugIcon />} onClick={() => handleAction()}> | ||
Debug | ||
</TopbarButton> | ||
); | ||
if (!enableBuildParameters) { | ||
return mainAction; | ||
} | ||
return ( | ||
<ButtonGroup | ||
variant="outlined" | ||
css={{ | ||
// Workaround to make the border transitions smoothly on button groups | ||
"& > button:hover + button": { | ||
borderLeft: "1px solid #FFF", | ||
}, | ||
}} | ||
> | ||
{mainAction} | ||
<BuildParametersPopover | ||
label="Debug with build parameters" | ||
workspace={workspace} | ||
onSubmit={handleAction} | ||
/> | ||
</ButtonGroup> | ||
); | ||
}; |
54 changes: 54 additions & 0 deletionssite/src/pages/WorkspacePage/WorkspaceActions/RetryButton.stories.tsx
This file contains hidden or 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,54 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import { RetryButton } from "./RetryButton"; | ||
import { MockWorkspace } from "testHelpers/entities"; | ||
import { userEvent, waitFor, within, expect } from "@storybook/test"; | ||
const meta: Meta<typeof RetryButton> = { | ||
title: "pages/WorkspacePage/RetryButton", | ||
component: RetryButton, | ||
}; | ||
export default meta; | ||
type Story = StoryObj<typeof RetryButton>; | ||
export const Default: Story = {}; | ||
export const WithBuildParameters: Story = { | ||
args: { | ||
enableBuildParameters: true, | ||
workspace: MockWorkspace, | ||
}, | ||
parameters: { | ||
queries: [ | ||
{ | ||
key: ["workspace", MockWorkspace.id, "parameters"], | ||
data: { templateVersionRichParameters: [], buildParameters: [] }, | ||
}, | ||
], | ||
}, | ||
}; | ||
export const WithOpenBuildParameters: Story = { | ||
args: { | ||
enableBuildParameters: true, | ||
workspace: MockWorkspace, | ||
}, | ||
parameters: { | ||
queries: [ | ||
{ | ||
key: ["workspace", MockWorkspace.id, "parameters"], | ||
data: { templateVersionRichParameters: [], buildParameters: [] }, | ||
}, | ||
], | ||
}, | ||
play: async ({ canvasElement, step }) => { | ||
const screen = within(canvasElement); | ||
await step("open popover", async () => { | ||
await userEvent.click(screen.getByTestId("build-parameters-button")); | ||
await waitFor(() => | ||
expect(screen.getByText("Build Options")).toBeInTheDocument(), | ||
); | ||
}); | ||
}, | ||
}; |
47 changes: 47 additions & 0 deletionssite/src/pages/WorkspacePage/WorkspaceActions/RetryButton.tsx
This file contains hidden or 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,47 @@ | ||
import ButtonGroup from "@mui/material/ButtonGroup"; | ||
import RetryIcon from "@mui/icons-material/CachedOutlined"; | ||
import { type FC } from "react"; | ||
import type { Workspace } from "api/typesGenerated"; | ||
import { BuildParametersPopover } from "./BuildParametersPopover"; | ||
import { TopbarButton } from "components/FullPageLayout/Topbar"; | ||
import { ActionButtonProps } from "./Buttons"; | ||
type RetryButtonProps = Omit<ActionButtonProps, "loading"> & { | ||
enableBuildParameters: boolean; | ||
workspace: Workspace; | ||
}; | ||
export const RetryButton: FC<RetryButtonProps> = ({ | ||
handleAction, | ||
workspace, | ||
enableBuildParameters, | ||
}) => { | ||
const mainAction = ( | ||
<TopbarButton startIcon={<RetryIcon />} onClick={() => handleAction()}> | ||
Retry | ||
</TopbarButton> | ||
); | ||
if (!enableBuildParameters) { | ||
return mainAction; | ||
} | ||
return ( | ||
<ButtonGroup | ||
variant="outlined" | ||
css={{ | ||
// Workaround to make the border transitions smoothly on button groups | ||
"& > button:hover + button": { | ||
borderLeft: "1px solid #FFF", | ||
}, | ||
}} | ||
> | ||
{mainAction} | ||
<BuildParametersPopover | ||
label="Retry with build parameters" | ||
workspace={workspace} | ||
onSubmit={handleAction} | ||
/> | ||
</ButtonGroup> | ||
); | ||
}; |
7 changes: 7 additions & 0 deletionssite/src/pages/WorkspacePage/WorkspaceActions/WorkspaceActions.stories.tsx
This file contains hidden or 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
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.