mirror of
https://github.com/makeplane/plane.git
synced 2026-07-13 14:01:45 +02:00
chore: handled feature flag for integrations (#1419)
Co-authored-by: akshat5302 <akshatjain9782@gmail.com>
This commit is contained in:
@@ -30,7 +30,7 @@ const ImportsPage = observer(() => {
|
||||
const isAdmin = allowPermissions([EUserPermissions.ADMIN], EUserPermissionsLevel.WORKSPACE);
|
||||
const isDarkMode = currentUserProfile?.theme.theme === "dark";
|
||||
const pageTitle = currentWorkspace?.name ? `${currentWorkspace.name} - Imports` : undefined;
|
||||
const isSiloIntegrationEnabled = useFlag(workspaceSlug?.toString(), "SILO_INTEGRATION") || true;
|
||||
const isSiloIntegrationEnabled = useFlag(workspaceSlug?.toString(), "SILO_INTEGRATION");
|
||||
const siloBaseUrl = config?.silo_base_url;
|
||||
|
||||
if (!isAdmin)
|
||||
|
||||
@@ -3,55 +3,46 @@
|
||||
import { observer } from "mobx-react";
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import { useParams, useSearchParams } from "next/navigation";
|
||||
import { useParams } from "next/navigation";
|
||||
import { Button } from "@plane/ui";
|
||||
// hooks
|
||||
import { useInstance, useWorkspace } from "@/hooks/store";
|
||||
import SiloIframe from "@/plane-web/components/iframe/silo-iframe";
|
||||
// constants
|
||||
import { IMPORTERS_LIST } from "@/plane-web/constants/workspace";
|
||||
// plane web hooks
|
||||
import { useFlag } from "@/plane-web/hooks/store";
|
||||
|
||||
const IntegrationGuide = observer(() => {
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
|
||||
// router
|
||||
const { workspaceSlug } = useParams();
|
||||
const searchParams = useSearchParams();
|
||||
const provider = searchParams.get("provider");
|
||||
|
||||
const { config } = useInstance();
|
||||
return (
|
||||
<>
|
||||
{(!provider || provider === "csv") && (
|
||||
<>
|
||||
{IMPORTERS_LIST.map((service) => (
|
||||
<div
|
||||
key={service.provider}
|
||||
className="flex items-center justify-between gap-2 border-b border-custom-border-100 bg-custom-background-100 px-4 py-6 flex-shrink-0"
|
||||
>
|
||||
<div className="flex items-start gap-4">
|
||||
<div className="relative h-10 w-10 flex-shrink-0">
|
||||
<Image src={service.logo} layout="fill" objectFit="cover" alt={`${service.title} Logo`} />
|
||||
{workspaceSlug &&
|
||||
IMPORTERS_LIST.map(
|
||||
(service) =>
|
||||
useFlag(workspaceSlug?.toString(), service.key) && (
|
||||
<div
|
||||
key={service.provider}
|
||||
className="flex items-center justify-between gap-2 border-b border-custom-border-100 bg-custom-background-100 px-4 py-6 flex-shrink-0"
|
||||
>
|
||||
<div className="flex items-start gap-4">
|
||||
<div className="relative h-10 w-10 flex-shrink-0">
|
||||
<Image src={service.logo} layout="fill" objectFit="cover" alt={`${service.title} Logo`} />
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="flex items-center gap-4 text-sm font-medium">{service.title}</h3>
|
||||
<p className="text-sm tracking-tight text-custom-text-200">{service.description}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="flex items-center gap-4 text-sm font-medium">{service.title}</h3>
|
||||
<p className="text-sm tracking-tight text-custom-text-200">{service.description}</p>
|
||||
<div className="flex-shrink-0">
|
||||
<Link href={`/${workspaceSlug}/settings/imports/${service.provider}`}>
|
||||
<span>
|
||||
<Button variant="primary">{service.type}</Button>
|
||||
</span>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex-shrink-0">
|
||||
<Link href={`/${workspaceSlug}/settings/imports/${service.provider}`}>
|
||||
<span>
|
||||
<Button variant="primary">{service.type}</Button>
|
||||
</span>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
{currentWorkspace && currentWorkspace.id && (
|
||||
<SiloIframe srcBase={`${config?.silo_base_url}?view=dashboard`} />
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
)
|
||||
)}
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
import { WORKSPACE_SETTINGS as WORKSPACE_SETTINGS_CE } from "@/ce/constants/workspace";
|
||||
// components
|
||||
import { SettingIcon } from "@/components/icons/attachment";
|
||||
// constants
|
||||
import { E_FEATURE_FLAGS } from "@/plane-web/hooks/store";
|
||||
// logos
|
||||
import JiraLogo from "@/public/services/jira.svg";
|
||||
import LinearLogo from "@/public/services/linear.svg";
|
||||
@@ -58,6 +60,7 @@ export const WORKSPACE_SETTINGS_LINKS = [
|
||||
|
||||
export const IMPORTERS_LIST = [
|
||||
{
|
||||
key: E_FEATURE_FLAGS.SILO_JIRA_INTEGRATION,
|
||||
provider: "jira",
|
||||
type: "Import",
|
||||
title: "Jira",
|
||||
@@ -65,6 +68,7 @@ export const IMPORTERS_LIST = [
|
||||
logo: JiraLogo,
|
||||
},
|
||||
{
|
||||
key: E_FEATURE_FLAGS.SILO_LINEAR_INTEGRATION,
|
||||
provider: "linear",
|
||||
type: "Import",
|
||||
title: "Linear",
|
||||
|
||||
@@ -20,9 +20,12 @@ export enum E_FEATURE_FLAGS {
|
||||
WORKSPACE_PAGES = "WORKSPACE_PAGES",
|
||||
ISSUE_WORKLOG = "ISSUE_WORKLOG",
|
||||
PROJECT_GROUPING = "PROJECT_GROUPING",
|
||||
SILO_INTEGRATION = "SILO_INTEGRATION",
|
||||
ACTIVE_CYCLE_PRO = "ACTIVE_CYCLE_PRO",
|
||||
NO_LOAD = "NO_LOAD",
|
||||
// integrations
|
||||
SILO_INTEGRATION = "SILO_INTEGRATION",
|
||||
SILO_JIRA_INTEGRATION = "SILO_JIRA_INTEGRATION",
|
||||
SILO_LINEAR_INTEGRATION = "SILO_LINEAR_INTEGRATION",
|
||||
}
|
||||
|
||||
export const useFlag = (
|
||||
|
||||
Reference in New Issue
Block a user