소스 검색

prevent clustersection from editing provisioner

jusrhee 5 년 전
부모
커밋
b130464816
2개의 변경된 파일23개의 추가작업 그리고 3개의 파일을 삭제
  1. 21 1
      dashboard/src/components/TabRegion.tsx
  2. 2 2
      dashboard/src/main/home/sidebar/ClusterSection.tsx

+ 21 - 1
dashboard/src/components/TabRegion.tsx

@@ -38,7 +38,15 @@ export default class TabRegion extends Component<PropsType, StateType> {
   }
   }
 
 
   renderContents = () => {
   renderContents = () => {
-    if (!this.props.currentTab) {
+    if (this.props.options.length === 0) {
+      return (
+        <Div>
+          <TabContents>
+            <Placeholder>No additional settings found.</Placeholder>
+          </TabContents>
+        </Div>
+      );
+    } else if (!this.props.currentTab) {
       return (
       return (
         <Loading />
         <Loading />
       );
       );
@@ -70,6 +78,18 @@ export default class TabRegion extends Component<PropsType, StateType> {
   }
   }
 }
 }
 
 
+const Placeholder = styled.div`
+  width: 100%;
+  height: 200px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  background: #ffffff11;
+  border-radius: 5px;
+  color: #ffffff44;
+  font-size: 13px;
+`;
+
 const Div = styled.div`
 const Div = styled.div`
   width: 100%;
   width: 100%;
   height: 100%;
   height: 100%;

+ 2 - 2
dashboard/src/main/home/sidebar/ClusterSection.tsx

@@ -56,7 +56,7 @@ export default class ClusterSection extends Component<PropsType, StateType> {
           if (clusters.length > 0) {
           if (clusters.length > 0) {
             this.setState({ clusters });
             this.setState({ clusters });
             setCurrentCluster(clusters[0]);
             setCurrentCluster(clusters[0]);
-          } else {
+          } else if (this.props.currentView !== 'provisioner') {
             this.setState({ clusters: [] });
             this.setState({ clusters: [] });
             setCurrentCluster(null);
             setCurrentCluster(null);
             this.props.setCurrentView('dashboard');
             this.props.setCurrentView('dashboard');
@@ -75,7 +75,7 @@ export default class ClusterSection extends Component<PropsType, StateType> {
     if (prevProps !== this.props) {
     if (prevProps !== this.props) {
 
 
       // Refresh clusters on project change 
       // Refresh clusters on project change 
-      if (this.state.prevProjectId !== this.context.currentProject.id && this.props.currentView !== 'provisioner') {
+      if (this.state.prevProjectId !== this.context.currentProject.id) {
         this.updateClusters();
         this.updateClusters();
         this.setState({ prevProjectId: this.context.currentProject.id });
         this.setState({ prevProjectId: this.context.currentProject.id });
       } else if (this.props.forceRefreshClusters === true) {
       } else if (this.props.forceRefreshClusters === true) {