Skip to content

Commit

Permalink
fixed the schema and refreshActionState
Browse files Browse the repository at this point in the history
  • Loading branch information
pazhersh committed Nov 15, 2023
1 parent ad683b7 commit ba3aec6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion port/action/refreshActionState.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ func writeVisibleToResource(v cli.ActionProperty) (types.Bool, types.String) {
jqQueryValue := jq["jqQuery"].(string)
return types.BoolNull(), flex.GoStringToFramework(&jqQueryValue)
}

return types.BoolNull(), types.StringNull()
}

func writeInputsToResource(ctx context.Context, a *cli.Action, state *ActionModel) error {
Expand Down Expand Up @@ -254,7 +256,7 @@ func refreshActionState(ctx context.Context, state *ActionModel, a *cli.Action,
}

func setCommonProperties(ctx context.Context, v cli.ActionProperty, prop interface{}) error {
properties := []string{"Description", "Icon", "Default", "Title", "DependsOn", "Dataset"}
properties := []string{"Description", "Icon", "Default", "Title", "DependsOn", "Dataset", "Visible"}
for _, property := range properties {
switch property {
case "Description":
Expand Down
10 changes: 5 additions & 5 deletions port/action/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ func StringPropertySchema() schema.Attribute {
MarkdownDescription: "The visibility condition jq query of the string property",
Optional: true,
Validators: []validator.String{
stringvalidator.ConflictsWith(path.MatchRelative().AtParent().AtName("enum")),
stringvalidator.ConflictsWith(path.MatchRelative().AtParent().AtName("visible")),
},
},
}
Expand Down Expand Up @@ -391,7 +391,7 @@ func NumberPropertySchema() schema.Attribute {
MarkdownDescription: "The visibility condition jq query of the number property",
Optional: true,
Validators: []validator.String{
stringvalidator.ConflictsWith(path.MatchRelative().AtParent().AtName("enum")),
stringvalidator.ConflictsWith(path.MatchRelative().AtParent().AtName("visible")),
},
},
}
Expand Down Expand Up @@ -427,7 +427,7 @@ func BooleanPropertySchema() schema.Attribute {
MarkdownDescription: "The visibility condition jq query of the boolean property",
Optional: true,
Validators: []validator.String{
stringvalidator.ConflictsWith(path.MatchRelative().AtParent().AtName("enum")),
stringvalidator.ConflictsWith(path.MatchRelative().AtParent().AtName("visible")),
},
},
}
Expand Down Expand Up @@ -470,7 +470,7 @@ func ObjectPropertySchema() schema.Attribute {
MarkdownDescription: "The visibility condition jq query of the object property",
Optional: true,
Validators: []validator.String{
stringvalidator.ConflictsWith(path.MatchRelative().AtParent().AtName("enum")),
stringvalidator.ConflictsWith(path.MatchRelative().AtParent().AtName("visible")),
},
},
}
Expand Down Expand Up @@ -602,7 +602,7 @@ func ArrayPropertySchema() schema.Attribute {
MarkdownDescription: "The visibility condition jq query of the array property",
Optional: true,
Validators: []validator.String{
stringvalidator.ConflictsWith(path.MatchRelative().AtParent().AtName("enum")),
stringvalidator.ConflictsWith(path.MatchRelative().AtParent().AtName("visible")),
},
},
}
Expand Down

0 comments on commit ba3aec6

Please sign in to comment.