-
Notifications
You must be signed in to change notification settings - Fork 18
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
Conversation
return this.registeredSources[type].then(source => source.registerQuery(query, callback)); | ||
return this.registeredSources[type].then(source => { | ||
source.registerQuery(query, callback); | ||
return source; |
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.
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.
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.
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.
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.
This seems fine to me, but I think Shane should give it a look over. I can't comment on the note about promises.
Can you bring this up-to-date so it's easier to review what's new? |
Done. |
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.
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]; |
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.
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.
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.
Okay, will change back. I was avoiding query.query
.
@@ -19,7 +19,7 @@ | |||
align-content: flex-start; | |||
} | |||
|
|||
.component { | |||
.breakdown { |
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.
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; }, |
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.
why this change? Also you don't need a function to initialize objects to null, just use value: null.
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.
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: { |
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.
why did you reorder this?
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.
No idea TBH. :/
attached: function() { | ||
registerSource('cz-config', 'users', function(users) { | ||
registerSource('cz-config', 'users', users => { |
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.
(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); |
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.
this.updateSLO = updateSLO. Also I think it's fine to put it all on one line now.
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.
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}) { |
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.
(nit) splitting this out does not improve readability, but does destroy locality of effect
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.
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); |
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.
again: why?
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.
The reasoning here was to make the names team
, others
and unowned
consistent between these local variables and the members of this.component
.
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). |
BTW you should be able to merge this yourself now but let me know if that doesn't work. |
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 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.