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

Add priority to protected branch #32286

Merged
merged 51 commits into from
Nov 27, 2024

Conversation

6543
Copy link
Member

@6543 6543 commented Oct 17, 2024

Solves

Currently for rules to re-order them you have to alter the creation date. so you basicly have to delete and recreate them in the right order. This is more than just inconvinient ...

Solution

Add a new col for prioritization

TODOs:

  • alter models
  • backend func to handle priorities
  • API
  • alter WebUI
  • api tests
  • backend tests
  • fix mssql issue ...

Demo WebUI Video

vid-20241021-211051.mp4

Sponsored by Kithara Software GmbH

@6543 6543 added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Oct 17, 2024
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 17, 2024
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 17, 2024
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/migrations labels Oct 17, 2024
@github-actions github-actions bot added the modifies/api This PR adds API routes or modifies them label Oct 17, 2024
@github-actions github-actions bot added the modifies/templates This PR modifies the template files label Oct 21, 2024
@6543
Copy link
Member Author

6543 commented Oct 21, 2024

vid-20241021-211051.mp4

@GiteaBot GiteaBot 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 Nov 26, 2024
@6543
Copy link
Member Author

6543 commented Nov 26, 2024

@wxiaoguang now the webui is broken and dont update anymore ... the frontend test also catched that :/

@wxiaoguang
Copy link
Contributor

now the webui is broken and dont update anymore ...

Sorry I couldn't get the meaning. Which part is broken? Which don't update?

@6543
Copy link
Member Author

6543 commented Nov 26, 2024

if you drag the priority is not updated correctly ... see https://github.com/go-gitea/gitea/actions/runs/12032094762/job/33543141029?pr=32286

could you please suggest a fix for your code?

@wxiaoguang
Copy link
Contributor

could you please suggest a fix for your code?

But I do not see why the code causes broken? #32286 (comment) it should be the right approach.

@wxiaoguang
Copy link
Contributor

I will check out your branch to test.

Meanwhile if you have time, please help to review my non-draft PRs: https://github.com/go-gitea/gitea/pulls/wxiaoguang

@wxiaoguang
Copy link
Contributor

OK, the problems are clear.

  1. tests fail: because there is a bug in the testing framework, it doesn't support :scope selector correctly
  2. web updates fail: my code is just a demo, if you need to pass "int" values, you still need the parseInt

So I think this code will make everything work:

        const itemElems = queryElems(protectedBranchesList, '.item[data-id]');
        const itemIds = Array.from(itemElems, (el) => parseInt(el.getAttribute('data-id')));

@wxiaoguang
Copy link
Contributor

tests fail: because there is a bug in the testing framework, it doesn't support :scope selector correctly

Also please review this: Bypass vitest bug #32647 , to make queryElemChildren work correctly in vitest

@GiteaBot GiteaBot 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 Nov 27, 2024
web_src/js/index.ts Outdated Show resolved Hide resolved
@wxiaoguang wxiaoguang modified the milestones: 1.24.0, 1.23.0 Nov 27, 2024
@@ -154,4 +155,5 @@ export function initRepoSettings() {
initRepoSettingsCollaboration();
initRepoSettingsSearchTeamBox();
initRepoSettingsGitHook();
initRepoBranchesSettings();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other function names are unified to initRepoSettingsXxx 🤣

anyway, just a nit, no block, feel free to update or just merge (already 2 approvals)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... well there will be a refactor that catches it at some point

@6543 6543 merged commit 846f618 into go-gitea:main Nov 27, 2024
26 checks passed
@6543 6543 deleted the add-priority-to-ProtectedBranch branch November 27, 2024 04:41
zjjhot added a commit to zjjhot/gitea that referenced this pull request Nov 28, 2024
* giteaofficial/main:
  Allow cropping an avatar before setting it (go-gitea#32565)
  Add webpack EnvironmentPlugin (go-gitea#32661)
  Move team related functions to service layer (go-gitea#32537)
  Make frontend unit test code could know it is in testing (go-gitea#32656)
  Add priority to protected branch (go-gitea#32286)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/api This PR adds API routes or modifies them modifies/frontend modifies/go Pull requests that update Go code modifies/migrations modifies/templates This PR modifies the template files size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants