mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Reset region and Account when switching inventory (#54287)
This commit is contained in:
parent
303e4842ea
commit
e1e1d964c6
2 changed files with 17 additions and 2 deletions
|
@ -28,6 +28,8 @@ interface WaffleInventorySwitcherProps {
|
||||||
changeNodeType: (nodeType: InfraNodeType) => void;
|
changeNodeType: (nodeType: InfraNodeType) => void;
|
||||||
changeGroupBy: (groupBy: InfraSnapshotGroupbyInput[]) => void;
|
changeGroupBy: (groupBy: InfraSnapshotGroupbyInput[]) => void;
|
||||||
changeMetric: (metric: InfraSnapshotMetricInput) => void;
|
changeMetric: (metric: InfraSnapshotMetricInput) => void;
|
||||||
|
changeAccount: (id: string) => void;
|
||||||
|
changeRegion: (name: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getDisplayNameForType = (type: InventoryItemType) => {
|
const getDisplayNameForType = (type: InventoryItemType) => {
|
||||||
|
@ -39,6 +41,8 @@ export const WaffleInventorySwitcher: React.FC<WaffleInventorySwitcherProps> = (
|
||||||
changeNodeType,
|
changeNodeType,
|
||||||
changeGroupBy,
|
changeGroupBy,
|
||||||
changeMetric,
|
changeMetric,
|
||||||
|
changeAccount,
|
||||||
|
changeRegion,
|
||||||
nodeType,
|
nodeType,
|
||||||
}) => {
|
}) => {
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
@ -49,12 +53,14 @@ export const WaffleInventorySwitcher: React.FC<WaffleInventorySwitcherProps> = (
|
||||||
closePopover();
|
closePopover();
|
||||||
changeNodeType(targetNodeType);
|
changeNodeType(targetNodeType);
|
||||||
changeGroupBy([]);
|
changeGroupBy([]);
|
||||||
|
changeAccount('');
|
||||||
|
changeRegion('');
|
||||||
const inventoryModel = findInventoryModel(targetNodeType);
|
const inventoryModel = findInventoryModel(targetNodeType);
|
||||||
changeMetric({
|
changeMetric({
|
||||||
type: inventoryModel.metrics.defaultSnapshot as InfraSnapshotMetricType,
|
type: inventoryModel.metrics.defaultSnapshot as InfraSnapshotMetricType,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[closePopover, changeNodeType, changeGroupBy, changeMetric]
|
[closePopover, changeNodeType, changeGroupBy, changeMetric, changeAccount, changeRegion]
|
||||||
);
|
);
|
||||||
const goToHost = useCallback(() => goToNodeType('host' as InfraNodeType), [goToNodeType]);
|
const goToHost = useCallback(() => goToNodeType('host' as InfraNodeType), [goToNodeType]);
|
||||||
const goToK8 = useCallback(() => goToNodeType('pod' as InfraNodeType), [goToNodeType]);
|
const goToK8 = useCallback(() => goToNodeType('pod' as InfraNodeType), [goToNodeType]);
|
||||||
|
|
|
@ -23,12 +23,21 @@ export const SnapshotToolbar = () => (
|
||||||
<EuiFlexGroup alignItems="center" justifyContent="spaceBetween" gutterSize="m">
|
<EuiFlexGroup alignItems="center" justifyContent="spaceBetween" gutterSize="m">
|
||||||
<EuiFlexItem grow={false}>
|
<EuiFlexItem grow={false}>
|
||||||
<WithWaffleOptions>
|
<WithWaffleOptions>
|
||||||
{({ changeMetric, changeNodeType, changeGroupBy, nodeType }) => (
|
{({
|
||||||
|
changeMetric,
|
||||||
|
changeNodeType,
|
||||||
|
changeGroupBy,
|
||||||
|
changeAccount,
|
||||||
|
changeRegion,
|
||||||
|
nodeType,
|
||||||
|
}) => (
|
||||||
<WaffleInventorySwitcher
|
<WaffleInventorySwitcher
|
||||||
nodeType={nodeType}
|
nodeType={nodeType}
|
||||||
changeNodeType={changeNodeType}
|
changeNodeType={changeNodeType}
|
||||||
changeMetric={changeMetric}
|
changeMetric={changeMetric}
|
||||||
changeGroupBy={changeGroupBy}
|
changeGroupBy={changeGroupBy}
|
||||||
|
changeAccount={changeAccount}
|
||||||
|
changeRegion={changeRegion}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</WithWaffleOptions>
|
</WithWaffleOptions>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue