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

Tree refactoring, plugin api changes #457

Merged
merged 16 commits into from
Jul 9, 2017
Merged

Tree refactoring, plugin api changes #457

merged 16 commits into from
Jul 9, 2017

Conversation

baev
Copy link
Member

@baev baev commented Jul 4, 2017

  • Sign CLA
  • Add unit tests

@baev baev added the review label Jul 4, 2017
@@ -71,7 +71,8 @@ class WidgetsGridView extends View {

this.addRegion(name, {el: el.find('.widget__body')});
/// fetchAndShow(this, name, this.model, new Widget({model: this.model}))
this.getRegion(name).show(new Widget({model: this.model}));
const model = this.model;
this.getRegion(name).show(new Widget({model, name}));
Copy link
Contributor

Choose a reason for hiding this comment

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

would be better to prepare the correct model here

new Widget({model: this.model.getWidgetData(name)})

instead of doing this inside the Widget constructor

Copy link
Member Author

Choose a reason for hiding this comment

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

the problem is that graphs are widgets as well

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

I mean that graphs tab uses WidgetsGridView but model is different (plain list of results)

statistic[value] = 0;
});
items.forEach(item => {
if (item.children) {
Copy link
Contributor

Choose a reason for hiding this comment

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

you can also add a check for item.statistic and don't do it on every forEach loop

return time;
}

static updateTime(timeA, timeB, field, operation) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not Java you don't need to use static methods, you can just create a standalone function within this module

} else if ('status' in a && 'status' in b) {
return nodeCmp(a, b);
function compare(a, b, nodeCmp, groupCmp, direction) {
if (a.hasOwnProperty('children') && !b.hasOwnProperty('children')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you do this instead of just if (a.children && !b.children) {?

@just-boris
Copy link
Contributor

Also tested manually, key navigation was not broken 👍

@sseliverstov sseliverstov self-requested a review July 9, 2017 12:42
@baev baev merged commit 6367795 into master Jul 9, 2017
@baev baev deleted the tree-refactoring branch July 9, 2017 12:47
@baev baev removed the review label Jul 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants