Skip to content

Commit

Permalink
UI: Allow to set default discovery timeout via configuration (#211)
Browse files Browse the repository at this point in the history
* allow to set default discovery timeout via configuration
---------

Co-authored-by: Patrik Matiaško <patrik.matiasko@gmail.com>
  • Loading branch information
jkralik and PatrikMatiasko committed Feb 8, 2024
1 parent 2386cbb commit 8cd9d6d
Show file tree
Hide file tree
Showing 29 changed files with 1,292 additions and 177 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/staticAnalysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "^1.20" # The Go version to download (if necessary) and use.
go-version: "1.21" # The Go version to download (if necessary) and use.
check-latest: true
- run: go version

Expand Down
1 change: 1 addition & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ apis:
allowCredentials: false
ui:
enabled: false
defaultDiscoveryTimeout: 2s
directory: ""
grpc:
enabled: true
Expand Down
4 changes: 2 additions & 2 deletions pb/clear_cache.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pb/create_resource.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pb/delete_resource.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pb/disown_device.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion pb/get_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,24 @@ func (c *BuildInfo) Clone() *BuildInfo {
}
}

func NewGetConfigurationResponse(info *BuildInfo) *GetConfigurationResponse {
func NewGetConfigurationResponse(info *BuildInfo, ui *UIConfiguration) *GetConfigurationResponse {
return &GetConfigurationResponse{
BuildInfo: info,
Version: info.GetVersion(),
BuildDate: info.GetBuildDate(),
CommitHash: info.GetCommitHash(),
CommitDate: info.GetCommitDate(),
ReleaseUrl: info.GetReleaseUrl(),
Ui: ui,
}
}

func (r *UIConfiguration) Clone() *UIConfiguration {
if r == nil {
return nil
}
return &UIConfiguration{
DefaultDiscoveryTimeout: r.GetDefaultDiscoveryTimeout(),
}
}

Expand All @@ -94,6 +104,7 @@ func (r *GetConfigurationResponse) Clone() *GetConfigurationResponse {
ReleaseUrl: r.GetBuildInfo().GetReleaseUrl(),
RemoteProvisioning: r.RemoteProvisioning.Clone(),
BuildInfo: r.GetBuildInfo().Clone(),
Ui: r.GetUi().Clone(),
}
}

Expand Down
196 changes: 137 additions & 59 deletions pb/get_configuration.pb.go

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions pb/get_configuration.proto
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ message BuildInfo {
string release_url = 5;
}

// UI configuration
message UIConfiguration {
// similar to https://github.com/plgd-dev/hub/blob/4c4861a4bc483ba4080a1d448063da392eff4026/grpc-gateway/pb/hubConfiguration.proto#L61

int64 default_discovery_timeout = 100; // default discovery timeout in nanoseconds
}

message GetConfigurationResponse {
enum DeviceAuthenticationMode {
PRE_SHARED_KEY = 0;
Expand All @@ -91,4 +98,5 @@ message GetConfigurationResponse {
RemoteProvisioning remote_provisioning = 8;
string owner = 9;
BuildInfo build_info = 10;
UIConfiguration ui = 11;
}
4 changes: 2 additions & 2 deletions pb/get_device.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pb/get_device_resource_links.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pb/get_devices.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pb/get_identity_certificate.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pb/get_json_web_keys.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pb/get_resource.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pb/initialize.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pb/offboard_device.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pb/onboard_device.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pb/own_device.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pb/reset.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8cd9d6d

Please sign in to comment.