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

works for docker registry deployed apps

Feroze Mohideen 2 лет назад
Родитель
Сommit
46385f414f

+ 1 - 1
dashboard/src/lib/hooks/useGithubWorkflow.ts

@@ -18,7 +18,7 @@ export const useGithubWorkflow = (appData: any, hasBuiltImage: boolean) => {
                     return githubWorkflowFilename;
                 }
 
-                if (currentProject == null || currentCluster == null || appData == null) {
+                if (currentProject == null || currentCluster == null) {
                     return "";
                 }
 

+ 9 - 16
dashboard/src/main/home/app-dashboard/expanded-app/ExpandedApp.tsx

@@ -131,7 +131,7 @@ const ExpandedApp: React.FC<Props> = ({ ...props }) => {
   const selectedTab: ValidTab = tab != null && validTabs.includes(tab) ? tab : DEFAULT_TAB;
   const { appName } = props.match.params as any;
   const hasBuiltImage = useHasBuiltImage(appName);
-  const { githubWorkflowFilename, isLoading: isLoadingWorkflowFile } = useGithubWorkflow(appData?.app);
+  const { githubWorkflowFilename, isLoading: isLoadingWorkflowFile } = useGithubWorkflow(appData?.app, hasBuiltImage);
 
   useEffect(() => {
     if (!_.isEqual(_.omitBy(porterApp, _.isEmpty), _.omitBy(tempPorterApp, _.isEmpty))) {
@@ -479,6 +479,9 @@ const ExpandedApp: React.FC<Props> = ({ ...props }) => {
     appData: any
   ): Promise<PorterJson | undefined> => {
     try {
+      if (appData?.app?.git_repo_id == null || appData?.app?.repo_name == null) {
+        return undefined;
+      }
       const res = await api.getPorterYamlContents(
         "<token>",
         {
@@ -487,8 +490,8 @@ const ExpandedApp: React.FC<Props> = ({ ...props }) => {
         {
           project_id: appData.app.project_id,
           git_repo_id: appData.app.git_repo_id,
-          owner: appData.app.repo_name?.split("/")[0],
-          name: appData.app.repo_name?.split("/")[1],
+          owner: appData.app.repo_name.split("/")[0],
+          name: appData.app.repo_name.split("/")[1],
           kind: "github",
           branch: appData.app.git_branch,
         }
@@ -869,21 +872,11 @@ const ExpandedApp: React.FC<Props> = ({ ...props }) => {
                     appName={appData.app.name}
                   />
                   <DarkMatter antiHeight="-18px" />
-                </>)
+                </>
+              )
                 :
                 githubWorkflowFilename ? (
-                  <Banner
-                    suffix={
-                      <>
-                        <RefreshButton
-                          onClick={() => window.location.reload()}
-                        >
-                          <img src={refresh} />
-                          Refresh
-                        </RefreshButton>
-                      </>
-                    }
-                  >
+                  <Banner>
                     Your GitHub repo has not been built yet.
                     <Spacer inline width="5px" />
                     <Link

+ 0 - 10
dashboard/src/main/home/app-dashboard/expanded-app/GHABanner.tsx

@@ -38,11 +38,6 @@ const GHABanner: React.FC<Props> = ({
           {pullRequestUrl ? (
             <Banner
               type="warning"
-              suffix={
-                <RefreshButton onClick={() => window.location.reload()}>
-                  <img src={refresh} /> Refresh
-                </RefreshButton>
-              }
             >
               Your application will not be available until you merge the Porter PR.
               <Spacer inline width="5px" />
@@ -57,11 +52,6 @@ const GHABanner: React.FC<Props> = ({
           ) : (
             <Banner
               type="warning"
-              suffix={
-                <RefreshButton onClick={() => window.location.reload()}>
-                  <img src={refresh} /> Refresh
-                </RefreshButton>
-              }
             >
               Your application will not be available until you add the Porter workflow to your branch.
               <Spacer inline width="5px" />

+ 5 - 2
dashboard/src/main/home/app-dashboard/expanded-app/StatusFooter.tsx

@@ -299,7 +299,7 @@ const StatusFooter: React.FC<Props> = ({
         replicaSetArray.length > 0 &&
         replicaSetArray.map((replicaSet, i) => {
           return (
-            <>
+            <StatusFooterContainer key={i}>
               <StyledStatusFooterTop key={i} expanded={expanded}>
                 <StyledContainer row spaced>
                   {replicaSet.some((r) => r.crashLoopReason != "") || replicaSet.some((r) => r.failing) ? (
@@ -374,7 +374,7 @@ const StatusFooter: React.FC<Props> = ({
                   </StyledStatusFooter>
                 </AnimateHeight>
               )}
-            </>
+            </StatusFooterContainer>
           );
         })}
     </>
@@ -383,6 +383,9 @@ const StatusFooter: React.FC<Props> = ({
 
 export default withRouter(StatusFooter);
 
+const StatusFooterContainer = styled.div`
+`;
+
 const StatusDot = styled.div<{ color?: string }>`
   min-width: 7px;
   max-width: 7px;