diff --git a/frontend/src/container/ExplorerOptions/ExplorerOptions.tsx b/frontend/src/container/ExplorerOptions/ExplorerOptions.tsx index 7f7675561e..1ac7fefcdd 100644 --- a/frontend/src/container/ExplorerOptions/ExplorerOptions.tsx +++ b/frontend/src/container/ExplorerOptions/ExplorerOptions.tsx @@ -107,7 +107,7 @@ function ExplorerOptions({ const viewName = useGetSearchQueryParam(QueryParams.viewName) || ''; const viewKey = useGetSearchQueryParam(QueryParams.viewKey) || ''; - const extraData = viewsData?.data.data.find((view) => view.uuid === viewKey) + const extraData = viewsData?.data?.data?.find((view) => view.uuid === viewKey) ?.extraData; const extraDataColor = extraData ? JSON.parse(extraData).color : ''; @@ -134,7 +134,7 @@ function ExplorerOptions({ }; const onUpdateQueryHandler = (): void => { - const extraData = viewsData?.data.data.find((view) => view.uuid === viewKey) + const extraData = viewsData?.data?.data?.find((view) => view.uuid === viewKey) ?.extraData; updateViewAsync( { @@ -166,7 +166,7 @@ function ExplorerOptions({ ({ key }: { key: string }): void => { const currentViewDetails = getViewDetailsUsingViewKey( key, - viewsData?.data.data, + viewsData?.data?.data, ); if (!currentViewDetails) return; const { @@ -296,7 +296,7 @@ function ExplorerOptions({ onClear={handleClearSelect} ref={ref} > - {viewsData?.data.data.map((view) => { + {viewsData?.data?.data?.map((view) => { const extraData = view.extraData !== '' ? JSON.parse(view.extraData) : ''; let bgColor = getRandomColor(); diff --git a/frontend/src/container/GeneralSettings/GeneralSettings.tsx b/frontend/src/container/GeneralSettings/GeneralSettings.tsx index 5491e1394b..f2a7bfc93c 100644 --- a/frontend/src/container/GeneralSettings/GeneralSettings.tsx +++ b/frontend/src/container/GeneralSettings/GeneralSettings.tsx @@ -3,6 +3,7 @@ import { LoadingOutlined } from '@ant-design/icons'; import { Button, Card, Col, Divider, Modal, Row, Spin, Typography } from 'antd'; import setRetentionApi from 'api/settings/setRetention'; import TextToolTip from 'components/TextToolTip'; +import GeneralSettingsCloud from 'container/GeneralSettingsCloud'; import useComponentPermission from 'hooks/useComponentPermission'; import { useNotifications } from 'hooks/useNotifications'; import find from 'lodash-es/find'; @@ -24,6 +25,7 @@ import { PayloadPropsTraces as GetRetentionPeriodTracesPayload, } from 'types/api/settings/getRetention'; import AppReducer from 'types/reducer/app'; +import { isCloudUser } from 'utils/app'; import Retention from './Retention'; import StatusMessage from './StatusMessage'; @@ -394,6 +396,8 @@ function GeneralSettings({ onModalToggleHandler(type); }; + const isCloudUserVal = isCloudUser(); + const renderConfig = [ { name: 'Metrics', @@ -521,7 +525,7 @@ function GeneralSettings({ return ( - + {category.name} @@ -542,38 +546,43 @@ function GeneralSettings({ hide={!!retentionField.hide} /> ))} - - - {category.statusComponent} - - - onModalToggleHandler(category.name.toLowerCase() as TTTLType) - } - onOk={(): Promise => - onOkHandler(category.name.toLowerCase() as TTTLType) - } - centered - open={category.save.modal} - confirmLoading={category.save.apiLoading} - > - - {t('retention_confirmation_description', { - name: category.name.toLowerCase(), - })} - - + + {!isCloudUserVal && ( + <> + + + {category.statusComponent} + + + onModalToggleHandler(category.name.toLowerCase() as TTTLType) + } + onOk={(): Promise => + onOkHandler(category.name.toLowerCase() as TTTLType) + } + centered + open={category.save.modal} + confirmLoading={category.save.apiLoading} + > + + {t('retention_confirmation_description', { + name: category.name.toLowerCase(), + })} + + + + )} @@ -587,16 +596,20 @@ function GeneralSettings({ {Element} - + {!isCloudUserVal && ( + + )} {errorText && {errorText}} {renderConfig} + + {isCloudUserVal && } ); diff --git a/frontend/src/container/GeneralSettings/Retention.tsx b/frontend/src/container/GeneralSettings/Retention.tsx index 6228391503..172d1ee0c6 100644 --- a/frontend/src/container/GeneralSettings/Retention.tsx +++ b/frontend/src/container/GeneralSettings/Retention.tsx @@ -8,6 +8,7 @@ import { useRef, useState, } from 'react'; +import { isCloudUser } from 'utils/app'; import { Input, @@ -85,9 +86,13 @@ function Retention({ func(null); } }; + if (hide) { return null; } + + const isCloudUserVal = isCloudUser(); + return ( @@ -98,12 +103,14 @@ function Retention({ = 0 ? selectedValue : ''} + disabled={isCloudUserVal} onChange={(e): void => onChangeHandler(e, setSelectedValue)} style={{ width: 75 }} />