mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
Merge pull request #11123 from AlexSCorey/11028-MeshFix
Removes receptor instances from select option on metrics screen
This commit is contained in:
commit
fd3a82d430
@ -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,
|
||||
};
|
||||
}, []),
|
||||
|
||||
@ -13,7 +13,11 @@ describe('<Metrics/>', () => {
|
||||
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('<Metrics/>', () => {
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user