Add ability to attach merge request
Note to reviewer
- API calls are very slow, please monitor the network tab to make sure they are still loading (See https://gitlab.com/gitlab-org/gitlab-ce/issues/32042#note_33258115 for more details about API slowness)
- Trello allows you to create views for custom content but for list content, you have to use their API to display them
- Trello's list content API does not have a good debounce setup, so we are not doing search queries on the GitLab API even though that was an option in the beginning
- Project list retrieved from API is sorted based on last updated. Will need to check with @victorwu whether that is desired or not. Our projects are quite active and I have seen different projects jump to the top of the list.
What does this MR do?
- Adds the ability to save your auth token and api url - Closes #22 (closed)
- Automatically add the GitLab logo for attachments that are from gitlab.com - Closes #21 (closed)
- Adds the GitLab card button - Closes #2 (closed)
- Card button has the ability to search for a project and a merge request - Closes #4 (closed), #5 (closed)
- Card button has the ability to attach a merge request to the Trello card - Closes #6 (closed)
- Contains the general UI flow of this trello power up - Closes #1 (closed)
What does not work?
-
Attach Issue
list item button does not work when you click the GitLab card button #20 (closed) -
Authorize with GitLab.com
button does not work at the moment #15 - No error messages/catch blocks at the moment #19 (closed)
- No view for
Edit Power-Up Settings
#14 (closed)
Merge request reports
Activity
@filipa can you review please?
assigned to @filipa
- Resolved by username-removed-408677
- Resolved by Filipa Lacerda
- Resolved by username-removed-408677
- Resolved by username-removed-408677
- Resolved by username-removed-408677
- Resolved by username-removed-408677
@ClemMakesApps a couple of notes:
- what does
t
stands for? Can we make it more obvious? - All the
catch
are missing, can we fix it in this MR? - Do we need to use the window object?
- There are some functions being declared inside the
.then
, why?
How can I test this?
- what does
assigned to @ClemMakesApps
- what does
t
stands for? Can we make it more obvious?
It seems like the convention used in https://developers.trello.com/power-ups/client-library, we might be able to get away by renaming it to
trelloInstance
. Some of the challenges witht
is that eacht
in each callback is a mutated version of the previoust
. I had a few cases where I tried to use the previous version oft
and it would create an ambiguous error when testing on trello.com- All the
catch
are missing, can we fix it in this MR?
Yes, I have listed it as a follow up issue in the MR description
- Do we need to use the window object?
Yes if we don't add any additional libraries. Ideally, I'd like to add webpack to the build process so we can avoid this in a future iteration
- There are some functions being declared inside the
.then
, why?
Could you re-clarify this question? Not sure what you are asking here
- How can I test this?
There are steps on testing in the readme file
- what does
assigned to @filipa
assigned to @mikegreiling
2. When I initially configured the trello powerup, I used
gitlab.com/api/v4/
(omitting thehttps://
part) and this didn't produce any errors until I tried to use the powerup and looked in the dev console to notice 404 responses fromhttps://5f7b388a.ngrok.io/gitlab.com/api/v4/projects?membership=true&private_token=...
- we should validate the URL upon configuration
- we should enforce
https
and produce an error ifhttp
is specified (otherwise your personal access token will be sent in the clear )
Edited by username-removed-6364293. I think for the GitLab icon in the sidebar, we should try to use the same gray color to allow it to match the other icons above it. Right now the black and white is a bit jarring next to the others. I'm not sure how the other integrations handle this though, so maybe it's not a big deal.
Edited by username-removed-636429I think for the GitLab icon in the sidebar, we should try to use the same gray color to allow it to match the other icons above it. Right now the black and white is a bit jarring next to the others. I'm not sure how the other integrations handle this though, so maybe it's not a big deal.
Good catch, let me update that to a gray. I just checked the GitHub integration, and they are using gray
- Resolved by username-removed-408677
- Resolved by username-removed-408677
When I initially configured the trello powerup, I used
gitlab.com/api/v4/
(omitting thehttps://
part) and this didn't produce any errors until I tried to use the powerup and looked in the dev console to notice 404 responses fromhttps://5f7b388a.ngrok.io/gitlab.com/api/v4/projects?membership=true&private_token=...
-
we should validate the URL upon configuration
-
we should enforce
https
and produce an error ifhttp
is specified (otherwise your personal access token will be sent in the clear )
I have #13 (closed) as an issue to track that/implement that feature
-
- public/scripts/mergeRequest.js 0 → 100644
30 .then(function getAllMergeRequests(auth) { 31 return api.getAllMergeRequests(auth, projectId); 32 }); 33 // TODO: Add catch 34 } 35 36 function mapMergeRequest(t, projectNamespace, mr) { 37 var cardTitle = projectNamespace + ': Merge Request ' + mr.iid; 38 return { 39 text: '!' + mr.iid + ' ' + mr.title, 40 callback: attachMergeRequest.bind(this, t, mr.web_url, cardTitle) 41 }; 42 } 43 44 function showProjectMergeRequestCallback(t, projectNamespace, response) { 45 return response.data.map(mapMergeRequest.bind(this, t, projectNamespace)); Can we prevent the same MR from being attached multiple times to the same card? Also, when clicking on a MR to attach it, we should probably close the selector. I got confused the first time and just clicked it a few times, resulting in this:
Based on my code, it should be auto closing.. as seen in https://gitlab.com/gitlab-org/trello-power-up/blob/attach-merge-request/public/scripts/mergeRequest.js#L7-11 which matches up with their sample code in https://glitch.com/edit/#!/trello-power-up?path=public/js/client.js:181:16.
I'll need to reach out to Trello team to figure out whats going on
- public/scripts/project.js 0 → 100644
6 return t.get('organization', 'private', 'auth') 7 .then(api.getAllProjects); 8 // TODO: Add catch 9 } 10 11 function mapProjects(p) { 12 return { 13 text: p.name_with_namespace, 14 callback: function selectProject(t) { 15 return mergeRequest.showProjectMergeRequest(t, p.id, p.name_with_namespace); 16 } 17 }; 18 } 19 20 function showProjectsCallback(response) { 21 return response.data.map(mapProjects); mentioned in issue #21 (closed)
- Resolved by Filipa Lacerda
I commented in https://gitlab.com/gitlab-org/trello-power-up/issues/21#note_33835094 regarding the thumbnail icon we're using with the GitLab logo next to the attachments. I think it may be better to use attachment sections with the gitlab logo in the header.
Ups, sorry @mikegreiling did not see this was assigned to you
! Going to leave eheh- Resolved by username-removed-408677
@filipa it never hurts to have more eyes on it
I commented in https://gitlab.com/gitlab-org/trello-power-up/issues/21#note_33835094 regarding the thumbnail icon we're using with the GitLab logo next to the attachments. I think it may be better to use attachment sections with the gitlab logo in the header.
Yes, I agree. Though I also want to keep the iterations small, so I've left it as a logo for now.
Can we keep #21 (closed) open after this MR then? Or should I put those comments into a separate issue?
Can we keep #21 (closed) open after this MR then? Or should I put those comments into a separate issue?
I created #25 (closed) to track that
- Resolved by username-removed-408677
The attachment when viewed on the trello card doesn't display the MR title anywhere, just the project and the merge request ID.
I created https://gitlab.com/gitlab-org/trello-power-up/issues/26 to track that. I just followed GitHub's convention for the time being
Yes of course @mikegreiling, still needs a few things before it is ready to be submitted to Trello.
A lot of it is hinging on the API improving as well. If API doesn't improve in 9.4, this won't get released until it gets fixed
@mikegreiling did you test this locally?
assigned to @filipa
mentioned in issue #27 (closed)
@filipa yes I did. The bugs I noticed all have either been resolved, were already known/mentioned in the description, or been given their own issues.
Going to merge based in your review @mikegreiling! I don't want to delay this more and I think it is safe to merge. I will test the next iteration locally!
Thanks!
Thanks @filipa and @mikegreiling for being diligent!
changed milestone to %1.0