Patrick O'Carroll 7 лет назад
Родитель
Сommit
ce9c8ae854

+ 10 - 4
public/app/features/dashboard/dashgrid/AddPanelPanel.tsx

@@ -112,11 +112,8 @@ export class AddPanelPanel extends React.Component<AddPanelPanelProps, AddPanelP
   }
   }
 
 
   renderText(text: string) {
   renderText(text: string) {
-    //if(this.state.filter) {
     let searchWords = this.state.filter.split('');
     let searchWords = this.state.filter.split('');
     return <Highlighter highlightClassName="highlight-search-match" textToHighlight={text} searchWords={searchWords} />;
     return <Highlighter highlightClassName="highlight-search-match" textToHighlight={text} searchWords={searchWords} />;
-    //}
-    //return text;
   }
   }
 
 
   renderPanelItem(panel, index) {
   renderPanelItem(panel, index) {
@@ -128,6 +125,10 @@ export class AddPanelPanel extends React.Component<AddPanelPanelProps, AddPanelP
     );
     );
   }
   }
 
 
+  noCopiedPanelPlugins() {
+    return <div className="add-panel__no-panels">No copied panels yet.</div>;
+  }
+
   filterChange(evt) {
   filterChange(evt) {
     this.setState({
     this.setState({
       filter: evt.target.value,
       filter: evt.target.value,
@@ -173,7 +174,12 @@ export class AddPanelPanel extends React.Component<AddPanelPanelProps, AddPanelP
     } else if (this.state.tab === 'Copy') {
     } else if (this.state.tab === 'Copy') {
       addClass = '';
       addClass = '';
       copyClass = 'active active--panel';
       copyClass = 'active active--panel';
-      panelTab = this.state.copiedPanelPlugins.map(this.renderPanelItem);
+      console.log(this.state.copiedPanelPlugins);
+      if (this.state.copiedPanelPlugins.length > 0) {
+        panelTab = this.state.copiedPanelPlugins.map(this.renderPanelItem);
+      } else {
+        panelTab = this.noCopiedPanelPlugins();
+      }
     }
     }
 
 
     return (
     return (

+ 7 - 0
public/sass/components/_panel_add_panel.scss

@@ -86,3 +86,10 @@
   margin-bottom: 10px;
   margin-bottom: 10px;
   margin-top: 7px;
   margin-top: 7px;
 }
 }
+
+.add-panel__no-panels {
+  color: $text-color-weak;
+  font-style: italic;
+  width: 100%;
+  padding: 3px 8px;
+}