NestedFolders: Basic item selection (#66843)

* NestedFolders: Item selection state

* Select children in state

* Unselect parents when children are unselected

* remove unneeded comment

* tests

* tidy test a little bit

* tidy test a little bit

* tidy test a little bit

* tidy test a little bit

* tidy test a little bit
This commit is contained in:
Josh Hunt
2023-04-19 20:44:07 +01:00
committed by GitHub
parent 3634079b8f
commit e0c5b4f0e0
10 changed files with 462 additions and 42 deletions

View File

@@ -51,6 +51,7 @@ async function getChildFolders(parentUid?: string, parentTitle?: string): Promis
uid: item.uid,
title: item.title,
parentTitle,
parentUID: parentUid,
url: `/dashboards/f/${item.uid}/`,
}));
}

View File

@@ -81,6 +81,7 @@ export function queryResultToViewItem(
if (parentInfo) {
viewItem.parentTitle = parentInfo.name;
viewItem.parentKind = parentInfo.kind;
viewItem.parentUID = parentUid;
}
}

View File

@@ -50,11 +50,13 @@ export interface DashboardSearchItem {
folderUrl?: string;
}
export type DashboardViewItemKind = 'folder' | 'dashboard' | 'panel';
/**
* Type used in the folder view components
*/
export interface DashboardViewItem {
kind: 'folder' | 'dashboard' | 'panel';
kind: DashboardViewItemKind;
uid: string;
title: string;
url?: string;
@@ -62,7 +64,7 @@ export interface DashboardViewItem {
icon?: string;
// Most commonly parent folder title, but can be dashboard if panelTitleSearch is enabled
parentUID?: string;
parentTitle?: string;
parentKind?: string;