ydb-embedded-ui 4.19.1 → 4.19.3

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.19.3](https://github.com/ydb-platform/ydb-embedded-ui/compare/v4.19.2...v4.19.3) (2023-10-13)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * fix ProgressViewer background ([#556](https://github.com/ydb-platform/ydb-embedded-ui/issues/556)) ([6234462](https://github.com/ydb-platform/ydb-embedded-ui/commit/62344629713059fdfb191d3b8a57742f864dad66))
9
+ * **Storage:** display all groups by default ([#554](https://github.com/ydb-platform/ydb-embedded-ui/issues/554)) ([1da83f1](https://github.com/ydb-platform/ydb-embedded-ui/commit/1da83f19661ed8e49dd7c8a0930ce89a7c8c0185))
10
+
11
+ ## [4.19.2](https://github.com/ydb-platform/ydb-embedded-ui/compare/v4.19.1...v4.19.2) (2023-10-12)
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * add default data formatter to ProgressViewer ([#552](https://github.com/ydb-platform/ydb-embedded-ui/issues/552)) ([ac372a4](https://github.com/ydb-platform/ydb-embedded-ui/commit/ac372a415e67e7126518d9c5a8d04594b82cf485))
17
+ * **Tenant:** fix tree not fully collapsed bug ([#551](https://github.com/ydb-platform/ydb-embedded-ui/issues/551)) ([8469307](https://github.com/ydb-platform/ydb-embedded-ui/commit/8469307b67d463ed2aafd17b2c0319ea40c1f8d5))
18
+
3
19
  ## [4.19.1](https://github.com/ydb-platform/ydb-embedded-ui/compare/v4.19.0...v4.19.1) (2023-10-11)
4
20
 
5
21
 
@@ -1,6 +1,8 @@
1
1
  import cn from 'bem-cn-lite';
2
2
 
3
3
  import type {ValueOf} from '../../types/common';
4
+ import {isNumeric} from '../../utils/utils';
5
+ import {formatNumber, roundToPrecision} from '../../utils/dataFormatters/dataFormatters';
4
6
 
5
7
  import './ProgressViewer.scss';
6
8
 
@@ -18,6 +20,14 @@ export const PROGRESS_VIEWER_SIZE_IDS = {
18
20
 
19
21
  type ProgressViewerSize = ValueOf<typeof PROGRESS_VIEWER_SIZE_IDS>;
20
22
 
23
+ const formatValue = (value?: number) => {
24
+ return formatNumber(roundToPrecision(Number(value), 2));
25
+ };
26
+
27
+ const defaultFormatValues = (value?: number, total?: number) => {
28
+ return [formatValue(value), formatValue(total)];
29
+ };
30
+
21
31
  /*
22
32
 
23
33
  Props description:
@@ -47,7 +57,7 @@ interface ProgressViewerProps {
47
57
  export function ProgressViewer({
48
58
  value,
49
59
  capacity,
50
- formatValues,
60
+ formatValues = defaultFormatValues,
51
61
  percents,
52
62
  className,
53
63
  size = PROGRESS_VIEWER_SIZE_IDS.xs,
@@ -56,17 +66,18 @@ export function ProgressViewer({
56
66
  warningThreshold = 60,
57
67
  dangerThreshold = 80,
58
68
  }: ProgressViewerProps) {
59
- let fillWidth = Math.round((parseFloat(String(value)) / parseFloat(String(capacity))) * 100);
69
+ let fillWidth =
70
+ Math.round((parseFloat(String(value)) / parseFloat(String(capacity))) * 100) || 0;
60
71
  fillWidth = fillWidth > 100 ? 100 : fillWidth;
61
- let valueText: number | string | undefined = Math.round(Number(value)),
72
+ let valueText: number | string | undefined = value,
62
73
  capacityText: number | string | undefined = capacity,
63
74
  divider = '/';
64
- if (formatValues) {
65
- [valueText, capacityText] = formatValues(Number(value), Number(capacity));
66
- } else if (percents) {
75
+ if (percents) {
67
76
  valueText = fillWidth + '%';
68
77
  capacityText = '';
69
78
  divider = '';
79
+ } else if (formatValues) {
80
+ [valueText, capacityText] = formatValues(Number(value), Number(capacity));
70
81
  }
71
82
 
72
83
  let bg = inverseColorize ? 'scarlet' : 'apple';
@@ -85,14 +96,14 @@ export function ProgressViewer({
85
96
  const text = fillWidth > 60 ? 'contrast0' : 'contrast70';
86
97
 
87
98
  const renderContent = () => {
88
- if (capacityText) {
99
+ if (isNumeric(capacity)) {
89
100
  return `${valueText} ${divider} ${capacityText}`;
90
101
  }
91
102
 
92
103
  return valueText;
93
104
  };
94
105
 
95
- if (!isNaN(Number(value))) {
106
+ if (isNumeric(value)) {
96
107
  return (
97
108
  <div className={b({size}, className)}>
98
109
  <div className={b('line', {bg})} style={lineStyle}></div>
@@ -58,14 +58,14 @@ import './ObjectSummary.scss';
58
58
 
59
59
  const b = cn('object-summary');
60
60
 
61
- const getInitialIsSummaryCollapsed = () => {
62
- return Boolean(localStorage.getItem(DEFAULT_IS_TENANT_COMMON_INFO_COLLAPSED));
63
- };
61
+ const getTenantCommonInfoState = () => {
62
+ const collapsed = Boolean(localStorage.getItem(DEFAULT_IS_TENANT_COMMON_INFO_COLLAPSED));
64
63
 
65
- const initialTenantCommonInfoState = {
66
- triggerExpand: false,
67
- triggerCollapse: false,
68
- collapsed: getInitialIsSummaryCollapsed(),
64
+ return {
65
+ triggerExpand: false,
66
+ triggerCollapse: false,
67
+ collapsed,
68
+ };
69
69
  };
70
70
 
71
71
  function prepareOlapTableSchema(tableSchema: TColumnTableDescription = {}) {
@@ -109,7 +109,8 @@ export function ObjectSummary({
109
109
  const dispatch = useDispatch();
110
110
  const [commonInfoVisibilityState, dispatchCommonInfoVisibilityState] = useReducer(
111
111
  paneVisibilityToggleReducerCreator(DEFAULT_IS_TENANT_COMMON_INFO_COLLAPSED),
112
- initialTenantCommonInfoState,
112
+ undefined,
113
+ getTenantCommonInfoState,
113
114
  );
114
115
  const {
115
116
  data,
@@ -27,14 +27,14 @@ import './Tenant.scss';
27
27
 
28
28
  const b = cn('tenant-page');
29
29
 
30
- const getInitialIsSummaryCollapsed = () => {
31
- return Boolean(localStorage.getItem(DEFAULT_IS_TENANT_SUMMARY_COLLAPSED));
32
- };
30
+ const getTenantSummaryState = () => {
31
+ const collapsed = Boolean(localStorage.getItem(DEFAULT_IS_TENANT_SUMMARY_COLLAPSED));
33
32
 
34
- const initialTenantSummaryState = {
35
- triggerExpand: false,
36
- triggerCollapse: false,
37
- collapsed: getInitialIsSummaryCollapsed(),
33
+ return {
34
+ triggerExpand: false,
35
+ triggerCollapse: false,
36
+ collapsed,
37
+ };
38
38
  };
39
39
 
40
40
  interface TenantProps {
@@ -45,7 +45,8 @@ interface TenantProps {
45
45
  function Tenant(props: TenantProps) {
46
46
  const [summaryVisibilityState, dispatchSummaryVisibilityAction] = useReducer(
47
47
  paneVisibilityToggleReducerCreator(DEFAULT_IS_TENANT_SUMMARY_COLLAPSED),
48
- initialTenantSummaryState,
48
+ undefined,
49
+ getTenantSummaryState,
49
50
  );
50
51
 
51
52
  const {currentSchemaPath, currentSchema: currentItem = {}} = useSelector(
@@ -36,7 +36,7 @@ const initialState = {
36
36
  wasLoaded: false,
37
37
  filter: '',
38
38
  usageFilter: [],
39
- visible: VISIBLE_ENTITIES.missing,
39
+ visible: VISIBLE_ENTITIES.all,
40
40
  nodesUptimeFilter: NodesUptimeFilterValues.All,
41
41
  type: STORAGE_TYPES.groups,
42
42
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "4.19.1",
3
+ "version": "4.19.3",
4
4
  "files": [
5
5
  "dist"
6
6
  ],