diff --git a/awx/ui/src/screens/Metrics/Metrics.js b/awx/ui/src/screens/Metrics/Metrics.js
index 29c871a947..3cdca321fd 100644
--- a/awx/ui/src/screens/Metrics/Metrics.js
+++ b/awx/ui/src/screens/Metrics/Metrics.js
@@ -70,9 +70,16 @@ function Metrics() {
]);
const metricOptions = Object.keys(mets);
+ const instanceNames = [];
+ results.forEach((result) => {
+ if (result.node_type !== 'execution') {
+ instanceNames.push(result.hostname);
+ }
+ });
return {
- instances: [...results.map((result) => result.hostname), t`All`],
+ instances:
+ instanceNames.length > 1 ? [...instanceNames, t`All`] : instanceNames,
metrics: metricOptions,
};
}, []),
diff --git a/awx/ui/src/screens/Metrics/Metrics.test.js b/awx/ui/src/screens/Metrics/Metrics.test.js
index 55703fde5a..ceff796c58 100644
--- a/awx/ui/src/screens/Metrics/Metrics.test.js
+++ b/awx/ui/src/screens/Metrics/Metrics.test.js
@@ -13,7 +13,11 @@ describe('', () => {
beforeEach(async () => {
InstancesAPI.read.mockResolvedValue({
data: {
- results: [{ hostname: 'instance 1' }, { hostname: 'instance 2' }],
+ results: [
+ { hostname: 'instance 1', node_type: 'control' },
+ { hostname: 'instance 2', node_type: 'hybrid' },
+ { hostname: 'receptor', node_type: 'execution' },
+ ],
},
});
MetricsAPI.read.mockResolvedValue({
@@ -70,4 +74,15 @@ describe('', () => {
node: 'instance 1',
});
});
+
+ test('should not include receptor instances', async () => {
+ await act(async () => {
+ wrapper.find('Select[ouiaId="Instance-select"]').prop('onToggle')(true);
+ });
+ wrapper.update();
+ expect(wrapper.find('SelectOption[value="receptor"]')).toHaveLength(0);
+ expect(
+ wrapper.find('Select[ouiaId="Instance-select"]').find('SelectOption')
+ ).toHaveLength(3);
+ });
});