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

Bug 1060322 - Move hardcoded Bugzilla & slave health URLs in the UI to thUrl #598

Closed
wants to merge 1 commit into from

Conversation

mandaltapesh
Copy link
Contributor

Bug 1060322 - Move hardcoded treeherder-ui URLs to a config file

Respected all,
I have moved only those URLs which have been repeated more than once in a angularJS app..There are a lot of changes( 8 i think) besides two file inclusions.I have tried my best to keep the basic code structure and philosophy intact.However i am a beginner so there can be mistakes..I have tested it locally(but partially) so i suggest the reviewer to kindly check it once.
In case of any suggestions/changes feel free to contact me at tapesh.mandal@gmail.com.My IRC nick tapesh and i hang out in #treeherder channel in irc.mozilla.org.

Regards
Tapesh Mandal

Review on Reviewable

@edmorley
Copy link
Contributor

edmorley commented Jun 2, 2015

hi :-) so we don't need to create a new angular app for this - we want to add to the files used by the existing apps. eg the best way I think is likely to add to services/main.js, two new factories - one for bugzilla and one for slave health (though @camd / @wlach feel free to suggest something better - I'm still not 100% sure of the difference between some of the angular terminology and/or the UI directory layout). Each of these factories would have a function to return the URL - eg getBugURL(), which in the markup would have the bug id passed in as a parameter.

If it helps, take a look at the treestatus file for reference:
https://github.com/mozilla/treeherder/blob/master/ui/js/services/treestatus.js
...except instead of a tree name being returned, we'd return a URL.

@mandaltapesh
Copy link
Contributor Author

Respected Sir,
Was inspecting services/main.js . is there any place where treeherder factory format is defined?

Regards,
Tapesh Mandal

@edmorley
Copy link
Contributor

Was inspecting services/main.js . is there any place where treeherder factory format is defined?

I gave a link to an example in the comment above.

@@ -0,0 +1,4 @@


var app = angular.module("tree_url_app", []);
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 the part that Ed was saying is not needed. We don't need to create a new app, we should add to the existing treeherderApp.

I suggest adding your functions to this factory: https://github.com/mozilla/treeherder/blob/master/ui/js/services/main.js#L13-24

Then you can reference that factory in any of the controllers that need to use it.

@edmorley
Copy link
Contributor

Newer versions of the code here were pushed to different branches and new PRs opened.
I've closed those in favour of this older PR, since there are already review comments here, so it's helpful to keep everything in one place. Generally we try to avoid multiple PRs for the same fix, and instead rebase+force push to the branch, which updates the PR. For more info, see:
https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request

Once you've pushed the latest version to this PR, and there are no accidentally added files / the tests pass, request review from one of us in the bug - I'm on holiday until Monday, so if you want a review before then, one of the others may be a better choice :-)

Good luck!

@mandaltapesh
Copy link
Contributor Author

Hi Ed,

i hope you had a nice vacation. i followed the link in the above comment..was still unable to update the PR.. but i did manage to squash the commits as mentioned in the text.Even i am opposed to opening multiple PRs and totally understand that it creates a lot of inconvenience...i am at this juncture after the push ..https://github.com/mozilla/treeherder/compare/master...mandaltapesh:test?expand=1 ..will opening a new PR somehow merge the new one with the existing one ?

Regards
Tapesh Mandal

@edmorley
Copy link
Contributor

edmorley commented Aug 3, 2015

PRs are linked to the branch name - so to update this PR you need to push to the same branch name it was created with - which in this case was treetest.

@mandaltapesh
Copy link
Contributor Author

Hi Ed,
https://github.com/mandaltapesh/treeherder/tree/treetest ..i think i pushed to treetest

@mandaltapesh
Copy link
Contributor Author

ok yeah i can see the "test" written ..sorry my mistake ..

@mandaltapesh
Copy link
Contributor Author

Ed ,

i don't know what happened but it now says all checks have passed does that mean it is updated ?

Regards
Tapesh Mandal

@camd
Copy link
Contributor

camd commented Aug 5, 2015

Hi Tapesh, the code all looks good to me. I'm going to test with it tomorrow, and if all goes well, I'll merge it in for you.

Thanks for doing this work! :)

@@ -21,6 +21,12 @@ treeherder.factory('thUrl', [
},
getLogViewerUrl: function(job_id) {
return "logviewer.html#?job_id=" + job_id + "&repo=" + $rootScope.repoName;
},
getBugIdUrl:function(bug_id) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There needs to be a space after the colon, and before function.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think maybe the function name might be better as getBugUrl rather than getBugIdUrl?

@mandaltapesh
Copy link
Contributor Author

Hi Ed,
i have made the changes ...:)
Regards,
Tapesh Mandal

@@ -202,7 +202,7 @@
<tr>
<th class="small">Machine name</th>
<td class="small">
<a target="_blank" href="https://secure.pub.build.mozilla.org/builddata/reports/slave_health/slave.html?name={{ job.machine_name }}">{{ job.machine_name }}</a>
<a target="_blank" href="{{ getMachineNameUrl(job.machine_name) }}">{{ job.machine_name }}</a>
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be updated to getSlaveHealthUrl

@mandaltapesh
Copy link
Contributor Author

Hi Ed,

      Made the required changes. :)

Regards
Tapesh Mandal

@edmorley
Copy link
Contributor

edmorley commented Aug 7, 2015

Ah there's another slave health url instance that needs changing:

<a target="_blank" href="https://secure.pub.build.mozilla.org/builddata/reports/slave_health/slave.html?name={{ similar_job_selected.machine_name }}">
{{ similar_job_selected.machine_name }}

And one more for the bug url:

var bug_url = '<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=$1" ' +
'data-bugid=$1 ' + 'title=' + bug_title + '>$1</a>';

Could you also update the commit message to something like:
Bug 1060322 - Move hardcoded Bugzilla & slave health URLs in the UI to thUrl
(and remove the leftovers from squashing, from the multi-line commit message)

Apart from that looking great! :-)

@edmorley edmorley changed the title Bug 1060322 - Move hardcoded treeherder-ui URLs to a config file Bug 1060322 - Move hardcoded Bugzilla & slave health URLs in the UI to thUrl Aug 7, 2015
@mandaltapesh
Copy link
Contributor Author

Hi Ed,
Made the required changes :)
Regards,
Tapesh Mandal

@edmorley
Copy link
Contributor

Great! :-)

I've rebased against latest master, added back the angular one-time binding syntax (the '::'), dropped the filters.js change (since it required a bit more than just a simple substitution, and it's maybe easier if we save that for another time) and merged to master manually in: 9a2497d

Thank you for the patch!

@edmorley edmorley closed this Aug 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants