Skip to content
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

Gird #712

Merged
merged 13 commits into from
Mar 3, 2021
Merged

Gird #712

merged 13 commits into from
Mar 3, 2021

Conversation

adrianmroz-allegro
Copy link
Contributor

@adrianmroz-allegro adrianmroz-allegro commented Mar 2, 2021

No description provided.

Copy link
Member

@mkuthan mkuthan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - small impact on existing visualisations, especially for query assembly which is different for grid.
A few questions/comments raised.

const { dataCube: { attributes, source, options: { customAggregations, customTransforms } } } = essence;
const query = makeQuery(essence, timekeeper);
const { visualization, dataCube: { attributes, source, options: { customAggregations, customTransforms } } } = essence;
const queryFn = visualization.name === "grid" ? gridQuery : standardQuery;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leaking abstraction, visualisation is responsible for "queryfn" so could be move this logic into visualisation itself?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, very leaking. These components are very far apart and don't have a good point to communicate. I knowingly made this change in the name of technical debt :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, just make a note and we will discuss how to define visualisation-make-query abstraction later on

@@ -109,8 +109,12 @@ export class BaseVisualization<S extends BaseVisualizationState> extends React.C
return this.debouncedCallExecutor(essence, timekeeper);
}

protected getQuery(essence: Essence, timekeeper: Timekeeper): Expression {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this function only delegates to another function?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is base/default implementation. Specific Visualisations can override this.

And logic is extracted to function for better maintainability.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clear, w need better abstraction for this in the future, just make a note for further work


setSegmentWidth = (segmentWidth: number) => this.setState({ segmentWidth });

private getIdealColumnWidth(): number {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to test calculation if method is private? I would extract layout math form the component class.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably you're right. As always, these functions mostly connect multiple variables from object state so tests will get messy. But extraction is good first step!

@@ -50,7 +49,6 @@ export const MeasureRow: React.SFC<MeasureRowProps> = props => {
highlight={highlight}
scale={scales[i]}
cellWidth={cellWidth}
lastLevel={datum["__nest"] === splitLength}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is that, regression?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this logic is extracted higher in component tree and better named.

split.changeLimit(100).changeSort(sort)));

if (splits.equals(newSplits)) {
return Resolve.ready(isSelectedVisualization ? 10 : 6);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic numbers, do we have constants for that?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't and honestly I don't know what specific numbers mean. I think we need to heavily rework this mechanism in future.

@adrianmroz adrianmroz mentioned this pull request Mar 3, 2021
…o we can move forward before revamping whole SplitMenu component!
@@ -40,7 +40,9 @@ function applySeries(series: List<ConcreteSeries>, timeShiftEnv: TimeShiftEnv, n
}

function applyLimit({ limit }: Split) {
const limitExpression = new LimitExpression({ value: limit });
// TODO: this calculation is for evaluation purpose. We should add custom split values for Grid and remove this multiplication!
const value = limit * 10;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

Copy link
Member

@mkuthan mkuthan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets show beta and get some feedback!

@adrianmroz-allegro adrianmroz-allegro merged commit fa3dc82 into master Mar 3, 2021
@adrianmroz-allegro adrianmroz-allegro deleted the feature/grid branch March 3, 2021 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants