Skip to content

Commit d358c19

Browse files
authored
Merge pull request #257 from port-labs/dlvhdr/devbox-and-widget-blueprint
PORT-14153 feat: add blueprint to widget example
2 parents c949524 + f32561d commit d358c19

File tree

4 files changed

+44
-33
lines changed

4 files changed

+44
-33
lines changed

docs/resources/port_page.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,16 @@ description: |-
1818
title = "Microservices"
1919
type = "blueprint-entities"
2020
icon = "Microservice"
21-
blueprint = portblueprint.base_blueprint.identifier
21+
blueprint = portblueprint.baseblueprint.identifier
2222
widgets = [
2323
jsonencode(
2424
{
2525
"id" : "microservice-table-entities",
2626
"type" : "table-entities-explorer",
27+
"blueprint": portblueprint.base_blueprint.identifier,
2728
"dataset" : {
2829
"combinator" : "and",
2930
"rules" : [
30-
{
31-
"operator" : "=",
32-
"property" : "$blueprint",
33-
"value" : {{blueprint}}
34-
}
3531
]
3632
}
3733
}
@@ -241,14 +237,10 @@ resource "port_page" "microservice_blueprint_page" {
241237
{
242238
"id" : "microservice-table-entities",
243239
"type" : "table-entities-explorer",
240+
"blueprint": port_blueprint.base_blueprint.identifier,
244241
"dataset" : {
245242
"combinator" : "and",
246243
"rules" : [
247-
{
248-
"operator" : "=",
249-
"property" : "$blueprint",
250-
"value" : "{{blueprint}}"
251-
}
252244
]
253245
}
254246
}

examples/resources/port_page/main.tf

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
resource "port_blueprint" "microservice" {
2+
identifier = "microservice"
3+
title = "Microsvc from Port TF Examples"
4+
icon = "Terraform"
5+
description = ""
6+
properties = {
7+
string_props = {
8+
url = {
9+
type = "string"
10+
}
11+
author = {
12+
icon = "github"
13+
required = true
14+
min_length = 1
15+
max_length = 10
16+
default = "default"
17+
enum = ["default", "default2"]
18+
pattern = "^[a-zA-Z0-9]*$"
19+
format = "user"
20+
enum_colors = {
21+
default = "red"
22+
default2 = "green"
23+
}
24+
}
25+
}
26+
}
27+
}
28+
129
resource "port_page" "microservice_dashboard_page" {
230
identifier = "microservice_dashboard_page"
331
title = "Microservices"
@@ -12,7 +40,7 @@ resource "port_page" "microservice_dashboard_page" {
1240
"height" = 400,
1341
"columns" = [
1442
{
15-
"id" = "microserviceGuide",
43+
"id" = "microservice-table-entities",
1644
"size" = 12
1745
}
1846
]
@@ -21,12 +49,14 @@ resource "port_page" "microservice_dashboard_page" {
2149
"type" = "dashboard-widget",
2250
"widgets" = [
2351
{
24-
"title" = "Microservices Guide",
25-
"icon" = "BlankPage",
26-
"markdown" = "# This is the new Microservice Dashboard",
27-
"type" = "markdown",
28-
"description" = "",
29-
"id" = "microserviceGuide"
52+
"id" : "microservice-table-entities",
53+
"type" : "table-entities-explorer",
54+
"blueprint" : port_blueprint.microservice.identifier,
55+
"dataset" : {
56+
"combinator" : "and",
57+
"rules" : [
58+
]
59+
}
3060
}
3161
],
3262
}

port/page/resource_test.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"testing"
88

99
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
10+
1011
"github.com/port-labs/terraform-provider-port-labs/v2/internal/acctest"
1112
"github.com/port-labs/terraform-provider-port-labs/v2/internal/utils"
1213
)
@@ -49,14 +50,10 @@ resource "port_page" "microservice_blueprint_page" {
4950
{
5051
"id" : "blabla",
5152
"type" : "table-entities-explorer",
53+
"blueprint" : port_blueprint.microservice.identifier,
5254
"dataset" : {
5355
"combinator" : "and",
5456
"rules" : [
55-
{
56-
"operator" : "=",
57-
"property" : "$blueprint",
58-
"value" : "{{blueprint}}"
59-
}
6057
]
6158
}
6259
}
@@ -104,14 +101,10 @@ resource "port_page" "microservice_blueprint_page" {
104101
{
105102
"id" : "blabla",
106103
"type" : "table-entities-explorer",
104+
"blueprint" : port_blueprint.microservice.identifier,
107105
"dataset" : {
108106
"combinator" : "and",
109107
"rules" : [
110-
{
111-
"operator" : "=",
112-
"property" : "$blueprint",
113-
"value" : "{{blueprint}}"
114-
}
115108
]
116109
}
117110
}

port/page/schema.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,10 @@ resource "port_page" "microservice_blueprint_page" {
143143
{
144144
"id" : "microservice-table-entities",
145145
"type" : "table-entities-explorer",
146+
"blueprint": port_blueprint.base_blueprint.identifier,
146147
"dataset" : {
147148
"combinator" : "and",
148149
"rules" : [
149-
{
150-
"operator" : "=",
151-
"property" : "$blueprint",
152-
"value" : ` + "{{`\"{{blueprint}}\"`}}" + `
153-
}
154150
]
155151
}
156152
}

0 commit comments

Comments
 (0)