grafana/public/app/features/playlist/PlaylistNewPage.tsx
Torkel Ödegaard 77f7e8dafc
PageLayouts: Updates dashboard section routes with navId (#52175)
* First stab at new page layouts behind feature toggle

* Simplifying PageHeader

* Progress on a new model that can more easily support new and old page layouts

* Progress

* rename folder

* Progress

* Minor change

* fixes

* Fixing tests

* Make breadcrumbs work

* Add tests for old Page component

* Adding tests for new Page component and behavior

* fixing page header test

* Fixed test

* Moving user profile routes to navId

* PageLayouts: Updates dashboards routes with navId

* added missing navId

* AppChrome outside route

* Renaming folder

* Minor fix

* Updated

* Fixing StoragePage

* Updated

* Updating translation ids

* Updated snapshot

* update nav translation ids (yes this is confusing)

Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
Co-authored-by: joshhunt <josh@trtr.co>
2022-07-20 17:26:52 +02:00

38 lines
1.2 KiB
TypeScript

import React from 'react';
import { locationService } from '@grafana/runtime';
import { useStyles2 } from '@grafana/ui';
import { Page } from 'app/core/components/Page/Page';
import { PlaylistForm } from './PlaylistForm';
import { createPlaylist } from './api';
import { getPlaylistStyles } from './styles';
import { Playlist } from './types';
import { usePlaylist } from './usePlaylist';
export const PlaylistNewPage = () => {
const styles = useStyles2(getPlaylistStyles);
const { playlist, loading } = usePlaylist();
const onSubmit = async (playlist: Playlist) => {
await createPlaylist(playlist);
locationService.push('/playlists');
};
return (
<Page navId="dashboards/playlists">
<Page.Contents isLoading={loading}>
<h3 className={styles.subHeading}>New Playlist</h3>
<p className={styles.description}>
A playlist rotates through a pre-selected list of dashboards. A playlist can be a great way to build
situational awareness, or just show off your metrics to your team or visitors.
</p>
<PlaylistForm onSubmit={onSubmit} playlist={playlist} />
</Page.Contents>
</Page>
);
};
export default PlaylistNewPage;