@@ -32,6 +32,7 @@ import { PullRequestModel } from './github/pullRequestModel';
3232import { PullRequestOverviewPanel } from './github/pullRequestOverview' ;
3333import { chooseItem } from './github/quickPicks' ;
3434import { RepositoriesManager } from './github/repositoriesManager' ;
35+ import { TasksDashboardManager } from './github/tasksDashboard' ;
3536import { getIssuesUrl , getPullsUrl , isInCodespaces , ISSUE_OR_URL_EXPRESSION , parseIssueExpressionOutput , vscodeDevPrLink } from './github/utils' ;
3637import { OverviewContext } from './github/views' ;
3738import { isNotificationTreeItem , NotificationTreeItem } from './notifications/notificationItem' ;
@@ -212,6 +213,7 @@ export function registerCommands(
212213 telemetry : ITelemetry ,
213214 tree : PullRequestsTreeDataProvider ,
214215 copilotRemoteAgentManager : CopilotRemoteAgentManager ,
216+ tasksDashboard : TasksDashboardManager ,
215217) {
216218 const logId = 'RegisterCommands' ;
217219 context . subscriptions . push (
@@ -1130,92 +1132,8 @@ export function registerCommands(
11301132 ) ) ;
11311133
11321134 context . subscriptions . push (
1133- vscode . commands . registerCommand ( 'pr.openDashboard' , async ( ) => {
1134- /* __GDPR__
1135- "pr.openDashboard" : {}
1136- */
1137- telemetry . sendTelemetryEvent ( 'pr.openDashboard' ) ;
1138-
1139- // Look for existing .github-tasks files in the workspace
1140- const workspaceFolders = vscode . workspace . workspaceFolders ;
1141- if ( workspaceFolders && workspaceFolders . length > 0 ) {
1142- // Search for existing dashboard files
1143- const dashboardFiles = await vscode . workspace . findFiles ( '**/*.github-tasks' , '**/node_modules/**' , 10 ) ;
1144-
1145- if ( dashboardFiles . length > 0 ) {
1146- // If we found existing files, let user choose or open the first one
1147- if ( dashboardFiles . length === 1 ) {
1148- const document = await vscode . workspace . openTextDocument ( dashboardFiles [ 0 ] ) ;
1149- await vscode . window . showTextDocument ( document ) ;
1150- return ;
1151- } else {
1152- // Multiple files found, let user choose
1153- const items = dashboardFiles . map ( uri => ( {
1154- label : vscode . workspace . asRelativePath ( uri ) ,
1155- uri : uri
1156- } ) ) ;
1157-
1158- const selected = await vscode . window . showQuickPick ( items , {
1159- placeHolder : 'Select a dashboard file to open'
1160- } ) ;
1161-
1162- if ( selected ) {
1163- const document = await vscode . workspace . openTextDocument ( selected . uri ) ;
1164- await vscode . window . showTextDocument ( document ) ;
1165- return ;
1166- }
1167- }
1168- }
1169- }
1170-
1171- // No existing files found or user didn't select one, create a new one
1172- // Import here to avoid circular dependencies
1173- const { GitHubTasksEditorProvider } = await import ( './github/githubTasksEditorProvider' ) ;
1174-
1175- const defaultContent = GitHubTasksEditorProvider . createDefaultDocument ( ) ;
1176- const saveUri = await vscode . window . showSaveDialog ( {
1177- defaultUri : vscode . Uri . file ( 'dashboard.github-tasks' ) ,
1178- filters : {
1179- 'GitHub Tasks' : [ 'github-tasks' ] ,
1180- 'All Files' : [ '*' ]
1181- }
1182- } ) ;
1183-
1184- if ( saveUri ) {
1185- const encoder = new TextEncoder ( ) ;
1186- await vscode . workspace . fs . writeFile ( saveUri , encoder . encode ( defaultContent ) ) ;
1187- const savedDocument = await vscode . workspace . openTextDocument ( saveUri ) ;
1188- await vscode . window . showTextDocument ( savedDocument ) ;
1189- }
1190- } )
1191- ) ;
1192-
1193- context . subscriptions . push (
1194- vscode . commands . registerCommand ( 'pr.createDashboard' , async ( ) => {
1195- /* __GDPR__
1196- "pr.createDashboard" : {}
1197- */
1198- telemetry . sendTelemetryEvent ( 'pr.createDashboard' ) ;
1199-
1200- // Import here to avoid circular dependencies
1201- const { GitHubTasksEditorProvider } = await import ( './github/githubTasksEditorProvider' ) ;
1202-
1203- // Create a new dashboard file
1204- const defaultContent = GitHubTasksEditorProvider . createDefaultDocument ( ) ;
1205- const saveUri = await vscode . window . showSaveDialog ( {
1206- defaultUri : vscode . Uri . file ( 'dashboard.github-tasks' ) ,
1207- filters : {
1208- 'GitHub Tasks' : [ 'github-tasks' ] ,
1209- 'All Files' : [ '*' ]
1210- }
1211- } ) ;
1212-
1213- if ( saveUri ) {
1214- const encoder = new TextEncoder ( ) ;
1215- await vscode . workspace . fs . writeFile ( saveUri , encoder . encode ( defaultContent ) ) ;
1216- const savedDocument = await vscode . workspace . openTextDocument ( saveUri ) ;
1217- await vscode . window . showTextDocument ( savedDocument ) ;
1218- }
1135+ vscode . commands . registerCommand ( 'pr.openTasksDashboard' , async ( ) => {
1136+ tasksDashboard . showOrCreateDashboard ( ) ;
12191137 } )
12201138 ) ;
12211139
0 commit comments