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

Template Repositories #8768

Merged
merged 45 commits into from Nov 11, 2019
Merged

Template Repositories #8768

merged 45 commits into from Nov 11, 2019

Conversation

@jolheiser
Copy link
Member

jolheiser commented Oct 31, 2019

This is a first pass at template repositories.

This PR allows repositories to be set as templates and for users to generate a new repository based on a template.
Currently this only generates git files. Further improvements can be done in other PRs.

5
1
Screenshot from 2019-11-07 21-09-24
Screenshot from 2019-11-07 21-09-53
Screenshot from 2019-11-07 21-10-10

jolheiser added 11 commits Oct 29, 2019
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signed-off-by: jolheiser <john.olheiser@gmail.com>
make fmt
Signed-off-by: jolheiser <john.olheiser@gmail.com>
@jolheiser

This comment has been minimized.

Copy link
Member Author

jolheiser commented Oct 31, 2019

This ended up sharing quite a bit of code with the forking process. I tried to combine similar functionality, but let me know if there are more spots you think processes should be combined.

@guillep2k

This comment has been minimized.

Copy link
Member

guillep2k commented Oct 31, 2019

I didn't check the code yet (just popped on me!), but here's some ideas/questions:

  • Is the whole repository replicated or just one branch?
  • Why a repo should show where has it been "templated" from?
  • I think perhaps templates should not appear in general repo listings?
  • Can issue labels be copied as well?
  • What about the wiki?
  • It would be cool in the future if the "generate from" field could be browseable/searchable, so templates could be sought in the same page where they are used.
  • I'd use some kind of color band/icon/identifier for template repos (e.g. in a similar way as private repos have a lock icon).

Very cool feature! 🎉

Signed-off-by: jolheiser <john.olheiser@gmail.com>
@jolheiser

This comment has been minimized.

Copy link
Member Author

jolheiser commented Oct 31, 2019

Is the whole repository replicated or just one branch?

Just one branch, whichever is cloned by default

Why a repo should show where has it been "templated" from?

That can be removed, I just added it because GitHub shows it

I think perhaps templates should not appear in general repo listings?

Templates are still considered a normal repository, so I'm unsure what the advantage would be.

Can issue labels be copied as well?

In a future PR, yes. I would like to get a "minimal" feature through first before adding more complexity, as it makes PRs more difficult to check.

What about the wiki?

Also in a future PR, see above.

It would be cool in the future if the "generate from" field could be browseable/searchable, so templates could be sought in the same page where they are used.

I agree this would be nice, however it might make more sense to add that functionality to a real search page and then generate from there.

I'd use some kind of color band/icon/identifier for template repos (e.g. in a similar way as private repos have a lock icon).

I agree, but I couldn't find a good icon to use. Our octicons don't have the new icons GitHub uses, and FA4 is limited as well.

jolheiser added 2 commits Oct 31, 2019
Signed-off-by: jolheiser <john.olheiser@gmail.com>
make fmt
Signed-off-by: jolheiser <john.olheiser@gmail.com>
@guillep2k

This comment has been minimized.

Copy link
Member

guillep2k commented Oct 31, 2019

FA4 icon ideas:

image
image
image
image
image
image

OK, perhaps not the last one. 😁

@jolheiser

This comment has been minimized.

Copy link
Member Author

jolheiser commented Oct 31, 2019

@guillep2k How about this? I opted for the right side of the repo name rather than replace the public/private icon

5

jolheiser added 2 commits Oct 31, 2019
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signed-off-by: jolheiser <john.olheiser@gmail.com>
@guillep2k

This comment has been minimized.

Copy link
Member

guillep2k commented Oct 31, 2019

@guillep2k How about this? I opted for the right side of the repo name rather than replace the public/private icon

Looks nice. I think it's important that templates have a distinct icon. The right side sounds perfect.

@jaqra you did #8144 : any caveats to consider, here?

@lunny lunny added the kind/feature label Nov 1, 2019
@lunny lunny added this to the 1.11.0 milestone Nov 1, 2019
jolheiser added 2 commits Nov 1, 2019
Signed-off-by: jolheiser <john.olheiser@gmail.com>
@jolheiser jolheiser mentioned this pull request Nov 1, 2019
2 of 4 tasks complete
@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Nov 1, 2019

Codecov Report

Merging #8768 into master will decrease coverage by <.01%.
The diff coverage is 23.34%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8768      +/-   ##
==========================================
- Coverage   41.22%   41.22%   -0.01%     
==========================================
  Files         545      546       +1     
  Lines       70332    70573     +241     
==========================================
+ Hits        28993    29091      +98     
- Misses      37643    37785     +142     
- Partials     3696     3697       +1
Impacted Files Coverage Δ
modules/structs/repo.go 36.36% <ø> (ø) ⬆️
modules/auth/repo_form.go 41.73% <ø> (ø) ⬆️
models/migrations/migrations.go 1.3% <ø> (ø) ⬆️
modules/context/repo.go 55.47% <0%> (-1.08%) ⬇️
services/repository/repository.go 42.1% <0%> (-13.07%) ⬇️
routers/repo/setting.go 13.3% <0%> (-0.02%) ⬇️
models/migrations/v107.go 0% <0%> (ø)
routers/repo/pull.go 29.52% <30.43%> (+0.19%) ⬆️
routers/repo/repo.go 29.16% <48.07%> (+6.79%) ⬆️
routers/api/v1/repo/repo.go 68.71% <64.7%> (-0.09%) ⬇️
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 74bb292...a11f2ed. Read the comment docs.

@guillep2k

This comment has been minimized.

Copy link
Member

guillep2k commented Nov 1, 2019

@guillep2k How about this? I opted for the right side of the repo name rather than replace the public/private icon

Looks nice. I think it's important that templates have a distinct icon. The right side sounds perfect.

One idea: what if the template icon also happens to be clickeable?

Signed-off-by: jolheiser <john.olheiser@gmail.com>
@GiteaBot GiteaBot added lgtm/need 1 and removed lgtm/need 2 labels Nov 8, 2019
@GiteaBot GiteaBot added lgtm/done and removed lgtm/need 1 labels Nov 9, 2019
@lunny

This comment has been minimized.

Copy link
Member

lunny commented Nov 10, 2019

After I set my input focus on the template list, I cannot move my input focus on any other input box. I can't change repository name and description any more. Is that by design or a bug? @jolheiser

@jolheiser

This comment has been minimized.

Copy link
Member Author

jolheiser commented Nov 10, 2019

@lunny
That definitely sounds like a bug...
Would it be related to the drop-down JS?

EDIT: I cannot reproduce locally, I am able to change to other inputs after selecting a template

@lunny

This comment has been minimized.

Copy link
Member

lunny commented Nov 10, 2019

It affects chrome on macOS but not firefox on macOS. And if an empty repository is a template one, create a repository from it will result int 404.

@jolheiser

This comment has been minimized.

Copy link
Member Author

jolheiser commented Nov 10, 2019

I can fix the empty repo issue, but I'm not sure how to proceed on the JS drop-down bug...
That's the same drop-down we use in other places.

@zeripath

This comment has been minimized.

Copy link
Contributor

zeripath commented Nov 10, 2019

@jolheiser does this PR currently contain the drop-down work from @Jookia?

@Jookia is it possible there's a macos Chrome bug been introduced?

It actually could just be a bug with drop-down - iirc Fomantic-ui has done a lot of work on its js on its fork

@Jookia

This comment has been minimized.

Copy link
Contributor

Jookia commented Nov 10, 2019

That could be the Semantic-UI bug unrelated to the dropdown work I encountered. Navigating to some input fields such as a wiki input form or issue input form will grab your focus in Chromium/Chrome.

@jolheiser

This comment has been minimized.

Copy link
Member Author

jolheiser commented Nov 10, 2019

I last merged master in two days ago, so I'm not sure. Once I get to my computer I can check the commit history, perhaps.

I'll update here when I find out. Still not sure where to go from there, though. 😅
Implementing my own drop-down doesn't sound fun.

@jolheiser

This comment has been minimized.

Copy link
Member Author

jolheiser commented Nov 10, 2019

The last commit I merged was before the accessibility PR. Perhaps updating this branch would fix it... somehow? 😅

After I fix the migration conflicts...

@zeripath

This comment has been minimized.

Copy link
Contributor

zeripath commented Nov 10, 2019

I know how you feel about conflicts - I have a seriously complex PR that I just can't face deconflicting. I would be almost better off just starting again from scratch.

@zeripath

This comment has been minimized.

Copy link
Contributor

zeripath commented Nov 10, 2019

Cool re: the drop down issue - I suspect @Jookia may have fixed that one then.

@jolheiser

This comment has been minimized.

Copy link
Member Author

jolheiser commented Nov 10, 2019

Oddly enough, now that I merged in master I am seeing the issue @lunny mentioned.
Once I focus on the dropdown, I cannot focus on any other input...

@zeripath

This comment has been minimized.

Copy link
Contributor

zeripath commented Nov 10, 2019

Damn this is happening on try on the create repository page

Signed-off-by: jolheiser <john.olheiser@gmail.com>
@jolheiser

This comment has been minimized.

Copy link
Member Author

jolheiser commented Nov 10, 2019

@lunny I believe I have fixed the 404 issue you encountered.

Now just to figure out what is happening with the drop-downs. I'm thinking that PR will be needed before/outside of this PR since it is affecting other pieces of the system as well.

@Jookia

This comment has been minimized.

Copy link
Contributor

Jookia commented Nov 11, 2019

I can confirm the dropdown is my bug, I'll open an issue for it

lunny added 3 commits Nov 11, 2019
@lunny lunny merged commit 74a6add into go-gitea:master Nov 11, 2019
2 checks passed
2 checks passed
approvals/lgtm this commit looks good
continuous-integration/drone/pr Build is passing
Details
@jolheiser jolheiser deleted the jolheiser:template branch Nov 11, 2019
@jolheiser jolheiser mentioned this pull request Nov 22, 2019
7 of 13 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
9 participants
You can’t perform that action at this time.