mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
improvement: added validation for the expired date
This commit is contained in:
parent
664820af59
commit
250148c991
@ -731,7 +731,7 @@ export const CommandK: React.FC<Props> = ({ deleteIssue, isPaletteOpen, setIsPal
|
|||||||
</div>
|
</div>
|
||||||
</Command.Item>
|
</Command.Item>
|
||||||
<Command.Item
|
<Command.Item
|
||||||
onSelect={() => redirect(`/${workspaceSlug}/settings/import`)}
|
onSelect={() => redirect(`/${workspaceSlug}/settings/imports`)}
|
||||||
className="focus:outline-none"
|
className="focus:outline-none"
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-2 text-custom-text-200">
|
<div className="flex items-center gap-2 text-custom-text-200">
|
||||||
@ -740,7 +740,7 @@ export const CommandK: React.FC<Props> = ({ deleteIssue, isPaletteOpen, setIsPal
|
|||||||
</div>
|
</div>
|
||||||
</Command.Item>
|
</Command.Item>
|
||||||
<Command.Item
|
<Command.Item
|
||||||
onSelect={() => redirect(`/${workspaceSlug}/settings/export`)}
|
onSelect={() => redirect(`/${workspaceSlug}/settings/exports`)}
|
||||||
className="focus:outline-none"
|
className="focus:outline-none"
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-2 text-custom-text-200">
|
<div className="flex items-center gap-2 text-custom-text-200">
|
||||||
|
@ -63,7 +63,7 @@ export const Exporter: React.FC<Props> = ({
|
|||||||
await CSVIntegrationService.exportCSVService(workspaceSlug as string, payload, user)
|
await CSVIntegrationService.exportCSVService(workspaceSlug as string, payload, user)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
mutateServices();
|
mutateServices();
|
||||||
router.push(`/${workspaceSlug}/settings/export`);
|
router.push(`/${workspaceSlug}/settings/exports`);
|
||||||
setExportLoading(false);
|
setExportLoading(false);
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "success",
|
type: "success",
|
||||||
|
@ -41,7 +41,7 @@ const IntegrationGuide = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleCsvClose = () => {
|
const handleCsvClose = () => {
|
||||||
router.replace(`/plane/settings/export`);
|
router.replace(`/plane/settings/exports`);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -16,6 +16,14 @@ type Props = {
|
|||||||
export const SingleExport: React.FC<Props> = ({ service, refreshing }) => {
|
export const SingleExport: React.FC<Props> = ({ service, refreshing }) => {
|
||||||
const provider = service.provider;
|
const provider = service.provider;
|
||||||
const [isLoading, setIsLoading] = React.useState(false);
|
const [isLoading, setIsLoading] = React.useState(false);
|
||||||
|
|
||||||
|
const checkExpiry = (inputDateString: string) => {
|
||||||
|
const currentDate = new Date();
|
||||||
|
const expiryDate = new Date(inputDateString);
|
||||||
|
expiryDate.setDate(expiryDate.getDate() + 7);
|
||||||
|
return expiryDate > currentDate;
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-between gap-2 py-3">
|
<div className="flex items-center justify-between gap-2 py-3">
|
||||||
<div>
|
<div>
|
||||||
@ -53,14 +61,20 @@ export const SingleExport: React.FC<Props> = ({ service, refreshing }) => {
|
|||||||
<span>Exported by {service?.initiated_by_detail?.display_name}</span>
|
<span>Exported by {service?.initiated_by_detail?.display_name}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{service.status == "completed" && (
|
{checkExpiry(service.created_at) ? (
|
||||||
<div>
|
<>
|
||||||
<Link href={service?.url}>
|
{service.status == "completed" && (
|
||||||
<PrimaryButton className="w-full text-center">
|
<div>
|
||||||
{isLoading ? "Downloading..." : "Download"}
|
<Link href={service?.url}>
|
||||||
</PrimaryButton>
|
<PrimaryButton className="w-full text-center">
|
||||||
</Link>
|
{isLoading ? "Downloading..." : "Download"}
|
||||||
</div>
|
</PrimaryButton>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<div className="text-xs text-red-500">Expired</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -163,7 +163,7 @@ export const GithubImporterRoot: React.FC<Props> = ({ user }) => {
|
|||||||
|
|
||||||
await GithubIntegrationService.createGithubServiceImport(workspaceSlug as string, payload, user)
|
await GithubIntegrationService.createGithubServiceImport(workspaceSlug as string, payload, user)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
router.push(`/${workspaceSlug}/settings/import`);
|
router.push(`/${workspaceSlug}/settings/imports`);
|
||||||
mutate(IMPORTER_SERVICES_LIST(workspaceSlug as string));
|
mutate(IMPORTER_SERVICES_LIST(workspaceSlug as string));
|
||||||
})
|
})
|
||||||
.catch(() =>
|
.catch(() =>
|
||||||
@ -178,7 +178,7 @@ export const GithubImporterRoot: React.FC<Props> = ({ user }) => {
|
|||||||
return (
|
return (
|
||||||
<form onSubmit={handleSubmit(createGithubImporterService)}>
|
<form onSubmit={handleSubmit(createGithubImporterService)}>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Link href={`/${workspaceSlug}/settings/import`}>
|
<Link href={`/${workspaceSlug}/settings/imports`}>
|
||||||
<div className="inline-flex cursor-pointer items-center gap-2 text-sm font-medium text-custom-text-200 hover:text-custom-text-100">
|
<div className="inline-flex cursor-pointer items-center gap-2 text-sm font-medium text-custom-text-200 hover:text-custom-text-100">
|
||||||
<ArrowLeftIcon className="h-3 w-3" />
|
<ArrowLeftIcon className="h-3 w-3" />
|
||||||
<div>Cancel import & go back</div>
|
<div>Cancel import & go back</div>
|
||||||
|
@ -92,7 +92,7 @@ export const JiraImporterRoot: React.FC<Props> = ({ user }) => {
|
|||||||
.createJiraImporter(workspaceSlug.toString(), data, user)
|
.createJiraImporter(workspaceSlug.toString(), data, user)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
mutate(IMPORTER_SERVICES_LIST(workspaceSlug.toString()));
|
mutate(IMPORTER_SERVICES_LIST(workspaceSlug.toString()));
|
||||||
router.push(`/${workspaceSlug}/settings/import`);
|
router.push(`/${workspaceSlug}/settings/imports`);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
@ -109,7 +109,7 @@ export const JiraImporterRoot: React.FC<Props> = ({ user }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full flex-col space-y-2">
|
<div className="flex h-full flex-col space-y-2">
|
||||||
<Link href={`/${workspaceSlug}/settings/import`}>
|
<Link href={`/${workspaceSlug}/settings/imports`}>
|
||||||
<div className="inline-flex cursor-pointer items-center gap-2 text-sm font-medium text-custom-text-200 hover:text-custom-text-100">
|
<div className="inline-flex cursor-pointer items-center gap-2 text-sm font-medium text-custom-text-200 hover:text-custom-text-100">
|
||||||
<div>
|
<div>
|
||||||
<ArrowLeftIcon className="h-3 w-3" />
|
<ArrowLeftIcon className="h-3 w-3" />
|
||||||
|
@ -31,11 +31,11 @@ const SettingsNavbar: React.FC<Props> = ({ profilePage = false }) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Imports",
|
label: "Imports",
|
||||||
href: `/${workspaceSlug}/settings/import`,
|
href: `/${workspaceSlug}/settings/imports`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Exports",
|
label: "Exports",
|
||||||
href: `/${workspaceSlug}/settings/export`,
|
href: `/${workspaceSlug}/settings/exports`,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user