forked from startnext/terraform-provider-wikijs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from tyclipso/theming-api
Add data_sources and resource for theme api of wikijs
- Loading branch information
Showing
31 changed files
with
1,139 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "wikijs_theme_config Data Source - terraform-provider-wikijs" | ||
subcategory: "" | ||
description: |- | ||
The wikijs_theme_config Data Source implements the WikiJS API query theming{config{…}}. | ||
It can be used to read the current state and only change one of the required or any of the optional, without touching the required. | ||
The Schema descriptions are directly lifted from the descriptions of the input fields in WikiJS. | ||
--- | ||
|
||
# wikijs_theme_config (Data Source) | ||
|
||
The `wikijs_theme_config` Data Source implements the WikiJS API query `theming{config{…}}`. | ||
It can be used to read the current state and only change one of the required or any of the optional, without touching the required. | ||
The Schema descriptions are directly lifted from the descriptions of the input fields in WikiJS. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
# This data_source can be useful if you want to change only one of the | ||
# required theme configs but don't want to change the rest | ||
# Notice that this data source does not take any arguments | ||
data "wikijs_theme_config" "config" {} | ||
resource "wikijs_theme_config" "config" { | ||
theme = data.wikijs_theme_config.config.theme | ||
iconset = data.wikijs_theme_config.data.iconset | ||
# Only switch dark mode globally on | ||
dark_mode = true | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Read-Only | ||
|
||
- `dark_mode` (Boolean) Dark Mode. | ||
Not recommended for accessibility. | ||
May not be supported by all themes. | ||
- `iconset` (String) Set of icons to use for the sidebar navigation. | ||
- `inject_body` (String) HTML code to be injected just before the closing body tag. | ||
- `inject_css` (String) CSS code to inject after system default CSS. | ||
Consider using custom themes if you have a large amount of css code. | ||
Injecting too much CSS code will result in poor page load performance! | ||
CSS will automatically be minified. | ||
|
||
**CAUTION**: When adding styles for page content, you must scope them to the `.contents` class. | ||
Omitting this could break the layout of the editor! | ||
- `inject_head` (String) HTML code to be injected just before the closing head tag. Usually for script tags. | ||
- `theme` (String) Themes affect how content pages are displayed. | ||
Other site sections (such as the editor or admin area) are not affected. | ||
- `toc_position` (String) Select whether the table of contents is shown on the left, right or not at all. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "wikijs_themes Data Source - terraform-provider-wikijs" | ||
subcategory: "" | ||
description: |- | ||
The wikijs_themes Data Source implements the WikiJS API query theming{themes{…}}. | ||
In wikijs v2 https://github.com/requarks/wiki/blob/main/server/graph/resolvers/theming.js#L16-L19 this contains only the default theme. | ||
--- | ||
|
||
# wikijs_themes (Data Source) | ||
|
||
The `wikijs_themes` Data Source implements the WikiJS API query `theming{themes{…}}`. | ||
In wikijs [v2][api-themes] this contains only the default theme. | ||
|
||
[api-themes]: https://github.com/requarks/wiki/blob/main/server/graph/resolvers/theming.js#L16-L19 | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
# This data source currently only returns a list with one item | ||
# The themes query is hardcoded to only respond with the default | ||
# theme in v2 | ||
data "wikijs_themes" "themes_list" { | ||
themes = [] | ||
} | ||
# You could use it to reset the theme but it seems easier to just | ||
# write "default" | ||
resource "wikijs_theme_config" "theme_config" { | ||
theme = data.wikijs_themes.themes_list[0].key | ||
iconset = "mdi" | ||
dark_mode = false | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `themes` (Attributes List) List of registered themes. (see [below for nested schema](#nestedatt--themes)) | ||
|
||
<a id="nestedatt--themes"></a> | ||
### Nested Schema for `themes` | ||
|
||
Read-Only: | ||
|
||
- `author` (String) | ||
- `key` (String) | ||
- `title` (String) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "wikijs_theme_config Resource - terraform-provider-wikijs" | ||
subcategory: "" | ||
description: |- | ||
The wikijs_theme_config Resource implements the WikiJS API mutatation theming{setConfig{…}}. | ||
It can be used to manipulate the theme setting on instances with custom themes. | ||
The Schema descriptions are mostly lifted from the descriptions of the input fields in WikiJS. | ||
--- | ||
|
||
# wikijs_theme_config (Resource) | ||
|
||
The `wikijs_theme_config` Resource implements the WikiJS API mutatation `theming{setConfig{…}}`. | ||
It can be used to manipulate the theme setting on instances with custom themes. | ||
The Schema descriptions are mostly lifted from the descriptions of the input fields in WikiJS. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
# The following example shows how to configure the wikijs theme | ||
# Since v2 of Wiki.js does not allow for dynamic addition of | ||
# custom themes you need to provide your own string there | ||
resource "wikijs_theme_config" "config" { | ||
theme = "custom_name" | ||
iconset = "mdi" | ||
dark_mode = true | ||
} | ||
# If you want to change the iconset currently the provider only supports | ||
# the builtin names: | ||
# Material Design Icons: "mdi" | ||
# Font Awesome: "fa" | ||
# Font Awesome 4: "fa4" | ||
resource "wikijs_theme_config" "config" { | ||
theme = "default" | ||
iconset = "mdi" | ||
dark_mode = false | ||
} | ||
# The provider has a builtin default theme_config that is set with the | ||
# WikiJS setup. This config will be used for any Delete and a resource | ||
# representation looks like this | ||
resource "wikijs_theme_config" "config" { | ||
theme = "default" | ||
iconset = "mdi" | ||
dark_mode = false | ||
toc_position = "left" | ||
inject_css = "" | ||
inject_head = "" | ||
inject_body = "" | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `dark_mode` (Boolean) Dark Mode. | ||
Not recommended for accessibility. | ||
May not be supported by all themes. | ||
- `iconset` (String) Set of icons to use for the sidebar navigation. | ||
Accepted values: `mdi`, `fa`, `fa4` | ||
- `theme` (String) Themes affect how content pages are displayed. | ||
Other site sections (such as the editor or admin area) are not affected. | ||
|
||
### Optional | ||
|
||
- `inject_body` (String) HTML code to be injected just before the closing body tag. | ||
- `inject_css` (String) CSS code to inject after system default CSS. | ||
Consider using custom themes if you have a large amount of css code. | ||
Injecting too much CSS code will result in poor page load performance! | ||
CSS will automatically be minified. | ||
|
||
**CAUTION**: When adding styles for page content, you must scope them to the `.contents` class. | ||
Omitting this could break the layout of the editor! | ||
- `inject_head` (String) HTML code to be injected just before the closing head tag. Usually for script tags. | ||
- `toc_position` (String) Select whether the table of contents is shown on the left, right or not at all. | ||
Accepted values: `left`, `right`, `off` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This data_source can be useful if you want to change only one of the | ||
# required theme configs but don't want to change the rest | ||
|
||
# Notice that this data source does not take any arguments | ||
data "wikijs_theme_config" "config" {} | ||
|
||
resource "wikijs_theme_config" "config" { | ||
theme = data.wikijs_theme_config.config.theme | ||
iconset = data.wikijs_theme_config.data.iconset | ||
# Only switch dark mode globally on | ||
dark_mode = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This data source currently only returns a list with one item | ||
# The themes query is hardcoded to only respond with the default | ||
# theme in v2 | ||
|
||
data "wikijs_themes" "themes_list" { | ||
themes = [] | ||
} | ||
|
||
# You could use it to reset the theme but it seems easier to just | ||
# write "default" | ||
resource "wikijs_theme_config" "theme_config" { | ||
theme = data.wikijs_themes.themes_list[0].key | ||
iconset = "mdi" | ||
dark_mode = false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# The following example shows how to configure the wikijs theme | ||
# Since v2 of Wiki.js does not allow for dynamic addition of | ||
# custom themes you need to provide your own string there | ||
|
||
resource "wikijs_theme_config" "config" { | ||
theme = "custom_name" | ||
iconset = "mdi" | ||
dark_mode = true | ||
} | ||
|
||
# If you want to change the iconset currently the provider only supports | ||
# the builtin names: | ||
# Material Design Icons: "mdi" | ||
# Font Awesome: "fa" | ||
# Font Awesome 4: "fa4" | ||
|
||
resource "wikijs_theme_config" "config" { | ||
theme = "default" | ||
iconset = "mdi" | ||
dark_mode = false | ||
} | ||
|
||
# The provider has a builtin default theme_config that is set with the | ||
# WikiJS setup. This config will be used for any Delete and a resource | ||
# representation looks like this | ||
|
||
resource "wikijs_theme_config" "config" { | ||
theme = "default" | ||
iconset = "mdi" | ||
dark_mode = false | ||
toc_position = "left" | ||
inject_css = "" | ||
inject_head = "" | ||
inject_body = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.