Chore: replace `General` with `Dashboards` (#89017)

replace General with Dashboards
pull/89041/head
Ashley Harrison 1 year ago committed by GitHub
parent 1f967a89b6
commit 55dfc76b23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      public/app/core/components/FolderFilter/FolderFilter.tsx
  2. 2
      public/app/core/components/Select/DashboardPicker.tsx
  3. 4
      public/app/core/components/Select/ReadonlyFolderPicker/ReadonlyFolderPicker.test.tsx
  4. 6
      public/app/core/components/Select/ReadonlyFolderPicker/api.test.ts
  5. 4
      public/app/features/alerting/unified/components/rule-editor/DashboardPicker.tsx
  6. 2
      public/app/features/browse-dashboards/components/BrowseActions/MoveModal.test.tsx
  7. 2
      public/app/features/dashboard-scene/scene/LibraryVizPanel.test.ts
  8. 10
      public/app/features/library-panels/components/LibraryPanelsSearch/LibraryPanelsSearch.test.tsx
  9. 2
      public/app/features/library-panels/components/LibraryPanelsView/reducer.test.ts
  10. 2
      public/app/features/manage-dashboards/components/ImportDashboardLibraryPanelsList.tsx
  11. 2
      public/app/features/search/constants.ts
  12. 2
      public/app/features/search/page/components/columns.tsx
  13. 2
      public/app/features/search/service/sql.ts

@ -74,8 +74,8 @@ async function getFoldersAsOptions(
// FIXME: stop using id from search and use UID instead
const searchHits = await getBackendSrv().search(params);
const options = searchHits.map((d) => ({ label: d.title, value: { uid: d.uid, title: d.title } }));
if (!searchString || 'general'.includes(searchString.toLowerCase())) {
options.unshift({ label: 'General', value: { uid: 'general', title: 'General' } });
if (!searchString || 'dashboards'.includes(searchString.toLowerCase())) {
options.unshift({ label: 'Dashboards', value: { uid: 'general', title: 'Dashboards' } });
}
setLoading(false);

@ -16,7 +16,7 @@ interface Props extends Omit<AsyncSelectProps<DashboardPickerDTO>, 'value' | 'on
export type DashboardPickerDTO = Pick<DashboardDTO['dashboard'], 'uid' | 'title'> &
Pick<DashboardDTO['meta'], 'folderUid' | 'folderTitle'>;
const formatLabel = (folderTitle = 'General', dashboardTitle: string) => `${folderTitle}/${dashboardTitle}`;
const formatLabel = (folderTitle = 'Dashboards', dashboardTitle: string) => `${folderTitle}/${dashboardTitle}`;
async function findDashboards(query = '') {
return backendSrv.search({ type: 'dash-db', query, limit: 100 }).then((result: DashboardSearchItem[]) => {

@ -93,7 +93,7 @@ describe('ReadonlyFolderPicker', () => {
it('then the first folder in all folders should be selected', async () => {
const { selectors } = await getTestContext({}, FOLDERS);
expect(await within(selectors.container.get()).findByText('General')).toBeInTheDocument();
expect(await within(selectors.container.get()).findByText('Dashboards')).toBeInTheDocument();
});
describe('and initialFolderId is passed in props and it matches an existing folder', () => {
@ -130,7 +130,7 @@ describe('ReadonlyFolderPicker', () => {
undefined
);
expect(await within(selectors.container.get()).findByText('General')).toBeInTheDocument();
expect(await within(selectors.container.get()).findByText('Dashboards')).toBeInTheDocument();
expect(getFolderAsOptionSpy).toHaveBeenCalledTimes(1);
expect(getFolderAsOptionSpy).toHaveBeenCalledWith(50000);
});

@ -37,7 +37,7 @@ describe('getFoldersAsOptions', () => {
const result = await getFoldersAsOptions(args);
expect(result).toEqual([
{ value: { id: undefined, title: 'All' }, label: 'All' },
{ value: { id: 0, title: 'General' }, label: 'General' },
{ value: { id: 0, title: 'Dashboards' }, label: 'Dashboards' },
{ value: { id: 1, title: 'Folder 1' }, label: 'Folder 1' },
]);
});
@ -56,13 +56,13 @@ describe('getFoldersAsOptions', () => {
describe('and extra folders are passed and extra folders contain query', () => {
it('then correct extra folders should all appear first in the result', async () => {
const args = { query: 'er', extraFolders: [ALL_FOLDER, GENERAL_FOLDER] };
const args = { query: 'o', extraFolders: [ALL_FOLDER, GENERAL_FOLDER] };
const searchHits = [{ id: 1, title: 'Folder 1' }] as DashboardSearchHit[];
getTestContext(searchHits);
const result = await getFoldersAsOptions(args);
expect(result).toEqual([
{ value: { id: 0, title: 'General' }, label: 'General' },
{ value: { id: 0, title: 'Dashboards' }, label: 'Dashboards' },
{ value: { id: 1, title: 'Folder 1' }, label: 'Folder 1' },
]);
});

@ -124,7 +124,7 @@ export const DashboardPicker = ({ dashboardUid, panelId, isOpen, onChange, onDis
>
<div className={cx(styles.dashboardTitle, styles.rowButtonTitle)}>{dashboard.title}</div>
<div className={styles.dashboardFolder}>
<Icon name="folder" /> {dashboard.folderTitle ?? 'General'}
<Icon name="folder" /> {dashboard.folderTitle ?? 'Dashboards'}
</div>
</button>
);
@ -179,7 +179,7 @@ export const DashboardPicker = ({ dashboardUid, panelId, isOpen, onChange, onDis
<Alert title="Current selection" severity="info" topSpacing={0} bottomSpacing={1} className={styles.modalAlert}>
<div>
Dashboard: {dashboardModel.title} ({dashboardModel.uid}) in folder{' '}
{dashboardModel.meta?.folderTitle ?? 'General'}
{dashboardModel.meta?.folderTitle ?? 'Dashboards'}
</div>
{currentPanel && (
<div>

@ -20,7 +20,7 @@ describe('browse-dashboards MoveModal', () => {
const mockOnDismiss = jest.fn();
const mockOnConfirm = jest.fn();
const mockFolders = [
{ title: 'General', uid: '' } as DashboardSearchHit,
{ title: 'Dashboards', uid: '' } as DashboardSearchHit,
{ title: 'Folder 1', uid: 'wfTJJL5Wz' } as DashboardSearchHit,
];
let props: Props;

@ -112,7 +112,7 @@ function setUpApiMock(
},
version: 6,
meta: {
folderName: 'General',
folderName: 'Dashboards',
folderUid: '',
connectedDashboards: 1,
created: '2024-02-15T15:26:46Z',

@ -31,7 +31,7 @@ jest.mock('debounce-promise', () => {
const debounce = () => {
const debounced = () =>
Promise.resolve([
{ label: 'General', value: { uid: '', title: 'General' } },
{ label: 'Dashboards', value: { uid: '', title: 'Dashboards' } },
{ label: 'Folder1', value: { id: 'xMsQdBfWz', title: 'Folder1' } },
{ label: 'Folder2', value: { id: 'wfTJJL5Wz', title: 'Folder2' } },
]);
@ -207,7 +207,7 @@ describe('LibraryPanelsSearch', () => {
type: 'timeseries',
version: 1,
meta: {
folderName: 'General',
folderName: 'Dashboards',
folderUid: '',
connectedDashboards: 0,
created: '2021-01-01 12:00:00',
@ -259,7 +259,7 @@ describe('LibraryPanelsSearch', () => {
type: 'timeseries',
version: 1,
meta: {
folderName: 'General',
folderName: 'Dashboards',
folderUid: '',
connectedDashboards: 0,
created: '2021-01-01 12:00:00',
@ -300,7 +300,7 @@ describe('LibraryPanelsSearch', () => {
type: 'timeseries',
version: 1,
meta: {
folderName: 'General',
folderName: 'Dashboards',
folderUid: '',
connectedDashboards: 0,
created: '2021-01-01 12:00:00',
@ -339,7 +339,7 @@ describe('LibraryPanelsSearch', () => {
type: 'timeseries',
version: 1,
meta: {
folderName: 'General',
folderName: 'Dashboards',
folderUid: '',
connectedDashboards: 0,
created: '2021-01-01 12:00:00',

@ -108,7 +108,7 @@ function mockLibraryPanel({
name = 'Test Panel',
model = { type: 'text', title: 'Test Panel' } as Panel,
meta = {
folderName: 'General',
folderName: 'Dashboards',
folderUid: '',
connectedDashboards: 0,
created: '2021-01-01T00:00:00',

@ -35,7 +35,7 @@ export function ImportDashboardLibraryPanelsList({
const libraryPanelIndex = `elements[${index}]`;
const libraryPanel =
input.state === LibraryPanelInputState.New
? { ...input.model, meta: { ...input.model.meta, folderName: folderName ?? 'General' } }
? { ...input.model, meta: { ...input.model.meta, folderName: folderName ?? 'Dashboards' } }
: { ...input.model };
return (

@ -9,7 +9,7 @@ export const SECTION_STORAGE_KEY = 'search.sections';
export const SEARCH_EXPANDED_FOLDER_STORAGE_KEY = 'grafana.search.expanded-folder';
export const GENERAL_FOLDER_ID = 0;
export const GENERAL_FOLDER_UID = 'general';
export const GENERAL_FOLDER_TITLE = 'General';
export const GENERAL_FOLDER_TITLE = 'Dashboards';
export const SEARCH_PANELS_LOCAL_STORAGE_KEY = 'grafana.search.include.panels';
export const SEARCH_SELECTED_LAYOUT = 'grafana.search.layout';
export const SEARCH_SELECTED_SORT = 'grafana.search.sort';

@ -173,7 +173,7 @@ export const generateColumns = (
{parts.map((p) => {
let info = meta.locationInfo[p];
if (!info && p === 'general') {
info = { kind: 'folder', url: '/dashboards', name: 'General' };
info = { kind: 'folder', url: '/dashboards', name: 'Dashboards' };
}
return info ? (
<a key={p} href={info.url} className={styles.locationItem}>

@ -35,7 +35,7 @@ export class SQLSearcher implements GrafanaSearcher {
locationInfo: Record<string, LocationInfoEXT> = {
general: {
kind: 'folder',
name: 'General',
name: 'Dashboards',
url: '/dashboards',
},
}; // share location info with everyone

Loading…
Cancel
Save