mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-10-30 13:38:31 +00:00
Add dialog to insert user fields for board that require them to upload (#550)
* Rebuild gRPC protocol interfaces * Implement methods to get user fields for board/port combination * Implement dialog to input board user fields * Add configure and upload step when uploading to board requiring user fields * Disable Sketch > Configure and Upload menu if board doesn't support user fields * Fix serial upload not working with all boards * Update i18n source file * fix user fields UI * regenerate cli protocol * fix localisation * check if user fields are empty Co-authored-by: Alberto Iannaccone <a.iannaccone@arduino.cc>
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
NotificationServiceServer,
|
||||
AvailablePorts,
|
||||
BoardWithPackage,
|
||||
BoardUserField,
|
||||
} from '../common/protocol';
|
||||
import {
|
||||
PlatformInstallRequest,
|
||||
@@ -36,6 +37,8 @@ import {
|
||||
import {
|
||||
ListProgrammersAvailableForUploadRequest,
|
||||
ListProgrammersAvailableForUploadResponse,
|
||||
SupportedUserFieldsRequest,
|
||||
SupportedUserFieldsResponse,
|
||||
} from './cli-protocol/cc/arduino/cli/commands/v1/upload_pb';
|
||||
import { InstallWithProgress } from './grpc-installable';
|
||||
|
||||
@@ -244,6 +247,35 @@ export class BoardsServiceImpl
|
||||
return boards;
|
||||
}
|
||||
|
||||
async getBoardUserFields(options: { fqbn: string, protocol: string }): Promise<BoardUserField[]> {
|
||||
await this.coreClientProvider.initialized;
|
||||
const coreClient = await this.coreClient();
|
||||
const { client, instance } = coreClient;
|
||||
|
||||
const supportedUserFieldsReq = new SupportedUserFieldsRequest();
|
||||
supportedUserFieldsReq.setInstance(instance);
|
||||
supportedUserFieldsReq.setFqbn(options.fqbn);
|
||||
supportedUserFieldsReq.setProtocol(options.protocol);
|
||||
|
||||
const supportedUserFieldsResp = await new Promise<SupportedUserFieldsResponse>(
|
||||
(resolve, reject) => {
|
||||
client.supportedUserFields(supportedUserFieldsReq, (err, resp) => {
|
||||
(!!err ? reject : resolve)(!!err ? err : resp)
|
||||
})
|
||||
}
|
||||
);
|
||||
return supportedUserFieldsResp.getUserFieldsList().map(e => {
|
||||
return {
|
||||
toolId: e.getToolId(),
|
||||
name: e.getName(),
|
||||
label: e.getLabel(),
|
||||
secret: e.getSecret(),
|
||||
value: "",
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async search(options: { query?: string }): Promise<BoardsPackage[]> {
|
||||
await this.coreClientProvider.initialized;
|
||||
const coreClient = await this.coreClient();
|
||||
|
||||
Reference in New Issue
Block a user