ソースを参照

Merge branch 'belanger/fix-default-repo-urls' into dev

Alexander Belanger 3 年 前
コミット
f431421140

+ 28 - 20
dashboard/src/main/home/cluster-dashboard/expanded-chart/events/EventList.tsx

@@ -160,18 +160,6 @@ const EventList: React.FC<Props> = ({ filters, namespace, setLogData }) => {
         </Message>
         {logs.length ? (
           <LogsSectionWrapper>
-            <ViewLogsWrapper>
-              <DocsLink
-                onClick={(e) => {
-                  e.preventDefault();
-                  e.stopPropagation();
-                  redirectToLogs(expandedEvent);
-                }}
-              >
-                View logs
-                <i className="material-icons">open_in_new</i>{" "}
-              </DocsLink>
-            </ViewLogsWrapper>
             <StyledLogsSection>
               {logs?.map((log, i) => {
                 return (
@@ -200,8 +188,24 @@ const EventList: React.FC<Props> = ({ filters, namespace, setLogData }) => {
                 );
               })}
             </StyledLogsSection>
+            <ViewLogsWrapper>
+              <DocsLink
+                onClick={(e) => {
+                  e.preventDefault();
+                  e.stopPropagation();
+                  redirectToLogs(expandedEvent);
+                }}
+              >
+                View complete log history
+                <i className="material-icons">open_in_new</i>{" "}
+              </DocsLink>
+            </ViewLogsWrapper>
           </LogsSectionWrapper>
-        ) : null}
+        ) : (
+          <LogsLoadWrapper>
+            <Loading />
+          </LogsLoadWrapper>
+        )}
       </>
     );
   };
@@ -271,7 +275,7 @@ const EventList: React.FC<Props> = ({ filters, namespace, setLogData }) => {
             },
           },
           {
-            Header: "Last Seen",
+            Header: "Last seen",
             accessor: "timestamp",
             width: 140,
             Cell: ({ row }: CellProps<any>) => {
@@ -334,7 +338,7 @@ const EventList: React.FC<Props> = ({ filters, namespace, setLogData }) => {
           </InfoRow>
           {expandedEvent?.porter_doc_link && (
             <DocsLink target="_blank" href={expandedEvent?.porter_doc_link}>
-              View troubleshooting steps{" "}
+              View troubleshooting steps
               <i className="material-icons">open_in_new</i>{" "}
             </DocsLink>
           )}
@@ -373,6 +377,10 @@ const EventList: React.FC<Props> = ({ filters, namespace, setLogData }) => {
 
 export default EventList;
 
+const LogsLoadWrapper = styled.div`
+  height: 50px;
+`;
+
 const Message = styled.div`
   padding: 20px;
   background: #26292e;
@@ -439,6 +447,7 @@ const TableButton = styled.div<{ width?: string }>`
   justify-content: center;
   background: #ffffff11;
   border: 1px solid #aaaabb33;
+  margin-right: -17px;
   cursor: pointer;
   :hover {
     border: 1px solid #7a7b80;
@@ -573,6 +582,7 @@ const DocsLink = styled.a`
 
   > i {
     font-size: 12px;
+    margin-left: 5px;
   }
 `;
 
@@ -583,11 +593,11 @@ const LogsSectionWrapper = styled.div`
 const StyledLogsSection = styled.div`
   margin-top: 20px;
   width: 100%;
-  height: 200px;
   display: flex;
   flex-direction: column;
   position: relative;
   font-size: 13px;
+  max-height: 400px;
   border-radius: 8px;
   border: 1px solid #ffffff33;
   border-top: none;
@@ -660,8 +670,6 @@ const LogInnerSpan = styled.span`
 `;
 
 export const ViewLogsWrapper = styled.div`
-  top: 10px;
-  right: 10px;
-  position: absolute;
-  z-index: 999;
+  margin-bottom: -15px;
+  margin-top: 15px;
 `;

+ 5 - 2
dashboard/src/main/home/cluster-dashboard/stacks/ExpandedStack/NewAppResource/_TemplateSelector.tsx

@@ -1,4 +1,4 @@
-import React, { useEffect, useState } from "react";
+import React, { useContext, useEffect, useState } from "react";
 import api from "shared/api";
 import { PorterTemplate } from "shared/types";
 import semver from "semver";
@@ -8,8 +8,11 @@ import { BackButton, Card } from "../../launch/components/styles";
 import DynamicLink from "components/DynamicLink";
 import { VersionSelector } from "../../launch/components/VersionSelector";
 import TitleSection from "components/TitleSection";
+import { Context } from "shared/Context";
 
 const TemplateSelector = () => {
+  const { capabilities } = useContext(Context);
+
   const [templates, setTemplates] = useState<PorterTemplate[]>([]);
   const [selectedVersion, setSelectedVersion] = useState<{
     [template_name: string]: string;
@@ -23,7 +26,7 @@ const TemplateSelector = () => {
       const res = await api.getTemplates<PorterTemplate[]>(
         "<token>",
         {
-          repo_url: process.env.APPLICATION_CHART_REPO_URL,
+          repo_url: capabilities?.default_app_helm_repo_url,
         },
         {}
       );

+ 4 - 2
dashboard/src/main/home/cluster-dashboard/stacks/launch/components/AddResourceButton.tsx

@@ -1,4 +1,4 @@
-import React, { useEffect, useState } from "react";
+import React, { useContext, useEffect, useState } from "react";
 import api from "shared/api";
 import { PorterTemplate } from "shared/types";
 import semver from "semver";
@@ -8,8 +8,10 @@ import { VersionSelector } from "./VersionSelector";
 import DynamicLink from "components/DynamicLink";
 
 import styled from "styled-components";
+import { Context } from "shared/Context";
 
 export const AddResourceButton = () => {
+  const { capabilities } = useContext(Context);
   const [templates, setTemplates] = useState<PorterTemplate[]>([]);
   const [currentTemplate, setCurrentTemplate] = useState<PorterTemplate>();
   const [currentVersion, setCurrentVersion] = useState("");
@@ -19,7 +21,7 @@ export const AddResourceButton = () => {
       const res = await api.getTemplates<PorterTemplate[]>(
         "<token>",
         {
-          repo_url: process.env.APPLICATION_CHART_REPO_URL,
+          repo_url: capabilities?.default_app_helm_repo_url,
         },
         {}
       );

+ 4 - 2
dashboard/src/main/home/launch/expanded-template/ExpandedTemplate.tsx

@@ -75,8 +75,10 @@ export default class ExpandedTemplate extends Component<PropsType, StateType> {
     } else {
       let params =
         this.props.currentTab == "porter"
-          ? { repo_url: process.env.APPLICATION_CHART_REPO_URL }
-          : { repo_url: process.env.ADDON_CHART_REPO_URL };
+          ? { repo_url: this.context.capabilities?.default_app_helm_repo_url }
+          : {
+              repo_url: this.context.capabilities?.default_addon_helm_repo_url,
+            };
 
       api
         .getTemplateInfo("<token>", params, {

+ 3 - 2
dashboard/src/main/home/launch/launch-flow/LaunchFlow.tsx

@@ -130,7 +130,8 @@ const LaunchFlow: React.FC<PropsType> = (props) => {
           cluster_id: currentCluster.id,
           namespace: selectedNamespace,
           repo_url:
-            props.currentTemplate?.repo_url || process.env.ADDON_CHART_REPO_URL,
+            props.currentTemplate?.repo_url ||
+            context.capabilities.default_addon_helm_repo_url,
         }
       )
       .then((_) => {
@@ -337,7 +338,7 @@ const LaunchFlow: React.FC<PropsType> = (props) => {
           id: currentProject.id,
           cluster_id: currentCluster.id,
           namespace: selectedNamespace,
-          repo_url: process.env.APPLICATION_CHART_REPO_URL,
+          repo_url: context.capabilities?.default_app_helm_repo_url,
         }
       );
       // props.setCurrentView('cluster-dashboard');

+ 2 - 0
dashboard/src/main/home/modals/Modal.tsx

@@ -138,6 +138,7 @@ const StyledModal = styled.div`
   max-width: 80vw;
   height: ${(props: { width?: string; height?: string }) =>
     props.height ? props.height : "425px"};
+  max-height: calc(100vh - 30px);
   overflow: visible;
   padding: 25px 32px;
   z-index: 999;
@@ -145,6 +146,7 @@ const StyledModal = styled.div`
   border-radius: 10px;
   background: #202227;
   border: 1px solid #ffffff55;
+  overflow: auto;
   color: #ffffff;
   animation: floatInModal 0.5s 0s;
   @keyframes floatInModal {

+ 2 - 2
dashboard/src/main/home/modals/UpgradeChartModal.tsx

@@ -28,13 +28,13 @@ export default class UpgradeChartModal extends Component<PropsType, StateType> {
 
   componentDidMount() {
     // get the chart update notes from the api
-    let repoURL = process.env.ADDON_CHART_REPO_URL;
+    let repoURL = this.context.capabilities.default_addon_helm_repo_url;
     let chartName = this.props.currentChart.chart.metadata.name
       .toLowerCase()
       .trim();
 
     if (chartName == "web" || chartName == "worker" || chartName === "job") {
-      repoURL = process.env.APPLICATION_CHART_REPO_URL;
+      repoURL = this.context.capabilities?.default_app_helm_repo_url;
     }
 
     api

+ 1 - 0
dashboard/src/shared/Context.tsx

@@ -94,6 +94,7 @@ class ContextProvider extends Component<PropsType, StateType> {
       service_account_id: -1,
       infra_id: -1,
       service: "",
+      agent_integration_enabled: false,
     },
     setCurrentCluster: (currentCluster: ClusterType, callback?: any) => {
       localStorage.setItem(