瀏覽代碼

Settings Section replaced navigator clipboard with the new component CopyToClipboard

jnfrati 5 年之前
父節點
當前提交
61cf89ce7a
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      dashboard/src/main/home/cluster-dashboard/expanded-chart/SettingsSection.tsx

+ 5 - 4
dashboard/src/main/home/cluster-dashboard/expanded-chart/SettingsSection.tsx

@@ -17,6 +17,7 @@ import Heading from "components/values-form/Heading";
 import Helper from "components/values-form/Helper";
 import Helper from "components/values-form/Helper";
 import InputRow from "components/values-form/InputRow";
 import InputRow from "components/values-form/InputRow";
 import _ from "lodash";
 import _ from "lodash";
+import CopyToClipboard from "components/CopyToClipboard";
 
 
 type PropsType = {
 type PropsType = {
   currentChart: ChartType;
   currentChart: ChartType;
@@ -152,12 +153,12 @@ export default class SettingsSection extends Component<PropsType, StateType> {
             <div>{webhookText}</div>
             <div>{webhookText}</div>
             <i
             <i
               className="material-icons"
               className="material-icons"
-              onClick={() => {
-                navigator.clipboard.writeText(webhookText);
-                this.setState({ highlightCopyButton: true });
-              }}
               onMouseLeave={() => this.setState({ highlightCopyButton: false })}
               onMouseLeave={() => this.setState({ highlightCopyButton: false })}
             >
             >
+              <CopyToClipboard 
+                text={webhookText} 
+                onSuccess={() => this.setState({ highlightCopyButton: true })}
+              />
               content_copy
               content_copy
             </i>
             </i>
           </Webhook>
           </Webhook>