mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
* Add and configure eslint-plugin-import * Fix the lint:ts npm command * Autofix + prettier all the files * Manually fix remaining files * Move jquery code in jest-setup to external file to safely reorder imports * Resolve issue caused by circular dependencies within Prometheus * Update .betterer.results * Fix missing // @ts-ignore * ignore iconBundle.ts * Fix missing // @ts-ignore
37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
import React, { FC, useState } from 'react';
|
|
import { connect, ConnectedProps } from 'react-redux';
|
|
|
|
import Page from '../../core/components/Page/Page';
|
|
import { GrafanaRouteComponentProps } from '../../core/navigation/types';
|
|
import { getNavModel } from '../../core/selectors/navModel';
|
|
import { StoreState } from '../../types';
|
|
|
|
import { LibraryPanelsSearch } from './components/LibraryPanelsSearch/LibraryPanelsSearch';
|
|
import { OpenLibraryPanelModal } from './components/OpenLibraryPanelModal/OpenLibraryPanelModal';
|
|
import { LibraryElementDTO } from './types';
|
|
|
|
const mapStateToProps = (state: StoreState) => ({
|
|
navModel: getNavModel(state.navIndex, 'library-panels'),
|
|
});
|
|
|
|
const connector = connect(mapStateToProps, undefined);
|
|
|
|
interface OwnProps extends GrafanaRouteComponentProps {}
|
|
|
|
type Props = OwnProps & ConnectedProps<typeof connector>;
|
|
|
|
export const LibraryPanelsPage: FC<Props> = ({ navModel }) => {
|
|
const [selected, setSelected] = useState<LibraryElementDTO | undefined>(undefined);
|
|
|
|
return (
|
|
<Page navModel={navModel}>
|
|
<Page.Contents>
|
|
<LibraryPanelsSearch onClick={setSelected} showSecondaryActions showSort showPanelFilter showFolderFilter />
|
|
{selected ? <OpenLibraryPanelModal onDismiss={() => setSelected(undefined)} libraryPanel={selected} /> : null}
|
|
</Page.Contents>
|
|
</Page>
|
|
);
|
|
};
|
|
|
|
export default connect(mapStateToProps)(LibraryPanelsPage);
|