Unverified Commit 13fa409c authored by MatteoPologruto's avatar MatteoPologruto Committed by GitHub

Add `Online Help` link to gRPC interface's `Platform` (#2009)

* Add online help field to rpc platform

* Add online help field to the output of `core search --format json`

* Add tests for the changes
parent de905799
......@@ -56,6 +56,7 @@ func PlatformReleaseToRPC(platformRelease *cores.PlatformRelease) *rpc.Platform
Maintainer: platformRelease.Platform.Package.Maintainer,
Website: platformRelease.Platform.Package.WebsiteURL,
Email: platformRelease.Platform.Package.Email,
Help: &rpc.HelpResources{Online: platformRelease.Platform.Package.Help.Online},
Boards: boards,
Latest: platformRelease.Version.String(),
ManuallyInstalled: platformRelease.Platform.ManuallyInstalled,
......
......@@ -62,6 +62,7 @@ func TestPlatformSearch(t *testing.T) {
Email: "info@retrokits.com",
Boards: []*rpc.Board{{Name: "RK002"}},
Type: []string{"Contributed"},
Help: &rpc.HelpResources{Online: "https://www.retrokits.com/rk002/arduino"},
})
require.Contains(t, res.SearchOutput, &rpc.Platform{
Id: "Retrokits-RK002:arm",
......@@ -73,6 +74,7 @@ func TestPlatformSearch(t *testing.T) {
Email: "info@retrokits.com",
Boards: []*rpc.Board{{Name: "RK002"}},
Type: []string{"Contributed"},
Help: &rpc.HelpResources{Online: "https://www.retrokits.com/rk002/arduino"},
})
res, stat = PlatformSearch(&rpc.PlatformSearchRequest{
......@@ -93,6 +95,7 @@ func TestPlatformSearch(t *testing.T) {
Email: "info@retrokits.com",
Boards: []*rpc.Board{{Name: "RK002"}},
Type: []string{"Contributed"},
Help: &rpc.HelpResources{Online: "https://www.retrokits.com/rk002/arduino"},
})
// Search the Package Maintainer
......@@ -114,6 +117,7 @@ func TestPlatformSearch(t *testing.T) {
Email: "info@retrokits.com",
Boards: []*rpc.Board{{Name: "RK002"}},
Type: []string{"Contributed"},
Help: &rpc.HelpResources{Online: "https://www.retrokits.com/rk002/arduino"},
})
require.Contains(t, res.SearchOutput, &rpc.Platform{
Id: "Retrokits-RK002:arm",
......@@ -125,6 +129,7 @@ func TestPlatformSearch(t *testing.T) {
Email: "info@retrokits.com",
Boards: []*rpc.Board{{Name: "RK002"}},
Type: []string{"Contributed"},
Help: &rpc.HelpResources{Online: "https://www.retrokits.com/rk002/arduino"},
})
// Search using the Package name
......@@ -146,6 +151,7 @@ func TestPlatformSearch(t *testing.T) {
Email: "info@retrokits.com",
Boards: []*rpc.Board{{Name: "RK002"}},
Type: []string{"Contributed"},
Help: &rpc.HelpResources{Online: "https://www.retrokits.com/rk002/arduino"},
})
require.Contains(t, res.SearchOutput, &rpc.Platform{
Id: "Retrokits-RK002:arm",
......@@ -157,6 +163,7 @@ func TestPlatformSearch(t *testing.T) {
Email: "info@retrokits.com",
Boards: []*rpc.Board{{Name: "RK002"}},
Type: []string{"Contributed"},
Help: &rpc.HelpResources{Online: "https://www.retrokits.com/rk002/arduino"},
})
// Search using the Platform name
......@@ -178,6 +185,7 @@ func TestPlatformSearch(t *testing.T) {
Email: "info@retrokits.com",
Boards: []*rpc.Board{{Name: "RK002"}},
Type: []string{"Contributed"},
Help: &rpc.HelpResources{Online: "https://www.retrokits.com/rk002/arduino"},
})
require.Contains(t, res.SearchOutput, &rpc.Platform{
Id: "Retrokits-RK002:arm",
......@@ -189,6 +197,7 @@ func TestPlatformSearch(t *testing.T) {
Email: "info@retrokits.com",
Boards: []*rpc.Board{{Name: "RK002"}},
Type: []string{"Contributed"},
Help: &rpc.HelpResources{Online: "https://www.retrokits.com/rk002/arduino"},
})
// Search using a board name
......@@ -237,6 +246,7 @@ func TestPlatformSearch(t *testing.T) {
{Name: "Arduino Industrial 101"},
{Name: "Linino One"},
},
Help: &rpc.HelpResources{Online: "http://www.arduino.cc/en/Reference/HomePage"},
})
res, stat = PlatformSearch(&rpc.PlatformSearchRequest{
......@@ -284,6 +294,7 @@ func TestPlatformSearch(t *testing.T) {
{Name: "Arduino Industrial 101"},
{Name: "Linino One"},
},
Help: &rpc.HelpResources{Online: "http://www.arduino.cc/en/Reference/HomePage"},
})
}
......
This diff is collapsed.
......@@ -99,6 +99,9 @@ message Platform {
bool deprecated = 10;
// Type of the platform.
repeated string type = 11;
// A URL provided by the author of the platform's package, intended to point
// to their online help service.
HelpResources help = 12;
}
message InstalledPlatformReference {
......@@ -126,3 +129,9 @@ message Profile {
// FQBN specified in the profile.
string fqbn = 2;
}
message HelpResources {
// A URL provided by the author of the platform's package, intended to point
// to their online help service.
string online = 1;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment