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

Addons: update form to show all the options #11031

Merged
merged 10 commits into from
Jan 22, 2024
Merged

Conversation

humitos
Copy link
Member

@humitos humitos commented Jan 15, 2024

Add all the configuration options to the AddonsConfigForm so the user is able to enable/disable each of the addons independently.

This is the initial version of this work. We will keep adding more configuration options to each of the addons. That's why I decided to create one section per each. In the future, instead of just a regular FieldSet we can get more fancy and use tabs instead (creating a custom class or giving it a try to https://crispy-forms-gds.readthedocs.io/en/latest/components/tabs.html)

Preview

Screenshot 2024-01-15 at 16-04-18 test-builds - Addons - Read the Docs

ToDo

  • get a review on the copy for each of the sections
  • migrate projects with Feature flags to disable specific addons

Closes readthedocs/ext-theme#211

Add all the configuration options to the `AddonsConfigForm` so the user is able
to enable/disable each of the addons independently.

Closes readthedocs/ext-theme#211
if field.startswith("stable_latest_version_warning_")
],
),
]
Copy link
Contributor

@agjohnson agjohnson Jan 16, 2024

Choose a reason for hiding this comment

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

Noted at readthedocs/ext-theme#262 (comment)

Two things that are important here:

First, I think this interface will eventually use a tabbed interface, not fieldsets, or might even use separate form/views entirely -- we'll know more once we start adding deeper configuration options here. But for that, I am gathering fieldsets will probably be removed in the future.

Second, I wanted to discuss avoiding (and probably removing) use of Crispy layouts and the layout API. Having HTML authoring removed from template code is a bit awkward already, just given the code/template separation and repository split, but it gets much worse if we want JS/Knockout/etc code in the form.

For that, I might suggest keeping this incredibly simple for a first pass and removing fieldsets and Python HTML authoring.

Copy link
Member Author

Choose a reason for hiding this comment

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

For that, I might suggest keeping this incredibly simple for a first pass and removing fieldsets and Python HTML authoring.

How do you imagine that version? Just a bunch of inline checkboxes, as shown in readthedocs/ext-theme#262 (comment))?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, that seems like plenty 👍

It will look minimal, but should be fine -- especially with a fix for block display checkboxes. We definitely will want to improve on that later in some way in the future, and we can start mocking out what that looks like once we know what other configuration fields we want there.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure how to fix the inline checkbox CSS issue, but I found where is the issue at least.

.ui.checkbox {
  display: inline-block;
}

Removing that property it displays as we want, I'd say.

Screenshot_2024-01-18_13-20-22

Copy link
Member Author

Choose a reason for hiding this comment

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

I will move forward with the required changes on this PR and we can tackle that CSS issue in ext-theme, I guess.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, that sounds good. I agree it's probably minor and I should be able to squeeze a fix into the crispy field template before deploy

Create an `AddonsConfig` object when going to the form view to edit its
preferences. By default, disable all the addons for now.
Copy link
Contributor

@agjohnson agjohnson left a comment

Choose a reason for hiding this comment

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

This looks good! There are a few display issues I'll follow up on tomorrow or monday.

@@ -529,17 +529,27 @@ class AddonsConfigForm(forms.ModelForm):

class Meta:
model = AddonsConfig
fields = ("enabled", "project")
fields = (
"enabled",
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say the only thing I noticed is that this field renders as Enabled, and should probably be more descriptive regardless of the pattern we use -- Enable Addons or something.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, good point. I originally used the layout approach and added some text explaining this was "global". I'll check with the serializer if I can change how it renders since we are already using the help_text to explain the same thing.

Copy link
Member Author

Choose a reason for hiding this comment

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

I also thought we can use better labels for:

            "external_version_warning_enabled": _("Show a notification on builds from Pull Requests"),
            "stable_latest_version_warning_enabled": _("Show a notification on non-stable and latest versions"),

What do you think?

Also also, we can remove the enabled part from all of them and just leave the name of the addon with the checkbox?

Copy link
Member Author

Choose a reason for hiding this comment

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

Screenshot_2024-01-19_15-43-50

Copy link
Contributor

@agjohnson agjohnson Jan 19, 2024

Choose a reason for hiding this comment

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

I also thought we can use better labels for

Yeah those look better! Just a small note that "Pull Request" should use proper noun capitalization, "pull request builds" can be used instead. I follow what GitHub uses: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests

Also also, we can remove the enabled part

Aye, we could for this UI. Though thinking ahead to when we split it up to multiple pages/tabs, we might want the full verbose version "Flyout enabled"? I suppose I'd leave the "enabled" part on the text for now and if we want to remove it later we can. For now, the extra enabled isn't making the options any less clear.

@humitos humitos enabled auto-merge (squash) January 19, 2024 14:36
@humitos humitos merged commit 3cfc29b into main Jan 22, 2024
3 of 4 checks passed
@humitos humitos deleted the humitos/addons-admin-page branch January 22, 2024 09:52
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.

Addons: create project admin page to configure addons
2 participants