-
Notifications
You must be signed in to change notification settings - Fork 379
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
[graph-editor] Add support for WidgetCustomLink is_hidden
and override_label
properties
#1062
Changes from all commits
818f814
7c13054
c5c8986
3e43898
452045b
e63eed4
9a8c248
867441f
42e231b
3b1d57b
5353998
f4272e2
eefcad3
eeae881
0c1cbc7
fba61d5
642e29f
da9d56a
ef4b70b
bb90c45
23fb7d3
3f3906d
91e01c7
670dee8
814c53a
5edf648
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5953,35 +5953,64 @@ func getWidgetCustomLinkSchema() map[string]*schema.Schema { | |
"label": { | ||
Description: "The label for the custom link URL.", | ||
Type: schema.TypeString, | ||
Required: true, | ||
Optional: true, | ||
}, | ||
"link": { | ||
Description: "The URL of the custom link.", | ||
Type: schema.TypeString, | ||
Required: true, | ||
Optional: true, | ||
}, | ||
"is_hidden": { | ||
Description: "The flag for toggling context menu link visibility.", | ||
Type: schema.TypeBool, | ||
Optional: true, | ||
}, | ||
"override_label": { | ||
Description: "The label id that refers to a context menu link item. When override_label is provided, the client request will omit the label field.", | ||
Type: schema.TypeString, | ||
Optional: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could not use |
||
}, | ||
} | ||
} | ||
func buildDatadogWidgetCustomLinks(terraformWidgetCustomLinks *[]interface{}) *[]datadogV1.WidgetCustomLink { | ||
datadogWidgetCustomLinks := make([]datadogV1.WidgetCustomLink, len(*terraformWidgetCustomLinks)) | ||
for i, customLink := range *terraformWidgetCustomLinks { | ||
terraformCustomLink := customLink.(map[string]interface{}) | ||
datadogWidgetCustomLink := datadogV1.WidgetCustomLink{ | ||
Label: datadogV1.PtrString(terraformCustomLink["label"].(string)), | ||
Link: datadogV1.PtrString(terraformCustomLink["link"].(string)), | ||
datadogWidgetCustomLink := datadogV1.WidgetCustomLink{} | ||
if v, ok := terraformCustomLink["override_label"].(string); ok && len(v) > 0 { | ||
datadogWidgetCustomLink.SetOverrideLabel(v) | ||
} | ||
// if override_label is provided, the label field will be omitted. | ||
if v, ok := terraformCustomLink["label"].(string); ok && len(v) > 0 && !datadogWidgetCustomLink.HasOverrideLabel() { | ||
datadogWidgetCustomLink.SetLabel(v) | ||
} | ||
if v, ok := terraformCustomLink["is_hidden"].(bool); ok && v && datadogWidgetCustomLink.HasOverrideLabel() { | ||
datadogWidgetCustomLink.SetIsHidden(v) | ||
} | ||
if v, ok := terraformCustomLink["link"].(string); ok && len(v) > 0 { | ||
datadogWidgetCustomLink.SetLink(v) | ||
} | ||
datadogWidgetCustomLinks[i] = datadogWidgetCustomLink | ||
} | ||
return &datadogWidgetCustomLinks | ||
} | ||
func buildTerraformWidgetCustomLinks(datadogWidgetCustomLinks *[]datadogV1.WidgetCustomLink) *[]map[string]string { | ||
terraformWidgetCustomLinks := make([]map[string]string, len(*datadogWidgetCustomLinks)) | ||
func buildTerraformWidgetCustomLinks(datadogWidgetCustomLinks *[]datadogV1.WidgetCustomLink) *[]map[string]interface{} { | ||
terraformWidgetCustomLinks := make([]map[string]interface{}, len(*datadogWidgetCustomLinks)) | ||
for i, customLink := range *datadogWidgetCustomLinks { | ||
terraformWidgetCustomLink := map[string]string{} | ||
// Required params | ||
terraformWidgetCustomLink["label"] = customLink.GetLabel() | ||
terraformWidgetCustomLink["link"] = customLink.GetLink() | ||
|
||
terraformWidgetCustomLink := map[string]interface{}{} | ||
// Optional params | ||
if v, ok := customLink.GetLabelOk(); ok { | ||
terraformWidgetCustomLink["label"] = *v | ||
} | ||
if v, ok := customLink.GetLinkOk(); ok { | ||
terraformWidgetCustomLink["link"] = *v | ||
} | ||
if v, ok := customLink.GetOverrideLabelOk(); ok { | ||
terraformWidgetCustomLink["override_label"] = *v | ||
} | ||
if v, ok := customLink.GetIsHiddenOk(); ok { | ||
terraformWidgetCustomLink["is_hidden"] = *v | ||
} | ||
terraformWidgetCustomLinks[i] = terraformWidgetCustomLink | ||
} | ||
return &terraformWidgetCustomLinks | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2021-03-12T17:13:32.763037-05:00 | ||
2021-06-07T14:52:21.726734-04:00 |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2021-03-12T17:13:30.199134-05:00 | ||
2021-06-07T14:52:21.732309-04:00 |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2021-03-12T17:13:16.636793-05:00 | ||
2021-06-07T14:56:00.068169-04:00 |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2021-04-27T08:58:27.619933+02:00 | ||
2021-06-07T14:56:00.068244-04:00 |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2021-04-27T08:58:27.620391+02:00 | ||
2021-06-07T14:56:00.071311-04:00 |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2021-03-12T17:13:16.615202-05:00 | ||
2021-06-07T14:56:00.068519-04:00 |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2021-03-12T17:13:16.548459-05:00 | ||
2021-06-07T14:57:35.765228-04:00 |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2021-03-12T17:13:16.46456-05:00 | ||
2021-06-07T14:57:35.765637-04:00 |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2021-03-12T17:13:15.820444-05:00 | ||
2021-06-07T14:59:48.602905-04:00 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the most part it looks good to me. The perpetual diff when both are set might be something we have to live with. Not sure of any viable/clean workarounds unless the rest of the team has any ideas. Could you also add a tests for the new fields please. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skarimo what causes the perpetual diff ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chatted outside of the Github issue but to close the loop here, the perpetual diff is caused when both
label
andlabel_override
is set.We can keep the behavior as is but let's document that both fields should not be set at the same time.