foreman_resource_quota 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/foreman_resource_quota/version.rb +1 -1
- data/package.json +7 -8
- data/webpack/components/ResourceQuotaForm/components/Properties/index.js +6 -4
- data/webpack/components/ResourceQuotaForm/components/Resource/UtilizationProgress.js +12 -13
- data/webpack/helper.js +1 -13
- 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: acb27059a0b8ca259bce3aeb9c43044fc50f2766d6a9619e5dae66ff2cc4766b
|
4
|
+
data.tar.gz: d50841a42fbc287725a5612b1e7004187c331a8ca82c74ead75511b64dae8c5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b6dcae25dba0d534f807184573b54df1faebc010f23bde6134cd8a428f34c12c6103f528667ccbfbb42289eadc9a57c965e04927bed929339bc06f95dc431b8
|
7
|
+
data.tar.gz: 03b6d8bb2153880689169d7c73ca36fca03772734a7f086aaed0dd66ae48f9c8d92da53d971fd33bd081b2368f2df3d51f18bb39ca8c3b929bcaed14fdc86301
|
data/package.json
CHANGED
@@ -21,19 +21,18 @@
|
|
21
21
|
"url": "http://projects.theforeman.org/projects/foreman_resource_quota/issues"
|
22
22
|
},
|
23
23
|
"peerDependencies": {
|
24
|
-
"@theforeman/vendor": ">=
|
24
|
+
"@theforeman/vendor": ">= 12.0.1"
|
25
25
|
},
|
26
26
|
"dependencies": {},
|
27
27
|
"devDependencies": {
|
28
|
-
"@babel/core": "^7.
|
28
|
+
"@babel/core": "^7.7.0",
|
29
29
|
"@sheerun/mutationobserver-shim": "^0.3.3",
|
30
30
|
"@testing-library/react": "^10.4.9",
|
31
|
-
"@theforeman/builder": "
|
32
|
-
"@theforeman/eslint-plugin-foreman": "
|
33
|
-
"@theforeman/find-foreman": "
|
34
|
-
"@theforeman/
|
35
|
-
"@theforeman/
|
36
|
-
"@theforeman/vendor-dev": "^13.0.0",
|
31
|
+
"@theforeman/builder": ">=12.0.1",
|
32
|
+
"@theforeman/eslint-plugin-foreman": ">=12.0.1",
|
33
|
+
"@theforeman/find-foreman": ">=12.0.1",
|
34
|
+
"@theforeman/test": ">=12.0.1",
|
35
|
+
"@theforeman/vendor-dev": ">=12.0.1",
|
37
36
|
"babel-eslint": "^10.0.3",
|
38
37
|
"eslint": "^6.7.2",
|
39
38
|
"prettier": "^1.19.1",
|
@@ -16,10 +16,12 @@ import {
|
|
16
16
|
Tooltip,
|
17
17
|
} from '@patternfly/react-core';
|
18
18
|
|
19
|
-
import
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
import {
|
20
|
+
UserIcon,
|
21
|
+
UsersIcon,
|
22
|
+
ClusterIcon,
|
23
|
+
SyncAltIcon,
|
24
|
+
} from '@patternfly/react-icons';
|
23
25
|
|
24
26
|
import { translate as __ } from 'foremanReact/common/I18n';
|
25
27
|
import { dispatchAPICallbackToast } from '../../../../api_helper';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useState } from 'react';
|
1
|
+
import React, { useState, useEffect, useCallback } from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import {
|
4
4
|
Progress,
|
@@ -7,15 +7,12 @@ import {
|
|
7
7
|
ProgressMeasureLocation,
|
8
8
|
Tooltip,
|
9
9
|
} from '@patternfly/react-core';
|
10
|
-
import SyncAltIcon from '@patternfly/react-icons
|
10
|
+
import SyncAltIcon from '@patternfly/react-icons';
|
11
11
|
|
12
12
|
import { translate as __ } from 'foremanReact/common/I18n';
|
13
13
|
|
14
14
|
import './UtilizationProgress.scss';
|
15
|
-
import {
|
16
|
-
findLargestFittingUnit,
|
17
|
-
areReactElementsEqual,
|
18
|
-
} from '../../../../helper';
|
15
|
+
import { findLargestFittingUnit } from '../../../../helper';
|
19
16
|
|
20
17
|
const UtilizationProgress = ({
|
21
18
|
cardId,
|
@@ -40,7 +37,8 @@ const UtilizationProgress = ({
|
|
40
37
|
else if (resourceUtilizationPercent < 100) return ProgressVariant.warning;
|
41
38
|
return ProgressVariant.danger;
|
42
39
|
};
|
43
|
-
|
40
|
+
|
41
|
+
const updateResourceUtilizationView = useCallback(() => {
|
44
42
|
let newPercent;
|
45
43
|
let newTooltipText;
|
46
44
|
|
@@ -93,13 +91,14 @@ const UtilizationProgress = ({
|
|
93
91
|
</div>
|
94
92
|
);
|
95
93
|
}
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
};
|
94
|
+
setResourceUtilizationPercent(newPercent);
|
95
|
+
setResourceUtilizationTooltipText(newTooltipText);
|
96
|
+
}, [isNewQuota, resourceUnits, resourceUtilization, resourceValue]);
|
97
|
+
|
101
98
|
// call it once
|
102
|
-
|
99
|
+
useEffect(() => {
|
100
|
+
updateResourceUtilizationView();
|
101
|
+
}, [updateResourceUtilizationView]);
|
103
102
|
|
104
103
|
return (
|
105
104
|
<div>
|
data/webpack/helper.js
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
import ReactDOMServer from 'react-dom/server';
|
2
|
-
|
3
1
|
/**
|
4
2
|
* Performs a deep equality comparison between two objects, including nested objects and arrays.
|
5
3
|
* @param {Object} obj1 - The first object to compare.
|
@@ -37,16 +35,6 @@ const deepEqual = (obj1, obj2) => {
|
|
37
35
|
return true;
|
38
36
|
};
|
39
37
|
|
40
|
-
const areReactElementsEqual = (element1, element2) => {
|
41
|
-
const elementToStr = element =>
|
42
|
-
element && ReactDOMServer.renderToStaticMarkup(element);
|
43
|
-
|
44
|
-
const element1Str = elementToStr(element1);
|
45
|
-
const element2Str = elementToStr(element2);
|
46
|
-
|
47
|
-
return element1Str === element2Str;
|
48
|
-
};
|
49
|
-
|
50
38
|
/**
|
51
39
|
* Recursively copies values from the source hash (`src`) to the destination hash (`dest`).
|
52
40
|
* Only keys that are a member of dest will copied from src.
|
@@ -83,4 +71,4 @@ const findLargestFittingUnit = (value, unitList) => {
|
|
83
71
|
return unitList[0];
|
84
72
|
};
|
85
73
|
|
86
|
-
export { deepEqual, deepCopy, findLargestFittingUnit
|
74
|
+
export { deepEqual, deepCopy, findLargestFittingUnit };
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_resource_quota
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bastian Schmidt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Foreman Plug-in to manage resource usage among users.
|
14
14
|
email:
|