-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Remove (almost) server side data rendering from repo-search component #2317
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
Remove (almost) server side data rendering from repo-search component #2317
Conversation
public/js/index.js
Outdated
@@ -1675,6 +1675,26 @@ function initVueComponents(){ | |||
type: Number, | |||
required: true | |||
}, | |||
orgs: { |
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.
Where the variables are evaluated?
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.
All variables are "filled by server" in dashboard.tmpl
when creating Vue component and then used inside repo-search.tmpl
.
{{if not .ContextUser.IsOrganization}} | ||
:orgs="[ | ||
{{range .ContextUser.Orgs}} | ||
{name: '{{.Name}}', num_repos: '{{.NumRepos}}'}, |
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 think casing numRepos
should be used instead of num_repos
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 reason for this name is to act like it is loaded from json, where you use (at least in repo api).
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.
ok, than leave it as num_repos
{{end}} | ||
]" | ||
:is-org="false" | ||
:orgs-total="{{.ContextUser.GetOrganizationCount}}" |
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.
is orgs-total
really needed (if yes than it should be named as organization-count
)? shouldn't it be the same as orgs.length?
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.
Yes, it is. It's same as reposTotal
. Now gitea loads everything at once, but if we add pagination (and maybe search) in the future, we don't need to care about (I think repositories can and should be preloaded this way too, instead of making init search).
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.
ok, than anyway it should be called organzation-total-count
. Making shorthand variable names does not help readability to understand code later
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.
Also renamed reposTotal
to reposTotalCount
{name: '{{.Name}}', num_repos: '{{.NumRepos}}'}, | ||
{{end}} | ||
]" | ||
:is-org="false" |
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.
also I think it should be called is-organization
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 can rename it, it's just shorthand.
:uid="uid" | ||
:more-repos-link="'{{.ContextUser.HomeLink}}'" | ||
{{if not .ContextUser.IsOrganization}} | ||
:orgs="[ |
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 think it should be called organizations
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 can rename it, it's just shorthand.
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.
please do for sake of code readability
you can do both ways as changes will be squashed later anyway to single commit when merging PR |
Please resolve conflicts after #2318 |
65bfcb6
to
bbfef37
Compare
@lafriks Rebased |
@Morlinest force push again to force drone build again |
bbfef37
to
14577d6
Compare
I gave this a try to check if it fixed #2331 (it did) and noticed a misrendering of help text in repository search input, which goes: |
Oh, and the |
14577d6
to
edc39c9
Compare
Rebased on master (which includes fix for #2331). |
edc39c9
to
ba5b81a
Compare
LGTM |
LGTM |
Server will be needed only for rendering localization strings.