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

Delete collection all or single repo #3759

Merged

Conversation

MilanPospisil
Copy link
Contributor

@MilanPospisil MilanPospisil commented May 24, 2023

Issue: https://issues.redhat.com/browse/AAH-2261

Depends on ansible/galaxykit#93

This PR Adds:

  • Delete collection from repository - this is added into all collection menus (collection list, namespace collection list and collection detail).

  • Delete collection version from repository - this is added into collection detail only.

  • Both deletes from repository are only visible in standalone, since Insights mode does not have any repo management, this operation is meaningless.

  • Added tests for those operations.

  • existing "should copy collection version to validated repository" test is fixed

  • Delete entire collection menu item name slightly renamed from "Delete entire collection" to "Delete entire collection from system" to better distinguish from "Delete collection from repository"

  • deleteNamespacesAndCollections test command slightly changed. Now it does not removes orphan collections (otherwise it fails on them) and does not removes namespaces that has orphan collections. Also task wait all is used instead of more complicated waiting.

@github-actions github-actions bot added backport-4.6 This PR should be backported to stable-4.6 (2.3) backport-4.7 This PR should be backported to stable-4.7 (2.4) labels May 24, 2023
@MilanPospisil MilanPospisil force-pushed the deleteCollectionAllOrSingleRepo branch from 42e20da to 42b285b Compare May 29, 2023 12:38
@himdel himdel removed the backport-4.6 This PR should be backported to stable-4.6 (2.3) label May 29, 2023
@MilanPospisil MilanPospisil force-pushed the deleteCollectionAllOrSingleRepo branch 3 times, most recently from 120be6a to a3fd34a Compare June 6, 2023 11:25
@MilanPospisil MilanPospisil force-pushed the deleteCollectionAllOrSingleRepo branch 2 times, most recently from 13be395 to a1820b9 Compare June 8, 2023 11:42
@MilanPospisil MilanPospisil marked this pull request as ready for review June 9, 2023 11:58
@himdel
Copy link
Collaborator

himdel commented Jun 10, 2023

We should check the display_repositories feature flag for these as well (and then may not need the standalone mode checks).

@himdel
Copy link
Collaborator

himdel commented Jun 12, 2023

Looks good, just the linter fix please :)

@MilanPospisil MilanPospisil force-pushed the deleteCollectionAllOrSingleRepo branch from 589c15f to 72b7279 Compare June 13, 2023 08:27
@MilanPospisil MilanPospisil merged commit c09590f into ansible:master Jun 13, 2023
@patchback
Copy link

patchback bot commented Jun 13, 2023

Backport to stable-4.7: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply c09590f on top of patchback/backports/stable-4.7/c09590f3cc5e0b787a9739d7646254e78316349b/pr-3759

Backporting merged PR #3759 into master

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/ansible/ansible-hub-ui.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/stable-4.7/c09590f3cc5e0b787a9739d7646254e78316349b/pr-3759 upstream/stable-4.7
  4. Now, cherry-pick PR Delete collection all or single repo #3759 contents into that branch:
    $ git cherry-pick -x c09590f3cc5e0b787a9739d7646254e78316349b
    If it'll yell at you with something like fatal: Commit c09590f3cc5e0b787a9739d7646254e78316349b is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x c09590f3cc5e0b787a9739d7646254e78316349b
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Delete collection all or single repo #3759 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/stable-4.7/c09590f3cc5e0b787a9739d7646254e78316349b/pr-3759
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

himdel pushed a commit to himdel/ansible-hub-ui that referenced this pull request Jun 28, 2023
* Menu option to delete collection from all/repo

* Delete collection operation

* Collection version menu option

* Delete collection version

* Test changes

* Test changes repairs

* Test for deletion collection from repo

* Tests fix

* WIP

* Clear of orphans

* Clear collections only

* Better cleanup

* Remove cleanup

* Delete version from repo test

* Handle translations

* Issue
Issue: AAH-2261

* PR Checks

* Repair selector for insights

* Fix collection test for insights

* Fix collection test for insights2

* Finally really fix insights tests :)

* Switch contains and not contains

* Disable new test for insights

* Do not delete repos

* WIP

* Correct tests

* Collection Tests back to normal + new repo test

* Fix collection test

* Clear the mess done by previous commits in deleteAllCollections

* Make deleteNamespacesAndCollections clearer

* Move test to approvals

* Fix copy collection version test

* Disable removal from repo for insights

* Better translations in delete modal

* Change condition to display delete from repo to feature flag instead of insights mode

* Add deleteFromRepo string type

(cherry picked from commit c09590f)
himdel added a commit that referenced this pull request Jul 3, 2023
* Menu option to delete collection from all/repo

* Delete collection operation

* Collection version menu option

* Delete collection version

* Test changes

* Test changes repairs

* Test for deletion collection from repo

* Tests fix

* WIP

* Clear of orphans

* Clear collections only

* Better cleanup

* Remove cleanup

* Delete version from repo test

* Handle translations

* Issue
Issue: AAH-2261

* PR Checks

* Repair selector for insights

* Fix collection test for insights

* Fix collection test for insights2

* Finally really fix insights tests :)

* Switch contains and not contains

* Disable new test for insights

* Do not delete repos

* WIP

* Correct tests

* Collection Tests back to normal + new repo test

* Fix collection test

* Clear the mess done by previous commits in deleteAllCollections

* Make deleteNamespacesAndCollections clearer

* Move test to approvals

* Fix copy collection version test

* Disable removal from repo for insights

* Better translations in delete modal

* Change condition to display delete from repo to feature flag instead of insights mode

* Add deleteFromRepo string type

(cherry picked from commit c09590f)

Co-authored-by: MilanPospisil <arkanus@seznam.cz>
@github-actions github-actions bot added the backported-4.7 This PR has been backported to stable-4.7 (2.4) label Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-4.7 This PR should be backported to stable-4.7 (2.4) backported-4.7 This PR has been backported to stable-4.7 (2.4)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants