ydb-embedded-ui 5.4.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DiskPageTitle/DiskPageTitle.d.ts +11 -0
- package/dist/components/DiskPageTitle/DiskPageTitle.js +8 -0
- package/dist/components/DiskPageTitle/DiskPageTitle.scss +17 -0
- package/dist/{containers/Storage → components}/DiskStateProgressBar/DiskStateProgressBar.js +3 -3
- package/dist/components/ErrorBoundary/ErrorBoundary.d.ts +1 -1
- package/dist/components/GroupInfo/GroupInfo.d.ts +8 -0
- package/dist/components/GroupInfo/GroupInfo.js +28 -0
- package/dist/components/GroupInfo/i18n/en.json +6 -0
- package/dist/components/GroupInfo/i18n/index.d.ts +1 -0
- package/dist/components/GroupInfo/i18n/index.js +4 -0
- package/dist/components/MetricChart/MetricChart.js +3 -1
- package/dist/components/MetricChart/types.d.ts +4 -0
- package/dist/components/MonacoEditor/MonacoEditor.d.ts +2 -0
- package/dist/components/MonacoEditor/MonacoEditor.js +7 -0
- package/dist/{containers/Storage → components}/PDiskPopup/PDiskPopup.d.ts +3 -3
- package/dist/{containers/Storage → components}/PDiskPopup/PDiskPopup.js +6 -5
- package/dist/components/PageMeta/PageMeta.d.ts +2 -1
- package/dist/components/PageMeta/PageMeta.js +9 -2
- package/dist/components/PageMeta/PageMeta.scss +9 -0
- package/dist/components/Stack/Stack.scss +2 -0
- package/dist/{containers/Storage → components}/VDisk/VDisk.d.ts +2 -2
- package/dist/{containers/Storage → components}/VDisk/VDisk.js +8 -8
- package/dist/{containers/Storage → components}/VDisk/VDisk.scss +1 -1
- package/dist/components/VDisk/VDiskWithDonorsStack.d.ts +12 -0
- package/dist/components/VDisk/VDiskWithDonorsStack.js +14 -0
- package/dist/components/VDiskInfo/VDiskInfo.d.ts +10 -0
- package/dist/components/VDiskInfo/VDiskInfo.js +113 -0
- package/dist/components/VDiskInfo/VDiskInfo.scss +8 -0
- package/dist/components/VDiskInfo/i18n/en.json +23 -0
- package/dist/components/VDiskInfo/i18n/index.d.ts +1 -0
- package/dist/components/VDiskInfo/i18n/index.js +4 -0
- package/dist/{containers/Storage → components}/VDiskPopup/VDiskPopup.d.ts +3 -3
- package/dist/{containers/Storage → components}/VDiskPopup/VDiskPopup.js +8 -7
- package/dist/components/VirtualTable/TableHead.d.ts +2 -1
- package/dist/components/VirtualTable/TableHead.js +6 -6
- package/dist/components/VirtualTable/constants.d.ts +1 -0
- package/dist/components/VirtualTable/constants.js +1 -0
- package/dist/containers/App/App.js +0 -2
- package/dist/containers/App/App.scss +3 -0
- package/dist/containers/App/Content.js +19 -5
- package/dist/containers/App/appSlots.d.ts +9 -3
- package/dist/containers/App/appSlots.js +2 -1
- package/dist/containers/Header/breadcrumbs.js +12 -0
- package/dist/containers/Header/i18n/en.json +1 -0
- package/dist/containers/Header/i18n/index.d.ts +1 -1
- package/dist/containers/Heatmap/HeatmapCanvas/HeatmapCanvas.js +2 -2
- package/dist/containers/Node/NodeStructure/NodeStructure.js +1 -1
- package/dist/containers/Node/NodeStructure/Pdisk.js +2 -2
- package/dist/containers/Node/NodeStructure/Vdisk.d.ts +6 -2
- package/dist/containers/Node/NodeStructure/Vdisk.js +5 -78
- package/dist/containers/Nodes/getNodesColumns.js +0 -1
- package/dist/containers/PDiskPage/PDiskPage.d.ts +3 -0
- package/dist/containers/{PDisk/PDisk.js → PDiskPage/PDiskPage.js} +9 -11
- package/dist/containers/{PDisk/PDisk.scss → PDiskPage/PDiskPage.scss} +0 -14
- package/dist/containers/Storage/PDisk/PDisk.js +4 -10
- package/dist/containers/Storage/PDisk/PDisk.scss +0 -2
- package/dist/containers/Storage/Storage.js +1 -2
- package/dist/containers/Storage/StorageGroups/StorageGroups.scss +1 -7
- package/dist/containers/Storage/StorageGroups/getStorageGroupsColumns.d.ts +1 -1
- package/dist/containers/Storage/StorageGroups/getStorageGroupsColumns.js +9 -17
- package/dist/containers/Storage/VirtualStorage.js +3 -7
- package/dist/containers/Tablet/TabletControls/TabletControls.js +2 -1
- package/dist/containers/TabletsFilters/TabletsFilters.d.ts +2 -2
- package/dist/containers/TabletsFilters/TabletsFilters.js +7 -6
- package/dist/containers/Tenant/Diagnostics/Consumers/Consumers.js +1 -1
- package/dist/containers/Tenant/Diagnostics/Network/Network.js +2 -2
- package/dist/containers/Tenant/Diagnostics/Partitions/Partitions.js +1 -2
- package/dist/containers/Tenant/Diagnostics/Partitions/PartitionsControls/PartitionsControls.js +1 -1
- package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/cpuDashboardConfig.js +4 -0
- package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.js +5 -3
- package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.js +6 -4
- package/dist/containers/Tenant/Query/SaveQuery/SaveQuery.js +2 -2
- package/dist/containers/Tenant/Tenant.js +10 -5
- package/dist/containers/Tenants/Tenants.js +3 -2
- package/dist/containers/VDiskPage/VDiskPage.d.ts +3 -0
- package/dist/containers/VDiskPage/VDiskPage.js +109 -0
- package/dist/containers/VDiskPage/VDiskPage.scss +32 -0
- package/dist/containers/VDiskPage/i18n/en.json +9 -0
- package/dist/containers/VDiskPage/i18n/index.d.ts +1 -0
- package/dist/containers/VDiskPage/i18n/index.js +4 -0
- package/dist/containers/Versions/groupNodes.js +1 -1
- package/dist/routes.d.ts +3 -0
- package/dist/routes.js +5 -0
- package/dist/services/api.d.ts +11 -4
- package/dist/services/api.js +26 -4
- package/dist/store/configureStore.d.ts +4 -0
- package/dist/store/defaultStore.d.ts +2 -0
- package/dist/store/reducers/authentication/authentication.d.ts +3 -0
- package/dist/store/reducers/cluster/cluster.d.ts +1 -0
- package/dist/store/reducers/clusterNodes/clusterNodes.d.ts +1 -0
- package/dist/store/reducers/clusters/clusters.d.ts +1 -0
- package/dist/store/reducers/clusters/selectors.js +1 -1
- package/dist/store/reducers/describe.d.ts +2 -0
- package/dist/store/reducers/executeQuery.d.ts +1 -0
- package/dist/store/reducers/explainQuery.d.ts +2 -0
- package/dist/store/reducers/header/types.d.ts +4 -1
- package/dist/store/reducers/healthcheckInfo/healthcheckInfo.d.ts +1 -0
- package/dist/store/reducers/heatmap.d.ts +1 -0
- package/dist/store/reducers/host.d.ts +1 -0
- package/dist/store/reducers/index.d.ts +3 -0
- package/dist/store/reducers/index.js +2 -0
- package/dist/store/reducers/network/network.d.ts +1 -0
- package/dist/store/reducers/node/node.d.ts +2 -0
- package/dist/store/reducers/node/selectors.js +1 -1
- package/dist/store/reducers/nodes/nodes.d.ts +2 -0
- package/dist/store/reducers/nodesList.d.ts +1 -0
- package/dist/store/reducers/olapStats.d.ts +1 -0
- package/dist/store/reducers/overview/overview.d.ts +2 -0
- package/dist/store/reducers/partitions/partitions.d.ts +1 -0
- package/dist/store/reducers/pdisk/pdisk.d.ts +2 -0
- package/dist/store/reducers/pdisk/utils.js +1 -1
- package/dist/store/reducers/preview.d.ts +1 -0
- package/dist/store/reducers/schema/schema.d.ts +1 -0
- package/dist/store/reducers/schemaAcl/schemaAcl.d.ts +1 -0
- package/dist/store/reducers/shardsWorkload/shardsWorkload.d.ts +1 -0
- package/dist/store/reducers/storage/storage.d.ts +2 -0
- package/dist/store/reducers/storage/types.d.ts +3 -1
- package/dist/store/reducers/storage/utils.d.ts +1 -1
- package/dist/store/reducers/storage/utils.js +8 -9
- package/dist/store/reducers/tablet.d.ts +2 -0
- package/dist/store/reducers/tablets.d.ts +1 -0
- package/dist/store/reducers/tabletsFilters.d.ts +1 -0
- package/dist/store/reducers/tenant/tenant.d.ts +1 -0
- package/dist/store/reducers/tenantOverview/executeTopTables/executeTopTables.d.ts +1 -0
- package/dist/store/reducers/tenantOverview/topNodesByCpu/topNodesByCpu.d.ts +1 -0
- package/dist/store/reducers/tenantOverview/topNodesByLoad/topNodesByLoad.d.ts +1 -0
- package/dist/store/reducers/tenantOverview/topNodesByMemory/topNodesByMemory.d.ts +1 -0
- package/dist/store/reducers/tenantOverview/topQueries/tenantOverviewTopQueries.d.ts +1 -0
- package/dist/store/reducers/tenantOverview/topShards/tenantOverviewTopShards.d.ts +1 -0
- package/dist/store/reducers/tenantOverview/topStorageGroups/topStorageGroups.d.ts +1 -0
- package/dist/store/reducers/tenants/selectors.js +1 -1
- package/dist/store/reducers/tenants/tenants.d.ts +1 -0
- package/dist/store/reducers/topic.d.ts +1 -0
- package/dist/store/reducers/vdisk/types.d.ts +25 -0
- package/dist/store/reducers/vdisk/utils.d.ts +11 -0
- package/dist/store/reducers/vdisk/utils.js +33 -0
- package/dist/store/reducers/vdisk/vdisk.d.ts +100 -0
- package/dist/store/reducers/vdisk/vdisk.js +64 -0
- package/dist/store/state-url-mapping.js +6 -4
- package/dist/types/api/storage.d.ts +2 -0
- package/dist/utils/bytesParsers/__test__/formatBytes.test.js +7 -7
- package/dist/utils/clusterVersionColors.js +1 -1
- package/dist/utils/dataFormatters/dataFormatters.js +1 -0
- package/dist/utils/disks/constants.js +2 -2
- package/dist/utils/disks/types.d.ts +5 -1
- package/dist/utils/filters.js +1 -1
- package/dist/utils/hooks/useTableResize.d.ts +1 -1
- package/dist/utils/hooks/useTableResize.js +5 -3
- package/dist/utils/lazyComponent.d.ts +4 -0
- package/dist/utils/lazyComponent.js +25 -0
- package/dist/utils/monaco/index.d.ts +1 -0
- package/dist/utils/monaco/index.js +4 -0
- package/dist/utils/monaco/s-expression/constants.d.ts +1 -0
- package/dist/utils/monaco/s-expression/constants.js +1 -0
- package/dist/utils/monaco/s-expression/registerLanguage.d.ts +1 -0
- package/dist/utils/{monaco.js → monaco/s-expression/registerLanguage.js} +2 -19
- package/dist/utils/{yqlSuggestions → monaco/yqlSuggestions}/generateSuggestions.d.ts +2 -2
- package/dist/utils/{yqlSuggestions → monaco/yqlSuggestions}/generateSuggestions.js +40 -11
- package/dist/utils/monaco/yqlSuggestions/registerCompletionItemProvider.d.ts +1 -0
- package/dist/utils/monaco/yqlSuggestions/registerCompletionItemProvider.js +15 -0
- package/dist/utils/{yqlSuggestions → monaco/yqlSuggestions}/yqlSuggestions.js +1 -1
- package/dist/utils/numeral.js +7 -1
- package/dist/utils/storage.d.ts +1 -0
- package/dist/utils/storage.js +1 -0
- package/dist/utils/timeParsers/parsers.js +1 -1
- package/package.json +3 -1
- package/dist/containers/PDisk/PDisk.d.ts +0 -3
- package/dist/containers/Storage/DiskStateProgressBar/index.d.ts +0 -1
- package/dist/containers/Storage/DiskStateProgressBar/index.js +0 -1
- package/dist/containers/Storage/PDiskPopup/index.d.ts +0 -1
- package/dist/containers/Storage/PDiskPopup/index.js +0 -1
- package/dist/containers/Storage/VDisk/index.d.ts +0 -1
- package/dist/containers/Storage/VDisk/index.js +0 -1
- package/dist/containers/Storage/VDiskPopup/index.d.ts +0 -1
- package/dist/containers/Storage/VDiskPopup/index.js +0 -1
- package/dist/containers/Storage/utils/types.d.ts +0 -5
- package/dist/utils/monaco.d.ts +0 -3
- /package/dist/{containers/Storage → components}/DiskStateProgressBar/DiskStateProgressBar.d.ts +0 -0
- /package/dist/{containers/Storage → components}/DiskStateProgressBar/DiskStateProgressBar.scss +0 -0
- /package/dist/{containers/Storage → components}/PDiskPopup/PDiskPopup.scss +0 -0
- /package/dist/{containers/Storage → components}/VDiskPopup/VDiskPopup.scss +0 -0
- /package/dist/containers/{PDisk → PDiskPage}/PDiskGroups.d.ts +0 -0
- /package/dist/containers/{PDisk → PDiskPage}/PDiskGroups.js +0 -0
- /package/dist/containers/{PDisk → PDiskPage}/i18n/en.json +0 -0
- /package/dist/containers/{PDisk → PDiskPage}/i18n/index.d.ts +0 -0
- /package/dist/containers/{PDisk → PDiskPage}/i18n/index.js +0 -0
- /package/dist/containers/{PDisk → PDiskPage}/shared.d.ts +0 -0
- /package/dist/containers/{PDisk → PDiskPage}/shared.js +0 -0
- /package/dist/{containers/Storage/utils → store/reducers/vdisk}/types.js +0 -0
- /package/dist/utils/{yqlSuggestions → monaco/yqlSuggestions}/constants.d.ts +0 -0
- /package/dist/utils/{yqlSuggestions → monaco/yqlSuggestions}/constants.js +0 -0
- /package/dist/utils/{yqlSuggestions → monaco/yqlSuggestions}/yqlSuggestions.d.ts +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { EFlag } from '../../types/api/enums';
|
|
3
|
+
import './DiskPageTitle.scss';
|
|
4
|
+
interface DiskPageTitleProps {
|
|
5
|
+
entityName: ReactNode;
|
|
6
|
+
status: EFlag;
|
|
7
|
+
id: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function DiskPageTitle({ entityName, status, id, className }: DiskPageTitleProps): JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import { StatusIcon } from '../StatusIcon/StatusIcon';
|
|
4
|
+
import './DiskPageTitle.scss';
|
|
5
|
+
const b = cn('ydb-disk-page-title');
|
|
6
|
+
export function DiskPageTitle({ entityName, status, id, className }) {
|
|
7
|
+
return (_jsxs("div", Object.assign({ className: b(null, className) }, { children: [_jsx("span", Object.assign({ className: b('prefix') }, { children: entityName })), _jsx(StatusIcon, { status: status, size: "s" }), id] })));
|
|
8
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@import '../../styles/mixins.scss';
|
|
2
|
+
|
|
3
|
+
.ydb-disk-page-title {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-flow: row nowrap;
|
|
6
|
+
align-items: baseline;
|
|
7
|
+
|
|
8
|
+
text-wrap: nowrap;
|
|
9
|
+
|
|
10
|
+
@include header-2-typography();
|
|
11
|
+
|
|
12
|
+
&__prefix {
|
|
13
|
+
margin-right: 6px;
|
|
14
|
+
|
|
15
|
+
color: var(--g-color-text-secondary);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import cn from 'bem-cn-lite';
|
|
4
|
-
import { INVERTED_DISKS_KEY } from '
|
|
5
|
-
import { useSetting } from '
|
|
6
|
-
import { getSeverityColor } from '
|
|
4
|
+
import { INVERTED_DISKS_KEY } from '../../utils/constants';
|
|
5
|
+
import { useSetting } from '../../utils/hooks';
|
|
6
|
+
import { getSeverityColor } from '../../utils/disks/helpers';
|
|
7
7
|
import './DiskStateProgressBar.scss';
|
|
8
8
|
const b = cn('storage-disk-progress-bar');
|
|
9
9
|
export function DiskStateProgressBar({ diskAllocatedPercent = -1, severity, compact, }) {
|
|
@@ -12,7 +12,7 @@ export declare function ErrorBoundaryInner({ children, useRetry, onReportProblem
|
|
|
12
12
|
interface ErrorBoundaryFallbackProps {
|
|
13
13
|
error: Error;
|
|
14
14
|
useRetry?: boolean;
|
|
15
|
-
resetErrorBoundary
|
|
15
|
+
resetErrorBoundary?: () => void;
|
|
16
16
|
onReportProblem?: (error?: Error) => void;
|
|
17
17
|
}
|
|
18
18
|
export declare function ErrorBoundaryFallback({ error, resetErrorBoundary, useRetry, onReportProblem, }: ErrorBoundaryFallbackProps): JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { PreparedStorageGroup } from '../../store/reducers/storage/types';
|
|
3
|
+
import type { InfoViewerProps } from '../InfoViewer/InfoViewer';
|
|
4
|
+
interface GroupInfoProps<T extends Partial<PreparedStorageGroup>> extends Omit<InfoViewerProps, 'info'> {
|
|
5
|
+
data: T;
|
|
6
|
+
}
|
|
7
|
+
export declare function GroupInfo<T extends Partial<PreparedStorageGroup>>({ data, ...infoViewerProps }: GroupInfoProps<T>): JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { valueIsDefined } from '../../utils';
|
|
4
|
+
import { formatStorageValuesToGb } from '../../utils/dataFormatters/dataFormatters';
|
|
5
|
+
import { InfoViewer } from '../InfoViewer';
|
|
6
|
+
import { ProgressViewer } from '../ProgressViewer/ProgressViewer';
|
|
7
|
+
import { groupInfoKeyset } from './i18n';
|
|
8
|
+
export function GroupInfo(_a) {
|
|
9
|
+
var { data } = _a, infoViewerProps = __rest(_a, ["data"]);
|
|
10
|
+
const { GroupID, PoolName, Used, Limit, ErasureSpecies } = data;
|
|
11
|
+
const groupInfo = [];
|
|
12
|
+
if (valueIsDefined(GroupID)) {
|
|
13
|
+
groupInfo.push({ label: groupInfoKeyset('group-id'), value: GroupID });
|
|
14
|
+
}
|
|
15
|
+
if (valueIsDefined(PoolName)) {
|
|
16
|
+
groupInfo.push({ label: groupInfoKeyset('pool-name'), value: PoolName });
|
|
17
|
+
}
|
|
18
|
+
if (valueIsDefined(ErasureSpecies)) {
|
|
19
|
+
groupInfo.push({ label: groupInfoKeyset('erasure'), value: ErasureSpecies });
|
|
20
|
+
}
|
|
21
|
+
if (Number(Used) >= 0 && Number(Limit) >= 0) {
|
|
22
|
+
groupInfo.push({
|
|
23
|
+
label: groupInfoKeyset('size'),
|
|
24
|
+
value: (_jsx(ProgressViewer, { value: Used, capacity: Limit, formatValues: formatStorageValuesToGb, colorizeProgress: true })),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return _jsx(InfoViewer, Object.assign({ info: groupInfo }, infoViewerProps));
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const groupInfoKeyset: (key: "size" | "group-id" | "erasure" | "pool-name", params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
@@ -16,7 +16,7 @@ import './MetricChart.scss';
|
|
|
16
16
|
const b = cn('ydb-metric-chart');
|
|
17
17
|
settings.set({ plugins: [YagrPlugin] });
|
|
18
18
|
const prepareWidgetData = (data, options = {}) => {
|
|
19
|
-
const { dataType } = options;
|
|
19
|
+
const { dataType, scaleRange } = options;
|
|
20
20
|
const defaultDataFormatter = getDefaultDataFormatter(dataType);
|
|
21
21
|
const isDataEmpty = !data.metrics.length;
|
|
22
22
|
const graphs = data.metrics.map((metric, index) => {
|
|
@@ -56,6 +56,8 @@ const prepareWidgetData = (data, options = {}) => {
|
|
|
56
56
|
y: {
|
|
57
57
|
type: 'linear',
|
|
58
58
|
range: 'nice',
|
|
59
|
+
min: (scaleRange === null || scaleRange === void 0 ? void 0 : scaleRange.min) || 0,
|
|
60
|
+
max: scaleRange === null || scaleRange === void 0 ? void 0 : scaleRange.max,
|
|
59
61
|
},
|
|
60
62
|
},
|
|
61
63
|
axes: {
|
|
@@ -19,6 +19,10 @@ export type ChartValue = number | string | null;
|
|
|
19
19
|
export type ChartDataType = 'ms' | 'size' | 'percent';
|
|
20
20
|
export interface ChartOptions {
|
|
21
21
|
dataType?: ChartDataType;
|
|
22
|
+
scaleRange?: {
|
|
23
|
+
min?: number;
|
|
24
|
+
max?: number;
|
|
25
|
+
};
|
|
22
26
|
}
|
|
23
27
|
export type ChartDataStatus = 'loading' | 'success' | 'error';
|
|
24
28
|
export type OnChartDataStatusChange = (newStatus: ChartDataStatus) => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { lazyComponent } from '../../utils/lazyComponent';
|
|
2
|
+
export const MonacoEditor = lazyComponent(async () => {
|
|
3
|
+
const Editor = (await import('react-monaco-editor')).default;
|
|
4
|
+
const { registerLanguages } = await import('../../utils/monaco');
|
|
5
|
+
registerLanguages();
|
|
6
|
+
return { Editor };
|
|
7
|
+
}, 'Editor');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PopupProps } from '@gravity-ui/uikit';
|
|
2
|
-
import type { NodesMap } from '
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
import type { NodesMap } from '../../types/store/nodesList';
|
|
3
|
+
import type { PreparedPDisk } from '../../utils/disks/types';
|
|
4
|
+
import { InfoViewerItem } from '../InfoViewer';
|
|
5
5
|
import './PDiskPopup.scss';
|
|
6
6
|
export declare const preparePDiskData: (data: PreparedPDisk, nodes?: NodesMap) => InfoViewerItem[];
|
|
7
7
|
interface PDiskPopupProps extends PopupProps {
|
|
@@ -3,17 +3,18 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
import cn from 'bem-cn-lite';
|
|
5
5
|
import { Popup } from '@gravity-ui/uikit';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { EFlag } from '../../types/api/enums';
|
|
7
|
+
import { getPDiskId } from '../../utils/dataFormatters/dataFormatters';
|
|
8
|
+
import { bytesToGB } from '../../utils/utils';
|
|
9
|
+
import { EMPTY_DATA_PLACEHOLDER } from '../../utils/constants';
|
|
10
|
+
import { InfoViewer } from '../InfoViewer';
|
|
10
11
|
import './PDiskPopup.scss';
|
|
11
12
|
const b = cn('pdisk-storage-popup');
|
|
12
13
|
const errorColors = [EFlag.Orange, EFlag.Red, EFlag.Yellow];
|
|
13
14
|
export const preparePDiskData = (data, nodes) => {
|
|
14
15
|
const { AvailableSize, TotalSize, State, PDiskId, NodeId, Path, Realtime, Type, Device } = data;
|
|
15
16
|
const pdiskData = [
|
|
16
|
-
{ label: 'PDisk', value: getPDiskId({ NodeId, PDiskId }) ||
|
|
17
|
+
{ label: 'PDisk', value: getPDiskId({ NodeId, PDiskId }) || EMPTY_DATA_PLACEHOLDER },
|
|
17
18
|
{ label: 'State', value: State || 'not available' },
|
|
18
19
|
{ label: 'Type', value: Type || 'unknown' },
|
|
19
20
|
];
|
|
@@ -3,6 +3,7 @@ import './PageMeta.scss';
|
|
|
3
3
|
interface PageMetaProps {
|
|
4
4
|
items: (string | undefined)[];
|
|
5
5
|
className?: string;
|
|
6
|
+
loading?: boolean;
|
|
6
7
|
}
|
|
7
|
-
export declare function PageMeta({ items, className }: PageMetaProps): JSX.Element;
|
|
8
|
+
export declare function PageMeta({ items, loading, className }: PageMetaProps): JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Skeleton } from '@gravity-ui/uikit';
|
|
2
3
|
import { cn } from '../../utils/cn';
|
|
3
4
|
import './PageMeta.scss';
|
|
4
5
|
const b = cn('ydb-page-meta');
|
|
5
|
-
export function PageMeta({ items, className }) {
|
|
6
|
-
|
|
6
|
+
export function PageMeta({ items, loading, className }) {
|
|
7
|
+
const renderContent = () => {
|
|
8
|
+
if (loading) {
|
|
9
|
+
return _jsx(Skeleton, { className: b('skeleton') });
|
|
10
|
+
}
|
|
11
|
+
return items.filter((item) => Boolean(item)).join('\u00a0\u00a0\u00B7\u00a0\u00a0');
|
|
12
|
+
};
|
|
13
|
+
return _jsx("div", Object.assign({ className: b(null, className) }, { children: renderContent() }));
|
|
7
14
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { NodesMap } from '
|
|
2
|
-
import type { PreparedVDisk } from '
|
|
1
|
+
import type { NodesMap } from '../../types/store/nodesList';
|
|
2
|
+
import type { PreparedVDisk } from '../../utils/disks/types';
|
|
3
3
|
import './VDisk.scss';
|
|
4
4
|
interface VDiskProps {
|
|
5
5
|
data?: PreparedVDisk;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useState, useRef } from 'react';
|
|
3
3
|
import cn from 'bem-cn-lite';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { DiskStateProgressBar } from '../DiskStateProgressBar';
|
|
10
|
-
import {
|
|
4
|
+
import routes, { createHref } from '../../routes';
|
|
5
|
+
import { stringifyVdiskId } from '../../utils/dataFormatters/dataFormatters';
|
|
6
|
+
import { isFullVDiskData } from '../../utils/disks/helpers';
|
|
7
|
+
import { STRUCTURE } from '../../containers/Node/NodePages';
|
|
8
|
+
import { VDiskPopup } from '../VDiskPopup/VDiskPopup';
|
|
9
|
+
import { DiskStateProgressBar } from '../DiskStateProgressBar/DiskStateProgressBar';
|
|
10
|
+
import { InternalLink } from '../InternalLink';
|
|
11
11
|
import './VDisk.scss';
|
|
12
|
-
const b = cn('vdisk-
|
|
12
|
+
const b = cn('ydb-vdisk-component');
|
|
13
13
|
export const VDisk = ({ data = {}, nodes, compact }) => {
|
|
14
14
|
var _a, _b;
|
|
15
15
|
const isFullData = isFullVDiskData(data);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { NodesMap } from '../../types/store/nodesList';
|
|
3
|
+
import type { PreparedVDisk } from '../../utils/disks/types';
|
|
4
|
+
interface VDiskWithDonorsStackProps {
|
|
5
|
+
data?: PreparedVDisk;
|
|
6
|
+
nodes?: NodesMap;
|
|
7
|
+
compact?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
stackClassName?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function VDiskWithDonorsStack({ data, nodes, compact, className, stackClassName, }: VDiskWithDonorsStackProps): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { stringifyVdiskId } from '../../utils/dataFormatters/dataFormatters';
|
|
3
|
+
import { isFullVDiskData } from '../../utils/disks/helpers';
|
|
4
|
+
import { Stack } from '../Stack/Stack';
|
|
5
|
+
import { VDisk } from './VDisk';
|
|
6
|
+
export function VDiskWithDonorsStack({ data, nodes, compact, className, stackClassName, }) {
|
|
7
|
+
const donors = data === null || data === void 0 ? void 0 : data.Donors;
|
|
8
|
+
const content = donors && donors.length > 0 ? (_jsxs(Stack, Object.assign({ className: stackClassName }, { children: [_jsx(VDisk, { data: data, nodes: nodes, compact: compact }), donors.map((donor) => {
|
|
9
|
+
const isFullData = isFullVDiskData(donor);
|
|
10
|
+
// donor and acceptor are always in the same group
|
|
11
|
+
return (_jsx(VDisk, { data: donor, nodes: nodes, compact: compact }, stringifyVdiskId(isFullData ? donor.VDiskId : donor)));
|
|
12
|
+
})] }))) : (_jsx(VDisk, { data: data, nodes: nodes, compact: compact }));
|
|
13
|
+
return _jsx("div", Object.assign({ className: className }, { children: content }));
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { PreparedVDisk } from '../../utils/disks/types';
|
|
3
|
+
import type { InfoViewerProps } from '../InfoViewer/InfoViewer';
|
|
4
|
+
import './VDiskInfo.scss';
|
|
5
|
+
interface VDiskInfoProps<T extends PreparedVDisk> extends Omit<InfoViewerProps, 'info'> {
|
|
6
|
+
data: T;
|
|
7
|
+
isVDiskPage?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function VDiskInfo<T extends PreparedVDisk>({ data, isVDiskPage, ...infoViewerProps }: VDiskInfoProps<T>): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { valueIsDefined } from '../../utils';
|
|
4
|
+
import { formatStorageValuesToGb } from '../../utils/dataFormatters/dataFormatters';
|
|
5
|
+
import { bytesToSpeed } from '../../utils/utils';
|
|
6
|
+
import { cn } from '../../utils/cn';
|
|
7
|
+
import { createVDiskDeveloperUILink } from '../../utils/developerUI/developerUI';
|
|
8
|
+
import { getVDiskPagePath } from '../../routes';
|
|
9
|
+
import { InfoViewer } from '../InfoViewer';
|
|
10
|
+
import { EntityStatus } from '../EntityStatus/EntityStatus';
|
|
11
|
+
import { LinkWithIcon } from '../LinkWithIcon/LinkWithIcon';
|
|
12
|
+
import { ProgressViewer } from '../ProgressViewer/ProgressViewer';
|
|
13
|
+
import { vDiskInfoKeyset } from './i18n';
|
|
14
|
+
import './VDiskInfo.scss';
|
|
15
|
+
const b = cn('ydb-vdisk-info');
|
|
16
|
+
// eslint-disable-next-line complexity
|
|
17
|
+
export function VDiskInfo(_a) {
|
|
18
|
+
var _b, _c, _d, _e;
|
|
19
|
+
var { data, isVDiskPage = false } = _a, infoViewerProps = __rest(_a, ["data", "isVDiskPage"]);
|
|
20
|
+
const { AllocatedSize, DiskSpace, FrontQueues, Guid, Replicated, VDiskState, VDiskSlotId, Kind, SatisfactionRank, AvailableSize, HasUnreadableBlobs, IncarnationGuid, InstanceGuid, StoragePoolName, ReadThroughput, WriteThroughput, PDiskId, NodeId, } = data;
|
|
21
|
+
const vdiskInfo = [];
|
|
22
|
+
if (valueIsDefined(VDiskSlotId)) {
|
|
23
|
+
vdiskInfo.push({ label: vDiskInfoKeyset('slot-id'), value: VDiskSlotId });
|
|
24
|
+
}
|
|
25
|
+
if (valueIsDefined(StoragePoolName)) {
|
|
26
|
+
vdiskInfo.push({ label: vDiskInfoKeyset('pool-name'), value: StoragePoolName });
|
|
27
|
+
}
|
|
28
|
+
if (valueIsDefined(VDiskState)) {
|
|
29
|
+
vdiskInfo.push({
|
|
30
|
+
label: vDiskInfoKeyset('state-status'),
|
|
31
|
+
value: VDiskState,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (Number(AllocatedSize) >= 0 && Number(AvailableSize) >= 0) {
|
|
35
|
+
vdiskInfo.push({
|
|
36
|
+
label: vDiskInfoKeyset('size'),
|
|
37
|
+
value: (_jsx(ProgressViewer, { value: AllocatedSize, capacity: Number(AllocatedSize) + Number(AvailableSize), formatValues: formatStorageValuesToGb, colorizeProgress: true })),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
if (valueIsDefined(Kind)) {
|
|
41
|
+
vdiskInfo.push({ label: vDiskInfoKeyset('kind'), value: Kind });
|
|
42
|
+
}
|
|
43
|
+
if (valueIsDefined(Guid)) {
|
|
44
|
+
vdiskInfo.push({ label: vDiskInfoKeyset('guid'), value: Guid });
|
|
45
|
+
}
|
|
46
|
+
if (valueIsDefined(IncarnationGuid)) {
|
|
47
|
+
vdiskInfo.push({ label: vDiskInfoKeyset('incarnation-guid'), value: IncarnationGuid });
|
|
48
|
+
}
|
|
49
|
+
if (valueIsDefined(InstanceGuid)) {
|
|
50
|
+
vdiskInfo.push({ label: vDiskInfoKeyset('instance-guid'), value: InstanceGuid });
|
|
51
|
+
}
|
|
52
|
+
if (valueIsDefined(Replicated)) {
|
|
53
|
+
vdiskInfo.push({
|
|
54
|
+
label: vDiskInfoKeyset('replication-status'),
|
|
55
|
+
value: Replicated ? vDiskInfoKeyset('yes') : vDiskInfoKeyset('no'),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (valueIsDefined(DiskSpace)) {
|
|
59
|
+
vdiskInfo.push({
|
|
60
|
+
label: vDiskInfoKeyset('space-status'),
|
|
61
|
+
value: _jsx(EntityStatus, { status: DiskSpace }),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (valueIsDefined((_b = SatisfactionRank === null || SatisfactionRank === void 0 ? void 0 : SatisfactionRank.FreshRank) === null || _b === void 0 ? void 0 : _b.Flag)) {
|
|
65
|
+
vdiskInfo.push({
|
|
66
|
+
label: vDiskInfoKeyset('fresh-rank-satisfaction'),
|
|
67
|
+
value: _jsx(EntityStatus, { status: (_c = SatisfactionRank === null || SatisfactionRank === void 0 ? void 0 : SatisfactionRank.FreshRank) === null || _c === void 0 ? void 0 : _c.Flag }),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (valueIsDefined((_d = SatisfactionRank === null || SatisfactionRank === void 0 ? void 0 : SatisfactionRank.LevelRank) === null || _d === void 0 ? void 0 : _d.Flag)) {
|
|
71
|
+
vdiskInfo.push({
|
|
72
|
+
label: vDiskInfoKeyset('level-rank-satisfaction'),
|
|
73
|
+
value: _jsx(EntityStatus, { status: (_e = SatisfactionRank === null || SatisfactionRank === void 0 ? void 0 : SatisfactionRank.LevelRank) === null || _e === void 0 ? void 0 : _e.Flag }),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (valueIsDefined(FrontQueues)) {
|
|
77
|
+
vdiskInfo.push({
|
|
78
|
+
label: vDiskInfoKeyset('front-queues'),
|
|
79
|
+
value: _jsx(EntityStatus, { status: FrontQueues }),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (valueIsDefined(HasUnreadableBlobs)) {
|
|
83
|
+
vdiskInfo.push({
|
|
84
|
+
label: vDiskInfoKeyset('has-unreadable-blobs'),
|
|
85
|
+
value: HasUnreadableBlobs ? vDiskInfoKeyset('yes') : vDiskInfoKeyset('no'),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (valueIsDefined(ReadThroughput)) {
|
|
89
|
+
vdiskInfo.push({
|
|
90
|
+
label: vDiskInfoKeyset('read-throughput'),
|
|
91
|
+
value: bytesToSpeed(ReadThroughput),
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if (valueIsDefined(WriteThroughput)) {
|
|
95
|
+
vdiskInfo.push({
|
|
96
|
+
label: vDiskInfoKeyset('write-throughput'),
|
|
97
|
+
value: bytesToSpeed(WriteThroughput),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
if (valueIsDefined(PDiskId) && valueIsDefined(NodeId) && valueIsDefined(VDiskSlotId)) {
|
|
101
|
+
const vDiskPagePath = getVDiskPagePath(VDiskSlotId, PDiskId, NodeId);
|
|
102
|
+
const vDiskInternalViewerPath = createVDiskDeveloperUILink({
|
|
103
|
+
nodeId: NodeId,
|
|
104
|
+
pDiskId: PDiskId,
|
|
105
|
+
vDiskSlotId: VDiskSlotId,
|
|
106
|
+
});
|
|
107
|
+
vdiskInfo.push({
|
|
108
|
+
label: vDiskInfoKeyset('links'),
|
|
109
|
+
value: (_jsxs("span", Object.assign({ className: b('links') }, { children: [!isVDiskPage && (_jsx(LinkWithIcon, { title: vDiskInfoKeyset('vdisk-page'), url: vDiskPagePath, external: false })), _jsx(LinkWithIcon, { title: vDiskInfoKeyset('developer-ui'), url: vDiskInternalViewerPath })] }))),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
return _jsx(InfoViewer, Object.assign({ info: vdiskInfo }, infoViewerProps));
|
|
113
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"slot-id": "VDisk Slot Id",
|
|
3
|
+
"pool-name": "Storage Pool Name",
|
|
4
|
+
"kind": "Kind",
|
|
5
|
+
"guid": "GUID",
|
|
6
|
+
"incarnation-guid": "Incarnation GUID",
|
|
7
|
+
"instance-guid": "Instance GUID",
|
|
8
|
+
"replication-status": "Replicated",
|
|
9
|
+
"state-status": "VDisk State",
|
|
10
|
+
"space-status": "Disk Space",
|
|
11
|
+
"fresh-rank-satisfaction": "Fresh Rank Satisfaction",
|
|
12
|
+
"level-rank-satisfaction": "Level Rank Satisfaction",
|
|
13
|
+
"front-queues": "Front Queues",
|
|
14
|
+
"has-unreadable-blobs": "Has Unreadable Blobs",
|
|
15
|
+
"size": "Size",
|
|
16
|
+
"read-throughput": "Read Throughput",
|
|
17
|
+
"write-throughput": "Write Throughput",
|
|
18
|
+
"links": "Links",
|
|
19
|
+
"vdisk-page": "VDisk Page",
|
|
20
|
+
"developer-ui": "Developer UI",
|
|
21
|
+
"yes": "Yes",
|
|
22
|
+
"no": "No"
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const vDiskInfoKeyset: (key: "size" | "kind" | "yes" | "no" | "links" | "guid" | "developer-ui" | "slot-id" | "pool-name" | "incarnation-guid" | "instance-guid" | "replication-status" | "state-status" | "space-status" | "fresh-rank-satisfaction" | "level-rank-satisfaction" | "front-queues" | "has-unreadable-blobs" | "read-throughput" | "write-throughput" | "vdisk-page", params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PopupProps } from '@gravity-ui/uikit';
|
|
2
|
-
import type { NodesMap } from '
|
|
3
|
-
import type { TVDiskStateInfo } from '
|
|
4
|
-
import type { UnavailableDonor } from '
|
|
2
|
+
import type { NodesMap } from '../../types/store/nodesList';
|
|
3
|
+
import type { TVDiskStateInfo } from '../../types/api/vdisk';
|
|
4
|
+
import type { UnavailableDonor } from '../../utils/disks/types';
|
|
5
5
|
import './VDiskPopup.scss';
|
|
6
6
|
interface VDiskPopupProps extends PopupProps {
|
|
7
7
|
data: TVDiskStateInfo | UnavailableDonor;
|
|
@@ -3,12 +3,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
import cn from 'bem-cn-lite';
|
|
5
5
|
import { Label, Popup } from '@gravity-ui/uikit';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { preparePDiskData } from '../PDiskPopup';
|
|
6
|
+
import { EFlag } from '../../types/api/enums';
|
|
7
|
+
import { stringifyVdiskId } from '../../utils/dataFormatters/dataFormatters';
|
|
8
|
+
import { bytesToGB, bytesToSpeed } from '../../utils/utils';
|
|
9
|
+
import { isFullVDiskData } from '../../utils/disks/helpers';
|
|
10
|
+
import { EMPTY_DATA_PLACEHOLDER } from '../../utils/constants';
|
|
11
|
+
import { preparePDiskData } from '../PDiskPopup/PDiskPopup';
|
|
12
|
+
import { InfoViewer } from '../InfoViewer';
|
|
12
13
|
import './VDiskPopup.scss';
|
|
13
14
|
const b = cn('vdisk-storage-popup');
|
|
14
15
|
const prepareUnavailableVDiskData = (data) => {
|
|
@@ -17,7 +18,7 @@ const prepareUnavailableVDiskData = (data) => {
|
|
|
17
18
|
if (StoragePoolName) {
|
|
18
19
|
vdiskData.push({ label: 'StoragePool', value: StoragePoolName });
|
|
19
20
|
}
|
|
20
|
-
vdiskData.push({ label: 'NodeId', value: NodeId !== null && NodeId !== void 0 ? NodeId :
|
|
21
|
+
vdiskData.push({ label: 'NodeId', value: NodeId !== null && NodeId !== void 0 ? NodeId : EMPTY_DATA_PLACEHOLDER }, { label: 'PDiskId', value: PDiskId !== null && PDiskId !== void 0 ? PDiskId : EMPTY_DATA_PLACEHOLDER }, { label: 'VSlotId', value: VSlotId !== null && VSlotId !== void 0 ? VSlotId : EMPTY_DATA_PLACEHOLDER });
|
|
21
22
|
return vdiskData;
|
|
22
23
|
};
|
|
23
24
|
const prepareVDiskData = (data) => {
|
|
@@ -2,6 +2,7 @@ import type { HandleTableColumnsResize } from '../../utils/hooks/useTableResize'
|
|
|
2
2
|
import type { Column, OnSort, SortOrderType } from './types';
|
|
3
3
|
interface TableHeadCellProps<T> {
|
|
4
4
|
column: Column<T>;
|
|
5
|
+
resizeable?: boolean;
|
|
5
6
|
sortOrder?: SortOrderType;
|
|
6
7
|
defaultSortOrder: SortOrderType;
|
|
7
8
|
onSort?: (columnName: string) => void;
|
|
@@ -9,7 +10,7 @@ interface TableHeadCellProps<T> {
|
|
|
9
10
|
onCellMount?: (element: Element) => void;
|
|
10
11
|
onCellUnMount?: (element: Element) => void;
|
|
11
12
|
}
|
|
12
|
-
export declare const TableHeadCell: <T>({ column, sortOrder, defaultSortOrder, onSort, rowHeight, onCellMount, onCellUnMount, }: TableHeadCellProps<T>) => JSX.Element;
|
|
13
|
+
export declare const TableHeadCell: <T>({ column, resizeable, sortOrder, defaultSortOrder, onSort, rowHeight, onCellMount, onCellUnMount, }: TableHeadCellProps<T>) => JSX.Element;
|
|
13
14
|
interface TableHeadProps<T> {
|
|
14
15
|
columns: Column<T>[];
|
|
15
16
|
onSort?: OnSort;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { ASCENDING, DEFAULT_SORT_ORDER, DEFAULT_TABLE_ROW_HEIGHT, DESCENDING } from './constants';
|
|
3
|
+
import { ASCENDING, DEFAULT_RESIZEABLE, DEFAULT_SORT_ORDER, DEFAULT_TABLE_ROW_HEIGHT, DESCENDING, } from './constants';
|
|
4
4
|
import { b } from './shared';
|
|
5
5
|
const COLUMN_NAME_HTML_ATTRIBUTE = 'data-columnname';
|
|
6
6
|
// Icon similar to original DataTable icons to keep the same tables across diferent pages and tabs
|
|
@@ -15,7 +15,7 @@ const ColumnSortIcon = ({ sortOrder, sortable, defaultSortOrder }) => {
|
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
export const TableHeadCell = ({ column, sortOrder, defaultSortOrder, onSort, rowHeight, onCellMount, onCellUnMount, }) => {
|
|
18
|
+
export const TableHeadCell = ({ column, resizeable, sortOrder, defaultSortOrder, onSort, rowHeight, onCellMount, onCellUnMount, }) => {
|
|
19
19
|
var _a;
|
|
20
20
|
const cellWrapperRef = useRef(null);
|
|
21
21
|
useEffect(() => {
|
|
@@ -30,9 +30,7 @@ export const TableHeadCell = ({ column, sortOrder, defaultSortOrder, onSort, row
|
|
|
30
30
|
};
|
|
31
31
|
}, [onCellMount, onCellUnMount]);
|
|
32
32
|
const content = (_a = column.header) !== null && _a !== void 0 ? _a : column.name;
|
|
33
|
-
return (_jsx("th", { children: _jsx("div", Object.assign({ ref: cellWrapperRef, className: b('head-cell-wrapper', {
|
|
34
|
-
resizeable: column.resizeable,
|
|
35
|
-
}), style: {
|
|
33
|
+
return (_jsx("th", { children: _jsx("div", Object.assign({ ref: cellWrapperRef, className: b('head-cell-wrapper', { resizeable }), style: {
|
|
36
34
|
height: `${rowHeight}px`,
|
|
37
35
|
width: `${column.width}px`,
|
|
38
36
|
} }, {
|
|
@@ -101,8 +99,10 @@ export const TableHead = ({ columns, onSort, onColumnsResize, defaultSortOrder =
|
|
|
101
99
|
};
|
|
102
100
|
const renderTableHead = () => {
|
|
103
101
|
return (_jsx("thead", Object.assign({ className: b('head') }, { children: _jsx("tr", { children: columns.map((column) => {
|
|
102
|
+
var _a;
|
|
104
103
|
const sortOrder = sortParams.columnId === column.name ? sortParams.sortOrder : undefined;
|
|
105
|
-
|
|
104
|
+
const resizeable = onColumnsResize && ((_a = column.resizeable) !== null && _a !== void 0 ? _a : DEFAULT_RESIZEABLE);
|
|
105
|
+
return (_jsx(TableHeadCell, { column: column, resizeable: resizeable, sortOrder: sortOrder, defaultSortOrder: defaultSortOrder, onSort: handleSort, rowHeight: rowHeight, onCellMount: handleCellMount, onCellUnMount: handleCellUnMount }, column.name));
|
|
106
106
|
}) }) })));
|
|
107
107
|
};
|
|
108
108
|
return (_jsxs(_Fragment, { children: [renderTableColGroups(), renderTableHead()] }));
|
|
@@ -2,6 +2,7 @@ export declare const LEFT = "left";
|
|
|
2
2
|
export declare const CENTER = "center";
|
|
3
3
|
export declare const RIGHT = "right";
|
|
4
4
|
export declare const DEFAULT_ALIGN = "left";
|
|
5
|
+
export declare const DEFAULT_RESIZEABLE = true;
|
|
5
6
|
export declare const ASCENDING = 1;
|
|
6
7
|
export declare const DESCENDING = -1;
|
|
7
8
|
export declare const DEFAULT_SORT_ORDER = -1;
|
|
@@ -2,6 +2,7 @@ export const LEFT = 'left';
|
|
|
2
2
|
export const CENTER = 'center';
|
|
3
3
|
export const RIGHT = 'right';
|
|
4
4
|
export const DEFAULT_ALIGN = LEFT;
|
|
5
|
+
export const DEFAULT_RESIZEABLE = true;
|
|
5
6
|
export const ASCENDING = 1;
|
|
6
7
|
export const DESCENDING = -1;
|
|
7
8
|
export const DEFAULT_SORT_ORDER = DESCENDING;
|