Skip to content

Commit 8334260

Browse files
refactor: apply prettier fixes
1 parent 0269dba commit 8334260

File tree

14 files changed

+89
-155
lines changed

14 files changed

+89
-155
lines changed

src/components/InfoViewer/formatters/schema.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ export const formatPQGroupItem = createInfoFormatter<TPersQueueGroupDescription>
3232
values: {
3333
Partitions: (value) => formatNumber(value?.length || 0),
3434
PQTabletConfig: (value) => {
35-
const hours = Math.round(value.PartitionConfig.LifetimeSeconds / HOUR_IN_SECONDS * 100) / 100;
35+
const hours =
36+
Math.round((value.PartitionConfig.LifetimeSeconds / HOUR_IN_SECONDS) * 100) / 100;
3637
return `${formatNumber(hours)} hours`;
3738
},
3839
},

src/components/InfoViewer/schemaInfo/CDCStreamInfo.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,15 @@ import type {TEvDescribeSchemeResult, TCdcStreamDescription} from '../../../type
33
import {formatCdcStreamItem, formatCommonItem} from '../formatters';
44
import {InfoViewer, InfoViewerItem} from '..';
55

6-
const DISPLAYED_FIELDS: Set<keyof TCdcStreamDescription> = new Set([
7-
'Mode',
8-
'Format',
9-
]);
6+
const DISPLAYED_FIELDS: Set<keyof TCdcStreamDescription> = new Set(['Mode', 'Format']);
107

118
interface CDCStreamInfoProps {
129
data?: TEvDescribeSchemeResult;
1310
}
1411

1512
export const CDCStreamInfo = ({data}: CDCStreamInfoProps) => {
1613
if (!data) {
17-
return (
18-
<div className="error">No CDC Stream data</div>
19-
);
14+
return <div className="error">No CDC Stream data</div>;
2015
}
2116

2217
const TableIndex = data.PathDescription?.CdcStreamDescription;
@@ -32,13 +27,5 @@ export const CDCStreamInfo = ({data}: CDCStreamInfoProps) => {
3227
}
3328
}
3429

35-
return (
36-
<>
37-
{info.length ? (
38-
<InfoViewer info={info}></InfoViewer>
39-
) : (
40-
<>Empty</>
41-
)}
42-
</>
43-
);
30+
return <>{info.length ? <InfoViewer info={info}></InfoViewer> : <>Empty</>}</>;
4431
};

src/components/InfoViewer/schemaInfo/PersQueueGroupInfo.tsx

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ interface PersQueueGrouopInfoProps {
99

1010
export const PersQueueGroupInfo = ({data}: PersQueueGrouopInfoProps) => {
1111
if (!data) {
12-
return (
13-
<div className="error">No PersQueueGroup data</div>
14-
);
12+
return <div className="error">No PersQueueGroup data</div>;
1513
}
1614

1715
const pqGroup = data.PathDescription?.PersQueueGroup;
@@ -20,15 +18,12 @@ export const PersQueueGroupInfo = ({data}: PersQueueGrouopInfoProps) => {
2018
info.push(formatCommonItem('PathType', data.PathDescription?.Self?.PathType));
2119

2220
info.push(formatPQGroupItem('Partitions', pqGroup?.Partitions || []));
23-
info.push(formatPQGroupItem('PQTabletConfig', pqGroup?.PQTabletConfig || {PartitionConfig: {LifetimeSeconds: 0}}));
24-
25-
return (
26-
<>
27-
{info.length ? (
28-
<InfoViewer info={info}></InfoViewer>
29-
) : (
30-
<>Empty</>
31-
)}
32-
</>
21+
info.push(
22+
formatPQGroupItem(
23+
'PQTabletConfig',
24+
pqGroup?.PQTabletConfig || {PartitionConfig: {LifetimeSeconds: 0}},
25+
),
3326
);
27+
28+
return <>{info.length ? <InfoViewer info={info}></InfoViewer> : <>Empty</>}</>;
3429
};

src/components/InfoViewer/schemaInfo/TableIndexInfo.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ interface TableIndexInfoProps {
1717

1818
export const TableIndexInfo = ({data}: TableIndexInfoProps) => {
1919
if (!data) {
20-
return (
21-
<div className="error">no index data</div>
22-
);
20+
return <div className="error">no index data</div>;
2321
}
2422

2523
const TableIndex = data.PathDescription?.TableIndex;
@@ -32,13 +30,5 @@ export const TableIndexInfo = ({data}: TableIndexInfoProps) => {
3230
}
3331
}
3432

35-
return (
36-
<>
37-
{info.length ? (
38-
<InfoViewer info={info}></InfoViewer>
39-
) : (
40-
<>Empty</>
41-
)}
42-
</>
43-
);
33+
return <>{info.length ? <InfoViewer info={info}></InfoViewer> : <>Empty</>}</>;
4434
};

src/components/InfoViewer/schemaOverview/CDCStreamOverview.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,15 @@ import type {TEvDescribeSchemeResult, TCdcStreamDescription} from '../../../type
33
import {InfoViewer, InfoViewerItem} from '..';
44
import {formatCdcStreamItem, formatCommonItem} from '../formatters';
55

6-
const DISPLAYED_FIELDS: Set<keyof TCdcStreamDescription> = new Set([
7-
'Mode',
8-
'Format',
9-
]);
6+
const DISPLAYED_FIELDS: Set<keyof TCdcStreamDescription> = new Set(['Mode', 'Format']);
107

118
interface CDCStreamOverviewProps {
129
data?: TEvDescribeSchemeResult;
1310
}
1411

1512
export const CDCStreamOverview = ({data}: CDCStreamOverviewProps) => {
1613
if (!data) {
17-
return (
18-
<div className="error">No CDC Stream data</div>
19-
);
14+
return <div className="error">No CDC Stream data</div>;
2015
}
2116

2217
const TableIndex = data.PathDescription?.CdcStreamDescription;
@@ -32,13 +27,5 @@ export const CDCStreamOverview = ({data}: CDCStreamOverviewProps) => {
3227
}
3328
}
3429

35-
return (
36-
<>
37-
{info.length ? (
38-
<InfoViewer info={info}></InfoViewer>
39-
) : (
40-
<>Empty</>
41-
)}
42-
</>
43-
);
30+
return <>{info.length ? <InfoViewer info={info}></InfoViewer> : <>Empty</>}</>;
4431
};

src/components/InfoViewer/schemaOverview/PersQueueGroupOverview.tsx

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ interface PersQueueGroupOverviewProps {
99

1010
export const PersQueueGroupOverview = ({data}: PersQueueGroupOverviewProps) => {
1111
if (!data) {
12-
return (
13-
<div className="error">No PersQueueGroup data</div>
14-
);
12+
return <div className="error">No PersQueueGroup data</div>;
1513
}
1614

1715
const pqGroup = data.PathDescription?.PersQueueGroup;
@@ -21,15 +19,12 @@ export const PersQueueGroupOverview = ({data}: PersQueueGroupOverviewProps) => {
2119
info.push(formatCommonItem('CreateStep', data.PathDescription?.Self?.CreateStep));
2220

2321
info.push(formatPQGroupItem('Partitions', pqGroup?.Partitions || []));
24-
info.push(formatPQGroupItem('PQTabletConfig', pqGroup?.PQTabletConfig || {PartitionConfig: {LifetimeSeconds: 0}}));
25-
26-
return (
27-
<>
28-
{info.length ? (
29-
<InfoViewer info={info}></InfoViewer>
30-
) : (
31-
<>Empty</>
32-
)}
33-
</>
22+
info.push(
23+
formatPQGroupItem(
24+
'PQTabletConfig',
25+
pqGroup?.PQTabletConfig || {PartitionConfig: {LifetimeSeconds: 0}},
26+
),
3427
);
28+
29+
return <>{info.length ? <InfoViewer info={info}></InfoViewer> : <>Empty</>}</>;
3530
};

src/components/InfoViewer/utils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import type {ReactNode} from "react";
1+
import type {ReactNode} from 'react';
22

33
type LabelMap<T> = {
44
[label in keyof T]?: string;
5-
}
5+
};
66

77
type ValueFormatters<T> = {
88
[label in keyof T]?: (value: T[label]) => ReactNode;
9-
}
9+
};
1010

1111
function formatLabel<Shape>(label: keyof Shape, map: LabelMap<Shape>) {
1212
return map[label] ?? label;
@@ -25,9 +25,9 @@ function formatValue<Shape, Key extends keyof Shape>(
2525
}
2626

2727
interface CreateInfoFormatterOptions<Shape> {
28-
values?: ValueFormatters<Shape>,
29-
labels?: LabelMap<Shape>,
30-
defaultValueFormatter?: (value: Shape[keyof Shape]) => ReactNode,
28+
values?: ValueFormatters<Shape>;
29+
labels?: LabelMap<Shape>;
30+
defaultValueFormatter?: (value: Shape[keyof Shape]) => ReactNode;
3131
}
3232

3333
export function createInfoFormatter<Shape extends Record<string, any>>({

src/containers/Tenant/Acl/Acl.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,7 @@ class Acl extends React.Component {
8383
return null;
8484
}
8585

86-
return (
87-
<DataTable
88-
columns={this.COLUMNS}
89-
data={acl}
90-
settings={TABLE_SETTINGS}
91-
/>
92-
);
86+
return <DataTable columns={this.COLUMNS} data={acl} settings={TABLE_SETTINGS} />;
9387
};
9488

9589
renderOwner = () => {

src/containers/Tenant/Diagnostics/TopShards/TopShards.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,23 @@ function prepareDateSizeValue(value) {
4747
}
4848

4949
function stringToDataTableSortOrder(value) {
50-
return value && value.split(',').map((columnId) => ({
51-
columnId,
52-
order: DataTable.DESCENDING,
53-
}));
50+
return (
51+
value &&
52+
value.split(',').map((columnId) => ({
53+
columnId,
54+
order: DataTable.DESCENDING,
55+
}))
56+
);
5457
}
5558

5659
function stringToQuerySortOrder(value) {
57-
return value && value.split(',').map((columnId) => ({
58-
columnId,
59-
order: 'DESC',
60-
}));
60+
return (
61+
value &&
62+
value.split(',').map((columnId) => ({
63+
columnId,
64+
order: 'DESC',
65+
}))
66+
);
6167
}
6268

6369
function dataTableToStringSortOrder(value = []) {
@@ -85,11 +91,13 @@ function TopShards({
8591

8692
if (autorefresh) {
8793
autofetcher.start();
88-
autofetcher.fetch(() => sendShardQuery({
89-
database: path,
90-
path: currentSchemaPath,
91-
sortOrder: stringToQuerySortOrder(sortOrder),
92-
}));
94+
autofetcher.fetch(() =>
95+
sendShardQuery({
96+
database: path,
97+
path: currentSchemaPath,
98+
sortOrder: stringToQuerySortOrder(sortOrder),
99+
}),
100+
);
93101
}
94102

95103
return () => {

src/containers/Tenant/ObjectGeneral/ObjectGeneral.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,7 @@ function ObjectGeneral(props: ObjectGeneralProps) {
5454
if (!tenantName) {
5555
return null;
5656
}
57-
return (
58-
<div className={b()}>
59-
{renderTabContent()}
60-
</div>
61-
);
57+
return <div className={b()}>{renderTabContent()}</div>;
6258
};
6359

6460
return renderContent();

0 commit comments

Comments
 (0)