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

[LBSD-2786] - Complete Instance Settings UI #1381

Merged

Conversation

eos87
Copy link
Member

@eos87 eos87 commented May 3, 2024

Purpose

Completes the implementation of the UI to manage Instance Settings. This UI is restricted only to users that have the is_support attribute active. If the attribute is not active, then the UI is not visible.

What has changed

  • The resource schema has been enhanced
  • Validator method has been removed in favour of using Cerberus (Python Eve) dependency to run the validations against the resource's schema
  • Improved service class to make the instance settings act as a singleton
  • Implemented a few edge case when settings are not present
  • Improved frontend controller and fixed linter issues
  • Removed Instance Admin role in favour of using is_support attribute instead
  • Render instance settings UI based on user's is_support attribute
  • Added validation in the backend side so user cannot modify the instance settings if it doesn't have the is_support enabled
  • Remove the merge_config method to keep it simple for now. In the future we can analyse if a more complex approach is needed
  • Adjusted couple of places with new features service (I've missed them in previous PR)
  • Adjusted tests

Steps to test

  • Checkout the branch
  • Run the services
  • Go to instance settings UI. Notice that if user is not support, the menu entry will not render. Otherwise it should
  • Try to save the setting and play with validations. The settings structure should look like this below. You can try removing "features" for example, and the system should catch that.
{
    "settings": {
        "solo": {
            "features": {
                "syndication": true,
                "marketplace": false,
                "theme_styles": false,
                "custom_themes": false,
                "change_blog_theme": false,
                "freetypes_manager": false,
                "archived_blogs_available": false
            },
            "limits": {
                "blogs": 1,
                "themes": 1,
                "blog_members": 1,
                "custom_themes": 0
            }
        },
        "team": {
            "features": {
                "syndication": true,
                "marketplace": true,
                "theme_styles": true,
                "custom_themes": true,
                "change_blog_theme": true,
                "freetypes_manager": true,
                "archived_blogs_available": true
            },
            "limits": {
                "blogs": 3,
                "themes": 6,
                "blog_members": 5,
                "custom_themes": 5
            }
        }
    }
}

Thanks for reviewing!

Resolves: LBSD-2786

The instance settings is a part of the app that regular users should not have access to, therefore we filter out this entry from the settings as long as the user does not have the `is_support` attribute enabled for them

LBSD-2786
As we decided to go with `is_support` attribute instead we no longer need the newly added role

LBSD-2786
@eos87 eos87 requested a review from BrianMwangi21 May 3, 2024 14:08
Copy link
Collaborator

@BrianMwangi21 BrianMwangi21 left a comment

Choose a reason for hiding this comment

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

I've tested it locally and it works. LGTM! 👍

@eos87
Copy link
Member Author

eos87 commented May 6, 2024

I will merge this although there will be another PR just to adjust the plans' names and features/limits (Liveblog Go and Uni)

@eos87 eos87 merged commit a2db33d into feature/dynamic-subscriptions May 6, 2024
6 checks passed
@eos87 eos87 deleted the hg/LBSD-2786-instance-settigs-ui branch May 6, 2024 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants