diff --git a/.cypress/integration/9_integrations.spec.js b/.cypress/integration/9_integrations.spec.js index 6a6ad2fd5..4e93bf181 100644 --- a/.cypress/integration/9_integrations.spec.js +++ b/.cypress/integration/9_integrations.spec.js @@ -52,6 +52,22 @@ describe('Basic sanity test for integrations plugin', () => { cy.get('[data-test-subj="fields"]').click(); cy.get('[data-test-subj="nginx-fields"]').should('exist') }) + + it('Uses the search of assets and fields tables', () => { + moveToAvailableNginxIntegration(); + cy.get('input[type="search"]').eq(0).focus().type('ss4o{enter}'); + cy.get('.euiTableRow').should('have.length', 1);//Filters correctly to the index pattern + cy.get('[data-test-subj="fields"]').click(); + cy.get('input[type="search"]').eq(0).focus().clear().type('severity.observe') + cy.get('.euiTableRow').should('have.length', 2);//Filters correctly to the field name + }) + + it('Uses the filter of assets table', () => { + moveToAvailableNginxIntegration(); + cy.get('.euiFilterGroup').trigger('mouseover').click(); + cy.get('.euiFilterSelectItem').contains('visualization').click(); + cy.get('.euiTableRow').should('have.length', 4);//Filters correctly to visualization types + }) }); describe('Tests the add nginx integration instance flow', () => { @@ -73,6 +89,8 @@ describe('Tests the add nginx integration instance flow', () => { it('Navigates to installed integrations page and verifies that nginx-test exists', () => { moveToAddedIntegrations(); cy.contains(testInstance).should('exist'); + cy.get('input[type="search"]').eq(0).focus().type(`${testInstance}{enter}`); + cy.get('.euiTableRow').should('have.length', 1);//Filters correctly to the test integration instance cy.get(`[data-test-subj="${testInstance}IntegrationLink"]`).click(); }) diff --git a/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap b/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap index 72cbd8716..64c7d9e03 100644 --- a/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap +++ b/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap @@ -140,76 +140,10 @@ exports[`Added Integration Table View Test Renders added integration table view items={ Array [ Object { - "assets": Array [ - Object { - "assetId": "3fc41705-8a23-49f4-926c-2819e0d7306d", - "assetType": "index-pattern", - "description": "ss4o_logs-nginx-prod", - "isDefaultAsset": false, - "status": "available", - }, - Object { - "assetId": "a0415ddd-047d-4c02-8769-d14bfb70f525", - "assetType": "search", - "description": "[NGINX Core Logs 1.0] Nginx Access Logs", - "isDefaultAsset": false, - "status": "available", - }, - Object { - "assetId": "a17cd453-fb2f-4c24-81db-aedfc8682829", - "assetType": "visualization", - "description": "[NGINX Core Logs 1.0] Response codes over time", - "isDefaultAsset": false, - "status": "available", - }, - Object { - "assetId": "3e47dfed-d9ff-4c1b-b425-04ffc8ed3fa9", - "assetType": "search", - "description": "[NGINX Core Logs 1.0] Nginx Error Logs", - "isDefaultAsset": false, - "status": "available", - }, - Object { - "assetId": "641c2a03-eead-4900-94ee-e12d2fef8383", - "assetType": "visualization", - "description": "[NGINX Core Logs 1.0] Errors over time", - "isDefaultAsset": false, - "status": "available", - }, - Object { - "assetId": "ce61594d-8307-4358-9b7e-71101b3ed722", - "assetType": "visualization", - "description": "Data Volume", - "isDefaultAsset": false, - "status": "available", - }, - Object { - "assetId": "452bd6e3-3b50-407f-88f2-c35a29c56051", - "assetType": "visualization", - "description": "Top Paths", - "isDefaultAsset": false, - "status": "available", - }, - Object { - "assetId": "14a1ddab-08c1-4aba-ba3b-88bae36f7e50", - "assetType": "visualization", - "description": "Requests per Minute", - "isDefaultAsset": false, - "status": "available", - }, - Object { - "assetId": "179bad58-c840-4c6c-9fd8-1667c14bd03a", - "assetType": "dashboard", - "description": "[NGINX Core Logs 1.0] Overview", - "isDefaultAsset": true, - "status": "available", - }, - ], "creationDate": "2023-06-15T16:28:36.370Z", - "dataSource": Object { - "dataset": "nginx", - "namespace": "prod", - "sourceType": "logs", + "data": Object { + "name": "nginx", + "templateName": "nginx", }, "id": "ad7e6e30-0b99-11ee-b27c-c9863222e9bf", "name": "nginx", @@ -646,76 +580,10 @@ exports[`Added Integration Table View Test Renders added integration table view items={ Array [ Object { - "assets": Array [ - Object { - "assetId": "3fc41705-8a23-49f4-926c-2819e0d7306d", - "assetType": "index-pattern", - "description": "ss4o_logs-nginx-prod", - "isDefaultAsset": false, - "status": "available", - }, - Object { - "assetId": "a0415ddd-047d-4c02-8769-d14bfb70f525", - "assetType": "search", - "description": "[NGINX Core Logs 1.0] Nginx Access Logs", - "isDefaultAsset": false, - "status": "available", - }, - Object { - "assetId": "a17cd453-fb2f-4c24-81db-aedfc8682829", - "assetType": "visualization", - "description": "[NGINX Core Logs 1.0] Response codes over time", - "isDefaultAsset": false, - "status": "available", - }, - Object { - "assetId": "3e47dfed-d9ff-4c1b-b425-04ffc8ed3fa9", - "assetType": "search", - "description": "[NGINX Core Logs 1.0] Nginx Error Logs", - "isDefaultAsset": false, - "status": "available", - }, - Object { - "assetId": "641c2a03-eead-4900-94ee-e12d2fef8383", - "assetType": "visualization", - "description": "[NGINX Core Logs 1.0] Errors over time", - "isDefaultAsset": false, - "status": "available", - }, - Object { - "assetId": "ce61594d-8307-4358-9b7e-71101b3ed722", - "assetType": "visualization", - "description": "Data Volume", - "isDefaultAsset": false, - "status": "available", - }, - Object { - "assetId": "452bd6e3-3b50-407f-88f2-c35a29c56051", - "assetType": "visualization", - "description": "Top Paths", - "isDefaultAsset": false, - "status": "available", - }, - Object { - "assetId": "14a1ddab-08c1-4aba-ba3b-88bae36f7e50", - "assetType": "visualization", - "description": "Requests per Minute", - "isDefaultAsset": false, - "status": "available", - }, - Object { - "assetId": "179bad58-c840-4c6c-9fd8-1667c14bd03a", - "assetType": "dashboard", - "description": "[NGINX Core Logs 1.0] Overview", - "isDefaultAsset": true, - "status": "available", - }, - ], "creationDate": "2023-06-15T16:28:36.370Z", - "dataSource": Object { - "dataset": "nginx", - "namespace": "prod", - "sourceType": "logs", + "data": Object { + "name": "nginx", + "templateName": "nginx", }, "id": "ad7e6e30-0b99-11ee-b27c-c9863222e9bf", "name": "nginx", diff --git a/public/components/integrations/components/added_integration_table.tsx b/public/components/integrations/components/added_integration_table.tsx index 4f99e848b..3072bbf39 100644 --- a/public/components/integrations/components/added_integration_table.tsx +++ b/public/components/integrations/components/added_integration_table.tsx @@ -139,12 +139,20 @@ export function AddedIntegrationsTable(props: AddedIntegrationsTableProps) { ], }; + const entries = integrations.map((integration) => { + const id = integration.id; + const templateName = integration.templateName; + const creationDate = integration.creationDate; + const name = integration.name; + return { id, templateName, creationDate, name, data: { templateName, name } }; + }); + return ( - {integrations && integrations.length > 0 ? ( + {entries && entries.length > 0 ? ( ( - {_.truncate(record.attributes.title ? record.attributes.title : '(Unnamed)', { + {_.truncate(record.name, { length: 100, })} @@ -54,7 +54,6 @@ export function IntegrationAssets(props: any) { { field: 'type', name: 'Type', - sortable: true, truncateText: true, render: (_value, record) => ( @@ -64,6 +63,17 @@ export function IntegrationAssets(props: any) { }, ] as Array>; + const entries = assets?.savedObjects + ? assets.savedObjects + .filter((x: any) => x.type !== undefined) + .map((asset: any) => { + const name = asset.attributes.title ? asset.attributes.title : '(Unnamed)'; + const type = asset.type; + const id = asset.id; + return { name, type, id, data: { name, type } }; + }) + : []; + return ( @@ -71,9 +81,7 @@ export function IntegrationAssets(props: any) { x.type !== undefined) : [] - } + items={entries} columns={tableColumns} pagination={{ initialPageSize: 10,