1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 08:19:40 +02:00

feat(system/upgrade): add get license dialog [EE-4743] (#8249)

This commit is contained in:
Chaim Lev-Ari 2023-01-19 15:31:49 +02:00 committed by GitHub
parent 5942f4ff58
commit 406ff8812c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 369 additions and 25 deletions

View file

@ -1,6 +1,5 @@
import { Field, Form, Formik } from 'formik';
import { object, SchemaOf, string } from 'yup';
import { ExternalLink } from 'lucide-react';
import { useUpgradeEditionMutation } from '@/react/portainer/system/useUpgradeEditionMutation';
import { notifySuccess } from '@/portainer/services/notifications';
@ -9,6 +8,7 @@ import { Button, LoadingButton } from '@@/buttons';
import { FormControl } from '@@/form-components/FormControl';
import { Input } from '@@/form-components/Input';
import { Modal } from '@@/modals/Modal';
import { Alert } from '@@/Alert';
interface FormValues {
license: string;
@ -21,9 +21,13 @@ const initialValues: FormValues = {
export function UploadLicenseDialog({
onDismiss,
goToLoading,
goToGetLicense,
isGetLicenseSubmitted,
}: {
onDismiss: () => void;
goToLoading: () => void;
goToGetLicense: () => void;
isGetLicenseSubmitted: boolean;
}) {
const upgradeMutation = useUpgradeEditionMutation();
@ -44,9 +48,19 @@ export function UploadLicenseDialog({
{({ errors }) => (
<Form noValidate>
<Modal.Body>
<p className="font-semibold text-gray-7">
Please enter your Portainer License below
</p>
{!isGetLicenseSubmitted ? (
<p className="font-semibold text-gray-7">
Please enter your Portainer License below
</p>
) : (
<div className="mb-4">
<Alert color="success" title="License successfully sent">
Please check your email and copy your license into the field
below to upgrade Portainer.
</Alert>
</div>
)}
<FormControl
label="License"
errors={errors.license}
@ -58,21 +72,14 @@ export function UploadLicenseDialog({
</Modal.Body>
<Modal.Footer>
<div className="flex gap-2 [&>*]:w-1/2 w-full">
<a
href="https://www.portainer.io/pricing"
target="_blank"
rel="noreferrer"
className="no-link"
<Button
color="default"
size="medium"
className="w-full"
onClick={goToGetLicense}
>
<Button
color="default"
size="medium"
className="w-full"
icon={ExternalLink}
>
Get a license
</Button>
</a>
Get a license
</Button>
<LoadingButton
color="primary"
size="medium"