-
Notifications
You must be signed in to change notification settings - Fork 4
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
Create table from query with multiple columns and introduce tiles #150
Create table from query with multiple columns and introduce tiles #150
Conversation
✅ 29/29 passed, 2 skipped, 7m11s total Running from acceptance #175 |
widget = Widget(name=dataset.name, queries=[named_query], spec=counter_spec) | ||
spec: WidgetSpec | ||
if len(fields) == 1: # Counters are expected to have one field | ||
counter_encodings = CounterFieldEncoding(field_name=fields[0].name, display_name=fields[0].name) |
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.
can you refactor this code to introduce three new classes: CounterTile
, TableTile
, and MarkdownTile
. Those classes should have a widget_spec() -> WidgetSpec
and size() -> tuple[int, int]
methods.
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.
Sure, do you want each of them to receive the fields on initialisation? And the WidgetMetdata
, how should that be merged with the size?
6a5c319
to
bdec5d5
Compare
8c091cd
to
8e8e886
Compare
Probably #154 has preference over this one |
892de1a
to
eb5a33a
Compare
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.
Refactor to remove the Tiler
class
width, height = self._default_size | ||
self.position = dataclasses.replace(position, width=position.width or width, height=position.height or height) | ||
|
||
@property |
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.
Don't use property
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.
@nfx : And the size
on WidgetMetdata? Should that also not be a property? I recall the reasoning was that it is better to avoid in case of inherentence
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.
For consistency I remove the property there as well
999173e
to
ed03aa5
Compare
widget_metadata = WidgetMetadata(query_file, 1, 1, 1) | ||
tile = QueryTile(widget_metadata) | ||
|
||
fields = tile._find_fields() # pylint: disable=protected-access |
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.
@nfx : I prefer to keep this unit test as is, i.e. with protected access, it is logic which lends itself well for such a unit test and it should be tested well
4677acb
into
feat/dashboard-as-code-for-ucx
Resolves #127
Resolves #137
Stacked on top of #154