diff --git a/ui/cypress/e2e/collectors.test.ts b/ui/cypress/e2e/collectors.test.ts index 4a764c38bc8..052c43b491a 100644 --- a/ui/cypress/e2e/collectors.test.ts +++ b/ui/cypress/e2e/collectors.test.ts @@ -387,5 +387,31 @@ describe('Collectors', () => { }) }) }) + describe('Label creation and searching', () => { + beforeEach(() => { + const description = 'Config Description' + cy.get('@org').then(({id}: Organization) => { + cy.createTelegraf('newteleg', description, id, 'newbucket') + }) + cy.reload() + }) + it('Can add label', () => { + cy.getByTestID('inline-labels--add').click() + cy.getByTestID('inline-labels--popover-field').type('zoe') + cy.getByTestID('inline-labels--create-new').click() + cy.getByTestID('overlay--container').should('exist') + cy.getByTestID('create-label-form--submit').click() + cy.getByTestID('label--pill zoe').should('exist') + //can search by label + cy.getByTestID('search-widget') + .clear() + .type('zoe') + + cy.getByTestID('resource-card').should('have.length', 1) + cy.getByTestID('resource-card').should('contain', 'newteleg') + }) + + it('can search by label', () => {}) + }) }) }) diff --git a/ui/src/telegrafs/components/Collectors.tsx b/ui/src/telegrafs/components/Collectors.tsx index f7a5e68997b..171f2fe01dd 100644 --- a/ui/src/telegrafs/components/Collectors.tsx +++ b/ui/src/telegrafs/components/Collectors.tsx @@ -126,7 +126,11 @@ class Collectors extends PureComponent { searchTerm={searchTerm} - searchKeys={['plugins.0.config.bucket', 'name']} + searchKeys={[ + 'plugins.0.config.bucket', + 'name', + 'labels[].name', + ]} list={collectors} > {cs => ( @@ -264,11 +268,13 @@ class Collectors extends PureComponent { this.setState({searchTerm}) } } -const mstp = ({telegrafs, orgs: {org}, buckets}: AppState): StateProps => ({ - collectors: telegrafs.list, - orgName: org.name, - buckets: buckets.list, -}) +const mstp = ({telegrafs, orgs: {org}, buckets}: AppState): StateProps => { + return { + collectors: telegrafs.list, + orgName: org.name, + buckets: buckets.list, + } +} const mdtp: DispatchProps = { onSetBucketInfo: setBucketInfo,