Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Add Offline License Endpoint #26282

Merged
merged 14 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/meteor/client/views/admin/info/LicenseCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const LicenseCard = (): ReactElement => {
const t = useTranslation();
const setModal = useSetModal();

const currentLicense = useSetting('Enterprise_License');
const licenseStatus = useSetting('Enterprise_License_Status');
const currentLicense = useSetting('Enterprise_License') as string;
const licenseStatus = useSetting('Enterprise_License_Status') as string;

const isAirGapped = true;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { Modal, Box, ButtonGroup, Button, Scrollable, Callout, Margins, Icon } from '@rocket.chat/fuselage';
import { useMutableCallback } from '@rocket.chat/fuselage-hooks';
import { useToastMessageDispatch, useTranslation } from '@rocket.chat/ui-contexts';
import React, { useState } from 'react';
import React, { ComponentProps, FormEvent, ReactElement, useState } from 'react';

import { useEndpointActionExperimental } from '../../../hooks/useEndpointActionExperimental';

const OfflineLicenseModal = ({ onClose, license, licenseStatus, ...props }) => {
type OfflineLicenseModalProps = {
onClose: () => void;
license: string;
licenseStatus: string;
} & ComponentProps<typeof Modal>;

const OfflineLicenseModal = ({ onClose, license, licenseStatus, ...props }: OfflineLicenseModalProps): ReactElement => {
const t = useTranslation();

const dispatchToastMessage = useToastMessageDispatch();
Expand All @@ -15,7 +21,7 @@ const OfflineLicenseModal = ({ onClose, license, licenseStatus, ...props }) => {
const [status, setStatus] = useState(licenseStatus);
const [lastSetLicense, setLastSetLicense] = useState(license);

const handleNewLicense = (e) => {
const handleNewLicense = (e: FormEvent<HTMLInputElement>): void => {
setNewLicense(e.currentTarget.value);
};

Expand All @@ -35,8 +41,8 @@ const OfflineLicenseModal = ({ onClose, license, licenseStatus, ...props }) => {
const handleApplyLicense = useMutableCallback(async () => {
setIsUpdating(true);
setLastSetLicense(newLicense);
const data = await addLicense({ license: newLicense });
if (data.success) {
const data = (await addLicense({ license: newLicense })) as unknown as { success: true };
hugocostadev marked this conversation as resolved.
Show resolved Hide resolved
if (data?.success) {
onClose();
return;
}
Expand All @@ -62,7 +68,7 @@ const OfflineLicenseModal = ({ onClose, license, licenseStatus, ...props }) => {
pb='x8'
flexGrow={1}
backgroundColor='neutral-800'
mb={status === 'invalid' && 'x8'}
mb={status === 'invalid' ? 'x8' : undefined}
>
<Margins block='x8'>
<Scrollable vertical>
Expand Down