mirror of
https://github.com/Infisical/infisical.git
synced 2025-03-25 14:05:03 +00:00
Continue integration frontend refactor
This commit is contained in:
@ -21,7 +21,7 @@ const getBot = async ({ workspaceId }: Props) => {
|
||||
}
|
||||
).then(async (res) => {
|
||||
if (res && res.status == 200) {
|
||||
return await res.json();
|
||||
return (await res.json()).bot;
|
||||
} else {
|
||||
console.log("Failed to get bot for project");
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ const {
|
||||
const crypto = require("crypto");
|
||||
|
||||
export default function Integrations() {
|
||||
const [projectIntegrations, setProjectIntegrations] = useState([]);
|
||||
const [authorizations, setAuthorizations] = useState();
|
||||
const [integrationAuths, setIntegrationAuths] = useState([]);
|
||||
const [integrations, setIntegrations] = useState([]);
|
||||
const [bot, setBot] = useState(null);
|
||||
const [isActivateBotOpen, setIsActivateBotOpen] = useState(false);
|
||||
const [selectedIntegrationOption, setSelectedIntegrationOption] = useState(null);
|
||||
@ -33,23 +33,20 @@ export default function Integrations() {
|
||||
|
||||
useEffect(async () => {
|
||||
try {
|
||||
// get integrations authorized for project
|
||||
let projectAuthorizations = await getWorkspaceAuthorizations({
|
||||
// get project integration authorizations
|
||||
setIntegrationAuths(await getWorkspaceAuthorizations({
|
||||
workspaceId: router.query.id,
|
||||
});
|
||||
setAuthorizations(projectAuthorizations);
|
||||
}));
|
||||
|
||||
// get active/inactive (cloud) integrations for project
|
||||
const projectIntegrations = await getWorkspaceIntegrations({
|
||||
// get project integrations
|
||||
setIntegrations(await getWorkspaceIntegrations({
|
||||
workspaceId: router.query.id,
|
||||
});
|
||||
setProjectIntegrations(projectIntegrations);
|
||||
}));
|
||||
|
||||
// get bot for project
|
||||
const bot = await getBot({
|
||||
// get project bot
|
||||
setBot(await getBot({
|
||||
workspaceId: router.query.id
|
||||
});
|
||||
setBot(bot.bot);
|
||||
}));
|
||||
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
@ -170,18 +167,18 @@ export default function Integrations() {
|
||||
handleBotActivate={handleBotActivate}
|
||||
handleIntegrationOption={handleIntegrationOption}
|
||||
/>
|
||||
{projectIntegrations.length > 0 && (
|
||||
{integrations.length > 0 && ( // shouldn't need to check for length
|
||||
<ProjectIntegrationSection
|
||||
projectIntegrations={projectIntegrations}
|
||||
projectIntegrations={integrations}
|
||||
/>
|
||||
)}
|
||||
<CloudIntegrationSection
|
||||
projectIntegrations={projectIntegrations}
|
||||
projectIntegrations={integrations}
|
||||
integrations={cloudIntegrations}
|
||||
setSelectedIntegrationOption={setSelectedIntegrationOption}
|
||||
integrationOptionPress={integrationOptionPress}
|
||||
deleteIntegrationAuth={deleteIntegrationAuth}
|
||||
authorizations={authorizations}
|
||||
authorizations={integrationAuths}
|
||||
/>
|
||||
<FrameworkIntegrationSection
|
||||
frameworks={frameworkIntegrations}
|
||||
|
Reference in New Issue
Block a user