diff --git a/hivemq-edge/src/frontend/src/extensions/datahub/components/controls/ToolboxDryRun.tsx b/hivemq-edge/src/frontend/src/extensions/datahub/components/controls/ToolboxDryRun.tsx index d4546d040a..2f03f44f96 100644 --- a/hivemq-edge/src/frontend/src/extensions/datahub/components/controls/ToolboxDryRun.tsx +++ b/hivemq-edge/src/frontend/src/extensions/datahub/components/controls/ToolboxDryRun.tsx @@ -3,6 +3,8 @@ import { Node } from 'reactflow' import { useTranslation } from 'react-i18next' import { Box, Button, HStack, Icon, Stack } from '@chakra-ui/react' +import config from '@/config' + import PolicyErrorReport from '@datahub/components/helpers/PolicyErrorReport.tsx' import { usePolicyDryRun } from '@datahub/hooks/usePolicyDryRun.ts' import useDataHubDraftStore from '@datahub/hooks/useDataHubDraftStore.ts' @@ -34,8 +36,7 @@ export const ToolboxDryRun: FC = ({ onActiveStep, onShowNode } = usePolicyChecksStore() const CheckIcon = useMemo(() => getDryRunStatusIcon(status), [status]) - const isEditEnabled = - import.meta.env.VITE_FLAG_DATAHUB_EDIT_POLICY_ENABLED === 'true' || statusDraft === DesignerStatus.DRAFT + const isEditEnabled = config.features.DATAHUB_EDIT_POLICY_ENABLED || statusDraft === DesignerStatus.DRAFT const handleCheckPolicy = () => { if (!selectedNode) return diff --git a/hivemq-edge/src/frontend/src/extensions/datahub/components/controls/ToolboxNodes.tsx b/hivemq-edge/src/frontend/src/extensions/datahub/components/controls/ToolboxNodes.tsx index 4134bb88b9..cb8c403f6b 100644 --- a/hivemq-edge/src/frontend/src/extensions/datahub/components/controls/ToolboxNodes.tsx +++ b/hivemq-edge/src/frontend/src/extensions/datahub/components/controls/ToolboxNodes.tsx @@ -2,6 +2,8 @@ import { FC } from 'react' import { useTranslation } from 'react-i18next' import { HStack, Text, VStack, ButtonGroup } from '@chakra-ui/react' +import config from '@/config' + import { DataHubNodeType, DesignerStatus } from '@datahub/types.ts' import Tool from '@datahub/components/controls/Tool.tsx' import { DesignerToolBoxProps } from '@datahub/components/controls/DesignerToolbox.tsx' @@ -11,8 +13,7 @@ export const ToolboxNodes: FC = () => { const { t } = useTranslation('datahub') const { nodes, status } = useDataHubDraftStore() - const isEditEnabled = - import.meta.env.VITE_FLAG_DATAHUB_EDIT_POLICY_ENABLED === 'true' || status === DesignerStatus.DRAFT + const isEditEnabled = config.features.DATAHUB_EDIT_POLICY_ENABLED || status === DesignerStatus.DRAFT const isDraftEmpty = nodes.length === 0 return ( diff --git a/hivemq-edge/src/frontend/src/extensions/datahub/components/controls/ToolboxPublish.tsx b/hivemq-edge/src/frontend/src/extensions/datahub/components/controls/ToolboxPublish.tsx index 8db4fa547d..606fdc5dd9 100644 --- a/hivemq-edge/src/frontend/src/extensions/datahub/components/controls/ToolboxPublish.tsx +++ b/hivemq-edge/src/frontend/src/extensions/datahub/components/controls/ToolboxPublish.tsx @@ -4,6 +4,8 @@ import { UseMutateAsyncFunction } from '@tanstack/react-query' import { Box, Button, HStack, Icon, Stack, useToast } from '@chakra-ui/react' import { MdPublishedWithChanges } from 'react-icons/md' +import config from '@/config' + import { BehaviorPolicy, DataPolicy, Schema, Script } from '@/api/__generated__' import { useCreateDataPolicy } from '@datahub/api/hooks/DataHubDataPoliciesService/useCreateDataPolicy.tsx' @@ -57,8 +59,7 @@ export const ToolboxPublish: FC = ({ onActiveStep }) => { const createBehaviorPolicy = useCreateBehaviorPolicy() const toast = useToast() - const isEditEnabled = - import.meta.env.VITE_FLAG_DATAHUB_EDIT_POLICY_ENABLED === 'true' || statusDraft === DesignerStatus.DRAFT + const isEditEnabled = config.features.DATAHUB_EDIT_POLICY_ENABLED || statusDraft === DesignerStatus.DRAFT const isValid = !!report && report.length >= 1 && report?.every((e) => !e.error) const handleMutation = async (promise: Promise, type: DataHubNodeType) => { diff --git a/hivemq-edge/src/frontend/src/extensions/datahub/components/helpers/DataHubListAction.tsx b/hivemq-edge/src/frontend/src/extensions/datahub/components/helpers/DataHubListAction.tsx index daa41f8b6f..61e11a6251 100644 --- a/hivemq-edge/src/frontend/src/extensions/datahub/components/helpers/DataHubListAction.tsx +++ b/hivemq-edge/src/frontend/src/extensions/datahub/components/helpers/DataHubListAction.tsx @@ -3,6 +3,7 @@ import { ButtonGroup } from '@chakra-ui/react' import IconButton from '@/components/Chakra/IconButton.tsx' import { useTranslation } from 'react-i18next' import { LuFileEdit, LuTrash2, LuFileSearch, LuDownload } from 'react-icons/lu' +import config from '@/config' interface DataHubListActionProps { onEdit?: MouseEventHandler @@ -13,7 +14,7 @@ interface DataHubListActionProps { const DataHubListAction: FC = ({ onEdit, onDelete, onDownload, isAccessDisabled = false }) => { const { t } = useTranslation('datahub') - const isEditEnabled = import.meta.env.VITE_FLAG_DATAHUB_EDIT_POLICY_ENABLED === 'true' + const isEditEnabled = config.features.DATAHUB_EDIT_POLICY_ENABLED return (