Explorar o código

Link to vendor check (#4244)

ianedwards %!s(int64=2) %!d(string=hai) anos
pai
achega
d1e74d97a8

+ 4 - 2
dashboard/src/main/home/compliance-dashboard/VendorChecksList.tsx

@@ -213,8 +213,10 @@ export const VendorChecksList: React.FC = () => {
                 }}
                 additionalStyles=":hover { text-decoration: underline }"
                 onClick={() => {
-                  window.open("https://app.vanta.com", "_blank");
-                  // window.open(check.link, "_blank");
+                  window.open(
+                    `https://app.vanta.com/tests/${check.vendor_check_id}`,
+                    "_blank"
+                  );
                 }}
               >
                 {check.check}

+ 1 - 1
dashboard/src/main/home/compliance-dashboard/types.ts

@@ -12,7 +12,7 @@ export const vendorCheckValidator = z.object({
   check_group: z.string(),
   status: z.enum(["passed", "failing", "not_applicable"]),
   reason: z.string(),
-  link: z.string().optional(),
+  vendor_check_id: z.string(),
 });
 export type VendorCheck = z.infer<typeof vendorCheckValidator>;
 

+ 1 - 1
go.mod

@@ -83,7 +83,7 @@ require (
 	github.com/matryer/is v1.4.0
 	github.com/nats-io/nats.go v1.24.0
 	github.com/open-policy-agent/opa v0.44.0
-	github.com/porter-dev/api-contracts v0.2.98
+	github.com/porter-dev/api-contracts v0.2.99
 	github.com/riandyrn/otelchi v0.5.1
 	github.com/santhosh-tekuri/jsonschema/v5 v5.0.1
 	github.com/stefanmcshane/helm v0.0.0-20221213002717-88a4a2c6e77d

+ 2 - 2
go.sum

@@ -1523,8 +1523,8 @@ github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 github.com/polyfloyd/go-errorlint v0.0.0-20210722154253-910bb7978349/go.mod h1:wi9BfjxjF/bwiZ701TzmfKu6UKC357IOAtNr0Td0Lvw=
-github.com/porter-dev/api-contracts v0.2.98 h1:bfOmR9SfspEDkO72TF+YewGKvIpW9ZhcC6Nzpt1I9EI=
-github.com/porter-dev/api-contracts v0.2.98/go.mod h1:fX6JmP5QuzxDLvqP3evFOTXjI4dHxsG0+VKNTjImZU8=
+github.com/porter-dev/api-contracts v0.2.99 h1:eHzYSwacLEV5Di2boCnuv8ddoxzvaNCORAD0VOibOBU=
+github.com/porter-dev/api-contracts v0.2.99/go.mod h1:fX6JmP5QuzxDLvqP3evFOTXjI4dHxsG0+VKNTjImZU8=
 github.com/porter-dev/switchboard v0.0.3 h1:dBuYkiVLa5Ce7059d6qTe9a1C2XEORFEanhbtV92R+M=
 github.com/porter-dev/switchboard v0.0.3/go.mod h1:xSPzqSFMQ6OSbp42fhCi4AbGbQbsm6nRvOkrblFeXU4=
 github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=

+ 7 - 4
internal/compliance/convert.go

@@ -31,6 +31,8 @@ type VendorComplianceCheck struct {
 	Status VendorComplianceCheckStatus `json:"status"`
 	// Reason is a message indicating why the check is in its current state.
 	Reason string `json:"reason"`
+	// VendorCheckID is the unique identifier for the check from the vendor.
+	VendorCheckID string `json:"vendor_check_id"`
 }
 
 // CheckGroupStatus is the status for a check group
@@ -118,10 +120,11 @@ func VendorCheckGroupsFromProto(ctx context.Context, vendorCheck []*porterv1.Ven
 		}
 
 		res = append(res, VendorComplianceCheck{
-			Check:      vc.Description,
-			CheckGroup: vc.CheckGroup,
-			Status:     status,
-			Reason:     vc.Reason,
+			Check:         vc.Description,
+			CheckGroup:    vc.CheckGroup,
+			Status:        status,
+			Reason:        vc.Reason,
+			VendorCheckID: vc.VendorCheckId,
 		})
 	}