Skip to content

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

Merged
buenos-nachos merged 10 commits into
mainfrom
mes/delete-workspace
Oct 10, 2023
Merged

buenos-nachos merged 10 commits into
mainfrom
mes/delete-workspace

Conversation

@buenos-nachos

@buenos-nachos buenos-nachos commented Oct 9, 2023 •

Copy link
Copy Markdown
Contributor

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

@buenos-nachos buenos-nachos 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
@buenos-nachos
buenos-nachos marked this pull request as ready for review October 9, 2023 18:52
@buenos-nachos
buenos-nachos requested review from a team and aslilac and removed request for a team October 9, 2023 18:53
Comment thread site/src/api/queries/workspaces.ts Outdated
return ["workspaces", query] as const;
}

export function workspacesByQuery(query: string) {

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

my hero!

@buenos-nachos
buenos-nachos merged commit 5ae6cda into main Oct 10, 2023
@buenos-nachos
buenos-nachos 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