diff --git a/frontend/components/basic/dialog/IntegrationAccessTokenDialog.js b/frontend/components/basic/dialog/IntegrationAccessTokenDialog.js
new file mode 100644
index 000000000..dca8d672b
--- /dev/null
+++ b/frontend/components/basic/dialog/IntegrationAccessTokenDialog.js
@@ -0,0 +1,100 @@
+import { Fragment } from "react";
+import { Dialog, Transition } from "@headlessui/react";
+import getLatestFileKey from "../../../pages/api/workspace/getLatestFileKey";
+import setBotActiveStatus from "../../../pages/api/bot/setBotActiveStatus";
+import {
+ decryptAssymmetric,
+ encryptAssymmetric
+} from "../../utilities/cryptography/crypto";
+import Button from "../buttons/Button";
+import InputField from "../InputField";
+
+const IntegrationAccessTokenDialog = ({
+ isOpen,
+ closeModal,
+ selectedIntegrationOption,
+ handleBotActivate,
+ handleIntegrationOption
+}) => {
+
+ const submit = async () => {
+ try {
+ // 1. activate bot
+ await handleBotActivate();
+
+ // 2. start integration
+ await handleIntegrationOption({
+ integrationOption: selectedIntegrationOption
+ });
+ } catch (err) {
+ console.log(err);
+ }
+
+ closeModal();
+ }
+
+ return (
+
+
+
+
+
+ );
+}
+
+export default IntegrationAccessTokenDialog;
\ No newline at end of file
diff --git a/frontend/pages/integrations/[id].js b/frontend/pages/integrations/[id].js
index 6ebf3888e..46aec2220 100644
--- a/frontend/pages/integrations/[id].js
+++ b/frontend/pages/integrations/[id].js
@@ -15,6 +15,7 @@ import getBot from "../api/bot/getBot";
import setBotActiveStatus from "../api/bot/setBotActiveStatus";
import getLatestFileKey from "../api/workspace/getLatestFileKey";
import ActivateBotDialog from "~/components/basic/dialog/ActivateBotDialog";
+import IntegrationAccessTokenDialog from "~/components/basic/dialog/IntegrationAccessTokenDialog";
const {
decryptAssymmetric,
encryptAssymmetric
@@ -27,7 +28,8 @@ export default function Integrations() {
const [integrationAuths, setIntegrationAuths] = useState([]);
const [integrations, setIntegrations] = useState([]);
const [bot, setBot] = useState(null);
- const [isActivateBotOpen, setIsActivateBotOpen] = useState(false);
+ const [isActivateBotDialogOpen, setIsActivateBotDialogOpen] = useState(false);
+ const [isIntegrationAccessTokenDialogOpen, setIntegrationAccessTokenDialogOpen] = useState(true);
const [selectedIntegrationOption, setSelectedIntegrationOption] = useState(null);
const router = useRouter();
@@ -120,6 +122,8 @@ export default function Integrations() {
const state = crypto.randomBytes(16).toString("hex");
localStorage.setItem('latestCSRFToken', state);
+ // TODO: Add CircleCI, Render, Fly.io
+
switch (integrationOption.name) {
case 'Heroku':
window.location = `https://id.heroku.com/oauth/authorize?client_id=${integrationOption.clientId}&response_type=code&scope=write-protected&state=${state}`;
@@ -130,6 +134,10 @@ export default function Integrations() {
case 'Netlify':
window.location = `https://app.netlify.com/authorize?client_id=${integrationOption.clientId}&response_type=code&redirect_uri=${integrationOption.redirectURL}&state=${state}`;
break;
+ case 'Fly.io':
+ console.log('fly.io');
+ setIntegrationAccessTokenDialogOpen(true);
+ break;
}
} catch (err) {
console.log(err);
@@ -179,8 +187,15 @@ export default function Integrations() {
isProjectRelated={true}
/>
setIsActivateBotOpen(false)}
+ isOpen={isActivateBotDialogOpen}
+ closeModal={() => setIsActivateBotDialogOpen(false)}
+ selectedIntegrationOption={selectedIntegrationOption}
+ handleBotActivate={handleBotActivate}
+ handleIntegrationOption={handleIntegrationOption}
+ />
+ setIntegrationAccessTokenDialogOpen(false)}
selectedIntegrationOption={selectedIntegrationOption}
handleBotActivate={handleBotActivate}
handleIntegrationOption={handleIntegrationOption}
diff --git a/frontend/public/json/cloudIntegrations.json b/frontend/public/json/cloudIntegrations.json
index aa988fb5f..26ff79fc5 100644
--- a/frontend/public/json/cloudIntegrations.json
+++ b/frontend/public/json/cloudIntegrations.json
@@ -5,7 +5,8 @@
"image": "Heroku",
"isAvailable": true,
"type": "oauth2",
- "clientId": "7b1311a1-1cb2-4938-8adf-f37a399ec41b"
+ "clientId": "7b1311a1-1cb2-4938-8adf-f37a399ec41b",
+ "docsLink": ""
},
{
"name": "Vercel",
@@ -13,7 +14,8 @@
"image": "Vercel",
"isAvailable": true,
"type": "vercel",
- "clientId": ""
+ "clientId": "",
+ "docsLink": ""
},
{
"name": "Netlify",
@@ -22,7 +24,17 @@
"isAvailable": true,
"type": "oauth2",
"clientId": "fYWBhD3gt0pT62UIwYrlGRcy--pPVLYIQad6ORrES9o",
- "redirectURL": "http://localhost:8080/netlify"
+ "redirectURL": "http://localhost:8080/netlify",
+ "docsLink": ""
+ },
+ {
+ "name": "Fly.io",
+ "slug": "flyio",
+ "image": "Google Cloud Platform",
+ "isAvailable": true,
+ "type": "accessToken",
+ "clientId": "",
+ "docsLink": ""
},
{
"name": "Google Cloud Platform",
@@ -30,7 +42,8 @@
"image": "Google Cloud Platform",
"isAvailable": false,
"type": "",
- "clientId": ""
+ "clientId": "",
+ "docsLink": ""
},
{
"name": "Amazon Web Services",
@@ -38,7 +51,8 @@
"image": "Amazon Web Services",
"isAvailable": false,
"type": "",
- "clientId": ""
+ "clientId": "",
+ "docsLink": ""
},
{
"name": "Microsoft Azure",
@@ -46,7 +60,8 @@
"image": "Microsoft Azure",
"isAvailable": false,
"type": "",
- "clientId": ""
+ "clientId": "",
+ "docsLink": ""
},
{
"name": "Travis CI",
@@ -54,7 +69,8 @@
"image": "Travis CI",
"isAvailable": false,
"type": "",
- "clientId": ""
+ "clientId": "",
+ "docsLink": ""
},
{
"name": "Circle CI",
@@ -62,6 +78,7 @@
"image": "Circle CI",
"isAvailable": false,
"type": "",
- "clientId": ""
+ "clientId": "",
+ "docsLink": ""
}
]
\ No newline at end of file