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

handle env-key-value-array empty env

jusrhee 5 лет назад
Родитель
Сommit
37c2e13e5f

+ 5 - 3
dashboard/src/components/values-form/KeyValueArray.tsx

@@ -29,9 +29,11 @@ export default class KeyValueArray extends Component<PropsType, StateType> {
 
   componentDidMount() {
     let arr = [] as any[];
-    Object.keys(this.props.values).forEach((key: string, i: number) => {
-      arr.push({ key, value: this.props.values[key] });
-    });
+    if (this.props.values) {
+      Object.keys(this.props.values).forEach((key: string, i: number) => {
+        arr.push({ key, value: this.props.values[key] });
+      });
+    }
     this.setState({ values: arr });
   }
 

+ 17 - 2
dashboard/src/main/home/cluster-dashboard/DashboardHeader.tsx

@@ -1,6 +1,8 @@
 import React, { Component } from "react";
 import styled from "styled-components";
 
+import { Context } from "shared/Context";
+
 type PropsType = {
   image: any;
   title: string;
@@ -24,7 +26,9 @@ export default class DashboardHeader extends Component<PropsType, StateType> {
               <i className="material-icons">info</i> Info
             </InfoLabel>
           </TopRow>
-          <Description>{this.props.description}</Description>
+          <Description>
+            {this.props.description}
+          </Description>
         </InfoSection>
 
         <LineBreak />
@@ -33,6 +37,8 @@ export default class DashboardHeader extends Component<PropsType, StateType> {
   }
 }
 
+DashboardHeader.contextType = Context;
+
 const Img = styled.img`
   width: 30px;
 `;
@@ -54,6 +60,7 @@ const Description = styled.div`
   margin-top: 13px;
   margin-left: 2px;
   font-size: 13px;
+  line-height: 1.5em;
 `;
 
 const InfoLabel = styled.div`
@@ -83,10 +90,18 @@ const Title = styled.div`
   font-family: "Work Sans", sans-serif;
   margin-left: 18px;
   color: #ffffff;
+  text-transform: capitalize;
+  white-space: nowrap;
+`;
+
+const ClusterLabel = styled.div`
+  color: #ffffff22;
+  font-size: 14px;
+  text-transform: none;
+  font-weight: 400;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
-  text-transform: capitalize;
 `;
 
 const TitleSection = styled.div`