Skip to content

Commit

Permalink
Add support for 'legend_layout' and 'legend_columns' (#56)
Browse files Browse the repository at this point in the history
* Add support for 'legend_layout' and 'legend_columns'

* Update example

* Version bump to 3.6.0
  • Loading branch information
laurmurclar authored Mar 22, 2021
1 parent 929523c commit 01f32fd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 42 deletions.
15 changes: 10 additions & 5 deletions __tests__/__snapshots__/dashboard-converter.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ timeseries_definition {
title = \\"\\"
title_size = \\"16\\"
title_align = \\"left\\"
show_legend = false
show_legend = true
legend_layout = \\"vertical\\"
legend_columns = [\\"avg\\",\\"min\\",\\"max\\",\\"value\\",\\"sum\\"]
request {
q = \\"avg:system.cpu.user{*}\\"
style {
Expand Down Expand Up @@ -104,6 +106,7 @@ timeseries_definition {
title = \\"\\"
title_size = \\"16\\"
title_align = \\"left\\"
show_legend = false
request {
log_query {
index = \\"*\\"
Expand Down Expand Up @@ -180,6 +183,8 @@ title = \\"CPU for past day\\"
title_size = \\"16\\"
title_align = \\"left\\"
show_legend = false
legend_layout = \\"vertical\\"
legend_columns = [\\"avg\\",\\"min\\",\\"max\\",\\"value\\",\\"sum\\"]
live_span = \\"1d\\"
request {
q = \\"avg:system.cpu.user{*}\\"
Expand Down Expand Up @@ -244,8 +249,8 @@ palette_flip = false
}
widget {
widget_layout {
x = 25
y = 5
x = 64
y = 40
width = 61
height = 25
}
Expand All @@ -263,8 +268,8 @@ sort = \\"triggered,desc\\"
}
widget {
widget_layout {
x = 117
y = 5
x = 101
y = 1
width = 20
height = 25
}
Expand Down
4 changes: 2 additions & 2 deletions app/dashboard-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ const WIDGET_DEFINTION = {
show_resource_list: (v) => assignmentString("show_resource_list", v),
size_format: (v) => assignmentString("size_format", v),
widget_layout: (v) => block("widget_layout", v, assignmentString),
legend_layout: (_) => "",
legend_columns: (_) => "",
legend_layout: (v) => assignmentString("legend_layout", v),
legend_columns: (v) => assignmentString("legend_columns", v),
global_time_target: (_) => "",
count: (_) => "", // 2.23.0 deprecated, see docs for widget.manage_status_definition
start: (_) => "", // 2.23.0 deprecated, see docs for widget.manage_status_definition
Expand Down
2 changes: 1 addition & 1 deletion app/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Datadog-to-Terraform Converter",
"version": "3.5.5",
"version": "3.6.0",
"description": "Converts Datadog resource JSON into Terraform alarm code.",
"manifest_version": 2,
"browser_action": {
Expand Down
44 changes: 10 additions & 34 deletions examples/screenboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"title": "",
"title_size": "16",
"title_align": "left",
"show_legend": false,
"show_legend": true,
"legend_layout": "vertical",
"legend_columns": ["avg", "min", "max", "value", "sum"],
"type": "timeseries",
Expand Down Expand Up @@ -38,33 +38,27 @@
}
},
{
"id": 6396751932460267,
"id": 3919926419925456,
"layout": { "x": 3, "y": 17, "width": 47, "height": 15 },
"definition": {
"title": "",
"title_size": "16",
"title_align": "left",
"show_legend": false,
"type": "timeseries",
"requests": [
{
"log_query": {
"index": "*",
"search": {
"query": "status:(error OR emergency)"
},
"search": { "query": "status:(error OR emergency)" },
"group_by": [
{
"facet": "service",
"sort": {
"order": "desc",
"aggregation": "count"
},
"sort": { "order": "desc", "aggregation": "count" },
"limit": 10
}
],
"compute": {
"aggregation": "count"
}
"compute": { "aggregation": "count" }
},
"style": {
"palette": "dog_classic",
Expand Down Expand Up @@ -167,12 +161,7 @@
},
{
"id": 7056070493549668,
"layout": {
"x": 25,
"y": 5,
"width": 61,
"height": 25
},
"layout": { "x": 64, "y": 40, "width": 61, "height": 25 },
"definition": {
"title_size": "13",
"title_align": "left",
Expand All @@ -190,12 +179,7 @@
},
{
"id": 6280236466557720,
"layout": {
"x": 117,
"y": 5,
"width": 20,
"height": 25
},
"layout": { "x": 101, "y": 1, "width": 20, "height": 25 },
"definition": {
"type": "note",
"content": "` Shared Dashbords`\nhttps://app.datadoghq.com/dashboard/ezf-tjt-xcx",
Expand All @@ -211,12 +195,7 @@
},
{
"id": 1177803908467722,
"layout": {
"x": 968,
"y": -242,
"width": 33,
"height": 21
},
"layout": { "x": 968, "y": -242, "width": 33, "height": 21 },
"definition": {
"title": "Plugins",
"title_size": "13",
Expand All @@ -225,10 +204,7 @@
"logset": "",
"indexes": [],
"query": "$dd_env $app_group status:(error OR emergency)",
"sort": {
"column": "service",
"order": "desc"
},
"sort": { "column": "service", "order": "desc" },
"show_date_column": true,
"show_message_column": true,
"message_display": "expanded-md"
Expand Down

0 comments on commit 01f32fd

Please sign in to comment.