foreman_resource_quota 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ed49765e7cc2e0b0c0059798b8b7055e695d31d7f5c01fad2345f560d6e7c17
4
- data.tar.gz: 4b45e90aaea503b7b36f33939e60006a352718d81c7e40ccf0a2c21268556e25
3
+ metadata.gz: ebffd9d19b92459f29ae9d7838ab0293afb7a02d8873e7175f4074c357e412f2
4
+ data.tar.gz: d77e360fad5da830c368a020cffeb52f3986b1cbfd1cc9c4c54b8963c034c82e
5
5
  SHA512:
6
- metadata.gz: 5c937a1edd93a174d873c60ef741f96950d1360e0f4886cd6e72ac472ca52839cb1e692d2f2b2148087dda1af60a68e25c87d865b195363dba418caa520c4721
7
- data.tar.gz: 35c8bac94244083c54ba64620341b87e4801b1a190fd40b29c6e350b836e79e1dde15760ce995ed86c2d44db4e53a51497c8c0179a308868d9d34ecf5380c983
6
+ metadata.gz: c3949a4112d516b2ca0798f002909983271d1020559e303f0935b3a17837bc70a294d9c3d9388efdefac4f60671f8a6dbe27d953c74d816066c4966b1a9a13fe
7
+ data.tar.gz: be8e5f021cbd0ab79cb6a1ecd61677c51292d97408f21d085a35b46c3538081f4d6aa5be71153fdb8bd0fbcbab860d6253c77b871d175cad8b36dd9e4156e3bf
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ForemanResourceQuota
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
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": ">= 6.0.0"
24
+ "@theforeman/vendor": ">= 12.0.1"
25
25
  },
26
26
  "dependencies": {},
27
27
  "devDependencies": {
28
- "@babel/core": "^7.24.3",
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": "^12.0.1",
32
- "@theforeman/eslint-plugin-foreman": "13.0.0",
33
- "@theforeman/find-foreman": "^13.0.0",
34
- "@theforeman/stories": "^12.2.3",
35
- "@theforeman/test": "^13.0.0",
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",
@@ -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,
@@ -12,10 +12,7 @@ import SyncAltIcon from '@patternfly/react-icons/dist/esm/icons/sync-alt-icon';
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
- const updateResourceUtilizationView = () => {
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
- if (resourceUtilizationPercent !== newPercent)
97
- setResourceUtilizationPercent(newPercent);
98
- if (!areReactElementsEqual(resourceUtilizationTooltipText, newTooltipText))
99
- setResourceUtilizationTooltipText(newTooltipText);
100
- };
94
+ setResourceUtilizationPercent(newPercent);
95
+ setResourceUtilizationTooltipText(newTooltipText);
96
+ }, [isNewQuota, resourceUnits, resourceUtilization, resourceValue]);
97
+
101
98
  // call it once
102
- updateResourceUtilizationView();
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, areReactElementsEqual };
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.0
4
+ version: 0.2.1
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-04-30 00:00:00.000000000 Z
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: