Skip to content

feat: add warning message when trying to delete active template #10142

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 10 commits into from
Oct 10, 2023

Conversation

Parkreiner
Copy link
Member

@Parkreiner Parkreiner commented Oct 9, 2023

Closes #9348 and builds upon #10111 from last Friday

Changes made

  • Adds functionality when deleting a template that checks if the template is being used by any workspaces. Prevents the user from going through with a deletion until they delete all connected workspaces
  • Renames some of the variables used for the relevant components to be more clear
  • Renames some of the files so that their names aren't so misleading

@Parkreiner Parkreiner changed the title feat:add warning message when trying to delete active template feat: add warning message when trying to delete active template Oct 9, 2023
@Parkreiner Parkreiner marked this pull request as ready for review October 9, 2023 18:52
@Parkreiner Parkreiner requested review from a team and aslilac and removed request for a team October 9, 2023 18:53
return ["workspaces", query] as const;
}

export function workspacesByQuery(query: string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we've just been re-using the API function name for these, so this one would be workspaces

const queryText = `template:${templateName}`;
const workspaceCountQuery = useQuery({
...workspacesByQuery(queryText),
select: (res) => res.count,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL!

Comment on lines +35 to +40
type TemplateMenuProps = {
templateName: string;
templateVersion: string;
templateId: string;
onDelete: () => void;
}> = ({ templateName, templateVersion, onDelete }) => {
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my hero!

@Parkreiner Parkreiner merged commit 5ae6cda into main Oct 10, 2023
@Parkreiner Parkreiner deleted the mes/delete-workspace branch October 10, 2023 12:04
@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Link to existing workspaces when you can't delete a template
2 participants