From 252645b330b60d3cd8335382b371525bf963fd4e Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Wed, 19 Jan 2022 09:44:29 +0000 Subject: [PATCH] Playlists: Enable sharing direct links to playlists (#44161) * Special case mixed datasources... :/ * Hacky implementation of playlist share modal * Refactor StartModal into PlaylistSettingsModal * Revert "Refactor StartModal into PlaylistSettingsModal" This reverts commit e71fc338658d44c3f1ea260afdc447f7bf3c6092. * Create new ShareModal component * Revert "Special case mixed datasources... :/" This reverts commit dd0e3ea4a8f67786ba369050ff3a571c7b0378b3. * PlaylistMode instead of PlaylistModes * kick drone --- .../features/playlist/PlaylistPageList.tsx | 23 ++++++- public/app/features/playlist/ShareModal.tsx | 68 +++++++++++++++++++ public/app/features/playlist/StartModal.tsx | 12 ++-- public/app/features/playlist/types.ts | 2 + 4 files changed, 97 insertions(+), 8 deletions(-) create mode 100644 public/app/features/playlist/ShareModal.tsx diff --git a/public/app/features/playlist/PlaylistPageList.tsx b/public/app/features/playlist/PlaylistPageList.tsx index 9c31ac7e4ff..79adbe7e964 100644 --- a/public/app/features/playlist/PlaylistPageList.tsx +++ b/public/app/features/playlist/PlaylistPageList.tsx @@ -1,9 +1,11 @@ import React from 'react'; import { PlaylistDTO } from './types'; -import { Button, Card, LinkButton, useStyles2 } from '@grafana/ui'; +import { Button, Card, LinkButton, ModalsController, useStyles2 } from '@grafana/ui'; import { contextSrv } from 'app/core/services/context_srv'; import { GrafanaTheme2 } from '@grafana/data'; import { css } from '@emotion/css'; +import { DashNavButton } from '../dashboard/components/DashNav/DashNavButton'; +import { ShareModal } from './ShareModal'; interface Props { setStartPlaylist: (playlistItem: PlaylistDTO) => void; @@ -18,7 +20,24 @@ export const PlaylistPageList = ({ playlists, setStartPlaylist, setPlaylistToDel {playlists!.map((playlist: PlaylistDTO) => (
  • - {playlist.name} + + {playlist.name} + + {({ showModal, hideModal }) => ( + { + showModal(ShareModal, { + playlistId: playlist.id, + onDismiss: hideModal, + }); + }} + /> + )} + +