Przeglądaj źródła

form read in preconfigured values

jusrhee 5 lat temu
rodzic
commit
56a015966d

+ 1 - 0
dashboard/src/components/ResourceTab.tsx

@@ -162,6 +162,7 @@ const ResourceHeader = styled.div`
   display: flex;
   align-items: center;
   color: #ffffff66;
+  user-select: none;
   padding: 8px 18px;
   padding-left: ${(props: { expanded: boolean, hasChildren: boolean }) => props.hasChildren ? '10px' : '22px'};
   text-transform: capitalize;

+ 5 - 3
dashboard/src/components/image-selector/ImageSelector.tsx

@@ -91,6 +91,11 @@ export default class ImageSelector extends Component<PropsType, StateType> {
     });
   }
 
+  /*
+  <Highlight onClick={() => this.props.setCurrentView('integrations')}>
+    Link your registry.
+  </Highlight>
+  */
   renderImageList = () => {
     let { images, loading, error } = this.state;
     if (loading) {
@@ -101,9 +106,6 @@ export default class ImageSelector extends Component<PropsType, StateType> {
       return (
         <LoadingWrapper>
           No registries found. 
-          <Highlight onClick={() => this.props.setCurrentView('integrations')}>
-            Link your registry.
-          </Highlight>
         </LoadingWrapper>
       );
     }

+ 1 - 0
dashboard/src/components/values-form/ValuesForm.tsx

@@ -17,6 +17,7 @@ type PropsType = {
   sections?: Section[],
   disabled?: boolean,
   saveValuesStatus?: string | null,
+  config?: any, // Chart config object containing existing values
 };
 
 type StateType = any;

+ 15 - 15
dashboard/src/main/home/cluster-dashboard/chart/ChartList.tsx

@@ -63,50 +63,50 @@ export default class ChartList extends Component<PropsType, StateType> {
 
   setupWebsocket = (kind: string) => {
       let { currentCluster, currentProject } = this.context;
-      let protocol = process.env.NODE_ENV == 'production' ? 'wss' : 'ws'
-      let ws = new WebSocket(`${protocol}://${process.env.API_SERVER}/api/projects/${currentProject.id}/k8s/${kind}/status?cluster_id=${currentCluster.id}&service_account_id=${currentCluster.service_account_id}`)
+      let protocol = process.env.NODE_ENV == 'production' ? 'wss' : 'ws';
+      let ws = new WebSocket(`${protocol}://${process.env.API_SERVER}/api/projects/${currentProject.id}/k8s/${kind}/status?cluster_id=${currentCluster.id}`);
       ws.onopen = () => {
-        console.log('connected to websocket')
+        console.log('connected to websocket');
       }
   
       ws.onmessage = (evt: MessageEvent) => {
-        let event = JSON.parse(evt.data)
-        let object = event.Object
-        let chartKey = this.state.chartLookupTable[object.metadata.uid]
+        let event = JSON.parse(evt.data);
+        let object = event.Object;
+        let chartKey = this.state.chartLookupTable[object.metadata.uid];
 
         // ignore if updated object does not belong to any chart in the list.
         if (!chartKey) {
           return;
         }
 
-        let chartControllers = this.state.controllers[chartKey]
-        chartControllers[object.metadata.uid] = object
+        let chartControllers = this.state.controllers[chartKey];
+        chartControllers[object.metadata.uid] = object;
 
         this.setState({
           controllers: {
             ...this.state.controllers,
             [chartKey] : chartControllers
           }
-        })
+        });
       }
   
       ws.onclose = () => {
-        console.log('closing websocket')
+        console.log('closing websocket');
       }
   
       ws.onerror = (err: ErrorEvent) => {
-        console.log(err)
-        ws.close()
+        console.log(err);
+        ws.close();
       }
 
-      return ws
+      return ws;
   }
 
   setControllerWebsockets = (controllers: any[]) => {
     let websockets = controllers.map((kind: string) => {
-      return this.setupWebsocket(kind)
+      return this.setupWebsocket(kind);
     })
-    this.setState({websockets})
+    this.setState({ websockets });
   }
 
   getControllers = (charts: any[]) => {

+ 5 - 0
dashboard/src/main/home/cluster-dashboard/expanded-chart/ExpandedChart.tsx

@@ -35,6 +35,7 @@ type StateType = {
   tabContents: any,
   checkTabExists: boolean,
   saveValuesStatus: string | null,
+  config: any | null, // Chart config for form defaults
 };
 
 // Tabs not display when previewing an old revision
@@ -59,6 +60,7 @@ export default class ExpandedChart extends Component<PropsType, StateType> {
     tabContents: [] as any,
     checkTabExists: false,
     saveValuesStatus: null as (string | null),
+    config: null as any | null,
   }
 
   updateResources = () => {
@@ -101,6 +103,8 @@ export default class ExpandedChart extends Component<PropsType, StateType> {
   upgradeValues = (values: any) => {
     let { currentProject, currentCluster, setCurrentError } = this.context;
     values = yaml.dump(values);
+    this.setState({ saveValuesStatus: 'loading' });
+    this.props.refreshChart();
     api.upgradeChartValues('<token>', {
       namespace: this.props.currentChart.namespace,
       storage: StorageType.Secret,
@@ -137,6 +141,7 @@ export default class ExpandedChart extends Component<PropsType, StateType> {
                 sections={tab.sections} 
                 onSubmit={this.upgradeValues}
                 saveValuesStatus={this.state.saveValuesStatus}
+                config={this.props.currentChart.config}
               />
             </ValuesFormWrapper>
           ),

+ 1 - 1
dashboard/src/main/home/integrations/Integrations.tsx

@@ -36,7 +36,7 @@ export default class Integrations extends Component<PropsType, StateType> {
           if (err) {
             console.log(err);
           } else {
-            console.log(res.data)
+            // console.log(res.data)
           }
         });
         break;

+ 4 - 2
dashboard/src/main/home/sidebar/Sidebar.tsx

@@ -117,15 +117,17 @@ export default class Sidebar extends Component<PropsType, StateType> {
             Dashboard
           </NavButton>
           <NavButton
-            onClick={() => this.props.setCurrentView('templates')}
+            onClick={() => false ? this.props.setCurrentView('templates') : null}
             selected={this.props.currentView === 'templates'}
+            disabled={true}
           >
             <img src={filter} />
             Templates
           </NavButton>
           <NavButton
-            onClick={() => this.props.setCurrentView('integrations')}
+            onClick={() => false ? this.props.setCurrentView('integrations') : null}
             selected={this.props.currentView === 'integrations'}
+            disabled={true}
           >
             <img src={integrations} />
             Integrations