Skip to content

Commit

Permalink
feat: fixed linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
demeyerthom committed Feb 18, 2025
1 parent b0481f3 commit f771018
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .changes/unreleased/Added-20250218-090151.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Added
body: Added additional fields to component resource
time: 2025-02-18T09:01:51.133547493+01:00
21 changes: 21 additions & 0 deletions docs/resources/component.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,43 +202,64 @@ Required:
Optional:

- `add_https` (Boolean) Prepends https: to stop usage of relative protocol
- `allow_advanced_search` (Boolean) Allows advanced search in option fields
- `allow_custom_attributes` (Boolean) Enables custom attributes in links for richtext or multilink fields
- `allow_external_url` (Boolean) Allows external URLs in asset or multiasset fields
- `allow_multiline` (Boolean) Enables empty paragraphs in markdown fields
- `allow_target_blank` (Boolean) Allows to open links in a new tab for Richtext; Default: false
- `asset_folder_id` (Number) Default asset folder numeric id to store uploaded image of that field
- `asset_link_type` (Boolean) Allows assets in multilink fields
- `can_sync` (Boolean) Advanced usage to sync with field in preview; Default: false
- `component_group_whitelist` (List of String) Array of group UUIDs for restricting components in bloks fields
- `component_tag_whitelist` (List of Number) Array of tag IDs for restricting components in bloks fields
- `component_whitelist` (List of String) Array of component/content type names: ["post","page","product"]. Only for type: bloks, multilink, and richtext (for nestable bloks inside that)
- `conditional_settings` (Attributes List) Array containing the object with information about conditions set on the field (see [below for nested schema](#nestedatt--schema--conditional_settings))
- `customize_toolbar` (Boolean) Allow to customize the Markdown or Richtext toolbar; Default: false
- `datasource_slug` (String) Define selectable datasources string; Effects editor only if source=internal
- `decimals` (Number) Number of decimal places for number fields
- `default_value` (String) Default value for the field; Can be an escaped JSON object
- `description` (String) Description shown in the editor interface
- `disable_time` (Boolean) Disables time selection from date picker; Default: false
- `display_name` (String) Display name shown in the editor interface
- `email_link_type` (Boolean) Allows email links in multilink fields
- `entry_appearance` (String) Appearance of an option (link or card) in an option field
- `exclude_empty_option` (Boolean) Hides empty options in option fields
- `exclude_from_merge` (Boolean) Excludes a blok from merge actions (Dimensions App).
- `exclude_from_overwrite` (Boolean) Excludes a blok from overwrite actions (Dimensions App).
- `external_datasource` (String) Define external datasource JSON Url; Effects editor only if source=external
- `field_type` (String) Name of the custom field type plugin
- `filetypes` (List of String) Array of file type names: ["images", "videos", "audios", "texts"]
- `filter_content_type` (List of String) An array of content types that can be selected in a option or options field where source is internal_stories: ["post", "faq_item"]
- `folder_slug` (String) Filter on selectable stories path; Effects editor only if source=internal_stories; In case you have a multi-language folder structure you can add the '{0}' placeholder and the path will be adapted dynamically. Examples: "{0}/categories/", {0}/{1}/categories/
- `force_link_scope` (Boolean) Force link scope to be internal_stories; Default: false
- `force_merge` (Boolean) Forces overwriting a blok during a merge action (Dimensions App).
- `image_crop` (Boolean) Activate force crop for images: (true/false)
- `image_height` (String) Define height in px or height ratio if keep_image_size is enabled
- `image_width` (String) Define width in px or width ratio if keep_image_size is enabled
- `inline_label` (Boolean) Makes the label of a boolean field inline
- `is_reference_type` (Boolean) True if the options field is of type reference
- `keep_image_size` (Boolean) Keep original size: (true/false)
- `keys` (List of String) Array of field keys to include in this section
- `link_scope` (String) A path to a folder to restrict the link scope
- `max_length` (Number) Set the max length of the input string
- `max_options` (Number) Maximum amount of options for this options field
- `max_value` (Number) Maximum value for number fields
- `maximum` (Number) Maximum amount of added bloks in this blok field
- `min_options` (Number) Minimum amount of options for this options field
- `min_value` (Number) Minimum value for number fields
- `minimum` (Number) Minimum amount of added bloks in this blok field
- `no_translate` (Boolean) Should be excluded in translation export
- `options` (Attributes List) Array of datasource entries [{name:"", value:""}]; Effects editor only if source=undefined (see [below for nested schema](#nestedatt--schema--options))
- `regex` (String) Client Regex validation for the field
- `required` (Boolean) Is field required; Default: false
- `restrict_components` (Boolean) Activate restriction nestable component option; Default: false
- `restrict_content_types` (Boolean) Activate restriction content type option
- `restrict_type` (String) Restricts the type of components used in bloks fields (e.g., tags, groups).
- `rich_markdown` (Boolean) Enable rich markdown view by default (true/false)
- `rtl` (Boolean) Enable global RTL for this field
- `show_anchor` (Boolean) Enables anchor field for internal links in multilink fields
- `source` (String) Possible values: undefined: Self; internal_stories: Stories; internal: Datasource; external: API Endpoint in Datasource Entries Array Format
- `steps` (Number) Step interval for number fields
- `toolbar` (List of String) Array of toolbar keys to include in the Richtext or Markdown toolbar
- `tooltip` (Boolean) Show the description as a tooltip
- `translatable` (Boolean) Can field be translated; Default: false
Expand Down
1 change: 0 additions & 1 deletion internal/asset_folder_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ func (r *assetFolderResource) Delete(ctx context.Context, req resource.DeleteReq
)
return
}

}

func (r *assetFolderResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
Expand Down
4 changes: 3 additions & 1 deletion internal/asset_folder_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import (

func TestAssetFolderResourceBasic(t *testing.T) {
f, stop := ProviderFactories("./assets/asset_folder")
defer stop()
defer func() {
_ = stop()
}()

id := "test"
rn := fmt.Sprintf("storyblok_asset_folder.%s", id)
Expand Down
2 changes: 0 additions & 2 deletions internal/component_group_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ type componentGroupResourceModel struct {
}

func (m *componentGroupResourceModel) toCreateInput() sbmgmt.ComponentGroupCreateInput {

return sbmgmt.ComponentGroupCreateInput{
ComponentGroup: sbmgmt.ComponentGroupBase{
Name: m.Name.ValueString(),
},
}
}
func (m *componentGroupResourceModel) toUpdateInput() sbmgmt.ComponentGroupUpdateInput {

return sbmgmt.ComponentGroupUpdateInput{
ComponentGroup: sbmgmt.ComponentGroupBase{
Name: m.Name.ValueString(),
Expand Down
4 changes: 3 additions & 1 deletion internal/component_group_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import (

func TestComponentGroupResourceBasic(t *testing.T) {
f, stop := ProviderFactories("./assets/component_group")
defer stop()
defer func() {
_ = stop()
}()

id := "test"
rn := fmt.Sprintf("storyblok_component_group.%s", id)
Expand Down
4 changes: 0 additions & 4 deletions internal/component_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ type optionModel struct {
}

func (m *componentResourceModel) toRemoteInput() sbmgmt.ComponentCreateInput {

raw := make(map[string]sbmgmt.FieldInput, len(m.Schema))
for name := range m.Schema {
item := m.Schema[name]
Expand Down Expand Up @@ -154,7 +153,6 @@ func (m *componentResourceModel) toRemoteInput() sbmgmt.ComponentCreateInput {
}
}
func (m *componentResourceModel) toUpdateInput() sbmgmt.ComponentUpdateInput {

raw := make(map[string]sbmgmt.FieldInput, len(m.Schema))
for name := range m.Schema {
item := m.Schema[name]
Expand Down Expand Up @@ -491,7 +489,6 @@ func serializeModifications(modifications *[]sbmgmt.Modification) []modification
return serializedModifications
}
func serializeRuleConditions(ruleConditions *[]sbmgmt.RuleCondition) []ruleConditionModel {

if ruleConditions == nil {
return nil
}
Expand Down Expand Up @@ -519,7 +516,6 @@ func deserializeConditionalSettings(conditionalSettings []conditionalSettingsMod
deserializedConditionalSettings := make([]sbmgmt.ConditionalSettings, len(conditionalSettings))

for i, setting := range conditionalSettings {

deserializedConditionalSettings[i] = sbmgmt.ConditionalSettings{
RuleMatch: (*sbmgmt.ConditionalSettingsRuleMatch)(setting.RuleMatch.ValueStringPointer()),
Modifications: deserializeConditionalSettingsModificationsModel(setting.Modifications),
Expand Down
1 change: 0 additions & 1 deletion internal/component_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,6 @@ func (r *componentResource) Delete(ctx context.Context, req resource.DeleteReque
)
return
}

}

func (r *componentResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
Expand Down
4 changes: 3 additions & 1 deletion internal/component_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import (

func TestComponentResourceBasic(t *testing.T) {
f, stop := ProviderFactories("./assets/component")
defer stop()
defer func() {
_ = stop()
}()

id := "test"
rn := fmt.Sprintf("storyblok_component.%s", id)
Expand Down
1 change: 0 additions & 1 deletion internal/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ func TestProvider(t *testing.T) {
p := New()

assert.NotNil(t, p)

}
1 change: 0 additions & 1 deletion internal/space_role_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func (m *spaceRoleResourceModel) toCreateInput() sbmgmt.SpaceRoleCreateInput {
}
}
func (m *spaceRoleResourceModel) toUpdateInput() sbmgmt.SpaceRoleUpdateInput {

return sbmgmt.SpaceRoleUpdateInput{
SpaceRole: &sbmgmt.SpaceRoleBase{
AllowedLanguages: utils.ConvertToPointerStringSlice(m.AllowedLanguages),
Expand Down
4 changes: 3 additions & 1 deletion internal/space_role_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import (

func TestSpaceRoleResourceBasic(t *testing.T) {
f, stop := ProviderFactories("./assets/space_role")
defer stop()
defer func() {
_ = stop()
}()

id := "test"
rn := fmt.Sprintf("storyblok_space_role.%s", id)
Expand Down
1 change: 0 additions & 1 deletion internal/webhook/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ func (r *webhookResource) Delete(ctx context.Context, req resource.DeleteRequest
)
return
}

}

func (r *webhookResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
Expand Down

0 comments on commit f771018

Please sign in to comment.