From ebcd7c0bb54b0c29cbe06c3653d14e8142c8b96a Mon Sep 17 00:00:00 2001
From: Eric <menwe@amazon.com>
Date: Wed, 8 Nov 2023 21:31:21 +0000
Subject: [PATCH] Revert "Fix integration labeling to identify S3 integrations
 (#1157) (#1164)"

This reverts commit 9de9aea11496408178f6a6c0a4ea8e5320262cdb.

Signed-off-by: Eric <menwe@amazon.com>
---
 .../available_integration_overview_page.tsx   | 20 ++++++++++++++-----
 .../repository/apache/apache-1.0.0.json       |  2 +-
 .../aws_cloudfront/aws_cloudfront-1.0.0.json  |  2 +-
 .../aws_cloudtrail/aws_cloudtrail-1.0.0.json  |  2 +-
 .../repository/aws_elb/aws_elb-1.0.0.json     |  2 +-
 .../repository/aws_rds/aws_rds-1.0.0.json     |  2 +-
 .../repository/aws_s3/aws_s3-1.0.0.json       |  2 +-
 .../aws_vpc_flow/aws_vpc_flow-1.0.0.json      |  2 +-
 .../repository/aws_waf/aws_waf-1.0.0.json     |  2 +-
 .../__data__/repository/k8s/k8s-1.0.0.json    |  2 +-
 .../repository/nginx/nginx-1.0.0.json         |  2 +-
 server/adaptors/integrations/validators.ts    |  1 -
 12 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/public/components/integrations/components/available_integration_overview_page.tsx b/public/components/integrations/components/available_integration_overview_page.tsx
index 9fc1ec9ea..cd9a8300b 100644
--- a/public/components/integrations/components/available_integration_overview_page.tsx
+++ b/public/components/integrations/components/available_integration_overview_page.tsx
@@ -117,9 +117,7 @@ export function AvailableIntegrationOverviewPage(props: AvailableIntegrationOver
     http.get(`${INTEGRATIONS_BASE}/repository`).then((exists) => {
       setData(exists.data);
 
-      let newItems = exists.data.hits.flatMap(
-        (hit: { labels?: string[] }) => hit.labels?.sort() ?? []
-      );
+      let newItems = exists.data.hits.flatMap((hit: { labels?: string[] }) => hit.labels ?? []);
       newItems = [...new Set(newItems)].sort().map((newItem) => {
         return {
           name: newItem,
@@ -184,7 +182,13 @@ export function AvailableIntegrationOverviewPage(props: AvailableIntegrationOver
         {isCardView
           ? AvailableIntegrationsCardView({
               data: {
-                hits: data.hits.filter((hit) => helper.every((tag) => hit.labels?.includes(tag))),
+                hits: data.hits.filter((hit) =>
+                  helper.every((compon) =>
+                    hit.components
+                      .map((x) => x.name.split('_').findLast(() => true))
+                      .includes(compon)
+                  )
+                ),
               },
               isCardView,
               setCardView,
@@ -196,7 +200,13 @@ export function AvailableIntegrationOverviewPage(props: AvailableIntegrationOver
           : AvailableIntegrationsTable({
               loading: false,
               data: {
-                hits: data.hits.filter((hit) => helper.every((tag) => hit.labels?.includes(tag))),
+                hits: data.hits.filter((hit) =>
+                  helper.every((compon) =>
+                    hit.components
+                      .map((x) => x.name.split('_').findLast(() => true))
+                      .includes(compon)
+                  )
+                ),
               },
               isCardView,
               setCardView,
diff --git a/server/adaptors/integrations/__data__/repository/apache/apache-1.0.0.json b/server/adaptors/integrations/__data__/repository/apache/apache-1.0.0.json
index 99fb24a16..80cbfc906 100644
--- a/server/adaptors/integrations/__data__/repository/apache/apache-1.0.0.json
+++ b/server/adaptors/integrations/__data__/repository/apache/apache-1.0.0.json
@@ -5,7 +5,7 @@
   "description": "Apache web logs collector",
   "license": "Apache-2.0",
   "type": "logs_apache",
-  "labels": ["Observability", "Logs"],
+  "labels": ["log", "communication", "http"],
   "author": "OpenSearch",
   "sourceUrl": "https://github.com/opensearch-project/dashboards-observability/tree/main/server/adaptors/integrations/__data__/repository/apache/info",
   "statics": {
diff --git a/server/adaptors/integrations/__data__/repository/aws_cloudfront/aws_cloudfront-1.0.0.json b/server/adaptors/integrations/__data__/repository/aws_cloudfront/aws_cloudfront-1.0.0.json
index 2f4d806b2..5a1c526e5 100644
--- a/server/adaptors/integrations/__data__/repository/aws_cloudfront/aws_cloudfront-1.0.0.json
+++ b/server/adaptors/integrations/__data__/repository/aws_cloudfront/aws_cloudfront-1.0.0.json
@@ -5,7 +5,7 @@
   "description": "AWS cloudfront Object Store",
   "license": "Apache-2.0",
   "type": "logs-aws_cloudfront",
-  "labels": ["Observability", "Logs", "AWS", "Cloud"],
+  "labels": ["log", "aws", "s3", "cloud", "cloudfront"],
   "author": "OpenSearch",
   "sourceUrl": "https://github.com/opensearch-project/dashboards-observability/tree/main/server/adaptors/integrations/__data__/repository/aws_cloudfront/info",
   "statics": {
diff --git a/server/adaptors/integrations/__data__/repository/aws_cloudtrail/aws_cloudtrail-1.0.0.json b/server/adaptors/integrations/__data__/repository/aws_cloudtrail/aws_cloudtrail-1.0.0.json
index 818b6e8a9..3964ae11c 100644
--- a/server/adaptors/integrations/__data__/repository/aws_cloudtrail/aws_cloudtrail-1.0.0.json
+++ b/server/adaptors/integrations/__data__/repository/aws_cloudtrail/aws_cloudtrail-1.0.0.json
@@ -5,7 +5,7 @@
   "description": "AWS CloudTrail log collector",
   "license": "Apache-2.0",
   "type": "logs-aws_cloudtrail",
-  "labels": ["Observability", "Logs", "AWS", "Flint S3", "Cloud"],
+  "labels": ["log", "aws", "s3", "cloud", "cloudtrail"],
   "author": "OpenSearch",
   "sourceUrl": "https://github.com/opensearch-project/dashboards-observability/tree/main/server/adaptors/integrations/__data__/repository/aws_cloudtrail/info",
   "statics": {
diff --git a/server/adaptors/integrations/__data__/repository/aws_elb/aws_elb-1.0.0.json b/server/adaptors/integrations/__data__/repository/aws_elb/aws_elb-1.0.0.json
index a91ee5bc9..3a8a58d29 100644
--- a/server/adaptors/integrations/__data__/repository/aws_elb/aws_elb-1.0.0.json
+++ b/server/adaptors/integrations/__data__/repository/aws_elb/aws_elb-1.0.0.json
@@ -5,7 +5,7 @@
   "description": "AWS Elastic Load Balancer collector",
   "license": "Apache-2.0",
   "type": "logs_elb",
-  "labels": ["Observability", "Logs", "AWS", "Flint S3", "Cloud"],
+  "labels": ["log", "aws", "communication", "http", "cloud", "elb", "url"],
   "author": "OpenSearch",
   "sourceUrl": "https://github.com/opensearch-project/dashboards-observability/tree/main/server/adaptors/integrations/__data__/repository/aws_elb/info",
   "statics": {
diff --git a/server/adaptors/integrations/__data__/repository/aws_rds/aws_rds-1.0.0.json b/server/adaptors/integrations/__data__/repository/aws_rds/aws_rds-1.0.0.json
index ca46d616c..c34f2697b 100644
--- a/server/adaptors/integrations/__data__/repository/aws_rds/aws_rds-1.0.0.json
+++ b/server/adaptors/integrations/__data__/repository/aws_rds/aws_rds-1.0.0.json
@@ -5,7 +5,7 @@
   "description": "AWS RDS",
   "license": "Apache-2.0",
   "type": "logs_rds",
-  "labels": ["Observability", "Logs", "AWS", "Cloud"],
+  "labels": ["log", "aws", "s3", "cloud", "rds"],
   "author": "OpenSearch",
   "sourceUrl": "https://github.com/opensearch-project/dashboards-observability/tree/main/server/adaptors/integrations/__data__/repository/aws_rds/info",
   "statics": {
diff --git a/server/adaptors/integrations/__data__/repository/aws_s3/aws_s3-1.0.0.json b/server/adaptors/integrations/__data__/repository/aws_s3/aws_s3-1.0.0.json
index c519e57b7..60a1b011d 100644
--- a/server/adaptors/integrations/__data__/repository/aws_s3/aws_s3-1.0.0.json
+++ b/server/adaptors/integrations/__data__/repository/aws_s3/aws_s3-1.0.0.json
@@ -5,7 +5,7 @@
   "description": "AWS S3 Object Store",
   "license": "Apache-2.0",
   "type": "logs_s3",
-  "labels": ["Observability", "Logs", "AWS", "Cloud"],
+  "labels": ["log", "aws", "s3", "cloud"],
   "author": "OpenSearch",
   "sourceUrl": "https://github.com/opensearch-project/dashboards-observability/tree/main/server/adaptors/integrations/__data__/repository/aws_s3/info",
   "statics": {
diff --git a/server/adaptors/integrations/__data__/repository/aws_vpc_flow/aws_vpc_flow-1.0.0.json b/server/adaptors/integrations/__data__/repository/aws_vpc_flow/aws_vpc_flow-1.0.0.json
index 24110600a..deee7d362 100644
--- a/server/adaptors/integrations/__data__/repository/aws_vpc_flow/aws_vpc_flow-1.0.0.json
+++ b/server/adaptors/integrations/__data__/repository/aws_vpc_flow/aws_vpc_flow-1.0.0.json
@@ -5,7 +5,7 @@
   "description": "AWS VPC Flow log collector",
   "license": "Apache-2.0",
   "type": "logs_vpc",
-  "labels": ["Observability", "Logs", "AWS", "Flint S3", "Cloud"],
+  "labels": ["log", "aws", "s3", "cloud", "communication", "vpc"],
   "author": "Haidong Wang",
   "sourceUrl": "https://github.com/opensearch-project/dashboards-observability/tree/main/server/adaptors/integrations/__data__/repository/aws_vpc_flow/info",
   "statics": {
diff --git a/server/adaptors/integrations/__data__/repository/aws_waf/aws_waf-1.0.0.json b/server/adaptors/integrations/__data__/repository/aws_waf/aws_waf-1.0.0.json
index 2075aecf6..1b1171eb9 100644
--- a/server/adaptors/integrations/__data__/repository/aws_waf/aws_waf-1.0.0.json
+++ b/server/adaptors/integrations/__data__/repository/aws_waf/aws_waf-1.0.0.json
@@ -5,7 +5,7 @@
   "description": "AWS waf log collector",
   "license": "Apache-2.0",
   "type": "logs_waf",
-  "labels": ["Observability", "Logs", "AWS", "Cloud"],
+  "labels": ["log", "aws", "s3", "cloud", "waf"],
   "author": "OpenSearch",
   "sourceUrl": "https://github.com/opensearch-project/dashboards-observability/tree/main/server/adaptors/integrations/__data__/repository/aws_waf/info",
   "statics": {
diff --git a/server/adaptors/integrations/__data__/repository/k8s/k8s-1.0.0.json b/server/adaptors/integrations/__data__/repository/k8s/k8s-1.0.0.json
index d359ffe8e..7454b25a9 100644
--- a/server/adaptors/integrations/__data__/repository/k8s/k8s-1.0.0.json
+++ b/server/adaptors/integrations/__data__/repository/k8s/k8s-1.0.0.json
@@ -5,7 +5,7 @@
   "description": "Kubernetes web logs collector",
   "license": "Apache-2.0",
   "type": "logs-k8s",
-  "labels": ["Observability", "Logs", "Cloud"],
+  "labels": ["log", "k8s", "cloud", "container"],
   "author": "OpenSearch",
   "sourceUrl": "https://github.com/opensearch-project/dashboards-observability/tree/main/server/adaptors/integrations/__data__/repository/k8s/info",
   "statics": {
diff --git a/server/adaptors/integrations/__data__/repository/nginx/nginx-1.0.0.json b/server/adaptors/integrations/__data__/repository/nginx/nginx-1.0.0.json
index 1b87c497a..daca06aa8 100644
--- a/server/adaptors/integrations/__data__/repository/nginx/nginx-1.0.0.json
+++ b/server/adaptors/integrations/__data__/repository/nginx/nginx-1.0.0.json
@@ -5,7 +5,7 @@
   "description": "Nginx HTTP server collector",
   "license": "Apache-2.0",
   "type": "logs",
-  "labels": ["Observability", "Logs", "Flint S3"],
+  "labels": ["log", "http", "communication"],
   "author": "OpenSearch",
   "sourceUrl": "https://github.com/opensearch-project/dashboards-observability/tree/main/server/adaptors/integrations/__data__/repository/nginx/info",
   "statics": {
diff --git a/server/adaptors/integrations/validators.ts b/server/adaptors/integrations/validators.ts
index 5aa65cf81..2a4a717a9 100644
--- a/server/adaptors/integrations/validators.ts
+++ b/server/adaptors/integrations/validators.ts
@@ -26,7 +26,6 @@ const templateSchema: JSONSchemaType<IntegrationConfig> = {
     license: { type: 'string' },
     type: { type: 'string' },
     labels: { type: 'array', items: { type: 'string' }, nullable: true },
-    tags: { type: 'array', items: { type: 'string' }, nullable: true },
     author: { type: 'string', nullable: true },
     description: { type: 'string', nullable: true },
     sourceUrl: { type: 'string', nullable: true },