Improved boards view

This commit is contained in:
Christian Weichel 2019-05-08 08:24:56 +02:00
parent 2f7d26ded9
commit d787de3ed9
6 changed files with 102 additions and 9 deletions

View File

@ -62,21 +62,21 @@ export class BoardsServiceImpl implements BoardsService {
req.setInstance(instance); req.setInstance(instance);
const resp = await new Promise<PlatformSearchResp>((resolve, reject) => client.platformSearch(req, (err, resp) => (!!err ? reject : resolve)(!!err ? err : resp))); const resp = await new Promise<PlatformSearchResp>((resolve, reject) => client.platformSearch(req, (err, resp) => (!!err ? reject : resolve)(!!err ? err : resp)));
let items = resp.getSearchOutputList().map(o => { let items = resp.getSearchOutputList().map(item => {
let installedVersion: string | undefined; let installedVersion: string | undefined;
const matchingPlatform = installedPlatforms.find(ip => ip.getId().startsWith(`${o.getId()}@`)); const matchingPlatform = installedPlatforms.find(ip => ip.getId().startsWith(`${item.getId()}@`));
if (!!matchingPlatform) { if (!!matchingPlatform) {
installedVersion = matchingPlatform.getInstalled(); installedVersion = matchingPlatform.getInstalled();
} }
const result: Board = { const result: Board = {
id: o.getId(), id: item.getId(),
name: o.getName(), name: item.getName(),
author: "Someone", author: item.getAuthor(),
availableVersions: [ o.getVersion() ], availableVersions: [ item.getVersion() ],
description: "lorem ipsum sit dolor amet", description: item.getParagragh(),
installable: true, installable: true,
summary: "has none", summary: item.getSentence(),
installedVersion, installedVersion,
} }
return result; return result;

View File

@ -317,6 +317,15 @@ export class SearchOutput extends jspb.Message {
getName(): string; getName(): string;
setName(value: string): void; setName(value: string): void;
getAuthor(): string;
setAuthor(value: string): void;
getSentence(): string;
setSentence(value: string): void;
getParagragh(): string;
setParagragh(value: string): void;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): SearchOutput.AsObject; toObject(includeInstance?: boolean): SearchOutput.AsObject;
@ -333,6 +342,9 @@ export namespace SearchOutput {
id: string, id: string,
version: string, version: string,
name: string, name: string,
author: string,
sentence: string,
paragragh: string,
} }
} }

View File

@ -2087,7 +2087,10 @@ proto.arduino.SearchOutput.toObject = function(includeInstance, msg) {
var f, obj = { var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, ""), id: jspb.Message.getFieldWithDefault(msg, 1, ""),
version: jspb.Message.getFieldWithDefault(msg, 2, ""), version: jspb.Message.getFieldWithDefault(msg, 2, ""),
name: jspb.Message.getFieldWithDefault(msg, 3, "") name: jspb.Message.getFieldWithDefault(msg, 3, ""),
author: jspb.Message.getFieldWithDefault(msg, 4, ""),
sentence: jspb.Message.getFieldWithDefault(msg, 5, ""),
paragragh: jspb.Message.getFieldWithDefault(msg, 6, "")
}; };
if (includeInstance) { if (includeInstance) {
@ -2136,6 +2139,18 @@ proto.arduino.SearchOutput.deserializeBinaryFromReader = function(msg, reader) {
var value = /** @type {string} */ (reader.readString()); var value = /** @type {string} */ (reader.readString());
msg.setName(value); msg.setName(value);
break; break;
case 4:
var value = /** @type {string} */ (reader.readString());
msg.setAuthor(value);
break;
case 5:
var value = /** @type {string} */ (reader.readString());
msg.setSentence(value);
break;
case 6:
var value = /** @type {string} */ (reader.readString());
msg.setParagragh(value);
break;
default: default:
reader.skipField(); reader.skipField();
break; break;
@ -2186,6 +2201,27 @@ proto.arduino.SearchOutput.serializeBinaryToWriter = function(message, writer) {
f f
); );
} }
f = message.getAuthor();
if (f.length > 0) {
writer.writeString(
4,
f
);
}
f = message.getSentence();
if (f.length > 0) {
writer.writeString(
5,
f
);
}
f = message.getParagragh();
if (f.length > 0) {
writer.writeString(
6,
f
);
}
}; };
@ -2234,6 +2270,51 @@ proto.arduino.SearchOutput.prototype.setName = function(value) {
}; };
/**
* optional string Author = 4;
* @return {string}
*/
proto.arduino.SearchOutput.prototype.getAuthor = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
};
/** @param {string} value */
proto.arduino.SearchOutput.prototype.setAuthor = function(value) {
jspb.Message.setProto3StringField(this, 4, value);
};
/**
* optional string Sentence = 5;
* @return {string}
*/
proto.arduino.SearchOutput.prototype.getSentence = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
};
/** @param {string} value */
proto.arduino.SearchOutput.prototype.setSentence = function(value) {
jspb.Message.setProto3StringField(this, 5, value);
};
/**
* optional string Paragragh = 6;
* @return {string}
*/
proto.arduino.SearchOutput.prototype.getParagragh = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, ""));
};
/** @param {string} value */
proto.arduino.SearchOutput.prototype.setParagragh = function(value) {
jspb.Message.setProto3StringField(this, 6, value);
};
/** /**
* Generated by JsPbCodeGenerator. * Generated by JsPbCodeGenerator.