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

Support system/user default clone editors #22378

Closed
wants to merge 16 commits into from

Conversation

lunny
Copy link
Member

@lunny lunny commented Jan 9, 2023

Replace #21123
Close #21121
Close #22149

This PR introduces a global configuration named dev.default_editors and a user level configuration named dev.default_editors. Login users will see the menu items from him own configuration and anonymous user will see the menus from global configurations.

Currently, it embeded 3 editors, vscode, vscodium and IDEA. More influent editors and IDE could be added.

TODO:

  • Bug: The system options list cannot float over stack div
  • Add a user level configuration item to save the default editor.
  • Multiple editors support
  • Next PRs: Customized editors

Admin panel configuration

image

User setting configuration

image

UI in the repository home page

image

@lunny lunny added the type/enhancement An improvement of existing functionality label Jan 9, 2023
@lunny lunny added this to the 1.19.0 milestone Jan 9, 2023
@lafriks
Copy link
Member

lafriks commented Jan 9, 2023

This should be option to allow select multiple. My use case: on work laptop I use VSCode but on personal laptop I use VSCodium

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 9, 2023
@lunny
Copy link
Member Author

lunny commented Jan 9, 2023

This should be option to allow select multiple. My use case: on work laptop I use VSCode but on personal laptop I use VSCodium

I will add multiple editors support.

@JakobDev
Copy link
Contributor

JakobDev commented Jan 9, 2023

Looks nice. I think it should also be possible to use a custom editor in case a User uses some odd editor that is not in the list. You could add a radio button "Use editor from list" which is the current list of your PR and "Use custom editor" where the User can Input a Name, URL and optional a Icon.

@lunny
Copy link
Member Author

lunny commented Jan 9, 2023

Looks nice. I think it should also be possible to use a custom editor in case a User uses some odd editor that is not in the list. You could add a radio button "Use editor from list" which is the current list of your PR and "Use custom editor" where the User can Input a Name, URL and optional a Icon.

That should be next PR for customized editors.

@jolheiser
Copy link
Member

Honestly imo this doesn't fix the core issue, it just moves it around.

I think Gitea should allow instance admins to configure whichever they want (and still allow per-user custom anyways)
Each editor in the config would need a name, URL template, and icon URL and this would be more or less fully customizable without opening the door for an ever-growing list like webhooks.

@lunny
Copy link
Member Author

lunny commented Jan 10, 2023

Honestly imo this doesn't fix the core issue, it just moves it around.

I think Gitea should allow instance admins to configure whichever they want (and still allow per-user custom anyways) Each editor in the config would need a name, URL template, and icon URL and this would be more or less fully customizable without opening the door for an ever-growing list like webhooks.

That's what's the next step to do.

services/dev/editor.go Outdated Show resolved Hide resolved
templates/user/settings/appearance.tmpl Outdated Show resolved Hide resolved
templates/user/settings/appearance.tmpl Outdated Show resolved Hide resolved
templates/admin/config.tmpl Outdated Show resolved Hide resolved
templates/admin/config.tmpl Outdated Show resolved Hide resolved
@lunny lunny changed the title Support default clone editor Support default clone editors Jan 10, 2023
@lunny lunny changed the title Support default clone editors Support system/user default clone editors Jan 10, 2023
@codecov-commenter
Copy link

codecov-commenter commented Jan 10, 2023

Codecov Report

Merging #22378 (1dfcab4) into main (477a1cc) will increase coverage by 48.17%.
The diff coverage is 20.39%.

@@            Coverage Diff            @@
##           main   #22378       +/-   ##
=========================================
+ Coverage      0   48.17%   +48.17%     
=========================================
  Files         0     1045     +1045     
  Lines         0   142503   +142503     
=========================================
+ Hits          0    68645    +68645     
- Misses        0    65680    +65680     
- Partials      0     8178     +8178     
Impacted Files Coverage Δ
modules/templates/helper.go 44.55% <0.00%> (ø)
modules/util/slice.go 81.35% <0.00%> (ø)
routers/web/admin/config.go 21.46% <0.00%> (ø)
routers/web/user/setting/profile.go 31.86% <0.00%> (ø)
services/dev/editor.go 29.41% <29.41%> (ø)
modules/context/repo.go 52.90% <33.33%> (ø)
routers/web/web.go 84.60% <42.85%> (ø)
models/user/setting.go 66.14% <66.66%> (ø)
modules/repository/generate.go 32.58% <0.00%> (ø)
models/issues/issue_lock.go 0.00% <0.00%> (ø)
... and 1042 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

options/locale/locale_en-US.ini Outdated Show resolved Hide resolved
services/dev/editor.go Outdated Show resolved Hide resolved
templates/repo/home.tmpl Outdated Show resolved Hide resolved
lunny and others added 3 commits January 10, 2023 19:59
Co-authored-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
@lunny
Copy link
Member Author

lunny commented Jan 10, 2023

@yardenshoham @lafriks Both done.

@goyalyashpal
Copy link

goyalyashpal commented Jan 11, 2023

My use case: on work laptop I use VSCode but on personal laptop I use VSCodium
- lafriks at #22378 (comment)

  • How about making it to be tie-able to the local system?
  • So, some option like:
    Allow different default on each browser instance or
    Allow device specific preference
  • ... similar to how theme settings in various sites (github, youtube, etc) are not tied to the global account settings, but rather tie only to a particular browser instance (i guess using cookies or what not?)

Reference

vivaldi_pKV6RbHvOb.mp4

@lunny
Copy link
Member Author

lunny commented Jan 12, 2023

My use case: on work laptop I use VSCode but on personal laptop I use VSCodium

  • How about making it to be tie-able to the local system?
  • So, some option like:
    Allow different default on each browser instance or
    Allow device specific preference
  • ... similar to how theme settings in various sites (github, youtube, etc) are not tied to the global account settings, but rather tie only to a particular browser instance (i guess using cookies or what not?)

Reference

vivaldi_pKV6RbHvOb.mp4

How could we know the users' editors within the webbrowser?

@lafriks
Copy link
Member

lafriks commented Jan 12, 2023

As I commented also in other PR, I don't see from current UI perspective much of the problem if in menu I have one option (Open in xxx editor) or multiple, so I don't see how that would make it much easier to use it if default editor would be selected per browser?

@goyalyashpal
Copy link

goyalyashpal commented Jan 19, 2023

How could we know the users' editors within the webbrowser?

we don't need to, we only need to know all their preferences (which per will enter) and which one to pick on that particular webbrowser (which again, the user will select perself ofcourse).

After that, that editor will be shown in the repos etc as default.

@lunny lunny modified the milestones: 1.19.0, 1.20.0 Feb 8, 2023
@silverwind
Copy link
Member

Needs a rebase

@wxiaoguang
Copy link
Contributor

I guess this PR is not mature yet (the implement doesn't seem maintainable for future).

@silverwind
Copy link
Member

Maybe non-ui config would be simpler to implement, e.g. #21121 (comment). Downside is only admin can change it.

@wxiaoguang
Copy link
Contributor

-> Customizable "Open with" applications for repository clone #29320

@lunny lunny closed this Feb 22, 2024
@lunny lunny deleted the lunny/default_editor branch February 22, 2024 13:47
wxiaoguang added a commit that referenced this pull request Feb 24, 2024
Users could customize the "clone" menu with their own application URLs on the admin panel.

Replace #22378
Close #21121
Close #22149
Copy link

github-actions bot commented Mar 1, 2024

Automatically locked because of our CONTRIBUTING guidelines

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

clone option to directly clone into Jetbrains IDEs Support additional clone schemes