mirror of
https://github.com/grafana/grafana.git
synced 2025-02-09 23:16:16 -06:00
Search(Playground)- Manage Actions: Disable delete button when folder is General (#49021)
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
parent
0ea04ac64d
commit
a3233c6ac3
@ -5,6 +5,6 @@ export const SEARCH_ITEM_MARGIN = 8;
|
||||
export const DEFAULT_SORT = { label: 'A\u2013Z', value: 'alpha-asc' };
|
||||
export const SECTION_STORAGE_KEY = 'search.sections';
|
||||
export const GENERAL_FOLDER_ID = 0;
|
||||
export const GENERAL_FOLDER_UID = 'GeneralFolderUID';
|
||||
export const GENERAL_FOLDER_UID = 'general';
|
||||
export const GENERAL_FOLDER_TITLE = 'General';
|
||||
export const PREVIEWS_LOCAL_STORAGE_KEY = 'grafana.dashboard.previews';
|
||||
|
@ -6,6 +6,7 @@ import { GrafanaTheme2 } from '@grafana/data';
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { Spinner, useStyles2 } from '@grafana/ui';
|
||||
|
||||
import { GENERAL_FOLDER_UID } from '../../constants';
|
||||
import { getGrafanaSearcher } from '../../service';
|
||||
import { SearchResultsProps } from '../components/SearchResultsTable';
|
||||
|
||||
@ -26,7 +27,7 @@ export const FolderView = ({
|
||||
const folders: DashboardSection[] = [
|
||||
{ title: 'Recent', icon: 'clock', kind: 'query-recent', uid: '__recent' },
|
||||
{ title: 'Starred', icon: 'star', kind: 'query-star', uid: '__starred' },
|
||||
{ title: 'General', url: '/dashboards', kind: 'folder', uid: 'general' }, // not sure why this is not in the index
|
||||
{ title: 'General', url: '/dashboards', kind: 'folder', uid: GENERAL_FOLDER_UID }, // not sure why this is not in the index
|
||||
];
|
||||
for (const row of rsp.view) {
|
||||
folders.push({
|
||||
|
@ -27,7 +27,7 @@ export function ManageActions({ items, folder, onChange }: Props) {
|
||||
|
||||
// TODO: check user permissions for delete, should not be able to delete if includes general folder and user don't have permissions
|
||||
// There is not GENERAL_FOLDER_UID configured yet, we need to make sure to add it to the data.
|
||||
const selectedFolders = Array.from(items.get('folders') ?? []);
|
||||
const selectedFolders = Array.from(items.get('folder') ?? []);
|
||||
console.log({ selectedFolders });
|
||||
const includesGeneralFolder = selectedFolders.find((result) => result === GENERAL_FOLDER_UID);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user