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

Merge branch 'nico/new-onboarding-flow' of github.com:porter-dev/porter into nico/new-onboarding-flow

jnfrati 4 лет назад
Родитель
Сommit
4015439f53

+ 1 - 0
api/server/handlers/provision/helpers.go

@@ -57,6 +57,7 @@ func GetSharedProvisionerOpts(conf *config.Config, infra *models.Infra) (*provis
 		DryRun:              true,
 		Infra:               infra,
 		ProvImageTag:        conf.ServerConf.ProvisionerImageTag,
+		ProvJobNamespace:    conf.ServerConf.ProvisionerJobNamespace,
 		ProvImagePullSecret: conf.ServerConf.ProvisionerImagePullSecret,
 		TFHTTPBackendURL:    conf.ServerConf.ProvisionerBackendURL,
 		CredentialExchange: &provisioner.ProvisionCredentialExchange{

+ 1 - 0
api/server/shared/config/env/envconfs.go

@@ -59,6 +59,7 @@ type ServerConf struct {
 	// Options for the provisioner jobs
 	ProvisionerImageTag        string `env:"PROV_IMAGE_TAG,default=latest"`
 	ProvisionerImagePullSecret string `env:"PROV_IMAGE_PULL_SECRET"`
+	ProvisionerJobNamespace    string `env:"PROV_JOB_NAMESPACE,default=default"`
 	ProvisionerBackendURL      string `env:"PROV_BACKEND_URL"`
 
 	SegmentClientKey string `env:"SEGMENT_CLIENT_KEY"`

+ 36 - 17
dashboard/src/main/home/onboarding/steps/ConnectSource.tsx

@@ -90,24 +90,32 @@ const ConnectSource: React.FC<{
       )}
       {!isLoading && accountData?.accounts.length && (
         <>
+          <Helper>Porter currently has access to:</Helper>
           <List>
-            {accountData?.accounts.map((name, i) => {
-              return (
-                <Row
-                  key={i}
-                  isLastItem={i === accountData.accounts.length - 1}
-                >
-                  <i className="material-icons">bookmark</i>
-                  {name}
-                </Row>
-              );
-            })}
+            {
+              accountData?.accounts.length > 0 ? (
+                accountData?.accounts.map((name, i) => {
+                  return (
+                    <Row
+                      key={i}
+                      isLastItem={i === accountData.accounts.length - 1}
+                    >
+                      <i className="material-icons">bookmark</i>
+                      {name}
+                    </Row>
+                  );
+                })
+              ) : (
+                <Placeholder>No repositories found.</Placeholder>
+              )
+            }
           </List>
-          <br />
-          Don't see the right repos?{" "}
-          <A href={"/api/integrations/github-app/install"}>
-            Install Porter in more repositories
-          </A>
+          <Helper>
+            Don't see the right repos?{" "}
+            <A href={"/api/integrations/github-app/install"}>
+              Install Porter in more repositories
+            </A>.
+          </Helper>
           <NextStep
             text="Continue"
             disabled={false}
@@ -127,6 +135,16 @@ const ConnectSource: React.FC<{
 
 export default ConnectSource;
 
+const Placeholder = styled.div`
+  width: 100%;
+  height: 80px;
+  color: #aaaabb;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  font-size: 13px;
+`;
+
 const FadeWrapper = styled.div<{ delay?: string }>`
   opacity: 0;
   animation: fadeIn 0.5s ${(props) => props.delay || "0.2s"};
@@ -181,7 +199,7 @@ const List = styled.div`
   background: #ffffff11;
   border-radius: 5px;
   margin-top: 20px;
-  border: 1px solid #ffffff44;
+  border: 1px solid #aaaabb;
   max-height: 200px;
   overflow-y: auto;
 `;
@@ -190,6 +208,7 @@ const Row = styled.div<{ isLastItem?: boolean }>`
   width: 100%;
   height: 35px;
   color: #ffffff55;
+  font-size: 13px;
   display: flex;
   align-items: center;
   border-bottom: ${(props) => (props.isLastItem ? "" : "1px solid #ffffff44")};

+ 1 - 1
internal/kubernetes/agent.go

@@ -990,7 +990,7 @@ func (a *Agent) Provision(
 	}
 
 	// apply the provisioner job template
-	_, err = a.Clientset.BatchV1().Jobs("default").Create(
+	_, err = a.Clientset.BatchV1().Jobs(opts.ProvJobNamespace).Create(
 		context.TODO(),
 		job,
 		metav1.CreateOptions{},

+ 2 - 1
internal/kubernetes/provisioner/provisioner.go

@@ -34,6 +34,7 @@ type ProvisionOpts struct {
 	DryRun              bool
 	Infra               *models.Infra
 	ProvImageTag        string
+	ProvJobNamespace    string
 	ProvImagePullSecret string
 	TFHTTPBackendURL    string
 	CredentialExchange  *ProvisionCredentialExchange
@@ -83,7 +84,7 @@ func GetProvisionerJobTemplate(opts *ProvisionOpts) (*batchv1.Job, error) {
 	return &batchv1.Job{
 		ObjectMeta: metav1.ObjectMeta{
 			Name:      opts.Infra.GetUniqueName(),
-			Namespace: "default",
+			Namespace: opts.ProvJobNamespace,
 			Labels:    labels,
 		},
 		Spec: batchv1.JobSpec{