Skip to content

Commit

Permalink
Add a setting/flag to display or not display repository info in the U…
Browse files Browse the repository at this point in the history
…I. (#1669)

* Add a setting/flag to display or not display repository info in the UI.

No-Issue

Signed-off-by: James Tanner <[email protected]>
  • Loading branch information
jctanner authored Apr 6, 2023
1 parent fb8a79f commit 242c2a4
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev/standalone-community/galaxy_ng.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ PULP_ANSIBLE_CONTENT_HOSTNAME=http://localhost:24816/api/v3/artifacts/collection
PULP_TOKEN_AUTH_DISABLED=true
PULP_CONTENT_ORIGIN="http://localhost:24816"

PULP_GALAXY_FEATURE_FLAGS__display_repositories=false

# Pulp container requires this to be set in order to provide docker registry
# compatible token authentication.
Expand Down
4 changes: 4 additions & 0 deletions docs/config/featureflags.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,7 @@ The same pattern can be used for the following feature flags:
- boolean
- Enables AI Deny Index endpoints and tells UI to display the Wisdom opt-out buttons
- default: False
- `display_repositories`
- boolean
- Signals the UI to show or not to show repository information.
- default: True
1 change: 1 addition & 0 deletions galaxy_ng/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@

# Dictionary with True|False values for the application to turn on/off features
GALAXY_FEATURE_FLAGS = {
'display_repositories': True,
'execution_environments': True, # False will make execution_environments endpoints 404
'legacy_roles': False,
'ai_deny_index': False, # False will make _ui/v1/ai_deny_index/ to 404
Expand Down
19 changes: 19 additions & 0 deletions galaxy_ng/tests/integration/api/test_community.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,31 @@ def test_community_settings(ansible_config):
assert resp['GALAXY_SIGNATURE_UPLOAD_ENABLED'] is False
assert resp['GALAXY_ENABLE_UNAUTHENTICATED_COLLECTION_ACCESS'] is True
assert resp['GALAXY_ENABLE_UNAUTHENTICATED_COLLECTION_DOWNLOAD'] is True
assert resp['GALAXY_FEATURE_FLAGS']['display_repositories'] is False
assert resp['GALAXY_FEATURE_FLAGS']['execution_environments'] is False
assert resp['GALAXY_FEATURE_FLAGS']['legacy_roles'] is True
assert resp['GALAXY_FEATURE_FLAGS']['ai_deny_index'] is True
assert resp['GALAXY_CONTAINER_SIGNING_SERVICE'] is None


@pytest.mark.community_only
def test_community_feature_flags(ansible_config):
"""Tests feature flags are correct"""

config = ansible_config("anonymous_user")
api_client = get_client(
config=config,
request_token=False,
require_auth=False
)

resp = api_client('/api/_ui/v1/feature-flags/', method='GET')
assert resp['ai_deny_index'] is True
assert resp['display_repositories'] is False
assert resp['execution_environments'] is False
assert resp['legacy_roles'] is True


@pytest.mark.community_only
def test_me_anonymous(ansible_config):
"""Tests anonymous user is detected correctly"""
Expand Down
5 changes: 5 additions & 0 deletions galaxy_ng/tests/integration/api/test_ui_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@ def test_api_ui_v1_feature_flags(ansible_config):
ds = resp.json()
validate_json(instance=ds, schema=schema_featureflags)

assert ds['ai_deny_index'] is False
assert ds['display_repositories'] is True
assert ds['execution_environments'] is True
assert ds['legacy_roles'] is False


# /api/automation-hub/_ui/v1/groups/
@pytest.mark.standalone_only
Expand Down

0 comments on commit 242c2a4

Please sign in to comment.