mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Scopes: Allow navigating to inner containers (#89676)
Scopes: Allow navigating to inner levels after selecting a scope
This commit is contained in:
@@ -38,7 +38,6 @@ import {
|
|||||||
mocksScopes,
|
mocksScopes,
|
||||||
queryAllDashboard,
|
queryAllDashboard,
|
||||||
queryFiltersApply,
|
queryFiltersApply,
|
||||||
queryApplicationsClustersSlothClusterNorthTitle,
|
|
||||||
queryApplicationsClustersTitle,
|
queryApplicationsClustersTitle,
|
||||||
queryApplicationsSlothPictureFactoryTitle,
|
queryApplicationsSlothPictureFactoryTitle,
|
||||||
queryApplicationsSlothVoteTrackerTitle,
|
queryApplicationsSlothVoteTrackerTitle,
|
||||||
@@ -137,12 +136,14 @@ describe('ScopesScene', () => {
|
|||||||
expect(getFiltersInput().value).toBe('slothVoteTracker, slothPictureFactory, Cluster Index Helper');
|
expect(getFiltersInput().value).toBe('slothVoteTracker, slothPictureFactory, Cluster Index Helper');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Can't navigate deeper than the level where scopes are selected", async () => {
|
it('Can select a node from an inner level', async () => {
|
||||||
await userEvents.click(getFiltersInput());
|
await userEvents.click(getFiltersInput());
|
||||||
await userEvents.click(getApplicationsExpand());
|
await userEvents.click(getApplicationsExpand());
|
||||||
await userEvents.click(getApplicationsSlothVoteTrackerSelect());
|
await userEvents.click(getApplicationsSlothVoteTrackerSelect());
|
||||||
await userEvents.click(getApplicationsClustersExpand());
|
await userEvents.click(getApplicationsClustersExpand());
|
||||||
expect(queryApplicationsClustersSlothClusterNorthTitle()).not.toBeInTheDocument();
|
await userEvents.click(getApplicationsClustersSlothClusterNorthSelect());
|
||||||
|
await userEvents.click(getFiltersApply());
|
||||||
|
expect(getFiltersInput().value).toBe('slothClusterNorth');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can select a node from an upper level', async () => {
|
it('Can select a node from an upper level', async () => {
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ export function ScopesTreeLevel({
|
|||||||
|
|
||||||
const scopeNames = scopes.map(({ scopeName }) => scopeName);
|
const scopeNames = scopes.map(({ scopeName }) => scopeName);
|
||||||
const anyChildExpanded = childNodesArr.some(({ isExpanded }) => isExpanded);
|
const anyChildExpanded = childNodesArr.some(({ isExpanded }) => isExpanded);
|
||||||
const anyChildSelected = childNodesArr.some(({ linkId }) => linkId && scopeNames.includes(linkId!));
|
|
||||||
|
|
||||||
const onQueryUpdate = useMemo(() => debounce(onNodeUpdate, 500), [onNodeUpdate]);
|
const onQueryUpdate = useMemo(() => debounce(onNodeUpdate, 500), [onNodeUpdate]);
|
||||||
|
|
||||||
@@ -102,7 +101,6 @@ export function ScopesTreeLevel({
|
|||||||
|
|
||||||
{childNode.isExpandable && (
|
{childNode.isExpandable && (
|
||||||
<IconButton
|
<IconButton
|
||||||
disabled={anyChildSelected && !childNode.isExpanded}
|
|
||||||
name={!childNode.isExpanded ? 'angle-right' : 'angle-down'}
|
name={!childNode.isExpanded ? 'angle-right' : 'angle-down'}
|
||||||
aria-label={
|
aria-label={
|
||||||
childNode.isExpanded ? t('scopes.tree.collapse', 'Collapse') : t('scopes.tree.expand', 'Expand')
|
childNode.isExpanded ? t('scopes.tree.collapse', 'Collapse') : t('scopes.tree.expand', 'Expand')
|
||||||
|
|||||||
Reference in New Issue
Block a user