瀏覽代碼

feat: add instructions to connect project and cluster

Soham Parekh 3 年之前
父節點
當前提交
18e8ff1c1a

+ 10 - 1
dashboard/src/main/home/cluster-dashboard/expanded-chart/jobs/ConnectToJobInstructionsModal.tsx

@@ -1,5 +1,6 @@
 import Modal from "main/home/modals/Modal";
 import Modal from "main/home/modals/Modal";
-import React from "react";
+import React, { useContext } from "react";
+import { Context } from "shared/Context";
 import { ChartType } from "shared/types";
 import { ChartType } from "shared/types";
 import styled from "styled-components";
 import styled from "styled-components";
 
 
@@ -8,6 +9,7 @@ const ConnectToJobInstructionsModal: React.FC<{
   onClose: () => void;
   onClose: () => void;
   chartName: string;
   chartName: string;
 }> = ({ show, chartName, onClose }) => {
 }> = ({ show, chartName, onClose }) => {
+  const { currentCluster, currentProject } = useContext(Context);
   if (!show) {
   if (!show) {
     return null;
     return null;
   }
   }
@@ -27,6 +29,13 @@ const ConnectToJobInstructionsModal: React.FC<{
       ).
       ).
       <br />
       <br />
       <br />
       <br />
+      Run the following commands to set your current project and cluster
+      <Code>
+        porter config set-project {currentProject.id}
+        <br />
+        porter config set-cluster {currentCluster.id}
+      </Code>
+      <br />
       Run the following line of code, and make sure to change the command to
       Run the following line of code, and make sure to change the command to
       something your container can run:
       something your container can run:
       <Code>porter run {chartName || "[APP-NAME]"} -- [COMMAND]</Code>
       <Code>porter run {chartName || "[APP-NAME]"} -- [COMMAND]</Code>