ydb-embedded-ui 1.2.6 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.3.0](https://www.github.com/ydb-platform/ydb-embedded-ui/compare/v1.2.6...v1.3.0) (2022-05-12)
4
+
5
+
6
+ ### Features
7
+
8
+ * **Storage:** red progress bars for unavailable disks ([17cf94d](https://www.github.com/ydb-platform/ydb-embedded-ui/commit/17cf94defb23681bc62c768d3282eed00c7e974d))
9
+
3
10
  ### [1.2.6](https://www.github.com/ydb-platform/ydb-embedded-ui/compare/v1.2.5...v1.2.6) (2022-05-05)
4
11
 
5
12
 
@@ -13,6 +13,8 @@ import DiskStateProgressBar, {
13
13
  } from '../DiskStateProgressBar/DiskStateProgressBar';
14
14
  import {STRUCTURE} from '../../Node/NodePages';
15
15
 
16
+ import {colorSeverity, NOT_AVAILABLE_SEVERITY} from '../utils';
17
+
16
18
  import './Pdisk.scss';
17
19
 
18
20
  const b = cn('pdisk-storage');
@@ -34,14 +36,6 @@ const stateSeverity = {
34
36
  DeviceIoError: 5,
35
37
  };
36
38
 
37
- const colorSeverity = {
38
- Grey: 0,
39
- Green: 1,
40
- Blue: 2,
41
- Yellow: 3,
42
- Orange: 4,
43
- Red: 5,
44
- };
45
39
  type PDiskState = keyof typeof stateSeverity;
46
40
 
47
41
  interface PDiskProps {
@@ -57,7 +51,7 @@ interface PDiskProps {
57
51
  }
58
52
 
59
53
  const getStateSeverity = (pDiskState?: PDiskState) => {
60
- return pDiskState ? stateSeverity[pDiskState] : colorSeverity.Grey;
54
+ return pDiskState ? stateSeverity[pDiskState] : NOT_AVAILABLE_SEVERITY;
61
55
  };
62
56
 
63
57
  function Pdisk(props: PDiskProps) {
@@ -12,6 +12,8 @@ import DiskStateProgressBar, {
12
12
  } from '../DiskStateProgressBar/DiskStateProgressBar';
13
13
  import {STRUCTURE} from '../../Node/NodePages';
14
14
 
15
+ import {colorSeverity, NOT_AVAILABLE_SEVERITY} from '../utils';
16
+
15
17
  import './Vdisk.scss';
16
18
 
17
19
  const b = cn('vdisk-storage');
@@ -34,17 +36,8 @@ const stateSeverity = {
34
36
  OK: 1,
35
37
  };
36
38
 
37
- const colorSeverity = {
38
- Grey: 0,
39
- Green: 1,
40
- Blue: 2,
41
- Yellow: 3,
42
- Orange: 4,
43
- Red: 5,
44
- };
45
-
46
39
  const getStateSeverity = (vDiskState) => {
47
- return stateSeverity[vDiskState] ?? colorSeverity.Grey;
40
+ return stateSeverity[vDiskState] ?? NOT_AVAILABLE_SEVERITY;
48
41
  };
49
42
 
50
43
  const getColorSeverity = (color) => {
@@ -57,15 +50,25 @@ function Vdisk(props) {
57
50
 
58
51
  const anchor = useRef();
59
52
 
53
+ // determine disk status severity
60
54
  useEffect(() => {
61
55
  const {DiskSpace, VDiskState, FrontQueues, Replicated} = props;
56
+
57
+ // if the disk is not available, this determines its status severity regardless of other features
58
+ if (!VDiskState) {
59
+ setSeverity(NOT_AVAILABLE_SEVERITY);
60
+ return;
61
+ }
62
+
62
63
  const DiskSpaceSeverity = getColorSeverity(DiskSpace);
63
64
  const VDiskSpaceSeverity = getStateSeverity(VDiskState);
64
65
  const FrontQueuesSeverity = Math.min(colorSeverity.Orange, getColorSeverity(FrontQueues));
66
+
65
67
  let newSeverity = Math.max(DiskSpaceSeverity, VDiskSpaceSeverity, FrontQueuesSeverity);
66
68
  if (!Replicated && newSeverity === colorSeverity.Green) {
67
69
  newSeverity = colorSeverity.Blue;
68
70
  }
71
+
69
72
  setSeverity(newSeverity);
70
73
  }, [props.VDiskState, props.DiskSpace, props.FrontQueues, props.Replicated]);
71
74
 
@@ -0,0 +1,10 @@
1
+ export const colorSeverity = {
2
+ Grey: 0,
3
+ Green: 1,
4
+ Blue: 2,
5
+ Yellow: 3,
6
+ Orange: 4,
7
+ Red: 5,
8
+ };
9
+
10
+ export const NOT_AVAILABLE_SEVERITY = colorSeverity.Red;
@@ -0,0 +1 @@
1
+ export * from './constants';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "1.2.6",
3
+ "version": "1.3.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],