mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-11 19:29:28 +00:00
feat: new UX for the boards/library manager widgets
Closes #19 Closes #781 Closes #1591 Closes #1607 Closes #1697 Closes #1707 Closes #1924 Closes #1941 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
@@ -118,6 +118,16 @@ export class ExamplesServiceImpl implements ExamplesService {
|
||||
return { user, current, any };
|
||||
}
|
||||
|
||||
async find(options: { libraryName: string }): Promise<SketchContainer[]> {
|
||||
const { libraryName } = options;
|
||||
const packages = await this.libraryService.list({ libraryName });
|
||||
return Promise.all(
|
||||
packages
|
||||
.filter(({ location }) => location === LibraryLocation.USER)
|
||||
.map((pkg) => this.tryGroupExamples(pkg))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The CLI provides direct FS paths to the examples so that menus and menu groups cannot be built for the UI by traversing the
|
||||
* folder hierarchy. This method tries to workaround it by falling back to the `installDirUri` and manually creating the
|
||||
|
||||
@@ -103,7 +103,6 @@ export class LibraryServiceImpl
|
||||
return toLibrary(
|
||||
{
|
||||
name: item.getName(),
|
||||
installable: true,
|
||||
installedVersion,
|
||||
},
|
||||
item.getLatest()!,
|
||||
@@ -154,8 +153,10 @@ export class LibraryServiceImpl
|
||||
|
||||
async list({
|
||||
fqbn,
|
||||
libraryName,
|
||||
}: {
|
||||
fqbn?: string | undefined;
|
||||
libraryName?: string | undefined;
|
||||
}): Promise<LibraryPackage[]> {
|
||||
const coreClient = await this.coreClient;
|
||||
const { client, instance } = coreClient;
|
||||
@@ -166,6 +167,9 @@ export class LibraryServiceImpl
|
||||
req.setAll(true); // https://github.com/arduino/arduino-ide/pull/303#issuecomment-815556447
|
||||
req.setFqbn(fqbn);
|
||||
}
|
||||
if (libraryName) {
|
||||
req.setName(libraryName);
|
||||
}
|
||||
|
||||
const resp = await new Promise<LibraryListResponse | undefined>(
|
||||
(resolve, reject) => {
|
||||
@@ -219,7 +223,6 @@ export class LibraryServiceImpl
|
||||
{
|
||||
name: library.getName(),
|
||||
installedVersion,
|
||||
installable: true,
|
||||
description: library.getSentence(),
|
||||
summary: library.getParagraph(),
|
||||
moreInfoLink: library.getWebsite(),
|
||||
@@ -455,8 +458,7 @@ function toLibrary(
|
||||
return {
|
||||
name: '',
|
||||
exampleUris: [],
|
||||
installable: false,
|
||||
location: 0,
|
||||
location: LibraryLocation.BUILTIN,
|
||||
...pkg,
|
||||
|
||||
author: lib.getAuthor(),
|
||||
|
||||
Reference in New Issue
Block a user