Skip to content

Commit 1a4b4b8

Browse files
authored
Revert "[Fleet] Filter OPAMP agents out of agent table (#270258)"
This reverts commit 9814ffb.
1 parent 8698a34 commit 1a4b4b8

3 files changed

Lines changed: 13 additions & 24 deletions

File tree

x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agents/agent_list_page/hooks/use_fetch_agents_data.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ describe('useFetchAgentsData', () => {
177177
},
178178
});
179179
expect(result?.current.kuery).toEqual(
180-
'(status:online or (status:error or status:degraded) or status:orphaned or (status:updating or status:unenrolling or status:enrolling) or status:offline) and NOT type:OPAMP'
180+
'status:online or (status:error or status:degraded) or status:orphaned or (status:updating or status:unenrolling or status:enrolling) or status:offline'
181181
);
182182

183183
expect(result?.current.page).toEqual({ index: 0, size: 20 });

x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agents/agent_list_page/utils/get_kuery.test.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,56 +18,54 @@ describe('getKuery', () => {
1818
const inactiveStatuses = ['unhealthy', 'offline', 'inactive', 'unenrolled'];
1919

2020
it('should return a kuery with base search', () => {
21-
expect(getKuery({ search })).toEqual('(base search) and NOT type:OPAMP');
21+
expect(getKuery({ search })).toEqual('base search');
2222
});
2323

2424
it('should return a kuery with selected tags', () => {
2525
expect(getKuery({ selectedTags })).toEqual(
26-
'(fleet-agents.tags : ("tag_1" or "tag_2" or "tag_3")) and NOT type:OPAMP'
26+
'fleet-agents.tags : ("tag_1" or "tag_2" or "tag_3")'
2727
);
2828
});
2929
it('should return a kuery for no tags if selected', () => {
30-
expect(getKuery({ selectedTags: noTags })).toEqual(
31-
'(((NOT fleet-agents.tags : (*)))) and NOT type:OPAMP'
32-
);
30+
expect(getKuery({ selectedTags: noTags })).toEqual('((NOT fleet-agents.tags : (*)))');
3331
});
3432
it('should return a kuery for no tags and other tags when multiple are selected', () => {
3533
expect(getKuery({ selectedTags: [...noTags, ...selectedTags] })).toEqual(
36-
'(((NOT fleet-agents.tags : (*)) or fleet-agents.tags : ("tag_1" or "tag_2" or "tag_3"))) and NOT type:OPAMP'
34+
'((NOT fleet-agents.tags : (*)) or fleet-agents.tags : ("tag_1" or "tag_2" or "tag_3"))'
3735
);
3836
});
3937

4038
it('should return a kuery with selected agent policies', () => {
4139
expect(getKuery({ selectedAgentPolicies })).toEqual(
42-
'(fleet-agents.policy_id : ("policy1" or "policy2" or "policy3")) and NOT type:OPAMP'
40+
'fleet-agents.policy_id : ("policy1" or "policy2" or "policy3")'
4341
);
4442
});
4543

4644
it('should return a kuery with selected agent ids', () => {
4745
expect(getKuery({ selectedAgentIds })).toEqual(
48-
'(fleet-agents.agent.id : ("agent_id1" or "agent_id2")) and NOT type:OPAMP'
46+
'fleet-agents.agent.id : ("agent_id1" or "agent_id2")'
4947
);
5048
});
5149

5250
it('should return a kuery with healthy selected status', () => {
5351
expect(getKuery({ selectedStatus: healthyStatuses })).toEqual(
54-
'(status:online or (status:updating or status:unenrolling or status:enrolling)) and NOT type:OPAMP'
52+
'status:online or (status:updating or status:unenrolling or status:enrolling)'
5553
);
5654
});
5755

5856
it('should return a kuery with unhealthy selected status', () => {
5957
expect(getKuery({ selectedStatus: inactiveStatuses })).toEqual(
60-
'((status:error or status:degraded) or status:offline or status:inactive or status:unenrolled) and NOT type:OPAMP'
58+
'(status:error or status:degraded) or status:offline or status:inactive or status:unenrolled'
6159
);
6260
});
6361

6462
it('should return a kuery with a combination of previous kueries', () => {
6563
expect(getKuery({ search, selectedTags, selectedStatus })).toEqual(
66-
'(((base search) and fleet-agents.tags : ("tag_1" or "tag_2" or "tag_3")) and (status:online or (status:error or status:degraded))) and NOT type:OPAMP'
64+
'((base search) and fleet-agents.tags : ("tag_1" or "tag_2" or "tag_3")) and (status:online or (status:error or status:degraded))'
6765
);
6866
});
6967

70-
it('should exclude OpAMP agents even when no filters are passed', () => {
71-
expect(getKuery({})).toEqual('NOT type:OPAMP');
68+
it('should return empty string if nothing is passed', () => {
69+
expect(getKuery({})).toEqual('');
7270
});
7371
});

x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agents/agent_list_page/utils/get_kuery.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77
import { i18n } from '@kbn/i18n';
88

9-
import { AGENT_TYPE_OPAMP } from '../../../../../../../common/constants';
109
import { AgentStatusKueryHelper } from '../../../../services';
1110
import { AGENTS_PREFIX } from '../../../../constants';
1211

@@ -102,13 +101,5 @@ export const getKuery = ({
102101
kueryBuilder = kueryStatus;
103102
}
104103
}
105-
const excludeOpamp = `NOT type:${AGENT_TYPE_OPAMP}`;
106-
const trimmed = kueryBuilder.trim();
107-
if (trimmed) {
108-
kueryBuilder = `(${trimmed}) and ${excludeOpamp}`;
109-
} else {
110-
kueryBuilder = excludeOpamp;
111-
}
112-
113-
return kueryBuilder;
104+
return kueryBuilder.trim();
114105
};

0 commit comments

Comments
 (0)