foreman_resource_quota 0.2.0 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ed49765e7cc2e0b0c0059798b8b7055e695d31d7f5c01fad2345f560d6e7c17
4
- data.tar.gz: 4b45e90aaea503b7b36f33939e60006a352718d81c7e40ccf0a2c21268556e25
3
+ metadata.gz: acb27059a0b8ca259bce3aeb9c43044fc50f2766d6a9619e5dae66ff2cc4766b
4
+ data.tar.gz: d50841a42fbc287725a5612b1e7004187c331a8ca82c74ead75511b64dae8c5b
5
5
  SHA512:
6
- metadata.gz: 5c937a1edd93a174d873c60ef741f96950d1360e0f4886cd6e72ac472ca52839cb1e692d2f2b2148087dda1af60a68e25c87d865b195363dba418caa520c4721
7
- data.tar.gz: 35c8bac94244083c54ba64620341b87e4801b1a190fd40b29c6e350b836e79e1dde15760ce995ed86c2d44db4e53a51497c8c0179a308868d9d34ecf5380c983
6
+ metadata.gz: 6b6dcae25dba0d534f807184573b54df1faebc010f23bde6134cd8a428f34c12c6103f528667ccbfbb42289eadc9a57c965e04927bed929339bc06f95dc431b8
7
+ data.tar.gz: 03b6d8bb2153880689169d7c73ca36fca03772734a7f086aaed0dd66ae48f9c8d92da53d971fd33bd081b2368f2df3d51f18bb39ca8c3b929bcaed14fdc86301
@@ -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.2'
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",
@@ -16,10 +16,12 @@ import {
16
16
  Tooltip,
17
17
  } from '@patternfly/react-core';
18
18
 
19
- import UserIcon from '@patternfly/react-icons/dist/esm/icons/user-icon';
20
- import UsersIcon from '@patternfly/react-icons/dist/esm/icons/users-icon';
21
- import ClusterIcon from '@patternfly/react-icons/dist/esm/icons/cluster-icon';
22
- import SyncAltIcon from '@patternfly/react-icons/dist/esm/icons/sync-alt-icon';
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/dist/esm/icons/sync-alt-icon';
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
- 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.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-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: