Skip to content

Commit

Permalink
chore: fix for 'npm run test'
Browse files Browse the repository at this point in the history
  • Loading branch information
ma-efremoff committed Oct 19, 2023
1 parent ab8cc09 commit be28590
Show file tree
Hide file tree
Showing 22 changed files with 38 additions and 30 deletions.
2 changes: 1 addition & 1 deletion packages/ui/src/ui/UIFactory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {YTSubjectSuggest} from './components/ACL/SubjectsControl/YTSubjectSugges
import RoleActions, {Props as RoleActionsProps} from './components/ACL/RoleActions';
import OperationDetailMonitorLinks from './pages/operations/OperationDetail/tabs/monitor/OperationDetailsMonitorLinks';
import {PERMISSIONS_SETTINGS} from './constants/acl';
import {uiSettings} from './config';
import {uiSettings} from './config/ui-settings';
import YT from './config/yt-config';

type HeaderItemOrPage =
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/ui/common/thor/unipika-settings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {createSelector} from 'reselect';
import {uiSettings} from '../../config';
import {uiSettings} from '../../config/ui-settings';
import {rumLogError} from '../../rum/rum-counter';
import {Settings} from '../../components/Yson/StructuredYson/StructuredYsonTypes';

Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/ui/common/thor/unipika.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
shouldShowDecoded,
useBinaryAsHex,
} from '../../store/selectors/settings';
import {Settings} from '../../components/Yson/StructuredYson/StructuredYsonTypes';
import type {Settings} from '../../components/Yson/StructuredYson/StructuredYsonTypes';
import {getUnipikaSettingsFromConfig} from './unipika-settings';

const parseSetting = hammer.utils.parseSetting;
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/ui/common/utils/metrics.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {getConfigData} from '../../config';
import {getConfigData} from '../../config/ui-settings';
import YT from '../../config/yt-config';
import {rumLogError} from '../../rum/rum-counter';

Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/ui/components/Linkify/Linkify.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import {Link} from '@gravity-ui/uikit';
import {uiSettings} from '../../config';
import {uiSettings} from '../../config/ui-settings';

const {trackerBaseUrl} = uiSettings;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import withBlockedNavigation from '../../hocs/withBlockedNavigation';
import Button from '../Button/Button';
import {getGlobalError} from '../../store/selectors/global';
import {showErrorPopup} from '../../utils/utils';
import {isDocsAllowed, uiSettings} from '../../config';
import {isDocsAllowed} from '../../config';
import {uiSettings} from '../../config/ui-settings';
import UIFactory from '../../UIFactory';

const b = block('preloader');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import Link from '../Link/Link';
import {uiSettings} from '../../config';
import {uiSettings} from '../../config/ui-settings';

function StarTrackLink(props: {id: string; emptyContent?: React.ReactNode}) {
const {id, emptyContent = null, ...rest} = props;
Expand Down
9 changes: 2 additions & 7 deletions packages/ui/src/ui/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import _ from 'lodash';
import {ConfigData} from '../../shared/yt-types';
// TODO: get rid of the import, the file should not import UIFactory
import UIFactory from '../UIFactory';

export function getConfigData(): ConfigData {
return (window as any).__DATA__;
}

export const uiSettings: Partial<Required<ConfigData>['uiSettings']> =
getConfigData()?.uiSettings || {};
import {getConfigData, uiSettings} from './ui-settings';

export function hasOdinPage() {
return getConfigData().odinPageEnabled;
Expand Down
8 changes: 8 additions & 0 deletions packages/ui/src/ui/config/ui-settings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type {ConfigData} from '../../shared/yt-types';

export function getConfigData(): ConfigData {
return (window as any).__DATA__;
}

export const uiSettings: Partial<Required<ConfigData>['uiSettings']> =
getConfigData()?.uiSettings || {};
2 changes: 1 addition & 1 deletion packages/ui/src/ui/containers/Host/Host.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {getCluster} from '../../store/selectors/global';
import Link from '../../components/Link/Link';
import ClipboardButton from '../../components/ClipboardButton/ClipboardButton';
import {Tooltip} from '../../components/Tooltip/Tooltip';
import {uiSettings} from '../../config';
import {uiSettings} from '../../config/ui-settings';

import './Host.scss';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import withBlockedNavigation from '../../hocs/withBlockedNavigation';
import Icon from '../../components/Icon/Icon';
import Button from '../../components/Button/Button';
import {Linkify} from '../../components/Linkify/Linkify';
import {uiSettings} from '../../config';
import {uiSettings} from '../../config/ui-settings';

import './MaintenancePage.scss';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import shieldIcon from '../../../../img/svg/shield-icon.svg';
import tableIcon from '../../../../img/svg/table-icon.svg';
import infoIcon from '../../../../img/svg/info-icon.svg';
import {useClusterFromLocation} from '../../hooks/use-cluster';
import {docsUrl, uiSettings} from '../../config/index';
import {docsUrl} from '../../config/index';
import {uiSettings} from '../../config/ui-settings';

import ypath from '../../common/thor/ypath';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import './VersionCell.scss';
import {useDispatch} from 'react-redux';
import {changeVersionStateTypeFilters} from '../../../../store/actions/components/versions/versions_v2';
import {Tooltip} from '../../../../components/Tooltip/Tooltip';
import {uiSettings} from '../../../../config';
import {uiSettings} from '../../../../config/ui-settings';

const block = cn('version-cell');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@ import {
import {getColumns} from '../../../../../store/selectors/navigation/content/table-ts';

import './DownloadManager.scss';
import {docsUrl, getConfigData} from '../../../../../config';
import {docsUrl} from '../../../../../config';
import {uiSettings} from '../../../../../config/ui-settings';
import SeparatorInput, {prepareSeparatorValue} from './SeparatorInput';
import UIFactory from '../../../../../UIFactory';
import {makeDirectDownloadPath} from '../../../../../utils/navigation';

const block = cn('table-download-manager');
const messageBlock = cn('elements-message');

const EXCEL_BASE_URL = getConfigData()?.uiSettings?.exportTableBaseUrl;
const EXCEL_BASE_URL = uiSettings?.exportTableBaseUrl;

function checkExcelExporter(cluster) {
if (!EXCEL_BASE_URL) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {getSchemaStrict} from '../../../../../store/selectors/navigation/tabs/sc
import {Secondary} from '../../../../../components/Text/Text';
import ColumnsPresetButton from './ColumnsPresetButton';
import {RootState} from '../../../../../store/reducers';
import {getConfigData} from '../../../../../config';
import {getConfigData} from '../../../../../config/ui-settings';

ColumnSelectorButton.propTypes = {
// from parent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {Secondary, Warning} from '../../../../../components/Text/Text';
import Link from '../../../../../components/Link/Link';
import {getNavigationPathAttributesLoadState} from '../../../../../store/selectors/navigation/navigation';
import {LOADING_STATUS} from '../../../../../constants';
import {docsUrl, uiSettings} from '../../../../../config';
import {docsUrl} from '../../../../../config';
import {uiSettings} from '../../../../../config/ui-settings';
import UIFactory from '../../../../../UIFactory';

export default function DataLensButton({className}: {className: string}) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import cn from 'bem-cn-lite';
import type {OperationMonitoringTabProps} from '../../../../../UIFactory';
import {uiSettings} from '../../../../../config';
import {uiSettings} from '../../../../../config/ui-settings';
import Icon from '../../../../../components/Icon/Icon';
import Link from '../../../../../components/Link/Link';
import Error from '../../../../../components/Error/Error';
Expand Down
5 changes: 3 additions & 2 deletions packages/ui/src/ui/rum/rum-counter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ export function rumSendFrameworkInited() {
return RUM.sendTimeMark('3036');
}

const ENABLE_RUM_DEBUG_2 = -1 !== window.location.search.slice(1).split('&').indexOf('rumdebug=2');
const ENABLE_RUM_DEBUG_2 =
-1 !== window.location?.search?.slice(1).split('&').indexOf('rumdebug=2');
const ENABLE_RUM_DEBUG =
ENABLE_RUM_DEBUG_2 || -1 !== window.location.search.slice(1).split('&').indexOf('rumdebug=1');
ENABLE_RUM_DEBUG_2 || -1 !== window.location?.search?.slice(1).split('&').indexOf('rumdebug=1');

const startTime = Date.now();

Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/ui/store/actions/global/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {YTApiId, ytApiV3Id} from '../../../rum/rum-wrap-api';
import {getWindowStore} from '../../../store/window-store';
import {reloadUserSettings} from '../settings';
import YT from '../../../config/yt-config';
import {getConfigData} from '../../../config';
import {getConfigData} from '../../../config/ui-settings';

export function setTheme(theme: 'light' | 'dark' | 'system' | 'light-hc' | 'dark-hc') {
return {type: GLOBAL_SET_THEME, data: theme};
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/ui/store/selectors/global/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {getClusterNS} from '../settings';
import {ClusterConfig} from '../../../../shared/yt-types';
import {FIX_MY_TYPE} from '../../../types';
import UIFactory from '../../../UIFactory';
import {getConfigData, ytApiUseCORS} from '../../../config';
import {getConfigData} from '../../../config/ui-settings';
import {isSupportedYtTvmAPIGlobal} from '../thor/support';

export const getGlobalError = (state: RootState) => state.global.error.error;
Expand Down Expand Up @@ -54,7 +54,7 @@ export function getClusterConfigByName(clusterName: string): ClusterConfig {
}

export function isAllowYtTwmApi() {
return !ytApiUseCORS() && isSupportedYtTvmAPIGlobal();
return !getConfigData().ytApiUseCORS && isSupportedYtTvmAPIGlobal();
}

export function getClusterProxy(clusterConfig: ClusterConfig): string {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/ui/store/selectors/settings-ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {AccountUsageViewType} from '../reducers/accounts/usage/accounts-usage-fi
import {AccountUsageDataItem} from '../../store/reducers/accounts/usage/account-usage-types';
import {ActiveJobTypesMap} from '../../store/actions/settings/settings';
import {RootState} from '../../store/reducers';
import {uiSettings} from '../../config';
import {uiSettings} from '../../config/ui-settings';
import _ from 'lodash';
import {NODE_TYPE} from '../../../shared/constants/system';
import {ValueOf} from '../../../@types/types';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/ui/utils/errors/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-expect-error
import yt from '@ytsaurus/javascript-wrapper/lib/yt';

import {YTError} from '../../types';
import type {YTError} from '../../types';

export function getErrorWithCode(errors: YTError[], code: number): YTError | undefined {
const queue: YTError[] = [...errors];
Expand Down

0 comments on commit be28590

Please sign in to comment.