ydb-embedded-ui 1.12.0 → 1.12.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.12.1](https://github.com/ydb-platform/ydb-embedded-ui/compare/v1.12.0...v1.12.1) (2022-08-26)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **Storage:** properly display usage for 0 storage ([aee67f9](https://github.com/ydb-platform/ydb-embedded-ui/commit/aee67f9314341c995e2c9468f5eedc48fa0a3d35))
9
+
3
10
  ## [1.12.0](https://github.com/ydb-platform/ydb-embedded-ui/compare/v1.11.1...v1.12.0) (2022-08-26)
4
11
 
5
12
 
@@ -126,16 +126,19 @@ function StorageGroups({data, tableSettings, visibleEntities, nodes}: StorageGro
126
126
  width: 100,
127
127
  render: ({row}) => {
128
128
  const usage = getUsage(row, 5);
129
- return (
129
+ // without a limit the usage can be evaluated as 0,
130
+ // but the absence of a value is more clear
131
+ return row.Limit ? (
130
132
  <Label
131
133
  theme={getUsageSeverity(usage)}
132
134
  className={b('usage-label', {overload: usage >= 100})}
133
135
  >
134
136
  ≥ {usage}%
135
137
  </Label>
136
- );
138
+ ) : '-';
137
139
  },
138
- sortAccessor: getUsage,
140
+ // without a limit exclude usage from sort to display at the bottom
141
+ sortAccessor: (row) => row.Limit ? getUsage(row) : null,
139
142
  align: DataTable.LEFT,
140
143
  },
141
144
  {
@@ -44,7 +44,8 @@ export const getDegradedSeverity = (group: IStoragePoolGroup) => {
44
44
  export const getUsageSeverity = generateEvaluator(80, 85);
45
45
 
46
46
  export const getUsage = (data: IStoragePoolGroup, step = 1) => {
47
- const usage = Math.round((data.Used * 100) / data.Limit);
47
+ // if limit is 0, display 0
48
+ const usage = Math.round((data.Used * 100) / data.Limit) || 0;
48
49
 
49
50
  return Math.floor(usage / step) * step;
50
51
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "1.12.0",
3
+ "version": "1.12.1",
4
4
  "files": [
5
5
  "dist"
6
6
  ],