feat: license creation admin PR (#15024)
* WIP: UI created to see if it matches RFC idea * Remove schema as we validate on the backend with old+new key schemas * Add comment about proxy URL request when on older versions * feat: create custom axios instance to use signature middleware * fix: update form to respect new schema * Add cal signature token to trubo env * use backend mutation for creating license keys * add loading state to creation button * update form to have a success state * fix type error for console.warning :') * use api version v1 * restore checkLicense from main * Add env vars to example * nit: rename page export * use US spelling --------- Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
1 parent
a574e5e60f
commit
2a41cd0770
9 files changed
+435
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import type { GetServerSidePropsContext } from "next";
|
||||
|
||||
import { getServerSession } from "@calcom/feature-auth/lib/getServerSession";
|
||||
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
|
||||
|
||||
export const getServerSideProps = async (context: GetServerSidePropsContext) => {
|
||||
const session = await getServerSession({
|
||||
req: context.req,
|
||||
res: context.res,
|
||||
authOptions: AUTH_OPTIONS,
|
||||
});
|
||||
// Disable this check if we ever make this self serve.
|
||||
if (session?.user.role !== "ADMIN") {
|
||||
return {
|
||||
notFound: true,
|
||||
} as const;
|
||||
}
|
||||
|
||||
return {
|
||||
props: {},
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
"use client";
|
||||
|
||||
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
|
||||
import { CreateANewLicenseKeyForm } from "@calcom/features/ee/deployment/licensekey/CreateLicenseKeyForm";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { WizardLayout, Meta } from "@calcom/ui";
|
||||
|
||||
import { getServerSideProps } from "@lib/settings/license-keys/new/getServerSideProps";
|
||||
|
||||
import PageWrapper from "@components/PageWrapper";
|
||||
|
||||
const CreateNewLicenseKeyPage = () => {
|
||||
const { t } = useLocale();
|
||||
return (
|
||||
<LicenseRequired>
|
||||
<Meta title={t("set_up_your_organization")} description={t("organizations_description")} />
|
||||
<CreateANewLicenseKeyForm />
|
||||
</LicenseRequired>
|
||||
);
|
||||
};
|
||||
const LayoutWrapper = (page: React.ReactElement) => {
|
||||
return (
|
||||
<WizardLayout currentStep={1} maxSteps={2}>
|
||||
{page}
|
||||
</WizardLayout>
|
||||
);
|
||||
};
|
||||
|
||||
CreateNewLicenseKeyPage.getLayout = LayoutWrapper;
|
||||
CreateNewLicenseKeyPage.PageWrapper = PageWrapper;
|
||||
|
||||
export default CreateNewLicenseKeyPage;
|
||||
export { getServerSideProps };
|
||||
Reference in new issue
Block a user