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

Add "issue-sources" concept to config and make cz-component-dash use it #76

Merged
merged 11 commits into from
Oct 19, 2016

Conversation

alancutter
Copy link
Collaborator

This patch rewrites cz-component-dash to no longer be dependent on Crbug for getting issue data or generating query URLs.
This is a step towards providing GitHub issue data to the same dash using a common Issue JSON format.

This change builds upon #74.
BUG=#72

+@suzyh as author of cz-component-dash.

return this.registeredSources[type].then(source => source.registerQuery(query, callback));
return this.registeredSources[type].then(source => {
source.registerQuery(query, callback);
return source;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Drawing attention to this change.
Is it weird to return a promise to the source element from registerSource()? I added this to support being able to call queryURL() on the issue source element to get an issue vendor specific URL.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This gets used again in #77 where the dash asks the issue source to give its interpretation of a username from the user config as it differs between Crbug and Github.

Copy link
Collaborator

@suzyh suzyh left a comment

Choose a reason for hiding this comment

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

This seems fine to me, but I think Shane should give it a look over. I can't comment on the note about promises.

@shans
Copy link
Owner

shans commented Oct 19, 2016

Can you bring this up-to-date so it's easier to review what's new?

@alancutter
Copy link
Collaborator Author

Done.

Copy link
Owner

@shans shans left a comment

Choose a reason for hiding this comment

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

In addition to functionality changes, you've made at least 5 fairly unrelated variable name changes. I guess I have 3 comments:

(1) by changing names and reordering files you've made this significantly harder to review. The functionality changes are obscured by all the incidental changes.

(2) the old names were fine. They really didn't need changing. In many cases you've just taken a different aesthetic stance to the old version, and what's to say that either stance is more correct? You're just making work for both you and your reviewer. Why?

(3) If you absolutely must make name changes unrelated to functionality changes, I suggest you do it as a separate CL in the future, explicitly marked as such, and summarize the changes in the patch header to make it easier for your reviewer. But seriously, don't do this unless there's a good reason.

Having said allll that, I think (but I'm not as confident as I would like to be because of aforementioned obscuring) that this is fine to commit once you change 'breakdown' back to 'component'.

@@ -28,17 +29,17 @@ ChromeZBehaviors.AJAXBehavior = {
}
},
handleResponse: function(data) {
var query = this.searchQueries[data.model.index];
var searchQuery = this.searchQueries[data.model.index];
Copy link
Owner

Choose a reason for hiding this comment

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

This rename is super marginal:
(1) you almost don't make use of the parameter at all, so you're adding a lot of noise to the review
(2) there's absolutely nothing wrong with the old name
(3) you don't need to do the rename for your code to work

I'd avoid things like this in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, will change back. I was avoiding query.query.

@@ -19,7 +19,7 @@
align-content: flex-start;
}

.component {
.breakdown {
Copy link
Owner

Choose a reason for hiding this comment

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

again with this one. "breakdown" isn't really more generic than "component", and is more confusing. I'd actually like you to change this back before committing.

type: 'Object',
value: function() { return {}; },
value: function() { return null; },
Copy link
Owner

Choose a reason for hiding this comment

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

why this change? Also you don't need a function to initialize objects to null, just use value: null.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't know we could use values directly, cool. I assume the functions are used for non-primitive value types then.

value: function() { return {}; },
value: function() { return null; },
},
issueBreakdown: {
Copy link
Owner

Choose a reason for hiding this comment

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

why did you reorder this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No idea TBH. :/

attached: function() {
registerSource('cz-config', 'users', function(users) {
registerSource('cz-config', 'users', users => {
Copy link
Owner

Choose a reason for hiding this comment

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

(this is an example of an unrelated change that I don't mind seeing in a review. It's well contained, improves readability, and doesn't force me to chase changes all over the file.)

}.bind(this));
registerSource('cz-config', 'updateSLO', function(updateSLO) {
});
registerSource('cz-config', 'updateSLO', updateSLO => {
this.set('updateSLO', updateSLO);
Copy link
Owner

Choose a reason for hiding this comment

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

this.updateSLO = updateSLO. Also I think it's fine to put it all on one line now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought we should use this.set() when the property is used in the template otherwise the template is not guaranteed to react to the change. Is this an incorrect assumption?

var teamsIssueList = new IssueList();
var othersIssueList = new IssueList();
var unownedIssueList = new IssueList();
updateIssueSource: function({tag, query}) {
Copy link
Owner

Choose a reason for hiding this comment

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

(nit) splitting this out does not improve readability, but does destroy locality of effect

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was a remnant of when I was storing a separate issueSource property that made this split necessary. It is no longer necessary and can be inlined again.

for (var issue of issueList) {
if (issue.owner == null) {
unownedIssueList.push(issue);
unowned.push(issue);
Copy link
Owner

Choose a reason for hiding this comment

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

again: why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The reasoning here was to make the names team, others and unowned consistent between these local variables and the members of this.component.

@shans
Copy link
Owner

shans commented Oct 19, 2016

Dude, I don't care what the reasons are :)

Seriously, this is much more about velocity than it is about naming arguments (which are generally bankrupt of logic and full of personal opinion).

@shans
Copy link
Owner

shans commented Oct 19, 2016

BTW you should be able to merge this yourself now but let me know if that doesn't work.

@alancutter
Copy link
Collaborator Author

It's hard not to justify yourself when being asked "why?". (:

Have s/breakdown/component/g'd, will merge. I'm still curious about the this.set() thing though.

@alancutter alancutter merged commit 8ed366d into shans:master Oct 19, 2016
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