@@ -23,14 +23,22 @@ const NoUpdates = nls.localize(
23
23
'arduino/checkForUpdates/noUpdates' ,
24
24
'There are no recent updates available.'
25
25
) ;
26
- const UpdateBoards = nls . localize (
27
- 'arduino/checkForUpdates/updatedBoth ' ,
26
+ const PromptUpdateBoards = nls . localize (
27
+ 'arduino/checkForUpdates/promptUpdateBoards ' ,
28
28
'Updates are available for some of your boards.'
29
29
) ;
30
- const UpdateLibraries = nls . localize (
31
- 'arduino/checkForUpdates/updatedBoth ' ,
30
+ const PromptUpdateLibraries = nls . localize (
31
+ 'arduino/checkForUpdates/promptUpdateLibraries ' ,
32
32
'Updates are available for some of your libraries.'
33
33
) ;
34
+ const UpdatingBoards = nls . localize (
35
+ 'arduino/checkForUpdates/updatingBoards' ,
36
+ 'Updating boards...'
37
+ ) ;
38
+ const UpdatingLibraries = nls . localize (
39
+ 'arduino/checkForUpdates/updatingLibraries' ,
40
+ 'Updating libraries...'
41
+ ) ;
34
42
const InstallAll = nls . localize (
35
43
'arduino/checkForUpdates/installAll' ,
36
44
'Install All'
@@ -47,12 +55,12 @@ const Updatable = { type: 'Updatable' } as const;
47
55
export class CheckForUpdates extends Contribution {
48
56
@inject ( WindowServiceExt )
49
57
private readonly windowService : WindowServiceExt ;
50
- @inject ( LibraryService )
51
- private readonly libraryService : LibraryService ;
52
- @inject ( BoardsService )
53
- private readonly boardsService : BoardsService ;
54
58
@inject ( ResponseServiceClient )
55
59
private readonly responseService : ResponseServiceClient ;
60
+ @inject ( BoardsService )
61
+ private readonly boardsService : BoardsService ;
62
+ @inject ( LibraryService )
63
+ private readonly libraryService : LibraryService ;
56
64
@inject ( BoardsListWidgetFrontendContribution )
57
65
private readonly boardsContribution : BoardsListWidgetFrontendContribution ;
58
66
@inject ( LibraryListWidgetFrontendContribution )
@@ -87,23 +95,25 @@ export class CheckForUpdates extends Contribution {
87
95
}
88
96
}
89
97
90
- private promptUpdateLibraries ( items : LibraryPackage [ ] ) : void {
98
+ private promptUpdateBoards ( items : BoardsPackage [ ] ) : void {
91
99
this . prompt ( {
92
100
items,
93
- installable : this . libraryService ,
94
- viewContribution : this . librariesContribution ,
95
- viewSearchOptions : { query : '' , topic : 'All' , ...Updatable } ,
96
- message : UpdateLibraries ,
101
+ installable : this . boardsService ,
102
+ viewContribution : this . boardsContribution ,
103
+ viewSearchOptions : { query : '' , ...Updatable } ,
104
+ promptMessage : PromptUpdateBoards ,
105
+ updatingMessage : UpdatingBoards ,
97
106
} ) ;
98
107
}
99
108
100
- private promptUpdateBoards ( items : BoardsPackage [ ] ) : void {
109
+ private promptUpdateLibraries ( items : LibraryPackage [ ] ) : void {
101
110
this . prompt ( {
102
111
items,
103
- installable : this . boardsService ,
104
- viewContribution : this . boardsContribution ,
105
- viewSearchOptions : { query : '' , ...Updatable } ,
106
- message : UpdateBoards ,
112
+ installable : this . libraryService ,
113
+ viewContribution : this . librariesContribution ,
114
+ viewSearchOptions : { query : '' , topic : 'All' , ...Updatable } ,
115
+ promptMessage : PromptUpdateLibraries ,
116
+ updatingMessage : UpdatingLibraries ,
107
117
} ) ;
108
118
}
109
119
@@ -115,10 +125,18 @@ export class CheckForUpdates extends Contribution {
115
125
installable : Installable < T > ;
116
126
viewContribution : AbstractViewContribution < ListWidget < T , S > > ;
117
127
viewSearchOptions : S ;
118
- message : string ;
128
+ promptMessage : string ;
129
+ updatingMessage : string ;
119
130
} ) : void {
120
- const { items, installable, viewContribution, message, viewSearchOptions } =
121
- options ;
131
+ const {
132
+ items,
133
+ installable,
134
+ viewContribution,
135
+ promptMessage : message ,
136
+ viewSearchOptions,
137
+ updatingMessage,
138
+ } = options ;
139
+
122
140
if ( ! items . length ) {
123
141
return ;
124
142
}
@@ -129,7 +147,7 @@ export class CheckForUpdates extends Contribution {
129
147
const tasks = items . map ( ( item ) =>
130
148
this . createInstallTask ( item , installable )
131
149
) ;
132
- this . executeTasks ( tasks ) ;
150
+ this . executeTasks ( updatingMessage , tasks ) ;
133
151
} else if ( answer === InstallManually ) {
134
152
viewContribution
135
153
. openView ( { reveal : true } )
@@ -138,19 +156,19 @@ export class CheckForUpdates extends Contribution {
138
156
} ) ;
139
157
}
140
158
141
- private async executeTasks ( tasks : Task < ArduinoComponent > [ ] ) : Promise < void > {
159
+ private async executeTasks (
160
+ message : string ,
161
+ tasks : Task < ArduinoComponent > [ ]
162
+ ) : Promise < void > {
142
163
if ( tasks . length ) {
143
164
return ExecuteWithProgress . withProgress (
144
- nls . localize ( 'arduino/checkForUpdates/updating' , 'Updating' ) ,
165
+ message ,
145
166
this . messageService ,
146
167
async ( progress ) => {
147
168
try {
148
169
const total = tasks . length ;
149
170
let count = 0 ;
150
171
for ( const { run, item } of tasks ) {
151
- // progress.report({
152
- // message: item.name,
153
- // });
154
172
try {
155
173
await run ( ) ; // runs update sequentially. // TODO: is parallel update desired?
156
174
} catch ( err ) {
0 commit comments