Conversation
- 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)
There was a problem hiding this comment.
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.relatedNameTaskfrom the scheduler name during scheduler creation to support default RG name pre-population. - Trigger
azureResourceGroups.refreshafter deleting a scheduler. - Trigger
azureResourceGroups.refreshafter 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'); |
There was a problem hiding this comment.
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.
| await commands.executeCommand('azureResourceGroups.refresh'); | |
| try { | |
| await commands.executeCommand('azureResourceGroups.refresh'); | |
| } catch { | |
| // Ignore refresh failures so they do not override the delete result. | |
| } |
| } | ||
| finally { | ||
| taskHub.scheduler.refresh(); | ||
| await commands.executeCommand('azureResourceGroups.refresh'); |
There was a problem hiding this comment.
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.
| await commands.executeCommand('azureResourceGroups.refresh'); | |
| try { | |
| await commands.executeCommand('azureResourceGroups.refresh'); | |
| } catch { | |
| // Ignore refresh failures so they don't override the delete result. | |
| } |
| 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); | ||
| } |
There was a problem hiding this comment.
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.
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
relatedNameTaskon the wizard context after the scheduler name is entered, soResourceGroupListStepcan 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.refreshcommand 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: SetwizardContext.relatedNameTaskinSchedulerNamingStep.prompt()soResourceGroupListSteppre-populates the default namesrc/commands/durableTaskScheduler/deleteScheduler.ts: Callcommands.executeCommand('azureResourceGroups.refresh')after deletion to auto-remove the scheduler from the treesrc/commands/durableTaskScheduler/deleteTaskHub.ts: Callcommands.executeCommand('azureResourceGroups.refresh')after deletion to auto-remove the task hub from the treeFixes #4967, #4968