-
Notifications
You must be signed in to change notification settings - Fork 952
feat: make dynamic parameters opt-in by default for new templates #19006
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
Open
jaaydenh
wants to merge
13
commits into
main
Choose a base branch
from
jaaydenh/dynamic-params-default-optin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+290
−35
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
532218e
feat: make dynamic parameters opt-in by default for new templates
jaaydenh 2ec5806
fix: format
jaaydenh b933efe
fix: fix stories
jaaydenh 7144f4f
chore: update warning content
jaaydenh 170c5c6
chore: cleanup
jaaydenh 9bbd2b2
flip golden default value
Emyrk f25a9f8
chore: echo provisioner reponses to include terraform to match
Emyrk b10945c
fixup! chore: echo provisioner reponses to include terraform to match
Emyrk 67dc627
fixup! fixup! chore: echo provisioner reponses to include terraform t…
Emyrk 9eeb11b
fix: use classic parameter flow for MockWorkspace
jaaydenh 7aa393c
sane defaultS
Emyrk 238df67
sane defaultS
Emyrk ee116fb
fixup! sane defaultS
Emyrk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
Empty file.
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
37 changes: 37 additions & 0 deletions
37
...es/ClassicParameterFlowDeprecationWarning/ClassicParameterFlowDeprecationWarning.test.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,37 @@ | ||
import { render, screen } from "@testing-library/react"; | ||
import { ClassicParameterFlowDeprecationWarning } from "./ClassicParameterFlowDeprecationWarning"; | ||
|
||
jest.mock("modules/navigation", () => ({ | ||
useLinks: () => () => "/mock-link", | ||
linkToTemplate: () => "/mock-template-link", | ||
})); | ||
|
||
describe("ClassicParameterFlowDeprecationWarning", () => { | ||
const defaultProps = { | ||
organizationName: "test-org", | ||
templateName: "test-template", | ||
}; | ||
|
||
it("renders warning when enabled and user has template update permissions", () => { | ||
render( | ||
<ClassicParameterFlowDeprecationWarning | ||
{...defaultProps} | ||
isEnabled={true} | ||
/>, | ||
); | ||
|
||
expect(screen.getByText("deprecated")).toBeInTheDocument(); | ||
expect(screen.getByText("Go to Template Settings")).toBeInTheDocument(); | ||
}); | ||
|
||
it("does not render when enabled is false", () => { | ||
const { container } = render( | ||
<ClassicParameterFlowDeprecationWarning | ||
{...defaultProps} | ||
isEnabled={false} | ||
/>, | ||
); | ||
|
||
expect(container.firstChild).toBeNull(); | ||
}); | ||
}); |
46 changes: 46 additions & 0 deletions
46
...kspaces/ClassicParameterFlowDeprecationWarning/ClassicParameterFlowDeprecationWarning.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,46 @@ | ||
import { Alert } from "components/Alert/Alert"; | ||
import { Link } from "components/Link/Link"; | ||
import { linkToTemplate, useLinks } from "modules/navigation"; | ||
import type { FC } from "react"; | ||
import { docs } from "utils/docs"; | ||
|
||
interface ClassicParameterFlowDeprecationWarningProps { | ||
organizationName: string; | ||
templateName: string; | ||
isEnabled: boolean; | ||
} | ||
|
||
export const ClassicParameterFlowDeprecationWarning: FC< | ||
ClassicParameterFlowDeprecationWarningProps | ||
> = ({ organizationName, templateName, isEnabled }) => { | ||
const getLink = useLinks(); | ||
|
||
if (!isEnabled) { | ||
return null; | ||
} | ||
|
||
const templateSettingsLink = `${getLink( | ||
linkToTemplate(organizationName, templateName), | ||
)}/settings`; | ||
|
||
return ( | ||
<Alert severity="warning" className="mb-2"> | ||
<div> | ||
This template is using the classic parameter flow, which will be{" "} | ||
<strong>deprecated</strong> and removed in a future release. Please | ||
migrate to{" "} | ||
<a | ||
href={docs("/admin/templates/extending-templates/dynamic-parameters")} | ||
className="text-content-link" | ||
> | ||
dynamic parameters | ||
</a>{" "} | ||
on template settings for improved functionality. | ||
</div> | ||
|
||
<Link className="text-xs" href={templateSettingsLink}> | ||
Go to Template Settings | ||
</Link> | ||
</Alert> | ||
); | ||
}; |
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
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.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.