8000 Layout improvements of the filter for boards and libs manager by francescospissu · Pull Request #1369 · arduino/arduino-ide · GitHub
[go: up one dir, main page]

Skip to content

Layout improvements of the filter for boards and libs manager #1369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updated message when running tasks.
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
  • Loading branch information
Akos Kitta committed Aug 30, 2022
commit b3d1fe89c535ef7450ff209e1115eab77d67d526
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,22 @@ const NoUpdates = nls.localize(
'arduino/checkForUpdates/noUpdates',
'There are no recent updates available.'
);
const UpdateBoards = nls.localize(
'arduino/checkForUpdates/updatedBoth',
const PromptUpdateBoards = nls.localize(
'arduino/checkForUpdates/promptUpdateBoards',
'Updates are available for some of your boards.'
);
const UpdateLibraries = nls.localize(
'arduino/checkForUpdates/updatedBoth',
const PromptUpdateLibraries = nls.localize(
'arduino/checkForUpdates/promptUpdateLibraries',
'Updates are available for some of your libraries.'
);
const UpdatingBoards = nls.localize(
'arduino/checkForUpdates/updatingBoards',
'Updating boards...'
);
const UpdatingLibraries = nls.localize(
'arduino/checkForUpdates/updatingLibraries',
'Updating libraries...'
);
const InstallAll = nls.localize(
'arduino/checkForUpdates/installAll',
'Install All'
Expand All @@ -47,12 +55,12 @@ const Updatable = { type: 'Updatable' } as const;
export class CheckForUpdates extends Contribution {
@inject(WindowServiceExt)
private readonly windowService: WindowServiceExt;
@inject(LibraryService)
private readonly libraryService: LibraryService;
@inject(BoardsService)
private readonly boardsService: BoardsService;
@inject(ResponseServiceClient)
private readonly responseService: ResponseServiceClient;
@inject(BoardsService)
private readonly boardsService: BoardsService;
@inject(LibraryService)
private readonly libraryService: LibraryService;
@inject(BoardsListWidgetFrontendContribution)
private readonly boardsContribution: BoardsListWidgetFrontendContribution;
@inject(LibraryListWidgetFrontendContribution)
Expand Down Expand Up @@ -87,23 +95,25 @@ export class CheckForUpdates extends Contribution {
}
}

private promptUpdateLibraries(items: LibraryPackage[]): void {
private promptUpdateBoards(items: BoardsPackage[]): void {
this.prompt({
items,
installable: this.libraryService,
viewContribution: this.librariesContribution,
viewSearchOptions: { query: '', topic: 'All', ...Updatable },
message: UpdateLibraries,
installable: this.boardsService,
viewContribution: this.boardsContribution,
viewSearchOptions: { query: '', ...Updatable },
promptMessage: PromptUpdateBoards,
updatingMessage: UpdatingBoards,
});
}

private promptUpdateBoards(items: BoardsPackage[]): void {
private promptUpdateLibraries(items: LibraryPackage[]): void {
this.prompt({
items,
installable: this.boardsService,
viewContribution: this.boardsContribution,
viewSearchOptions: { query: '', ...Updatable },
message: UpdateBoards,
installable: this.libraryService,
viewContribution: this.librariesContribution,
viewSearchOptions: { query: '', topic: 'All', ...Updatable },
promptMessage: PromptUpdateLibraries,
updatingMessage: UpdatingLibraries,
});
}

Expand All @@ -115,10 +125,18 @@ export class CheckForUpdates extends Contribution {
installable: Installable<T>;
viewContribution: AbstractViewContribution<ListWidget<T, S>>;
viewSearchOptions: S;
message: string;
promptMessage: string;
updatingMessage: string;
}): void {
const { items, installable, viewContribution, message, viewSearchOptions } =
options;
const {
items,
installable,
viewContribution,
promptMessage: message,
viewSearchOptions,
updatingMessage,
} = options;

if (!items.length) {
return;
}
Expand All @@ -129,7 +147,7 @@ export class CheckForUpdates extends Contribution {
const tasks = items.map((item) =>
this.createInstallTask(item, installable)
);
this.executeTasks(tasks);
this.executeTasks(updatingMessage, tasks);
} else if (answer === InstallManually) {
viewContribution
.openView({ reveal: true })
Expand All @@ -138,19 +156,19 @@ export class CheckForUpdates extends Contribution {
});
}

private async executeTasks(tasks: Task<ArduinoComponent>[]): Promise<void> {
private async executeTasks(
message: string,
tasks: Task<ArduinoComponent>[]
): Promise<void> {
if (tasks.length) {
return ExecuteWithProgress.withProgress(
nls.localize('arduino/checkForUpdates/updating', 'Updating'),
message,
this.messageService,
async (progress) => {
try {
const total = tasks.length;
let count = 0;
for (const { run, item } of tasks) {
// progress.report({
// message: item.name,
// });
try {
await run(); // runs update sequentially. // TODO: is parallel update desired?
} catch (err) {
Expand Down
6 changes: 4 additions & 2 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@
"checkForUpdates": "Check for Arduino Updates",
"installAll": "Install All",
"noUpdates": "There are no recent updates available.",
"updatedBoth": "Updates are available for some of your libraries.",
"updating": "Updating"
"promptUpdateBoards": "Updates are available for some of your boards.",
"promptUpdateLibraries": "Updates are available for some of your libraries.",
"updatingBoards": "Updating boards...",
"updatingLibraries": "Updating libraries..."
},
"cli-error-parser": {
"keyboardError": "'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'?",
Expand Down
0