LibrayPanels: Fix unlinking libray panel (#57825) (#58042)

This commit is contained in:
Torkel Ödegaard
2022-11-02 16:19:53 +01:00
committed by GitHub
parent 5895100beb
commit 8b7664294c
3 changed files with 8 additions and 6 deletions
@@ -370,8 +370,7 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
onClick={() => {
showModal(UnlinkModal, {
onConfirm: () => {
delete this.props.panel.libraryPanel;
this.props.panel.render();
this.props.panel.unlinkLibraryPanel();
this.forceUpdate();
},
onDismiss: hideModal,
@@ -659,6 +659,12 @@ export class PanelModel implements DataConfigSource, IPanelModel {
getDisplayTitle(): string {
return this.replaceVariables(this.title, undefined, 'text');
}
unlinkLibraryPanel() {
delete this.libraryPanel;
this.configRev++;
this.render();
}
}
function getPluginVersion(plugin: PanelPlugin): string {
+1 -4
View File
@@ -87,10 +87,7 @@ export const unlinkLibraryPanel = (panel: PanelModel) => {
new ShowModalReactEvent({
component: UnlinkModal,
props: {
onConfirm: () => {
delete panel.libraryPanel;
panel.render();
},
onConfirm: () => panel.unlinkLibraryPanel(),
isOpen: true,
},
})