foreman_resource_quota 0.6.4 → 0.6.5
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.
- checksums.yaml +4 -4
- data/lib/foreman_resource_quota/version.rb +1 -1
- data/webpack/components/ResourceQuotaEmptyState/__test__/__snapshots__/ResourceQuotaEmptyState.test.js.snap +1 -0
- data/webpack/components/ResourceQuotaForm/components/Resource/UtilizationProgress.js +11 -5
- data/webpack/global_test_setup.js +3 -1
- data/webpack/lib/react-testing-lib-wrapper.js +0 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0fc7d72bb33cb797328a1656add6ef5861b91c7ad4273da69a1faf53cfe3005c
|
|
4
|
+
data.tar.gz: ed425c2df6ba263e4314bb6ccef97812102d0703ab41c08d4aaebfc382df4bf4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 99e464800af7f2e48219666453d1c7958d7826478c60ef09753764af87e034374fd651c07d22d0c23b6a3b770bb84e8589684050a41b6f3ab9d1214378762213
|
|
7
|
+
data.tar.gz: c60c8b5231acb3ec2d9a2dcc41c46884c30ebe82b200212bcace9cd706419975c5b0206bddca6ee750e91ec8afdabb09cf18754a3e6136d22e76a9d72723d61a
|
|
@@ -14,6 +14,10 @@ import { translate as __ } from 'foremanReact/common/I18n';
|
|
|
14
14
|
import './UtilizationProgress.scss';
|
|
15
15
|
import { findLargestFittingUnit } from '../../../../helper';
|
|
16
16
|
|
|
17
|
+
const UTILIZATION_DANGER_THRESHOLD = 80;
|
|
18
|
+
const UTILIZATION_MAX_VALUE = 100;
|
|
19
|
+
const UTILIZATION_MIN_VALUE = 0;
|
|
20
|
+
|
|
17
21
|
const UtilizationProgress = ({
|
|
18
22
|
cardId,
|
|
19
23
|
resourceValue,
|
|
@@ -33,8 +37,9 @@ const UtilizationProgress = ({
|
|
|
33
37
|
|
|
34
38
|
/* resource utilization bar */
|
|
35
39
|
const resourceProgressVariant = () => {
|
|
36
|
-
if (resourceUtilizationPercent <
|
|
37
|
-
else if (resourceUtilizationPercent <
|
|
40
|
+
if (resourceUtilizationPercent < UTILIZATION_DANGER_THRESHOLD) return null;
|
|
41
|
+
else if (resourceUtilizationPercent < UTILIZATION_MAX_VALUE)
|
|
42
|
+
return ProgressVariant.warning;
|
|
38
43
|
return ProgressVariant.danger;
|
|
39
44
|
};
|
|
40
45
|
|
|
@@ -50,7 +55,7 @@ const UtilizationProgress = ({
|
|
|
50
55
|
</div>
|
|
51
56
|
);
|
|
52
57
|
} else if (resourceUtilization == null) {
|
|
53
|
-
newPercent =
|
|
58
|
+
newPercent = UTILIZATION_MIN_VALUE;
|
|
54
59
|
newTooltipText = (
|
|
55
60
|
<div>
|
|
56
61
|
<div>{__('No consumption to display.')}</div>
|
|
@@ -68,7 +73,7 @@ const UtilizationProgress = ({
|
|
|
68
73
|
);
|
|
69
74
|
const utilizationInUnit = resourceUtilization / utilizationUnit.factor;
|
|
70
75
|
const valueInUnit = resourceValue / valueUnit.factor;
|
|
71
|
-
newPercent =
|
|
76
|
+
newPercent = UTILIZATION_MAX_VALUE;
|
|
72
77
|
newTooltipText = (
|
|
73
78
|
<div>
|
|
74
79
|
{`${utilizationInUnit} ${utilizationUnit.symbol} / ${valueInUnit} ${valueUnit.symbol}`}
|
|
@@ -82,7 +87,8 @@ const UtilizationProgress = ({
|
|
|
82
87
|
);
|
|
83
88
|
const utilizationInUnit = resourceUtilization / utilizationUnit.factor;
|
|
84
89
|
const valueInUnit = resourceValue / valueUnit.factor;
|
|
85
|
-
const percent =
|
|
90
|
+
const percent =
|
|
91
|
+
(UTILIZATION_MAX_VALUE * resourceUtilization) / resourceValue;
|
|
86
92
|
if (Number.isFinite(percent)) newPercent = percent;
|
|
87
93
|
else newPercent = 0;
|
|
88
94
|
newTooltipText = (
|
|
@@ -7,7 +7,6 @@ import thunk from 'redux-thunk';
|
|
|
7
7
|
import Immutable from 'seamless-immutable';
|
|
8
8
|
import { APIMiddleware, reducers as apiReducer } from 'foremanReact/redux/API';
|
|
9
9
|
import { reducers as fillReducers } from 'foremanReact/components/common/Fill';
|
|
10
|
-
import { reducers as foremanModalReducer } from 'foremanReact/components/ForemanModal';
|
|
11
10
|
import { STATUS } from 'foremanReact/constants';
|
|
12
11
|
import {
|
|
13
12
|
render,
|
|
@@ -36,7 +35,6 @@ function renderWithRedux(
|
|
|
36
35
|
// Adding the reducer in the expected namespaced format
|
|
37
36
|
const combinedReducers = combineReducers({
|
|
38
37
|
...apiReducer,
|
|
39
|
-
...foremanModalReducer,
|
|
40
38
|
...fillReducers,
|
|
41
39
|
});
|
|
42
40
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foreman_resource_quota
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ATIX AG
|
|
@@ -321,7 +321,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
321
321
|
- !ruby/object:Gem::Version
|
|
322
322
|
version: '0'
|
|
323
323
|
requirements: []
|
|
324
|
-
rubygems_version: 4.0.
|
|
324
|
+
rubygems_version: 4.0.16
|
|
325
325
|
specification_version: 4
|
|
326
326
|
summary: Foreman plugin for resource quota
|
|
327
327
|
test_files: []
|