-
Notifications
You must be signed in to change notification settings - Fork 1k
Add GitLab Statistics #4384
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 GitLab Statistics #4384
Conversation
0647ada
to
c893fdf
Compare
warehouse/packaging/models.py
Outdated
@@ -413,6 +413,18 @@ def github_repo_info_url(self): | |||
user_name, repo_name = segments[:2] | |||
return f"https://github.com/api/repos/{user_name}/{repo_name}" | |||
|
|||
@property | |||
def gitlab_repo_info_url(self): | |||
# import pdb; pdb.set_trace() |
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.
Comment left behind here.
As discussed at the sprints with @am-on, I would like to know if it's possible to use a macro for the links, e.g. moving this code into a macro: <a class="vertical-tabs__tab vertical-tabs__tab--with-icon vertical-tabs__tab--condensed gitlab-repo-info__item"
data-key="html_url" data-attr="href" data-supplement="/network" rel="noopener"
target="_blank">
<i class="fa fa-code-branch" aria-hidden="true"></i>
<strong>Forks: </strong>
<span class="gitlab-repo-info__item" data-key="forks_count"></span>
</a> |
We could also probably make that section more generic, since it's unlikely that a project has both GitHub and gitlab links. Also, we should probably prefer one over the other here so we don't show approximately the same section twice (I'd lean towards preferring GitHub). |
6e3ebc0
to
178c0bc
Compare
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.
LGTM aside from my question about the CSS
As discussed in the sprints, we're going to create a new SCSS component for these links as |
@am-on - what project were you testing this with in development? |
@nlhkabu not sure which is gitlab and which github pymagnitude |
This is nice. 😄 However, Gitlab being free, there are several instances (for instance, my projects are hosted at Framagit). While having warehouse check a list of every single public gitlab instance is a bad idea, I wonder if it would be possible to:
Thanks for your work! |
Added star and fork statistics on detailed project view for projects with an valid GitLab URL. Ref: pypi#4301
GitLab has no view for stars, so it shouldn't be presented as clickable link. We are prefering GitHub over GitLab. Because of that we can generalize class names as only one of them gets rendered.
cc024e4
to
5d9e21c
Compare
Thanks again for this PR @am-on - and sorry for the delay on getting back to it! I've just pushed a PR that separates out the CSS classes from the JS class (the JS hook is now I've also updated the template to be (what I think is) more readable, and adapted the SCSS accordingly. @yeraydiazdiaz would you be able to re-review the JS for this PR? There is an empty |
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.
parsed.netloc == "gitlab.com" or parsed.netloc == "www.gitlab.com" | ||
) and len(segments) >= 2: | ||
user_name, repo_name = segments[:2] | ||
return f"https://gitlab.com/api/v4/projects/{user_name}%2F{repo_name}" |
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 property has a lot of common code with the above. It's not a blocker for the PR, but it'd be nice if we could refactor the common logic into a helper function.
@am-on would you be interested in finishing this up? Also, some of us will be at the PyCon North America sprints again this year, May 6th-9th, in case you would like to join us then! |
@am-on Is this ready to be re-reviewed? |
I believe this is waiting on another HTML and SCSS review on my side (and possible updates). |
Note: |
@am-on would you be interested in continuing work on this? Looks like it was pretty close to merging. |
This is still. a good idea, but due to age, too many conflicts, closing this PR. If there's still interest, please revive. |
Added star and fork statistics on detailed project view for projects with an
valid GitLab URL.
Closes #4301
Ref: #4301