From 2cc66e548adb770f2256d30761e3964f9a05b6fd Mon Sep 17 00:00:00 2001 From: kay delaney <45561153+kaydelaney@users.noreply.github.com> Date: Tue, 4 May 2021 09:00:44 +0100 Subject: [PATCH] Library panels: Normalize feature name as "Library panels" (#33540) --- packages/grafana-ui/src/components/Icon/Icon.tsx | 2 +- packages/grafana-ui/src/components/Icon/iconBundle.ts | 4 ++-- packages/grafana-ui/src/types/icon.ts | 4 ++-- pkg/api/index.go | 4 ++-- .../dashboard/components/PanelEditor/PanelEditor.tsx | 2 +- .../components/PanelEditor/VisualizationSelectPane.tsx | 6 +++--- .../components/PanelEditor/getPanelFrameOptions.tsx | 2 +- .../{ShareGlobalPanel.tsx => ShareLibraryPanel.tsx} | 4 ++-- .../features/dashboard/components/ShareModal/ShareModal.tsx | 4 ++-- .../features/dashboard/dashgrid/PanelHeader/PanelHeader.tsx | 2 +- public/app/features/dashboard/utils/getPanelMenu.test.ts | 2 +- public/app/features/dashboard/utils/getPanelMenu.ts | 4 ++-- .../AddLibraryPanelModal/AddLibraryPanelModal.tsx | 4 ++-- .../components/LibraryPanelsView/LibraryPanelsView.tsx | 2 +- .../PanelLibraryOptionsGroup/PanelLibraryOptionsGroup.tsx | 2 +- .../icons/mono/{reusable-panel.svg => library-panel.svg} | 0 16 files changed, 24 insertions(+), 24 deletions(-) rename public/app/features/dashboard/components/ShareModal/{ShareGlobalPanel.tsx => ShareLibraryPanel.tsx} (74%) rename public/img/icons/mono/{reusable-panel.svg => library-panel.svg} (100%) diff --git a/packages/grafana-ui/src/components/Icon/Icon.tsx b/packages/grafana-ui/src/components/Icon/Icon.tsx index 3a83cb4e9fd..8e3b9129ecf 100644 --- a/packages/grafana-ui/src/components/Icon/Icon.tsx +++ b/packages/grafana-ui/src/components/Icon/Icon.tsx @@ -7,7 +7,7 @@ import { IconName, IconType, IconSize } from '../../types/icon'; import SVG from 'react-inlinesvg'; import { cacheInitialized, initIconCache, iconRoot } from './iconBundle'; -const alwaysMonoIcons: IconName[] = ['grafana', 'favorite', 'heart-break', 'heart', 'panel-add', 'reusable-panel']; +const alwaysMonoIcons: IconName[] = ['grafana', 'favorite', 'heart-break', 'heart', 'panel-add', 'library-panel']; export interface IconProps extends React.HTMLAttributes { name: IconName; diff --git a/packages/grafana-ui/src/components/Icon/iconBundle.ts b/packages/grafana-ui/src/components/Icon/iconBundle.ts index becfdda7485..4bbe54eabb9 100644 --- a/packages/grafana-ui/src/components/Icon/iconBundle.ts +++ b/packages/grafana-ui/src/components/Icon/iconBundle.ts @@ -140,7 +140,7 @@ import u1131 from '!!raw-loader!../../../../../public/img/icons/mono/grafana.svg import u1132 from '!!raw-loader!../../../../../public/img/icons/mono/heart.svg'; import u1133 from '!!raw-loader!../../../../../public/img/icons/mono/heart-break.svg'; import u1134 from '!!raw-loader!../../../../../public/img/icons/mono/panel-add.svg'; -import u1135 from '!!raw-loader!../../../../../public/img/icons/mono/reusable-panel.svg'; +import u1135 from '!!raw-loader!../../../../../public/img/icons/mono/library-panel.svg'; function cacheItem(content: string, path: string) { cacheStore[iconRoot + path] = { content, status: 'loaded', queue: [] }; @@ -290,5 +290,5 @@ export function initIconCache() { cacheItem(u1132, 'mono/heart.svg'); cacheItem(u1133, 'mono/heart-break.svg'); cacheItem(u1134, 'mono/panel-add.svg'); - cacheItem(u1135, 'mono/reusable-panel.svg'); + cacheItem(u1135, 'mono/library-panel.svg'); } diff --git a/packages/grafana-ui/src/types/icon.ts b/packages/grafana-ui/src/types/icon.ts index f7122c59f15..a9cfd7be313 100644 --- a/packages/grafana-ui/src/types/icon.ts +++ b/packages/grafana-ui/src/types/icon.ts @@ -112,7 +112,7 @@ export type IconName = | 'power' | 'question-circle' | 'repeat' - | 'reusable-panel' + | 'library-panel' | 'rocket' | 'save' | 'search-minus' @@ -248,7 +248,7 @@ export const getAvailableIcons = (): IconName[] => [ 'power', 'question-circle', 'repeat', - 'reusable-panel', + 'library-panel', 'rocket', 'save', 'search-minus', diff --git a/pkg/api/index.go b/pkg/api/index.go index ca4395da85d..33538cfd700 100644 --- a/pkg/api/index.go +++ b/pkg/api/index.go @@ -168,10 +168,10 @@ func (hs *HTTPServer) getNavTree(c *models.ReqContext, hasEditPerm bool) ([]*dto Icon: "camera", }) dashboardChildNavs = append(dashboardChildNavs, &dtos.NavLink{ - Text: "Global panels", + Text: "Library panels", Id: "library-panels", Url: hs.Cfg.AppSubURL + "/library-panels", - Icon: "reusable-panel", + Icon: "library-panel", }) } diff --git a/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx b/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx index 3a63973830b..2bad1c19664 100644 --- a/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx +++ b/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx @@ -354,7 +354,7 @@ export class PanelEditorUnconnected extends PureComponent { isOpen: true, }); }} - title="Disconnects this panel from the reusable panel so that you can edit it regularly." + title="Disconnects this panel from the library panel so that you can edit it regularly." key="unlink" > Unlink diff --git a/public/app/features/dashboard/components/PanelEditor/VisualizationSelectPane.tsx b/public/app/features/dashboard/components/PanelEditor/VisualizationSelectPane.tsx index 7df59275ecd..7d60eced22c 100644 --- a/public/app/features/dashboard/components/PanelEditor/VisualizationSelectPane.tsx +++ b/public/app/features/dashboard/components/PanelEditor/VisualizationSelectPane.tsx @@ -80,7 +80,7 @@ export const VisualizationSelectPane: FC = ({ panel }) => { { label: 'Visualizations', value: ListMode.Visualizations }, { label: 'Library panels', - value: ListMode.Globals, + value: ListMode.LibraryPanels, description: 'Reusable panels you can share between multiple dashboards.', }, ]; @@ -124,7 +124,7 @@ export const VisualizationSelectPane: FC = ({ panel }) => { onClose={() => {}} /> )} - {listMode === ListMode.Globals && ( + {listMode === ListMode.LibraryPanels && ( )} @@ -136,7 +136,7 @@ export const VisualizationSelectPane: FC = ({ panel }) => { enum ListMode { Visualizations, - Globals, + LibraryPanels, } VisualizationSelectPane.displayName = 'VisualizationSelectPane'; diff --git a/public/app/features/dashboard/components/PanelEditor/getPanelFrameOptions.tsx b/public/app/features/dashboard/components/PanelEditor/getPanelFrameOptions.tsx index b1d6ca570e1..ad56b99439c 100644 --- a/public/app/features/dashboard/components/PanelEditor/getPanelFrameOptions.tsx +++ b/public/app/features/dashboard/components/PanelEditor/getPanelFrameOptions.tsx @@ -19,7 +19,7 @@ export function getPanelFrameCategory(props: OptionPaneRenderProps): OptionsPane if (isPanelModelLibraryPanel(panel)) { descriptor.addItem( new OptionsPaneItemDescriptor({ - title: 'Global panel information', + title: 'Library panel information', render: function renderLibraryPanelInformation() { return ; }, diff --git a/public/app/features/dashboard/components/ShareModal/ShareGlobalPanel.tsx b/public/app/features/dashboard/components/ShareModal/ShareLibraryPanel.tsx similarity index 74% rename from public/app/features/dashboard/components/ShareModal/ShareGlobalPanel.tsx rename to public/app/features/dashboard/components/ShareModal/ShareLibraryPanel.tsx index 2195f540df5..11c77d96438 100644 --- a/public/app/features/dashboard/components/ShareModal/ShareGlobalPanel.tsx +++ b/public/app/features/dashboard/components/ShareModal/ShareLibraryPanel.tsx @@ -8,14 +8,14 @@ interface Props { initialFolderId?: number; } -export const ShareGlobalPanel = ({ panel, initialFolderId, onDismiss }: Props) => { +export const ShareLibraryPanel = ({ panel, initialFolderId, onDismiss }: Props) => { if (!panel) { return null; } return ( <> -

Add this panel to the panel library.

+

Create library panel.

); diff --git a/public/app/features/dashboard/components/ShareModal/ShareModal.tsx b/public/app/features/dashboard/components/ShareModal/ShareModal.tsx index 4846ecfa040..bf97d56d386 100644 --- a/public/app/features/dashboard/components/ShareModal/ShareModal.tsx +++ b/public/app/features/dashboard/components/ShareModal/ShareModal.tsx @@ -8,7 +8,7 @@ import { ShareExport } from './ShareExport'; import { ShareEmbed } from './ShareEmbed'; import { ShareModalTabModel } from './types'; import { contextSrv } from 'app/core/core'; -import { ShareGlobalPanel } from './ShareGlobalPanel'; +import { ShareLibraryPanel } from './ShareLibraryPanel'; const customDashboardTabs: ShareModalTabModel[] = []; const customPanelTabs: ShareModalTabModel[] = []; @@ -42,7 +42,7 @@ function getTabs(props: Props) { tabs.push({ label: 'Embed', value: 'embed', component: ShareEmbed }); if (!isPanelModelLibraryPanel(panel)) { - tabs.push({ label: 'Global panel', value: 'global_panel', component: ShareGlobalPanel }); + tabs.push({ label: 'Library panel', value: 'library_panel', component: ShareLibraryPanel }); } tabs.push(...customPanelTabs); } else { diff --git a/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeader.tsx b/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeader.tsx index 0e7d515697a..775c1033971 100644 --- a/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeader.tsx +++ b/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeader.tsx @@ -48,7 +48,7 @@ export const PanelHeader: FC = ({ panel, error, isViewing, isEditing, dat return (
- {panel.libraryPanel && } + {panel.libraryPanel && } {alertState ? ( { }, Object { "onClick": [Function], - "text": "To global panel", + "text": "Create library panel", }, ], "text": "More...", diff --git a/public/app/features/dashboard/utils/getPanelMenu.ts b/public/app/features/dashboard/utils/getPanelMenu.ts index 2d8b926bfee..9dc7b2f2c7b 100644 --- a/public/app/features/dashboard/utils/getPanelMenu.ts +++ b/public/app/features/dashboard/utils/getPanelMenu.ts @@ -169,12 +169,12 @@ export function getPanelMenu( if (isPanelModelLibraryPanel(panel)) { subMenu.push({ - text: 'Unlink global panel', + text: 'Unlink library panel', onClick: onUnlinkLibraryPanel, }); } else { subMenu.push({ - text: 'To global panel', + text: 'Create library panel', onClick: onAddLibraryPanel, }); } diff --git a/public/app/features/library-panels/components/AddLibraryPanelModal/AddLibraryPanelModal.tsx b/public/app/features/library-panels/components/AddLibraryPanelModal/AddLibraryPanelModal.tsx index 46c61993f9f..673862982ca 100644 --- a/public/app/features/library-panels/components/AddLibraryPanelModal/AddLibraryPanelModal.tsx +++ b/public/app/features/library-panels/components/AddLibraryPanelModal/AddLibraryPanelModal.tsx @@ -33,7 +33,7 @@ export const AddLibraryPanelContents = ({ panel, initialFolderId, onDismiss }: A saveLibraryPanel(panel, folderId!).then(() => onDismiss()); }} > - Add panel to the panel library + Create library panel @@ -46,7 +46,7 @@ interface Props extends AddLibraryPanelContentsProps { export const AddLibraryPanelModal: React.FC = ({ isOpen = false, panel, initialFolderId, ...props }) => { return ( - + ); diff --git a/public/app/features/library-panels/components/LibraryPanelsView/LibraryPanelsView.tsx b/public/app/features/library-panels/components/LibraryPanelsView/LibraryPanelsView.tsx index 3cc7e0dc895..d458f3707bc 100644 --- a/public/app/features/library-panels/components/LibraryPanelsView/LibraryPanelsView.tsx +++ b/public/app/features/library-panels/components/LibraryPanelsView/LibraryPanelsView.tsx @@ -62,7 +62,7 @@ export const LibraryPanelsView: React.FC = ({ ) : ( libraryPanels?.map((item, i) => ( = ({ panel, searchQuery }) => { {!panel.libraryPanel && ( )} diff --git a/public/img/icons/mono/reusable-panel.svg b/public/img/icons/mono/library-panel.svg similarity index 100% rename from public/img/icons/mono/reusable-panel.svg rename to public/img/icons/mono/library-panel.svg