mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 12:27:28 +00:00
feat: fix import paths
This commit is contained in:
@@ -4,7 +4,7 @@ import { config } from "@fortawesome/fontawesome-svg-core";
|
|||||||
|
|
||||||
import { initPostHog } from "~/components/analytics/posthog";
|
import { initPostHog } from "~/components/analytics/posthog";
|
||||||
import Layout from "~/components/basic/layout";
|
import Layout from "~/components/basic/layout";
|
||||||
import NotificationProvider from "~/components/context/NotificationProvider";
|
import NotificationProvider from "~/components/context/Notifications/NotificationProvider";
|
||||||
import RouteGuard from "~/components/RouteGuard";
|
import RouteGuard from "~/components/RouteGuard";
|
||||||
import { publicPaths } from "~/const";
|
import { publicPaths } from "~/const";
|
||||||
import { ENV } from "~/utilities/config";
|
import { ENV } from "~/utilities/config";
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import { Menu, Transition } from "@headlessui/react";
|
|||||||
import Button from "~/components/basic/buttons/Button";
|
import Button from "~/components/basic/buttons/Button";
|
||||||
import ListBox from "~/components/basic/Listbox";
|
import ListBox from "~/components/basic/Listbox";
|
||||||
import BottonRightPopup from "~/components/basic/popups/BottomRightPopup";
|
import BottonRightPopup from "~/components/basic/popups/BottomRightPopup";
|
||||||
|
import { useNotificationContext } from "~/components/context/Notifications/NotificationProvider";
|
||||||
import DashboardInputField from "~/components/dashboard/DashboardInputField";
|
import DashboardInputField from "~/components/dashboard/DashboardInputField";
|
||||||
import DropZone from "~/components/dashboard/DropZone";
|
import DropZone from "~/components/dashboard/DropZone";
|
||||||
import NavHeader from "~/components/navigation/NavHeader";
|
import NavHeader from "~/components/navigation/NavHeader";
|
||||||
@@ -60,7 +61,7 @@ const KeyPair = ({
|
|||||||
modifyValue,
|
modifyValue,
|
||||||
modifyVisibility,
|
modifyVisibility,
|
||||||
isBlurred,
|
isBlurred,
|
||||||
duplicates
|
duplicates,
|
||||||
}) => {
|
}) => {
|
||||||
const [randomStringLength, setRandomStringLength] = useState(32);
|
const [randomStringLength, setRandomStringLength] = useState(32);
|
||||||
|
|
||||||
@@ -227,6 +228,8 @@ export default function Dashboard() {
|
|||||||
const [checkDocsPopUpVisible, setCheckDocsPopUpVisible] = useState(false);
|
const [checkDocsPopUpVisible, setCheckDocsPopUpVisible] = useState(false);
|
||||||
const [hasUserEverPushed, setHasUserEverPushed] = useState(false);
|
const [hasUserEverPushed, setHasUserEverPushed] = useState(false);
|
||||||
|
|
||||||
|
const { createNotification } = useNotificationContext();
|
||||||
|
|
||||||
// #TODO: fix save message for changing reroutes
|
// #TODO: fix save message for changing reroutes
|
||||||
// const beforeRouteHandler = (url) => {
|
// const beforeRouteHandler = (url) => {
|
||||||
// const warningText =
|
// const warningText =
|
||||||
@@ -370,46 +373,61 @@ export default function Dashboard() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Checking if any of the secret keys start with a number - if so, don't do anything
|
// Checking if any of the secret keys start with a number - if so, don't do anything
|
||||||
const nameErrors = !Object.keys(obj).map(key => !isNaN(key.charAt(0))).every(v => v === false);
|
const nameErrors = !Object.keys(obj)
|
||||||
const duplicatesExist = data?.map(item => item[2]).filter((item, index) => index !== data?.map(item => item[2]).indexOf(item)).length > 0;
|
.map((key) => !isNaN(key.charAt(0)))
|
||||||
|
.every((v) => v === false);
|
||||||
|
const duplicatesExist =
|
||||||
|
data
|
||||||
|
?.map((item) => item[2])
|
||||||
|
.filter(
|
||||||
|
(item, index) => index !== data?.map((item) => item[2]).indexOf(item)
|
||||||
|
).length > 0;
|
||||||
|
|
||||||
if (nameErrors) {
|
if (nameErrors) {
|
||||||
console.log("Solve all name errors first!");
|
return createNotification({
|
||||||
} else if (duplicatesExist) {
|
text: "Solve all name errors first!",
|
||||||
console.log("Remove the duplicated entries first!");
|
type: "error",
|
||||||
} else {
|
|
||||||
// Once "Save changed is clicked", disable that button
|
|
||||||
setButtonReady(false);
|
|
||||||
pushKeys(obj, router.query.id, env);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check which integrations are active for this project and environment
|
|
||||||
* If there are any, update environment variables for those integrations
|
|
||||||
*/
|
|
||||||
let integrations = await getWorkspaceIntegrations({
|
|
||||||
workspaceId: router.query.id,
|
|
||||||
});
|
|
||||||
integrations.map(async (integration) => {
|
|
||||||
if (
|
|
||||||
envMapping[env] == integration.environment &&
|
|
||||||
integration.isActive == true
|
|
||||||
) {
|
|
||||||
let objIntegration = Object.assign(
|
|
||||||
{},
|
|
||||||
...data.map((row) => ({ [row[2]]: row[3] }))
|
|
||||||
);
|
|
||||||
await pushKeysIntegration({
|
|
||||||
obj: objIntegration,
|
|
||||||
integrationId: integration._id,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// If this user has never saved environment variables before, show them a prompt to read docs
|
if (duplicatesExist) {
|
||||||
if (!hasUserEverPushed) {
|
return createNotification({
|
||||||
setCheckDocsPopUpVisible(true);
|
text: "Your secrets weren't saved; please fix the conflicts first.",
|
||||||
await registerUserAction({ action: "first_time_secrets_pushed" });
|
type: "error",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Once "Save changed is clicked", disable that button
|
||||||
|
setButtonReady(false);
|
||||||
|
pushKeys(obj, router.query.id, env);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check which integrations are active for this project and environment
|
||||||
|
* If there are any, update environment variables for those integrations
|
||||||
|
*/
|
||||||
|
let integrations = await getWorkspaceIntegrations({
|
||||||
|
workspaceId: router.query.id,
|
||||||
|
});
|
||||||
|
integrations.map(async (integration) => {
|
||||||
|
if (
|
||||||
|
envMapping[env] == integration.environment &&
|
||||||
|
integration.isActive == true
|
||||||
|
) {
|
||||||
|
let objIntegration = Object.assign(
|
||||||
|
{},
|
||||||
|
...data.map((row) => ({ [row[2]]: row[3] }))
|
||||||
|
);
|
||||||
|
await pushKeysIntegration({
|
||||||
|
obj: objIntegration,
|
||||||
|
integrationId: integration._id,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// If this user has never saved environment variables before, show them a prompt to read docs
|
||||||
|
if (!hasUserEverPushed) {
|
||||||
|
setCheckDocsPopUpVisible(true);
|
||||||
|
await registerUserAction({ action: "first_time_secrets_pushed" });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -649,7 +667,13 @@ export default function Dashboard() {
|
|||||||
modifyKey={listenChangeKey}
|
modifyKey={listenChangeKey}
|
||||||
modifyVisibility={listenChangeVisibility}
|
modifyVisibility={listenChangeVisibility}
|
||||||
isBlurred={blurred}
|
isBlurred={blurred}
|
||||||
duplicates={data?.map(item => item[2]).filter((item, index) => index !== data?.map(item => item[2]).indexOf(item))}
|
duplicates={data
|
||||||
|
?.map((item) => item[2])
|
||||||
|
.filter(
|
||||||
|
(item, index) =>
|
||||||
|
index !==
|
||||||
|
data?.map((item) => item[2]).indexOf(item)
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -697,7 +721,13 @@ export default function Dashboard() {
|
|||||||
modifyKey={listenChangeKey}
|
modifyKey={listenChangeKey}
|
||||||
modifyVisibility={listenChangeVisibility}
|
modifyVisibility={listenChangeVisibility}
|
||||||
isBlurred={blurred}
|
isBlurred={blurred}
|
||||||
duplicates={data?.map(item => item[2]).filter((item, index) => index !== data?.map(item => item[2]).indexOf(item))}
|
duplicates={data
|
||||||
|
?.map((item) => item[2])
|
||||||
|
.filter(
|
||||||
|
(item, index) =>
|
||||||
|
index !==
|
||||||
|
data?.map((item) => item[2]).indexOf(item)
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user