Skip to content

Commit

Permalink
feat(frontend): settings page customization (#3194)
Browse files Browse the repository at this point in the history
feat: Updating environment settings page
  • Loading branch information
xoscar committed Sep 28, 2023
1 parent 1926818 commit 3077155
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions web/src/pages/Settings/Content.tsx
Expand Up @@ -7,7 +7,7 @@ import Linter from 'components/Settings/Linter';
import Polling from 'components/Settings/Polling';
import TestRunner from 'components/Settings/TestRunner';
import BetaBadge from 'components/BetaBadge/BetaBadge';
import {Flag, useCustomization} from 'providers/Customization';
import {Flag, useCustomization, withCustomization} from 'providers/Customization';
import * as S from './Settings.styled';

const TabsKeys = {
Expand Down Expand Up @@ -71,4 +71,4 @@ const Content = () => {
);
};

export default Content;
export default withCustomization(Content, 'settings');
3 changes: 1 addition & 2 deletions web/src/providers/DataStore/DataStore.provider.tsx
Expand Up @@ -12,8 +12,6 @@ import useDataStoreNotification from './hooks/useDataStoreNotification';
import {useConfirmationModal} from '../ConfirmationModal/ConfirmationModal.provider';
import {useSettingsValues} from '../SettingsValues/SettingsValues.provider';

const {useTestConnectionMutation, useUpdateDataStoreMutation, useDeleteDataStoreMutation} = TracetestAPI.instance;

interface IContext {
isFormValid: boolean;
isLoading: boolean;
Expand Down Expand Up @@ -41,6 +39,7 @@ interface IProps {
export const useDataStore = () => useContext(Context);

const DataStoreProvider = ({children}: IProps) => {
const {useTestConnectionMutation, useUpdateDataStoreMutation, useDeleteDataStoreMutation} = TracetestAPI.instance;
const {isFetching} = useSettingsValues();
const [updateDataStore, {isLoading: isLoadingUpdate}] = useUpdateDataStoreMutation();
const [deleteDataStore] = useDeleteDataStoreMutation();
Expand Down
4 changes: 2 additions & 2 deletions web/src/providers/Settings/Settings.provider.tsx
Expand Up @@ -5,8 +5,6 @@ import TracetestAPI from 'redux/apis/Tracetest';
import {TDraftResource} from 'types/Settings.types';
import {useNotification} from '../Notification/Notification.provider';

const {useCreateSettingMutation, useUpdateSettingMutation} = TracetestAPI.instance;

interface IContext {
isLoading: boolean;
onSubmit(resource: TDraftResource[]): void;
Expand All @@ -21,6 +19,8 @@ interface IProps {
export const useSettings = () => useContext(Context);

const SettingsProvider = ({children}: IProps) => {
const {useCreateSettingMutation, useUpdateSettingMutation} = TracetestAPI.instance;

const {showNotification} = useNotification();
const [createSetting, {isLoading: isLoadingCreate}] = useCreateSettingMutation();
const [updateSetting, {isLoading: isLoadingUpdate}] = useUpdateSettingMutation();
Expand Down
18 changes: 9 additions & 9 deletions web/src/providers/SettingsValues/SettingsValues.provider.tsx
Expand Up @@ -15,15 +15,6 @@ import AnalyticsService from 'services/Analytics/Analytics.service';
import {ConfigMode} from 'types/DataStore.types';
import Env from 'utils/Env';

const {
useGetDataStoreQuery,
useGetConfigQuery,
useGetDemoQuery,
useGetPollingQuery,
useGetLinterQuery,
useGetTestRunnerQuery,
} = TracetestAPI.instance;

interface IContext {
dataStoreConfig: DataStoreConfig;
isLoading: boolean;
Expand Down Expand Up @@ -63,6 +54,15 @@ interface IProps {
export const useSettingsValues = () => useContext(Context);

const SettingsValuesProvider = ({children}: IProps) => {
const {
useGetDataStoreQuery,
useGetConfigQuery,
useGetDemoQuery,
useGetPollingQuery,
useGetLinterQuery,
useGetTestRunnerQuery,
} = TracetestAPI.instance;

// DataStore
const dispatch = useAppDispatch();
const {data: dataStoreConfig = DataStoreConfig({}), isLoading, isError, isFetching} = useGetDataStoreQuery({});
Expand Down

0 comments on commit 3077155

Please sign in to comment.