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

Plugin settings #4143

Merged
merged 6 commits into from
Oct 18, 2023
Merged

Plugin settings #4143

merged 6 commits into from
Oct 18, 2023

Conversation

WithoutPants
Copy link
Collaborator

Adds the ability to get and set plugin-specific settings.

Setting plugin properties is done with mutation configurePlugin which accepts a plugin ID and a map of settings. The entire map of settings is replaced for the provided plugin ID.

Getting plugin settings is done with the existing configuration query. A new plugins field on the returned type presents the settings grouped by plugin ID.

For example:

query {
  configuration {
    plugins
  }
}

Returns:

{
  "data": {
    "configuration": {
      "plugins": {
        "foo": {
          "bar": true
        },
        "testReact": {
          "bar": 2,
          "foo": false,
          "xyz": "ffsfff"
        }
      }
    }
  }
}

The resolver accepts an includes field which specifies which plugins to return results for.

query {
  configuration {
    plugins(includes: ["testReact"])
  }
}

Returns:

{
  "data": {
    "configuration": {
      "plugins": {
        "testReact": {
          "bar": 2,
          "foo": false,
          "xyz": "ffsfff"
        }
      }
    }
  }
}

The plugin config yaml file now accepts a list of settings which will be displayed on the plugin settings page.

settings:
  foo:
    displayName: Foo
    type: BOOLEAN
  bar:
    description: baz
    type: NUMBER
  xyz:
    type: STRING

Where displayName is not set, then the internal key name will be used instead. If type is not specified, it defaults to STRING. The above configuration is shown in the UI as follows:

image

@WithoutPants WithoutPants added the feature Pull requests that add a new feature label Sep 22, 2023
@WithoutPants WithoutPants added this to the Version 0.24.0 milestone Sep 22, 2023
@scruffynerf
Copy link

Default values?

@stg-annon
Copy link
Collaborator

Default values?

should be able to do this from the plugin via the mutation

@WithoutPants WithoutPants merged commit 2b87181 into stashapp:develop Oct 18, 2023
2 checks passed
@WithoutPants WithoutPants linked an issue Jan 17, 2024 that may be closed by this pull request
halkeye pushed a commit to halkeye/stash that referenced this pull request Sep 1, 2024
* Add backend support for plugin settings
* Add plugin settings config
* Add UI support for plugin settings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Pull requests that add a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Generic key / value store for plugin config
3 participants