Преглед изворни кода

Merge branch 'master' of https://github.com/porter-dev/porter into sean-testing

Sean Rhee пре 5 година
родитељ
комит
103ab2f915

BIN
dashboard/src/assets/My Health Connection - Appointment Details.pdf


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

@@ -92,6 +92,20 @@ export default class ValuesForm extends Component<PropsType, StateType> {
               label={item.label}
               label={item.label}
             />
             />
           );
           );
+        case 'array-input':
+          return (
+            <InputRow
+              key={i}
+              isRequired={item.required}
+              type='text'
+              value={this.getInputValue(item)}
+              setValue={(x: string) => {
+                this.props.setMetaState({ [key]: [x] });
+              }}
+              label={item.label}
+              unit={item.settings ? item.settings.unit : null}
+            />
+          );
         case 'string-input':
         case 'string-input':
           return (
           return (
             <InputRow
             <InputRow

+ 3 - 0
dashboard/src/components/values-form/ValuesWrapper.tsx

@@ -47,6 +47,9 @@ export default class ValuesWrapper extends Component<PropsType, StateType> {
               case 'string-input':
               case 'string-input':
                 metaState[key] = def ? def : '';
                 metaState[key] = def ? def : '';
                 break;
                 break;
+              case 'array-input':
+                metaState[key] = def ? def : [];
+                break;
               case 'number-input':
               case 'number-input':
                 metaState[key] = def.toString() ? def : '';
                 metaState[key] = def.toString() ? def : '';
                 break;
                 break;

+ 15 - 0
dashboard/src/index.html

@@ -1,5 +1,10 @@
 <!DOCTYPE html>
 <!DOCTYPE html>
 <html lang="en">
 <html lang="en">
+  <script>
+    !function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);
+    posthog.init('XHhXMIA5YlgR4l9QV3Ydm5ZasEyyjvPvGCb33_QVLNc',{api_host:'https://posthog-porter.herokuapp.com'})
+  </script>
+
   <head>
   <head>
     <title>Porter | Dashboard</title>
     <title>Porter | Dashboard</title>
 
 
@@ -19,5 +24,15 @@
   </head>
   </head>
 <body>
 <body>
   <div id="output"></div>
   <div id="output"></div>
+  <script>
+    window.intercomSettings = {
+      app_id: "gq56g49i"
+    };
+  </script>
+
+  <script>
+  // We pre-filled your app ID in the widget URL: 'https://widget.intercom.io/widget/gq56g49i'
+  (function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/gq56g49i';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);};if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();
+  </script>
 </body>
 </body>
 </html>
 </html>

+ 3 - 2
dashboard/src/main/Main.tsx

@@ -31,8 +31,9 @@ export default class Main extends Component<PropsType, StateType> {
 
 
   componentDidMount() {
   componentDidMount() {
     let { setUser } = this.context;
     let { setUser } = this.context;
-    api.checkAuth('', {}, {}, (err: any, res: any) => {      
-      if (err && err.response.status == 403) {
+    api.checkAuth('', {}, {}, (err: any, res: any) => {    
+      console.log(err)  
+      if (err && err.response?.status == 403) {
         this.setState({ isLoggedIn: false, loading: false })
         this.setState({ isLoggedIn: false, loading: false })
       }
       }
 
 

+ 9 - 3
dashboard/src/main/home/cluster-dashboard/expanded-chart/ExpandedChart.tsx

@@ -474,9 +474,15 @@ export default class ExpandedChart extends Component<PropsType, StateType> {
         console.log(err);
         console.log(err);
         return
         return
       }
       }
-      
+
+      if (res.data?.spec?.rules && res.data?.spec?.rules[0]?.host) {
+        this.setState({url: `https://${res.data?.spec?.rules[0]?.host}` })
+        return;
+      }
+
       if (res.data?.status?.loadBalancer?.ingress) {
       if (res.data?.status?.loadBalancer?.ingress) {
-        this.setState({url: `http://${res.data?.status?.loadBalancer?.ingress[0]?.hostname}` })
+        this.setState({ url: `http://${res.data?.status?.loadBalancer?.ingress[0]?.hostname}` })
+        return;
       }
       }
     });
     });
 
 
@@ -520,7 +526,7 @@ export default class ExpandedChart extends Component<PropsType, StateType> {
       return (
       return (
         <Url>
         <Url>
           <Bolded>Internal URI:</Bolded>
           <Bolded>Internal URI:</Bolded>
-          {`${serviceName}.${serviceNamespace}.namespace.svc.cluster.local`}
+          {`${serviceName}.${serviceNamespace}.svc.cluster.local`}
         </Url>
         </Url>
       );
       );
     }
     }

+ 1 - 3
dashboard/src/main/home/cluster-dashboard/expanded-chart/status/ControllerTab.tsx

@@ -80,7 +80,7 @@ export default class ControllerTab extends Component<PropsType, StateType> {
   }
   }
 
 
   getPodStatus = (status: any) => {
   getPodStatus = (status: any) => {
-    if (status?.phase == 'Pending' && status?.containerStatuses) {
+    if (status?.phase == 'Pending' && status?.containerStatuses !== undefined) {
       return status.containerStatuses[0].state.waiting.reason
       return status.containerStatuses[0].state.waiting.reason
       // return 'waiting'
       // return 'waiting'
     }
     }
@@ -105,10 +105,8 @@ export default class ControllerTab extends Component<PropsType, StateType> {
 
 
   render() {
   render() {
     let { controller, selectedPod, isLast, selectPod } = this.props;
     let { controller, selectedPod, isLast, selectPod } = this.props;
-    console.log(controller)
     let [available, total] = this.getAvailability(controller.kind, controller);
     let [available, total] = this.getAvailability(controller.kind, controller);
     let status = (available == total) ? 'running' : 'waiting'
     let status = (available == total) ? 'running' : 'waiting'
-    console.log('state', this.state)
     return (
     return (
       <ResourceTab
       <ResourceTab
         label={controller.kind}
         label={controller.kind}

+ 1 - 0
dashboard/src/main/home/cluster-dashboard/expanded-chart/status/Logs.tsx

@@ -65,6 +65,7 @@ export default class Logs extends Component<PropsType, StateType> {
 
 
   componentWillUnmount() {
   componentWillUnmount() {
     if (this.state.ws) {
     if (this.state.ws) {
+      console.log('closing websockets')
       this.state.ws.close()
       this.state.ws.close()
     }
     }
   }
   }

+ 1 - 0
dashboard/src/main/home/new-project/NewProject.tsx

@@ -81,6 +81,7 @@ export default class NewProject extends Component<PropsType, StateType> {
   // TODO: split this out into a separate component
   // TODO: split this out into a separate component
   renderProvisioners = () => {
   renderProvisioners = () => {
     if (this.state.selectedProvider === 'aws') {
     if (this.state.selectedProvider === 'aws') {
+
       return (
       return (
         <FormSection>
         <FormSection>
           <CloseButton onClick={() => {
           <CloseButton onClick={() => {

+ 1 - 0
dashboard/src/main/home/templates/Templates.tsx

@@ -17,6 +17,7 @@ const tabOptions = [
 const hardcodedNames: any = {
 const hardcodedNames: any = {
   'postgresql': 'PostgreSQL',
   'postgresql': 'PostgreSQL',
   'docker': 'Docker',
   'docker': 'Docker',
+  'https-issuer': 'HTTPS Issuer'
 };
 };
 
 
 type PropsType = {
 type PropsType = {

+ 1 - 3
internal/kubernetes/agent.go

@@ -124,10 +124,8 @@ func (a *Agent) GetPodsByLabel(selector string) (*v1.PodList, error) {
 // GetPodLogs streams real-time logs from a given pod.
 // GetPodLogs streams real-time logs from a given pod.
 func (a *Agent) GetPodLogs(namespace string, name string, conn *websocket.Conn) error {
 func (a *Agent) GetPodLogs(namespace string, name string, conn *websocket.Conn) error {
 	// follow logs
 	// follow logs
-	tails := int64(30)
 	podLogOpts := v1.PodLogOptions{
 	podLogOpts := v1.PodLogOptions{
-		Follow:    true,
-		TailLines: &tails,
+		Follow: true,
 	}
 	}
 	req := a.Clientset.CoreV1().Pods(namespace).GetLogs(name, &podLogOpts)
 	req := a.Clientset.CoreV1().Pods(namespace).GetLogs(name, &podLogOpts)
 	podLogs, err := req.Stream(context.TODO())
 	podLogs, err := req.Stream(context.TODO())