Created two new env variables (#2120)
* created the two env variables * modify according to comments
This commit is contained in:
@ -648,7 +648,9 @@ export type BoolFilter = {
|
|||||||
export type ClientConfig = {
|
export type ClientConfig = {
|
||||||
__typename?: 'ClientConfig';
|
__typename?: 'ClientConfig';
|
||||||
authProviders: AuthProviders;
|
authProviders: AuthProviders;
|
||||||
|
dataModelSettingsEnabled: Scalars['Boolean'];
|
||||||
debugMode: Scalars['Boolean'];
|
debugMode: Scalars['Boolean'];
|
||||||
|
developersSettingsEnabled: Scalars['Boolean'];
|
||||||
flexibleBackendEnabled: Scalars['Boolean'];
|
flexibleBackendEnabled: Scalars['Boolean'];
|
||||||
signInPrefilled: Scalars['Boolean'];
|
signInPrefilled: Scalars['Boolean'];
|
||||||
support: Support;
|
support: Support;
|
||||||
@ -1383,6 +1385,8 @@ export type Mutation = {
|
|||||||
createOneApiKey: AuthToken;
|
createOneApiKey: AuthToken;
|
||||||
createOneComment: Comment;
|
createOneComment: Comment;
|
||||||
createOneCompany: Company;
|
createOneCompany: Company;
|
||||||
|
createOneField: Field;
|
||||||
|
createOneObject: Object;
|
||||||
createOnePerson: Person;
|
createOnePerson: Person;
|
||||||
createOnePipelineProgress: PipelineProgress;
|
createOnePipelineProgress: PipelineProgress;
|
||||||
createOnePipelineStage: PipelineStage;
|
createOnePipelineStage: PipelineStage;
|
||||||
@ -1397,6 +1401,8 @@ export type Mutation = {
|
|||||||
deleteManyView: AffectedRows;
|
deleteManyView: AffectedRows;
|
||||||
deleteManyViewFilter: AffectedRows;
|
deleteManyViewFilter: AffectedRows;
|
||||||
deleteManyViewSort: AffectedRows;
|
deleteManyViewSort: AffectedRows;
|
||||||
|
deleteOneField: FieldDeleteResponse;
|
||||||
|
deleteOneObject: ObjectDeleteResponse;
|
||||||
deleteOnePipelineStage: PipelineStage;
|
deleteOnePipelineStage: PipelineStage;
|
||||||
deleteOneView: View;
|
deleteOneView: View;
|
||||||
deleteUserAccount: User;
|
deleteUserAccount: User;
|
||||||
@ -1407,6 +1413,8 @@ export type Mutation = {
|
|||||||
signUp: LoginToken;
|
signUp: LoginToken;
|
||||||
updateOneActivity: Activity;
|
updateOneActivity: Activity;
|
||||||
updateOneCompany?: Maybe<Company>;
|
updateOneCompany?: Maybe<Company>;
|
||||||
|
updateOneField: Field;
|
||||||
|
updateOneObject: Object;
|
||||||
updateOnePerson?: Maybe<Person>;
|
updateOnePerson?: Maybe<Person>;
|
||||||
updateOnePipelineProgress?: Maybe<PipelineProgress>;
|
updateOnePipelineProgress?: Maybe<PipelineProgress>;
|
||||||
updateOnePipelineStage?: Maybe<PipelineStage>;
|
updateOnePipelineStage?: Maybe<PipelineStage>;
|
||||||
@ -2483,6 +2491,8 @@ export type Query = {
|
|||||||
clientConfig: ClientConfig;
|
clientConfig: ClientConfig;
|
||||||
currentUser: User;
|
currentUser: User;
|
||||||
currentWorkspace: Workspace;
|
currentWorkspace: Workspace;
|
||||||
|
field: Field;
|
||||||
|
fields: FieldConnection;
|
||||||
findFavorites: Array<Favorite>;
|
findFavorites: Array<Favorite>;
|
||||||
findManyActivities: Array<Activity>;
|
findManyActivities: Array<Activity>;
|
||||||
findManyApiKey: Array<ApiKey>;
|
findManyApiKey: Array<ApiKey>;
|
||||||
@ -2500,6 +2510,8 @@ export type Query = {
|
|||||||
findUniqueCompany: Company;
|
findUniqueCompany: Company;
|
||||||
findUniquePerson: Person;
|
findUniquePerson: Person;
|
||||||
findWorkspaceFromInviteHash: Workspace;
|
findWorkspaceFromInviteHash: Workspace;
|
||||||
|
object: Object;
|
||||||
|
objects: ObjectConnection;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -3769,7 +3781,7 @@ export type CheckUserExistsQuery = { __typename?: 'Query', checkUserExists: { __
|
|||||||
export type GetClientConfigQueryVariables = Exact<{ [key: string]: never; }>;
|
export type GetClientConfigQueryVariables = Exact<{ [key: string]: never; }>;
|
||||||
|
|
||||||
|
|
||||||
export type GetClientConfigQuery = { __typename?: 'Query', clientConfig: { __typename?: 'ClientConfig', signInPrefilled: boolean, debugMode: boolean, flexibleBackendEnabled: boolean, authProviders: { __typename?: 'AuthProviders', google: boolean, password: boolean }, telemetry: { __typename?: 'Telemetry', enabled: boolean, anonymizationEnabled: boolean }, support: { __typename?: 'Support', supportDriver: string, supportFrontChatId?: string | null } } };
|
export type GetClientConfigQuery = { __typename?: 'Query', clientConfig: { __typename?: 'ClientConfig', signInPrefilled: boolean, dataModelSettingsEnabled: boolean, developersSettingsEnabled: boolean, debugMode: boolean, flexibleBackendEnabled: boolean, authProviders: { __typename?: 'AuthProviders', google: boolean, password: boolean }, telemetry: { __typename?: 'Telemetry', enabled: boolean, anonymizationEnabled: boolean }, support: { __typename?: 'Support', supportDriver: string, supportFrontChatId?: string | null } } };
|
||||||
|
|
||||||
export type BaseCompanyFieldsFragmentFragment = { __typename?: 'Company', address: string, annualRecurringRevenue?: number | null, createdAt: string, domainName: string, employees?: number | null, id: string, idealCustomerProfile: boolean, linkedinUrl?: string | null, name: string, xUrl?: string | null, _activityCount: number };
|
export type BaseCompanyFieldsFragmentFragment = { __typename?: 'Company', address: string, annualRecurringRevenue?: number | null, createdAt: string, domainName: string, employees?: number | null, id: string, idealCustomerProfile: boolean, linkedinUrl?: string | null, name: string, xUrl?: string | null, _activityCount: number };
|
||||||
|
|
||||||
@ -5212,6 +5224,8 @@ export const GetClientConfigDocument = gql`
|
|||||||
password
|
password
|
||||||
}
|
}
|
||||||
signInPrefilled
|
signInPrefilled
|
||||||
|
dataModelSettingsEnabled
|
||||||
|
developersSettingsEnabled
|
||||||
debugMode
|
debugMode
|
||||||
telemetry {
|
telemetry {
|
||||||
enabled
|
enabled
|
||||||
|
|||||||
@ -8,6 +8,8 @@ import { supportChatState } from '@/client-config/states/supportChatState';
|
|||||||
import { telemetryState } from '@/client-config/states/telemetryState';
|
import { telemetryState } from '@/client-config/states/telemetryState';
|
||||||
import { useGetClientConfigQuery } from '~/generated/graphql';
|
import { useGetClientConfigQuery } from '~/generated/graphql';
|
||||||
|
|
||||||
|
import { isDataModelSettingsEnabledState } from '../states/isDataModelSettingsEnabled';
|
||||||
|
import { isDevelopersSettingsEnabledState } from '../states/isDevelopersSettingsEnabled';
|
||||||
import { isFlexibleBackendEnabledState } from '../states/isFlexibleBackendEnabledState';
|
import { isFlexibleBackendEnabledState } from '../states/isFlexibleBackendEnabledState';
|
||||||
|
|
||||||
export const ClientConfigProvider: React.FC<React.PropsWithChildren> = ({
|
export const ClientConfigProvider: React.FC<React.PropsWithChildren> = ({
|
||||||
@ -20,6 +22,12 @@ export const ClientConfigProvider: React.FC<React.PropsWithChildren> = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const [, setIsSignInPrefilled] = useRecoilState(isSignInPrefilledState);
|
const [, setIsSignInPrefilled] = useRecoilState(isSignInPrefilledState);
|
||||||
|
const [, setIsDataModelSettingsEnabled] = useRecoilState(
|
||||||
|
isDataModelSettingsEnabledState,
|
||||||
|
);
|
||||||
|
const [, setIsDevelopersSettingsEnabled] = useRecoilState(
|
||||||
|
isDevelopersSettingsEnabledState,
|
||||||
|
);
|
||||||
const [, setTelemetry] = useRecoilState(telemetryState);
|
const [, setTelemetry] = useRecoilState(telemetryState);
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
const setSupportChat = useSetRecoilState(supportChatState);
|
const setSupportChat = useSetRecoilState(supportChatState);
|
||||||
@ -39,6 +47,12 @@ export const ClientConfigProvider: React.FC<React.PropsWithChildren> = ({
|
|||||||
setIsFlexibleBackendEnabled(data?.clientConfig.flexibleBackendEnabled);
|
setIsFlexibleBackendEnabled(data?.clientConfig.flexibleBackendEnabled);
|
||||||
setIsDebugMode(data?.clientConfig.debugMode);
|
setIsDebugMode(data?.clientConfig.debugMode);
|
||||||
setIsSignInPrefilled(data?.clientConfig.signInPrefilled);
|
setIsSignInPrefilled(data?.clientConfig.signInPrefilled);
|
||||||
|
setIsDataModelSettingsEnabled(
|
||||||
|
data?.clientConfig.dataModelSettingsEnabled,
|
||||||
|
);
|
||||||
|
setIsDevelopersSettingsEnabled(
|
||||||
|
data?.clientConfig.developersSettingsEnabled,
|
||||||
|
);
|
||||||
setTelemetry(data?.clientConfig.telemetry);
|
setTelemetry(data?.clientConfig.telemetry);
|
||||||
setSupportChat(data?.clientConfig.support);
|
setSupportChat(data?.clientConfig.support);
|
||||||
}
|
}
|
||||||
@ -48,6 +62,8 @@ export const ClientConfigProvider: React.FC<React.PropsWithChildren> = ({
|
|||||||
setIsDebugMode,
|
setIsDebugMode,
|
||||||
setIsFlexibleBackendEnabled,
|
setIsFlexibleBackendEnabled,
|
||||||
setIsSignInPrefilled,
|
setIsSignInPrefilled,
|
||||||
|
setIsDataModelSettingsEnabled,
|
||||||
|
setIsDevelopersSettingsEnabled,
|
||||||
setTelemetry,
|
setTelemetry,
|
||||||
setIsLoading,
|
setIsLoading,
|
||||||
loading,
|
loading,
|
||||||
|
|||||||
@ -8,6 +8,8 @@ export const GET_CLIENT_CONFIG = gql`
|
|||||||
password
|
password
|
||||||
}
|
}
|
||||||
signInPrefilled
|
signInPrefilled
|
||||||
|
dataModelSettingsEnabled
|
||||||
|
developersSettingsEnabled
|
||||||
debugMode
|
debugMode
|
||||||
telemetry {
|
telemetry {
|
||||||
enabled
|
enabled
|
||||||
|
|||||||
@ -0,0 +1,6 @@
|
|||||||
|
import { atom } from 'recoil';
|
||||||
|
|
||||||
|
export const isDataModelSettingsEnabledState = atom<boolean>({
|
||||||
|
key: 'isDataModelSettingsEnabledState',
|
||||||
|
default: false,
|
||||||
|
});
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
import { atom } from 'recoil';
|
||||||
|
|
||||||
|
export const isDevelopersSettingsEnabledState = atom<boolean>({
|
||||||
|
key: 'isDevelopersSettingsEnabledState',
|
||||||
|
default: false,
|
||||||
|
});
|
||||||
@ -1,7 +1,10 @@
|
|||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import { useMatch, useNavigate, useResolvedPath } from 'react-router-dom';
|
import { useMatch, useNavigate, useResolvedPath } from 'react-router-dom';
|
||||||
|
import { useRecoilValue } from 'recoil';
|
||||||
|
|
||||||
import { useAuth } from '@/auth/hooks/useAuth';
|
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 { AppPath } from '@/types/AppPath';
|
||||||
import {
|
import {
|
||||||
IconColorSwatch,
|
IconColorSwatch,
|
||||||
@ -26,6 +29,22 @@ export const SettingsNavbar = () => {
|
|||||||
navigate(AppPath.SignIn);
|
navigate(AppPath.SignIn);
|
||||||
}, [signOut, navigate]);
|
}, [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/api').pathname,
|
||||||
|
end: true,
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SubMenuNavbar backButtonTitle="Settings" displayVersion={true}>
|
<SubMenuNavbar backButtonTitle="Settings" displayVersion={true}>
|
||||||
<NavTitle label="User" />
|
<NavTitle label="User" />
|
||||||
@ -74,28 +93,22 @@ export const SettingsNavbar = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<NavItem
|
{isDataModelSettingsEnabled && (
|
||||||
label="Data model"
|
<NavItem
|
||||||
to="/settings/objects"
|
label="Data model"
|
||||||
Icon={IconHierarchy2}
|
to="/settings/objects"
|
||||||
active={
|
Icon={IconHierarchy2}
|
||||||
!!useMatch({
|
active={isDataModelSettingsActive}
|
||||||
path: useResolvedPath('/settings/objects').pathname,
|
/>
|
||||||
end: false,
|
)}
|
||||||
})
|
{isDevelopersSettingsEnabled && (
|
||||||
}
|
<NavItem
|
||||||
/>
|
label="Developers"
|
||||||
<NavItem
|
to="/settings/apis"
|
||||||
label="Developers"
|
Icon={IconRobot}
|
||||||
to="/settings/apis"
|
active={isDevelopersSettingsActive}
|
||||||
Icon={IconRobot}
|
/>
|
||||||
active={
|
)}
|
||||||
!!useMatch({
|
|
||||||
path: useResolvedPath('/settings/api').pathname,
|
|
||||||
end: true,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<NavTitle label="Other" />
|
<NavTitle label="Other" />
|
||||||
<NavItem label="Logout" onClick={handleLogout} Icon={IconLogout} />
|
<NavItem label="Logout" onClick={handleLogout} Icon={IconLogout} />
|
||||||
</SubMenuNavbar>
|
</SubMenuNavbar>
|
||||||
|
|||||||
@ -217,6 +217,8 @@ export const graphqlMocks = [
|
|||||||
ctx.data({
|
ctx.data({
|
||||||
clientConfig: {
|
clientConfig: {
|
||||||
signInPrefilled: true,
|
signInPrefilled: true,
|
||||||
|
dataModelSettingsEnabled: true,
|
||||||
|
developersSettingsEnabled: true,
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
authProviders: { google: true, password: true, magicLink: false },
|
authProviders: { google: true, password: true, magicLink: false },
|
||||||
telemetry: { enabled: false, anonymizationEnabled: true },
|
telemetry: { enabled: false, anonymizationEnabled: true },
|
||||||
|
|||||||
@ -27,3 +27,5 @@ SIGN_IN_PREFILLED=true
|
|||||||
# SENTRY_DSN=https://xxx@xxx.ingest.sentry.io/xxx
|
# SENTRY_DSN=https://xxx@xxx.ingest.sentry.io/xxx
|
||||||
# LOG_LEVEL=error,warn
|
# LOG_LEVEL=error,warn
|
||||||
# FLEXIBLE_BACKEND_ENABLED=false
|
# FLEXIBLE_BACKEND_ENABLED=false
|
||||||
|
# IS_DATA_MODEL_SETTINGS_ENABLED=false
|
||||||
|
# IS_DEVELOPERS_SETTINGS_ENABLED=false
|
||||||
|
|||||||
@ -14,6 +14,8 @@ REFRESH_TOKEN_SECRET=secret_refresh_token
|
|||||||
# ———————— Optional ————————
|
# ———————— Optional ————————
|
||||||
# DEBUG_MODE=false
|
# DEBUG_MODE=false
|
||||||
# SIGN_IN_PREFILLED=false
|
# SIGN_IN_PREFILLED=false
|
||||||
|
# IS_DATA_MODEL_SETTINGS_ENABLED=false
|
||||||
|
# IS_DEVELOPERS_SETTINGS_ENABLED=false
|
||||||
# ACCESS_TOKEN_EXPIRES_IN=30m
|
# ACCESS_TOKEN_EXPIRES_IN=30m
|
||||||
# LOGIN_TOKEN_EXPIRES_IN=15m
|
# LOGIN_TOKEN_EXPIRES_IN=15m
|
||||||
# REFRESH_TOKEN_EXPIRES_IN=90d
|
# REFRESH_TOKEN_EXPIRES_IN=90d
|
||||||
|
|||||||
@ -41,6 +41,12 @@ export class ClientConfig {
|
|||||||
@Field(() => Boolean)
|
@Field(() => Boolean)
|
||||||
signInPrefilled: boolean;
|
signInPrefilled: boolean;
|
||||||
|
|
||||||
|
@Field(() => Boolean)
|
||||||
|
dataModelSettingsEnabled: boolean;
|
||||||
|
|
||||||
|
@Field(() => Boolean)
|
||||||
|
developersSettingsEnabled: boolean;
|
||||||
|
|
||||||
@Field(() => Boolean)
|
@Field(() => Boolean)
|
||||||
debugMode: boolean;
|
debugMode: boolean;
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,10 @@ export class ClientConfigResolver {
|
|||||||
this.environmentService.isTelemetryAnonymizationEnabled(),
|
this.environmentService.isTelemetryAnonymizationEnabled(),
|
||||||
},
|
},
|
||||||
signInPrefilled: this.environmentService.isSignInPrefilled(),
|
signInPrefilled: this.environmentService.isSignInPrefilled(),
|
||||||
|
dataModelSettingsEnabled:
|
||||||
|
this.environmentService.isDataModelSettingsEnabled(),
|
||||||
|
developersSettingsEnabled:
|
||||||
|
this.environmentService.isDevelopersSettingsEnabled(),
|
||||||
debugMode: this.environmentService.isDebugMode(),
|
debugMode: this.environmentService.isDebugMode(),
|
||||||
flexibleBackendEnabled:
|
flexibleBackendEnabled:
|
||||||
this.environmentService.isFlexibleBackendEnabled(),
|
this.environmentService.isFlexibleBackendEnabled(),
|
||||||
|
|||||||
@ -19,6 +19,18 @@ export class EnvironmentService {
|
|||||||
return this.configService.get<boolean>('SIGN_IN_PREFILLED') ?? false;
|
return this.configService.get<boolean>('SIGN_IN_PREFILLED') ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDataModelSettingsEnabled(): boolean {
|
||||||
|
return (
|
||||||
|
this.configService.get<boolean>('IS_DATA_MODEL_SETTINGS_ENABLED') ?? false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
isDevelopersSettingsEnabled(): boolean {
|
||||||
|
return (
|
||||||
|
this.configService.get<boolean>('IS_DEVELOPERS_SETTINGS_ENABLED') ?? false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
isTelemetryEnabled(): boolean {
|
isTelemetryEnabled(): boolean {
|
||||||
return this.configService.get<boolean>('TELEMETRY_ENABLED') ?? true;
|
return this.configService.get<boolean>('TELEMETRY_ENABLED') ?? true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,6 +36,16 @@ export class EnvironmentVariables {
|
|||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
SIGN_IN_PREFILLED?: boolean;
|
SIGN_IN_PREFILLED?: boolean;
|
||||||
|
|
||||||
|
@CastToBoolean()
|
||||||
|
@IsOptional()
|
||||||
|
@IsBoolean()
|
||||||
|
IS_DATA_MODEL_SETTINGS_ENABLED?: boolean;
|
||||||
|
|
||||||
|
@CastToBoolean()
|
||||||
|
@IsOptional()
|
||||||
|
@IsBoolean()
|
||||||
|
IS_DEVELOPERS_SETTINGS_ENABLED?: boolean;
|
||||||
|
|
||||||
@CastToBoolean()
|
@CastToBoolean()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
|
|||||||
Reference in New Issue
Block a user