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>
|
||||
</Command.Item>
|
||||
<Command.Item
|
||||
onSelect={() => redirect(`/${workspaceSlug}/settings/import`)}
|
||||
onSelect={() => redirect(`/${workspaceSlug}/settings/imports`)}
|
||||
className="focus:outline-none"
|
||||
>
|
||||
<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>
|
||||
</Command.Item>
|
||||
<Command.Item
|
||||
onSelect={() => redirect(`/${workspaceSlug}/settings/export`)}
|
||||
onSelect={() => redirect(`/${workspaceSlug}/settings/exports`)}
|
||||
className="focus:outline-none"
|
||||
>
|
||||
<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)
|
||||
.then(() => {
|
||||
mutateServices();
|
||||
router.push(`/${workspaceSlug}/settings/export`);
|
||||
router.push(`/${workspaceSlug}/settings/exports`);
|
||||
setExportLoading(false);
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
|
@ -41,7 +41,7 @@ const IntegrationGuide = () => {
|
||||
);
|
||||
|
||||
const handleCsvClose = () => {
|
||||
router.replace(`/plane/settings/export`);
|
||||
router.replace(`/plane/settings/exports`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -16,6 +16,14 @@ type Props = {
|
||||
export const SingleExport: React.FC<Props> = ({ service, refreshing }) => {
|
||||
const provider = service.provider;
|
||||
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 (
|
||||
<div className="flex items-center justify-between gap-2 py-3">
|
||||
<div>
|
||||
@ -53,6 +61,8 @@ export const SingleExport: React.FC<Props> = ({ service, refreshing }) => {
|
||||
<span>Exported by {service?.initiated_by_detail?.display_name}</span>
|
||||
</div>
|
||||
</div>
|
||||
{checkExpiry(service.created_at) ? (
|
||||
<>
|
||||
{service.status == "completed" && (
|
||||
<div>
|
||||
<Link href={service?.url}>
|
||||
@ -62,6 +72,10 @@ export const SingleExport: React.FC<Props> = ({ service, refreshing }) => {
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<div className="text-xs text-red-500">Expired</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
@ -163,7 +163,7 @@ export const GithubImporterRoot: React.FC<Props> = ({ user }) => {
|
||||
|
||||
await GithubIntegrationService.createGithubServiceImport(workspaceSlug as string, payload, user)
|
||||
.then(() => {
|
||||
router.push(`/${workspaceSlug}/settings/import`);
|
||||
router.push(`/${workspaceSlug}/settings/imports`);
|
||||
mutate(IMPORTER_SERVICES_LIST(workspaceSlug as string));
|
||||
})
|
||||
.catch(() =>
|
||||
@ -178,7 +178,7 @@ export const GithubImporterRoot: React.FC<Props> = ({ user }) => {
|
||||
return (
|
||||
<form onSubmit={handleSubmit(createGithubImporterService)}>
|
||||
<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">
|
||||
<ArrowLeftIcon className="h-3 w-3" />
|
||||
<div>Cancel import & go back</div>
|
||||
|
@ -92,7 +92,7 @@ export const JiraImporterRoot: React.FC<Props> = ({ user }) => {
|
||||
.createJiraImporter(workspaceSlug.toString(), data, user)
|
||||
.then(() => {
|
||||
mutate(IMPORTER_SERVICES_LIST(workspaceSlug.toString()));
|
||||
router.push(`/${workspaceSlug}/settings/import`);
|
||||
router.push(`/${workspaceSlug}/settings/imports`);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
@ -109,7 +109,7 @@ export const JiraImporterRoot: React.FC<Props> = ({ user }) => {
|
||||
|
||||
return (
|
||||
<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>
|
||||
<ArrowLeftIcon className="h-3 w-3" />
|
||||
|
@ -31,11 +31,11 @@ const SettingsNavbar: React.FC<Props> = ({ profilePage = false }) => {
|
||||
},
|
||||
{
|
||||
label: "Imports",
|
||||
href: `/${workspaceSlug}/settings/import`,
|
||||
href: `/${workspaceSlug}/settings/imports`,
|
||||
},
|
||||
{
|
||||
label: "Exports",
|
||||
href: `/${workspaceSlug}/settings/export`,
|
||||
href: `/${workspaceSlug}/settings/exports`,
|
||||
},
|
||||
];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user