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

Config panel actions + applied to domain cert management #1436

Merged
merged 33 commits into from Oct 4, 2022
Merged

Conversation

alexAubin
Copy link
Member

The problem

  • We need actions in the config panel for many reasons

Solution

  • Add an action mechanism @_@

PR Status

  • This is mainly a POC for now
  • The idea is to have a new component type button
  • Any section containing a button becomes an "action section" which is not displayed by default during config get
  • yunohost app config list lists all the buttons ids

How to test

Example dummy toml snippet in an app :

[actions]
name = "Actions example"

    [actions.foo]
    name = "Trigger foo action"

        [actions.foo.bar]
        ask = "I can haz bar ?"
        type = "number"
	min = 1
	max = 100
        default = 5

        [actions.foo.force]
        ask = "Force it ?"
        type = "boolean"
        default = false
	visible = "bar > 10"

        [actions.foo.foo]
        ask = "Foo!"
        type = "button"
        icon = "rocket"
        style = "success"
        help = "This should trigger function run__foo"
        enabled = "bar <= 10 or force"  # This doesnt do anything for now but could be useful for condition button (enabled/disabled)
        visible = "bar <= 10 or force"   # This doesnt do anything for now but could be useful for condition button (visible/invisible)

        [actions.foo.foo2]
        ask = "Foo2?"
        type = "button"
        icon = "rocket"
        style = "warning"
        help = "This should trigger function run__foo2"
        enabled = "bar > 50"   # This doesnt do anything for now but could be useful for condition button (enabled/disabled)
        visible = "bar > 50"    # This doesnt do anything for now but could be useful for condition button (visible/invisible)

and corresponding controller in config script:

run__foo() {
    ynh_print_info "I am running the action foo"
    touch /tmp/foo_$(date -Iseconds)
}

Then run yunohost app action list config_app and yunohost app action run actions.foo.foo (yeah the app is the full triplet for non-trivial reasons gni)

@alexAubin alexAubin changed the title WIP: Config panel actions WIP: Config panel actions + applied to domain cert management Feb 8, 2022
src/domain.py Outdated Show resolved Hide resolved
share/config_domain.toml Show resolved Hide resolved
share/config_domain.toml Show resolved Hide resolved
@alexAubin alexAubin added this to In progress in 11.1 Aug 6, 2022
alexAubin and others added 21 commits September 7, 2022 13:08
Currently translated at 13.4% (93 of 693 strings)

Translation: YunoHost/core
Translate-URL: https://translate.yunohost.org/projects/yunohost/core/ar/
Currently translated at 1.2% (9 of 693 strings)

Translation: YunoHost/core
Translate-URL: https://translate.yunohost.org/projects/yunohost/core/tr/
Currently translated at 1.4% (10 of 693 strings)

Translation: YunoHost/core
Translate-URL: https://translate.yunohost.org/projects/yunohost/core/tr/
Currently translated at 6.4% (45 of 693 strings)

Translation: YunoHost/core
Translate-URL: https://translate.yunohost.org/projects/yunohost/core/te/
Currently translated at 34.3% (238 of 693 strings)

Translation: YunoHost/core
Translate-URL: https://translate.yunohost.org/projects/yunohost/core/sk/
Co-authored-by: Axolotle <nchesnais@mailoo.org>
src/app.py Outdated Show resolved Hide resolved
src/utils/config.py Outdated Show resolved Hide resolved
@alexAubin alexAubin mentioned this pull request Oct 4, 2022
13 tasks
@alexAubin alexAubin changed the title WIP: Config panel actions + applied to domain cert management Config panel actions + applied to domain cert management Oct 4, 2022
@alexAubin alexAubin changed the base branch from dev to 11.1 October 4, 2022 20:27
@alexAubin alexAubin merged commit d1d2037 into 11.1 Oct 4, 2022
@alexAubin alexAubin deleted the enh-actions branch October 4, 2022 20:34
@alexAubin alexAubin moved this from In progress to Done in 11.1 Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
11.1
Done
6 participants