Skip to content

Commit

Permalink
[Backport 2.x] Search bar fixes (opensearch-project#732)
Browse files Browse the repository at this point in the history
* Search bar fixes (opensearch-project#727)

* fix name change bug and modify test to test behavior

Signed-off-by: Derek Ho <dxho@amazon.com>

* search bar fixes

Signed-off-by: Derek Ho <dxho@amazon.com>

---------

Signed-off-by: Derek Ho <dxho@amazon.com>
(cherry picked from commit 3bb8644)

* update snapshot from previous PR

Signed-off-by: Derek Ho <dxho@amazon.com>

---------

Signed-off-by: Derek Ho <dxho@amazon.com>
Co-authored-by: Derek Ho <dxho@amazon.com>
(cherry picked from commit e347c15)
  • Loading branch information
opensearch-trigger-bot[bot] authored and A9 Swift Project User committed Aug 10, 2023
1 parent 60c24a6 commit 2e57b9c
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 147 deletions.
18 changes: 18 additions & 0 deletions .cypress/integration/9_integrations.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand All @@ -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();
})

Expand Down
4 changes: 2 additions & 2 deletions auto_sync_commit_metadata.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"last_github_commit": "ebf2c6ac8628d7ad8ca1058e3d7e171362b3c1d6",
"last_gitfarm_commit": "d2b69cfd58bfa288241119fb4edf70e49505e25f"
"last_github_commit": "e347c15c07ad360496964c361d4ba068c4fa3fc6",
"last_gitfarm_commit": "479bef8af49310dad065fd446e5bc2c3b523acd0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<EuiPageContent data-test-subj="addedIntegrationsArea">
{integrations && integrations.length > 0 ? (
{entries && entries.length > 0 ? (
<EuiInMemoryTable
loading={props.loading}
items={integrations}
items={entries}
itemId="id"
columns={tableColumns}
tableLayout="auto"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function IntegrationAssets(props: any) {
truncateText: true,
render: (value, record) => (
<EuiText data-test-subj={`${record.id}IntegrationLink`}>
{_.truncate(record.attributes.title ? record.attributes.title : '(Unnamed)', {
{_.truncate(record.name, {
length: 100,
})}
</EuiText>
Expand All @@ -54,7 +54,6 @@ export function IntegrationAssets(props: any) {
{
field: 'type',
name: 'Type',
sortable: true,
truncateText: true,
render: (_value, record) => (
<EuiText data-test-subj={`${record.type}IntegrationDescription`}>
Expand All @@ -64,16 +63,25 @@ export function IntegrationAssets(props: any) {
},
] as Array<EuiTableFieldDataColumnType<any>>;

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 (
<EuiPanel data-test-subj={`${config.name}-assets`}>
<PanelTitle title={'Assets'} />
<EuiSpacer size="l" />
<EuiInMemoryTable
itemId="id"
loading={false}
items={
assets?.savedObjects ? assets.savedObjects.filter((x: any) => x.type !== undefined) : []
}
items={entries}
columns={tableColumns}
pagination={{
initialPageSize: 10,
Expand Down

0 comments on commit 2e57b9c

Please sign in to comment.