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

Remove (almost) server side data rendering from repo-search component #2317

Merged
merged 2 commits into from
Aug 22, 2017

Conversation

Morlinest
Copy link
Member

Server will be needed only for rendering localization strings.

@lunny lunny added type/refactoring Existing code has been cleaned up. There should be no new functionality. topic/ui Change the appearance of the Gitea UI labels Aug 17, 2017
@lunny lunny added this to the 1.2.0 milestone Aug 17, 2017
@@ -1675,6 +1675,26 @@ function initVueComponents(){
type: Number,
required: true
},
orgs: {
Copy link
Member

@lunny lunny Aug 17, 2017

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?

Copy link
Member Author

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}}'},
Copy link
Member

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

Copy link
Member Author

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).

Copy link
Member

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}}"
Copy link
Member

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?

Copy link
Member Author

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).

Copy link
Member

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

Copy link
Member Author

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"
Copy link
Member

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

Copy link
Member Author

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="[
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

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

@Morlinest
Copy link
Member Author

@lunny @lafriks One question, should I rebase with requested changes or do new commit?

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 17, 2017
@lafriks
Copy link
Member

lafriks commented Aug 17, 2017

you can do both ways as changes will be squashed later anyway to single commit when merging PR

@lafriks
Copy link
Member

lafriks commented Aug 17, 2017

Please resolve conflicts after #2318

@Morlinest Morlinest force-pushed the improve-repo-search-component branch from 65bfcb6 to bbfef37 Compare August 17, 2017 17:36
@Morlinest
Copy link
Member Author

@lafriks Rebased

@lafriks
Copy link
Member

lafriks commented Aug 17, 2017

@Morlinest force push again to force drone build again

@strk
Copy link
Member

strk commented Aug 18, 2017

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: Find a repository \.\.\. (with those backslashes)

@strk
Copy link
Member

strk commented Aug 18, 2017

Oh, and the plus icon on the top-right corner of that Find a repository block goes to a broken url repo/create> (with the ending closing angle bracket)

@Morlinest Morlinest force-pushed the improve-repo-search-component branch from 14577d6 to edc39c9 Compare August 19, 2017 15:49
@Morlinest
Copy link
Member Author

Rebased on master (which includes fix for #2331).

@Morlinest Morlinest force-pushed the improve-repo-search-component branch from edc39c9 to ba5b81a Compare August 20, 2017 20:30
@lunny
Copy link
Member

lunny commented Aug 22, 2017

LGTM

@tboerger tboerger added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Aug 22, 2017
@lafriks
Copy link
Member

lafriks commented Aug 22, 2017

LGTM

@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Aug 22, 2017
@lunny lunny merged commit 7455604 into go-gitea:master Aug 22, 2017
@Morlinest Morlinest deleted the improve-repo-search-component branch August 22, 2017 14:35
@lunny lunny mentioned this pull request Aug 23, 2017
7 tasks
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/ui Change the appearance of the Gitea UI type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants