Skip to content

Fix DTS resource group default name and auto-refresh after deletion#4971

Merged
nturinski merged 1 commit intomainfrom
fix/dts-resource-group-default-and-delete-refresh
Apr 10, 2026
Merged

Fix DTS resource group default name and auto-refresh after deletion#4971
nturinski merged 1 commit intomainfrom
fix/dts-resource-group-default-and-delete-refresh

Conversation

@nturinski
Copy link
Copy Markdown
Member

Summary

Fixes two Durable Task Scheduler UX issues:

Resource group name not pre-populated (#4967)

When creating a DTS and selecting "+ Create new resource group", the resource group name input was empty. This sets relatedNameTask on the wizard context after the scheduler name is entered, so ResourceGroupListStep can use it to pre-populate the default resource group name.

Deleted items remain visible until manual refresh (#4968)

After deleting a DTS scheduler or task hub, the item remained visible in the Azure Resources view (marked as "(Deleted)") until the user manually clicked Refresh. This adds azureResourceGroups.refresh command execution after deletion completes, triggering the Azure Resources extension to re-enumerate resources and remove the deleted item automatically.

Changes

  • src/commands/durableTaskScheduler/createScheduler.ts: Set wizardContext.relatedNameTask in SchedulerNamingStep.prompt() so ResourceGroupListStep pre-populates the default name
  • src/commands/durableTaskScheduler/deleteScheduler.ts: Call commands.executeCommand('azureResourceGroups.refresh') after deletion to auto-remove the scheduler from the tree
  • src/commands/durableTaskScheduler/deleteTaskHub.ts: Call commands.executeCommand('azureResourceGroups.refresh') after deletion to auto-remove the task hub from the tree

Fixes #4967, #4968

- Set relatedNameTask in SchedulerNamingStep so ResourceGroupListStep
  pre-populates the default resource group name (#4967)
- Add azureResourceGroups.refresh command after scheduler deletion to
  auto-remove deleted items from tree view (#4968)
- Add azureResourceGroups.refresh command after task hub deletion to
  auto-remove deleted items from tree view (#4968)
@nturinski nturinski requested a review from a team as a code owner April 9, 2026 21:35
Copilot AI review requested due to automatic review settings April 9, 2026 21:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Addresses two Durable Task Scheduler UX issues in the VS Code extension: (1) ensuring a sensible default resource group name is available when creating a scheduler, and (2) automatically refreshing Azure Resources view after deletions so deleted DTS items disappear without manual refresh.

Changes:

  • Set wizardContext.relatedNameTask from the scheduler name during scheduler creation to support default RG name pre-population.
  • Trigger azureResourceGroups.refresh after deleting a scheduler.
  • Trigger azureResourceGroups.refresh after deleting a task hub.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/commands/durableTaskScheduler/createScheduler.ts Sets relatedNameTask based on scheduler name to help pre-populate RG name.
src/commands/durableTaskScheduler/deleteScheduler.ts Refreshes Azure Resources view after scheduler deletion completes.
src/commands/durableTaskScheduler/deleteTaskHub.ts Refreshes Azure Resources view after task hub deletion completes.

}
finally {
dataBranchProvider.refresh();
await commands.executeCommand('azureResourceGroups.refresh');
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

commands.executeCommand('azureResourceGroups.refresh') is awaited inside a finally block without error handling. If that command fails/rejects, it can mask the original delete error (or surface an error after a successful deletion). Consider wrapping the refresh call in its own try/catch (or void ...catch(...)) so the delete flow's outcome isn't overridden by a refresh failure.

Suggested change
await commands.executeCommand('azureResourceGroups.refresh');
try {
await commands.executeCommand('azureResourceGroups.refresh');
} catch {
// Ignore refresh failures so they do not override the delete result.
}

Copilot uses AI. Check for mistakes.
}
finally {
taskHub.scheduler.refresh();
await commands.executeCommand('azureResourceGroups.refresh');
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

commands.executeCommand('azureResourceGroups.refresh') is awaited in a finally block with no error handling. A rejected refresh command can cause this command to throw even after the task hub deletion succeeds (and can also hide the real deletion error if the delete failed). Wrap the refresh call in try/catch or explicitly ignore failures so refresh problems don't override the primary operation.

Suggested change
await commands.executeCommand('azureResourceGroups.refresh');
try {
await commands.executeCommand('azureResourceGroups.refresh');
} catch {
// Ignore refresh failures so they don't override the delete result.
}

Copilot uses AI. Check for mistakes.
Comment on lines 27 to 32
async prompt(wizardContext: ICreateSchedulerContext): Promise<void> {
wizardContext.schedulerName = await wizardContext.ui.showInputBox({
prompt: localize('schedulerNamingStepPrompt', 'Enter a name for the new scheduler')
});
wizardContext.relatedNameTask = Promise.resolve(wizardContext.schedulerName);
}
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

relatedNameTask is only set when this step prompts. If schedulerName is provided ahead of time (e.g., via automation/agent inputs) and shouldPrompt returns false, the wizard context may still have an undefined relatedNameTask, so the resource group default name can remain empty. Consider also setting relatedNameTask in configureBeforePrompt (or when schedulerName is already present) to cover non-interactive paths.

Copilot uses AI. Check for mistakes.
@nturinski nturinski merged commit f57ebd2 into main Apr 10, 2026
6 checks passed
@nturinski nturinski deleted the fix/dts-resource-group-default-and-delete-refresh branch April 10, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default resource group name is not pre-populated when creating a Durable Task Scheduler in VS Code

3 participants