Skip to content

Commit 32b159e

Browse files
committed
Reset region and Account when switching inventory
1 parent 513428a commit 32b159e

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

x-pack/legacy/plugins/infra/public/components/waffle/waffle_inventory_switcher.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ interface WaffleInventorySwitcherProps {
2828
changeNodeType: (nodeType: InfraNodeType) => void;
2929
changeGroupBy: (groupBy: InfraSnapshotGroupbyInput[]) => void;
3030
changeMetric: (metric: InfraSnapshotMetricInput) => void;
31+
changeAccount: (id: string) => void;
32+
changeRegion: (name: string) => void;
3133
}
3234

3335
const getDisplayNameForType = (type: InventoryItemType) => {
@@ -39,6 +41,8 @@ export const WaffleInventorySwitcher: React.FC<WaffleInventorySwitcherProps> = (
3941
changeNodeType,
4042
changeGroupBy,
4143
changeMetric,
44+
changeAccount,
45+
changeRegion,
4246
nodeType,
4347
}) => {
4448
const [isOpen, setIsOpen] = useState(false);
@@ -49,12 +53,14 @@ export const WaffleInventorySwitcher: React.FC<WaffleInventorySwitcherProps> = (
4953
closePopover();
5054
changeNodeType(targetNodeType);
5155
changeGroupBy([]);
56+
changeAccount('');
57+
changeRegion('');
5258
const inventoryModel = findInventoryModel(targetNodeType);
5359
changeMetric({
5460
type: inventoryModel.metrics.defaultSnapshot as InfraSnapshotMetricType,
5561
});
5662
},
57-
[closePopover, changeNodeType, changeGroupBy, changeMetric]
63+
[closePopover, changeNodeType, changeGroupBy, changeMetric, changeAccount, changeRegion]
5864
);
5965
const goToHost = useCallback(() => goToNodeType('host' as InfraNodeType), [goToNodeType]);
6066
const goToK8 = useCallback(() => goToNodeType('pod' as InfraNodeType), [goToNodeType]);

x-pack/legacy/plugins/infra/public/pages/infrastructure/snapshot/toolbar.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,21 @@ export const SnapshotToolbar = () => (
2323
<EuiFlexGroup alignItems="center" justifyContent="spaceBetween" gutterSize="m">
2424
<EuiFlexItem grow={false}>
2525
<WithWaffleOptions>
26-
{({ changeMetric, changeNodeType, changeGroupBy, nodeType }) => (
26+
{({
27+
changeMetric,
28+
changeNodeType,
29+
changeGroupBy,
30+
changeAccount,
31+
changeRegion,
32+
nodeType,
33+
}) => (
2734
<WaffleInventorySwitcher
2835
nodeType={nodeType}
2936
changeNodeType={changeNodeType}
3037
changeMetric={changeMetric}
3138
changeGroupBy={changeGroupBy}
39+
changeAccount={changeAccount}
40+
changeRegion={changeRegion}
3241
/>
3342
)}
3443
</WithWaffleOptions>

0 commit comments

Comments
 (0)