<img width="573" alt="Screenshot 2025-03-12 at 17 36 44" src="https://github.com/user-attachments/assets/be6c20b0-626d-4a2c-810c-78a49e9f65ee" /> <img width="579" alt="Screenshot 2025-03-12 at 17 37 03" src="https://github.com/user-attachments/assets/23692ff8-ac88-4104-823e-1a06b3074551" /> <img width="590" alt="Screenshot 2025-03-12 at 17 37 14" src="https://github.com/user-attachments/assets/b46de1d3-a312-44cc-a54d-72208224453d" /> <img width="556" alt="Screenshot 2025-03-12 at 17 37 37" src="https://github.com/user-attachments/assets/12176d49-d76d-4fb1-abe6-1f7dc5349d94" /> <img width="607" alt="Screenshot 2025-03-12 at 17 37 50" src="https://github.com/user-attachments/assets/00e2edff-09db-45c5-a4df-6fd9ead830b6" />
69 lines
2.4 KiB
TypeScript
69 lines
2.4 KiB
TypeScript
import { SettingsAdminEnvVariablesTable } from '@/settings/admin-panel/components/SettingsAdminEnvVariablesTable';
|
|
import { SettingsAdminTabSkeletonLoader } from '@/settings/admin-panel/components/SettingsAdminTabSkeletonLoader';
|
|
import { SettingsListItemCardContent } from '@/settings/components/SettingsListItemCardContent';
|
|
import { SettingsPath } from '@/types/SettingsPath';
|
|
import { useTheme } from '@emotion/react';
|
|
import styled from '@emotion/styled';
|
|
import { t } from '@lingui/core/macro';
|
|
|
|
import { Card, H2Title, IconHeartRateMonitor, Section } from 'twenty-ui';
|
|
import { useGetEnvironmentVariablesGroupedQuery } from '~/generated/graphql';
|
|
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
|
|
|
const StyledGroupContainer = styled.div``;
|
|
|
|
const StyledInfoText = styled.div`
|
|
color: ${({ theme }) => theme.font.color.secondary};
|
|
`;
|
|
|
|
const StyledCard = styled(Card)`
|
|
margin-bottom: ${({ theme }) => theme.spacing(8)};
|
|
`;
|
|
|
|
export const SettingsAdminEnvVariables = () => {
|
|
const theme = useTheme();
|
|
const { data: environmentVariables, loading: environmentVariablesLoading } =
|
|
useGetEnvironmentVariablesGroupedQuery({
|
|
fetchPolicy: 'network-only',
|
|
});
|
|
|
|
const visibleGroups =
|
|
environmentVariables?.getEnvironmentVariablesGrouped.groups.filter(
|
|
(group) => !group.isHiddenOnLoad,
|
|
) ?? [];
|
|
|
|
if (environmentVariablesLoading) {
|
|
return <SettingsAdminTabSkeletonLoader />;
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<Section>
|
|
<StyledInfoText>
|
|
{t`These are only the server values. Ensure your worker environment has the same variables and values, this is required for asynchronous tasks like email sync.`}
|
|
</StyledInfoText>
|
|
</Section>
|
|
{visibleGroups.map((group) => (
|
|
<StyledGroupContainer key={group.name}>
|
|
<H2Title title={group.name} description={group.description} />
|
|
{group.variables.length > 0 && (
|
|
<SettingsAdminEnvVariablesTable variables={group.variables} />
|
|
)}
|
|
</StyledGroupContainer>
|
|
))}
|
|
|
|
<Section>
|
|
<StyledCard rounded>
|
|
<SettingsListItemCardContent
|
|
label={t`Other Variables`}
|
|
to={getSettingsPath(SettingsPath.AdminPanelOtherEnvVariables)}
|
|
rightComponent={null}
|
|
LeftIcon={IconHeartRateMonitor}
|
|
LeftIconColor={theme.font.color.tertiary}
|
|
/>
|
|
</StyledCard>
|
|
</Section>
|
|
</>
|
|
);
|
|
};
|