-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: variable, input and output support for custom dashboards #5301
Conversation
runtime/server/components.go
Outdated
"github.com/rilldata/rill/runtime/drivers" | ||
"github.com/rilldata/rill/runtime/pkg/httputil" | ||
"github.com/rilldata/rill/runtime/pkg/observability" | ||
"github.com/rilldata/rill/runtime/server/auth" | ||
"go.opentelemetry.io/otel/attribute" | ||
) | ||
|
||
func (s *Server) componentDataHandler(w http.ResponseWriter, req *http.Request) error { | ||
func (s *Server) parseTemplate(w http.ResponseWriter, req *http.Request) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the response here is structured and pretty small, it would probably be better to define an RPC with protocol buffers for it
runtime/server/components.go
Outdated
if err != nil { | ||
return nil | ||
} | ||
fmt.Println(name, args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these fmt.Println
s leftover from debugging?
runtime/server/components.go
Outdated
res, err := ctrl.Get(ctx, &runtimev1.ResourceName{Kind: runtime.ResourceKindComponent, Name: name}, false) | ||
if err != nil { | ||
return nil | ||
} | ||
|
||
blob, _, err := s.runtime.GetFile(ctx, instanceID, res.Meta.GetFilePaths()[0]) | ||
if err != nil { | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not safe to rely on file loading from APIs that are used for dashboard serving because the files may be unavailable (for example, if the Github clone takes a long time or Github is unavailable). Viewer roles also are not allowed to have any way of loading files for security reasons.
So it should only use fields in res
(which are available for querying as soon as the server is up).
Here's a PR that adds an RPC that addresses the above issues with the |
#5231
Remaining Items
show
to string and link with variables storeSpec for select component
Sample Spec for Bar template with variable
Sample dashboard spec