-
Notifications
You must be signed in to change notification settings - Fork 903
feat: implement deprecated flag for templates to prevent new workspaces #10745
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
Changes from 3 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c2b05f0
feat: implement deprecated flag for templates to prevent new workspaces
Emyrk 628b97a
Fix which user is used in unit tests
Emyrk 0935732
Update golden files
Emyrk 33f54f8
Add deprecated filter to template fetching
Emyrk f5dc43f
Add deprecated to template table
Emyrk 4cfa940
Add deprecated notice to template page
Emyrk 873300f
Add ui to deprecate a template
Emyrk 576837c
add story for not entitles
Emyrk a9922dc
Fix stories
Emyrk 7b647da
remove extra hook
Emyrk 143062a
workspace alert to warning on deprecated
Emyrk 00cc2b8
add params to getTemplates on FE
Emyrk cdf2945
add unit tests for agpl unsetting deprecated
Emyrk 8db1dd6
Add more enterprise test vectors
Emyrk 0b1c720
formatting
Emyrk af8226d
Merge remote-tracking branch 'origin/main' into stevenmasley/deprecat…
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
coderd/database/migrations/000169_deprecate_template.down.sql
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,24 @@ | ||
BEGIN; | ||
|
||
DROP VIEW template_with_users; | ||
|
||
ALTER TABLE templates | ||
DROP COLUMN deprecated; | ||
|
||
CREATE VIEW | ||
template_with_users | ||
AS | ||
SELECT | ||
templates.*, | ||
coalesce(visible_users.avatar_url, '') AS created_by_avatar_url, | ||
coalesce(visible_users.username, '') AS created_by_username | ||
FROM | ||
templates | ||
LEFT JOIN | ||
visible_users | ||
ON | ||
templates.created_by = visible_users.id; | ||
|
||
COMMENT ON VIEW template_with_users IS 'Joins in the username + avatar url of the created by user.'; | ||
|
||
COMMIT; |
28 changes: 28 additions & 0 deletions
28
coderd/database/migrations/000169_deprecate_template.up.sql
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,28 @@ | ||
BEGIN; | ||
|
||
-- The view will be rebuilt with the new column | ||
DROP VIEW template_with_users; | ||
|
||
ALTER TABLE templates | ||
ADD COLUMN deprecated TEXT NOT NULL DEFAULT ''; | ||
|
||
COMMENT ON COLUMN templates.deprecated IS 'If set to a non empty string, the template will no longer be able to be used. The message will be displayed to the user.'; | ||
|
||
-- Restore the old version of the template_with_users view. | ||
CREATE VIEW | ||
template_with_users | ||
AS | ||
SELECT | ||
templates.*, | ||
coalesce(visible_users.avatar_url, '') AS created_by_avatar_url, | ||
coalesce(visible_users.username, '') AS created_by_username | ||
FROM | ||
templates | ||
LEFT JOIN | ||
visible_users | ||
ON | ||
templates.created_by = visible_users.id; | ||
|
||
COMMENT ON VIEW template_with_users IS 'Joins in the username + avatar url of the created by user.'; | ||
|
||
COMMIT; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Emyrk marked this conversation as resolved.
Show resolved
Hide resolved
|
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.
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.