Remove three old env variables (#2297)

* remove three old env variables IS_DATA_MODEL_SETTINGS_ENABLED IS_DEVELOPERS_SETTINGS_ENABLED FLEXIBLE_BACKEND_ENABLED

* Fix database:reset script

* Removing unused variable

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
bosiraphael
2023-10-31 13:15:24 +01:00
committed by GitHub
parent 71dd6eb0a8
commit dda911fea7
17 changed files with 32 additions and 148 deletions

View File

@ -8,26 +8,14 @@ import { supportChatState } from '@/client-config/states/supportChatState';
import { telemetryState } from '@/client-config/states/telemetryState';
import { useGetClientConfigQuery } from '~/generated/graphql';
import { isDataModelSettingsEnabledState } from '../states/isDataModelSettingsEnabled';
import { isDevelopersSettingsEnabledState } from '../states/isDevelopersSettingsEnabled';
import { isFlexibleBackendEnabledState } from '../states/isFlexibleBackendEnabledState';
export const ClientConfigProvider: React.FC<React.PropsWithChildren> = ({
children,
}) => {
const [, setAuthProviders] = useRecoilState(authProvidersState);
const [, setIsDebugMode] = useRecoilState(isDebugModeState);
const [, setIsFlexibleBackendEnabled] = useRecoilState(
isFlexibleBackendEnabledState,
);
const [, setIsSignInPrefilled] = useRecoilState(isSignInPrefilledState);
const [, setIsDataModelSettingsEnabled] = useRecoilState(
isDataModelSettingsEnabledState,
);
const [, setIsDevelopersSettingsEnabled] = useRecoilState(
isDevelopersSettingsEnabledState,
);
const [, setTelemetry] = useRecoilState(telemetryState);
const [isLoading, setIsLoading] = useState(true);
const setSupportChat = useSetRecoilState(supportChatState);
@ -44,15 +32,9 @@ export const ClientConfigProvider: React.FC<React.PropsWithChildren> = ({
password: data?.clientConfig.authProviders.password,
magicLink: false,
});
setIsFlexibleBackendEnabled(data?.clientConfig.flexibleBackendEnabled);
setIsDebugMode(data?.clientConfig.debugMode);
setIsSignInPrefilled(data?.clientConfig.signInPrefilled);
setIsDataModelSettingsEnabled(
data?.clientConfig.dataModelSettingsEnabled,
);
setIsDevelopersSettingsEnabled(
data?.clientConfig.developersSettingsEnabled,
);
setTelemetry(data?.clientConfig.telemetry);
setSupportChat(data?.clientConfig.support);
}
@ -60,10 +42,7 @@ export const ClientConfigProvider: React.FC<React.PropsWithChildren> = ({
data,
setAuthProviders,
setIsDebugMode,
setIsFlexibleBackendEnabled,
setIsSignInPrefilled,
setIsDataModelSettingsEnabled,
setIsDevelopersSettingsEnabled,
setTelemetry,
setIsLoading,
loading,

View File

@ -8,8 +8,6 @@ export const GET_CLIENT_CONFIG = gql`
password
}
signInPrefilled
dataModelSettingsEnabled
developersSettingsEnabled
debugMode
telemetry {
enabled
@ -19,7 +17,6 @@ export const GET_CLIENT_CONFIG = gql`
supportDriver
supportFrontChatId
}
flexibleBackendEnabled
}
}
`;

View File

@ -1,6 +0,0 @@
import { atom } from 'recoil';
export const isDataModelSettingsEnabledState = atom<boolean>({
key: 'isDataModelSettingsEnabledState',
default: false,
});

View File

@ -1,6 +0,0 @@
import { atom } from 'recoil';
export const isDevelopersSettingsEnabledState = atom<boolean>({
key: 'isDevelopersSettingsEnabledState',
default: false,
});

View File

@ -1,6 +0,0 @@
import { atom } from 'recoil';
export const isFlexibleBackendEnabledState = atom<boolean>({
key: 'isFlexibleBackendEnabledState',
default: false,
});

View File

@ -1,10 +1,7 @@
import { useCallback } from 'react';
import { useMatch, useNavigate, useResolvedPath } from 'react-router-dom';
import { useRecoilValue } from 'recoil';
import { useAuth } from '@/auth/hooks/useAuth';
import { isDataModelSettingsEnabledState } from '@/client-config/states/isDataModelSettingsEnabled';
import { isDevelopersSettingsEnabledState } from '@/client-config/states/isDevelopersSettingsEnabled';
import { AppPath } from '@/types/AppPath';
import {
IconColorSwatch,
@ -29,22 +26,6 @@ export const SettingsNavbar = () => {
navigate(AppPath.SignIn);
}, [signOut, navigate]);
const isDataModelSettingsEnabled = useRecoilValue(
isDataModelSettingsEnabledState,
);
const isDevelopersSettingsEnabled = useRecoilValue(
isDevelopersSettingsEnabledState,
);
const isDataModelSettingsActive = !!useMatch({
path: useResolvedPath('/settings/objects').pathname,
end: false,
});
const isDevelopersSettingsActive = !!useMatch({
path: useResolvedPath('/settings/developers/api-keys').pathname,
end: true,
});
return (
<SubMenuNavbar backButtonTitle="Settings" displayVersion={true}>
<NavTitle label="User" />
@ -93,22 +74,30 @@ export const SettingsNavbar = () => {
})
}
/>
{isDataModelSettingsEnabled && (
<NavItem
label="Data model"
to="/settings/objects"
Icon={IconHierarchy2}
active={isDataModelSettingsActive}
/>
)}
{isDevelopersSettingsEnabled && (
<NavItem
label="Developers"
to="/settings/developers/api-keys"
Icon={IconRobot}
active={isDevelopersSettingsActive}
/>
)}
<NavItem
label="Data model"
to="/settings/objects"
Icon={IconHierarchy2}
active={
!!useMatch({
path: useResolvedPath('/settings/objects').pathname,
end: false,
})
}
/>
<NavItem
label="Developers"
to="/settings/developers/api-keys"
Icon={IconRobot}
active={
!!useMatch({
path: useResolvedPath('/settings/developers/api-keys').pathname,
end: true,
})
}
/>
<NavTitle label="Other" />
<NavItem label="Logout" onClick={handleLogout} Icon={IconLogout} />
</SubMenuNavbar>