Просмотр исходного кода

Merge pull request #759 from porter-dev/0.4.0-add-error-popup-to-addons

0.4.0 add error popup to addons
jusrhee 5 лет назад
Родитель
Сommit
89b6dd0718

+ 13 - 1
dashboard/src/components/CopyToClipboard.tsx

@@ -3,6 +3,7 @@ import ClipboardJS from "clipboard";
 import React, { Component, RefObject } from "react";
 import Tooltip from "@material-ui/core/Tooltip";
 import styled from "styled-components";
+import { styled as materialStyled } from "@material-ui/core/styles";
 
 type PropsType = {
   text: string;
@@ -79,7 +80,18 @@ export default class CopyToClipboard extends Component<PropsType, StateType> {
   render() {
     return (
       <Tooltip
-        title="Copied to clipboard!"
+        title={
+          <div
+            style={{
+              fontFamily: "Work Sans, sans-serif",
+              fontSize: "12px",
+              fontWeight: "normal",
+              padding: "5px 6px",
+            }}
+          >
+            Copied to clipboard
+          </div>
+        }
         open={this.state.success}
         placement="bottom"
         arrow

+ 3 - 1
dashboard/src/main/home/dashboard/ClusterList.tsx

@@ -268,7 +268,8 @@ const DashboardIcon = styled.div`
 
 const TemplateTitle = styled.div`
   margin-bottom: 0px;
-  width: 80%;
+  margin-top: 13px;
+  width: 100%;
   text-align: center;
   font-size: 14px;
   white-space: nowrap;
@@ -362,6 +363,7 @@ const Url = styled.a`
   width: 100%;
   font-size: 13px;
   user-select: text;
+  font-weight: 400;
   display: flex;
   align-items: center;
   justify-content: center;

+ 12 - 2
dashboard/src/main/home/launch/expanded-template/LaunchTemplate.tsx

@@ -181,8 +181,18 @@ class LaunchTemplate extends Component<PropsType, StateType> {
         });
       })
       .catch((err) => {
-        this.setState({ saveValuesStatus: "error" });
-        setCurrentError(err.response.data.errors[0]);
+        let parsedErr =
+          err?.response?.data?.errors && err.response.data.errors[0];
+        if (parsedErr) {
+          err = parsedErr;
+        }
+
+        this.setState({
+          saveValuesStatus: parsedErr,
+        });
+
+        setCurrentError(err);
+
         window.analytics.track("Failed to Deploy Add-on", {
           name: this.props.currentTemplate.name,
           namespace: this.state.selectedNamespace,

+ 2 - 2
dashboard/src/main/home/launch/launch-flow/LaunchFlow.tsx

@@ -188,7 +188,7 @@ class LaunchFlow extends Component<PropsType, StateType> {
         this.setState({
           saveValuesStatus: parsedErr,
         });
-        setCurrentError(err.response.data.errors[0]);
+        setCurrentError(err);
         window.analytics.track("Failed to Deploy Add-on", {
           name: this.props.currentTemplate.name,
           namespace: selectedNamespace,
@@ -274,7 +274,7 @@ class LaunchFlow extends Component<PropsType, StateType> {
               }
             )
             .then((res) => {
-              resolve(res.data?.external_url);
+              resolve(res?.data?.external_url);
             })
             .catch((err) => {
               let parsedErr =

+ 2 - 2
dashboard/src/shared/types.tsx

@@ -9,12 +9,12 @@ export interface ClusterType {
 
 export interface DetailedClusterType extends ClusterType {
   ingress_ip?: string;
-  ingress_error?: DetailedIngressError
+  ingress_error?: DetailedIngressError;
 }
 
 export interface DetailedIngressError {
   message: string;
-  error: string
+  error: string;
 }
 
 export interface ChartType {