From 2c31f6517787ca100afa24a2a9d7001b3e30621a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 14:22:18 +0000 Subject: [PATCH] Bump the patternfly group with 6 updates Bumps the patternfly group with 6 updates: | Package | From | To | | --- | --- | --- | | [@patternfly/patternfly](https://github.com/patternfly/patternfly) | `5.3.1` | `5.4.0` | | [@patternfly/react-core](https://github.com/patternfly/patternfly-react) | `5.3.4` | `5.4.0` | | [@patternfly/react-icons](https://github.com/patternfly/patternfly-react) | `5.3.2` | `5.4.0` | | @patternfly/react-styles | `5.3.1` | `5.4.0` | | [@patternfly/react-table](https://github.com/patternfly/patternfly-react) | `5.3.4` | `5.4.0` | | [@patternfly/react-tokens](https://github.com/patternfly/patternfly-react) | `5.3.1` | `5.4.0` | Updates `@patternfly/patternfly` from 5.3.1 to 5.4.0 - [Release notes](https://github.com/patternfly/patternfly/releases) - [Changelog](https://github.com/patternfly/patternfly/blob/main/release.config.js) - [Commits](https://github.com/patternfly/patternfly/compare/patch-v5.3.1...v5.4.0) Updates `@patternfly/react-core` from 5.3.4 to 5.4.0 - [Release notes](https://github.com/patternfly/patternfly-react/releases) - [Commits](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@5.3.4...@patternfly/react-core@5.4.0) Updates `@patternfly/react-icons` from 5.3.2 to 5.4.0 - [Release notes](https://github.com/patternfly/patternfly-react/releases) - [Commits](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-icons@5.3.2...@patternfly/react-icons@5.4.0) Updates `@patternfly/react-styles` from 5.3.1 to 5.4.0 Updates `@patternfly/react-table` from 5.3.4 to 5.4.0 - [Release notes](https://github.com/patternfly/patternfly-react/releases) - [Commits](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-table@5.3.4...@patternfly/react-table@5.4.0) Updates `@patternfly/react-tokens` from 5.3.1 to 5.4.0 - [Release notes](https://github.com/patternfly/patternfly-react/releases) - [Commits](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-tokens@5.3.1...@patternfly/react-tokens@5.4.0) --- updated-dependencies: - dependency-name: "@patternfly/patternfly" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: patternfly - dependency-name: "@patternfly/react-core" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: patternfly - dependency-name: "@patternfly/react-icons" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: patternfly - dependency-name: "@patternfly/react-styles" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: patternfly - dependency-name: "@patternfly/react-table" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: patternfly - dependency-name: "@patternfly/react-tokens" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: patternfly ... PatternFly's NumberInput has become stricter with the value's it accepts, it now does not accept a string as a valid value. This was a bug in podman as we had an inconsistent state which was either a string or number. Signed-off-by: dependabot[bot] --- node_modules | 2 +- package.json | 12 ++++++------ src/ImageRunModal.jsx | 43 ++++++++++++++++++++++++++----------------- 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/node_modules b/node_modules index 689fc8783..0491e71bd 160000 --- a/node_modules +++ b/node_modules @@ -1 +1 @@ -Subproject commit 689fc8783b4fbe29aa6a0d4a31f16890ad12d640 +Subproject commit 0491e71bd798d6fe0328e7d2b985fed1c2bedb14 diff --git a/package.json b/package.json index 786dabf14..ae8f1d5f5 100644 --- a/package.json +++ b/package.json @@ -43,12 +43,12 @@ "stylelint-use-logical-spec": "5.0.1" }, "dependencies": { - "@patternfly/patternfly": "5.3.1", - "@patternfly/react-core": "5.3.4", - "@patternfly/react-icons": "5.3.2", - "@patternfly/react-styles": "5.3.1", - "@patternfly/react-table": "5.3.4", - "@patternfly/react-tokens": "5.3.1", + "@patternfly/patternfly": "5.4.0", + "@patternfly/react-core": "5.4.0", + "@patternfly/react-icons": "5.4.0", + "@patternfly/react-styles": "5.4.0", + "@patternfly/react-table": "5.4.0", + "@patternfly/react-tokens": "5.4.0", "@xterm/addon-canvas": "0.7.0", "@xterm/xterm": "5.5.0", "docker-names": "1.2.1", diff --git a/src/ImageRunModal.jsx b/src/ImageRunModal.jsx index 46c3d0372..e6806de3e 100644 --- a/src/ImageRunModal.jsx +++ b/src/ImageRunModal.jsx @@ -158,12 +158,12 @@ export class ImageRunModal extends React.Component { } const resourceLimit = {}; if (this.state.memoryConfigure && this.state.memory) { - const memorySize = this.state.memory * (1000 ** units[this.state.memoryUnit].baseExponent); + const memorySize = Number.parseInt(this.state.memory * (1000 ** units[this.state.memoryUnit].baseExponent)); resourceLimit.memory = { limit: memorySize }; createConfig.resource_limits = resourceLimit; } - if (this.state.cpuSharesConfigure && parseInt(this.state.cpuShares) !== 0) { - resourceLimit.cpu = { shares: parseInt(this.state.cpuShares) }; + if (this.state.cpuSharesConfigure && this.state.cpuShares !== 0) { + resourceLimit.cpu = { shares: this.state.cpuShares }; createConfig.resource_limits = resourceLimit; } createConfig.terminal = this.state.hasTTY; @@ -203,7 +203,7 @@ export class ImageRunModal extends React.Component { if (this.state.restartPolicy !== "no") { createConfig.restart_policy = this.state.restartPolicy; if (this.state.restartPolicy === "on-failure" && this.state.restartTries !== null) { - createConfig.restart_tries = parseInt(this.state.restartTries); + createConfig.restart_tries = this.state.restartTries; } // Enable podman-restart.service for system containers, for user // sessions enable-linger needs to be enabled for containers to start on boot. @@ -214,13 +214,13 @@ export class ImageRunModal extends React.Component { if (this.state.healthcheck_command !== "") { createConfig.healthconfig = { - Interval: parseInt(this.state.healthcheck_interval) * 1000000000, + Interval: this.state.healthcheck_interval * 1000000000, Retries: this.state.healthcheck_retries, - StartPeriod: parseInt(this.state.healthcheck_start_period) * 1000000000, + StartPeriod: this.state.healthcheck_start_period * 1000000000, Test: utils.unquote_cmdline(this.state.healthcheck_command), - Timeout: parseInt(this.state.healthcheck_timeout) * 1000000000, + Timeout: this.state.healthcheck_timeout * 1000000000, }; - createConfig.health_check_on_failure_action = parseInt(this.state.healthcheck_action); + createConfig.health_check_on_failure_action = this.state.healthcheck_action; } return createConfig; @@ -327,11 +327,20 @@ export class ImageRunModal extends React.Component { } onPlusOne(key) { - this.setState(state => ({ [key]: parseInt(state[key]) + 1 })); + this.setState(state => ({ [key]: parseFloat(state[key]) + 1 })); } onMinusOne(key) { - this.setState(state => ({ [key]: parseInt(state[key]) - 1 })); + this.setState(state => ({ [key]: parseFloat(state[key]) - 1 })); + } + + onNumberValue(key, value, minimum = 0, is_float = false) { + const parseFunc = is_float ? Number.parseFloat : Number.parseInt; + value = parseFunc(value); + if (isNaN(value) || value < minimum) { + value = minimum; + } + this.onValueChanged(key, value); } handleTabClick = (event, tabIndex) => { @@ -897,7 +906,7 @@ export class ImageRunModal extends React.Component { onMinus={() => this.onMinusOne('memory')} minusBtnAriaLabel={_("Decrease memory")} plusBtnAriaLabel={_("Increase memory")} - onChange={ev => this.onValueChanged('memory', parseInt(ev.target.value) < 0 ? 0 : ev.target.value)} /> + onChange={ev => this.onNumberValue('memory', ev.target.value, 0, true)} /> this.onMinusOne('cpuShares')} minusBtnAriaLabel={_("Decrease CPU shares")} plusBtnAriaLabel={_("Increase CPU shares")} - onChange={ev => this.onValueChanged('cpuShares', parseInt(ev.target.value) < 2 ? 2 : ev.target.value)} /> + onChange={ev => this.onNumberValue('cpuShares', ev.target.value, 2)} /> } @@ -980,7 +989,7 @@ export class ImageRunModal extends React.Component { plusBtnAriaLabel={_("Increase maximum retries")} onMinus={() => this.onMinusOne('restartTries')} onPlus={() => this.onPlusOne('restartTries')} - onChange={ev => this.onValueChanged('restartTries', parseInt(ev.target.value) < 1 ? 1 : ev.target.value)} + onChange={ev => this.onNumberValue('restartTries', ev.target.value, 1)} /> } @@ -1051,7 +1060,7 @@ export class ImageRunModal extends React.Component { plusBtnAriaLabel={_("Increase interval")} onMinus={() => this.onMinusOne('healthcheck_interval')} onPlus={() => this.onPlusOne('healthcheck_interval')} - onChange={ev => this.onValueChanged('healthcheck_interval', parseInt(ev.target.value) < 0 ? 0 : ev.target.value)} /> + onChange={ev => this.onNumberValue('healthcheck_interval', ev.target.value)} /> {_("seconds")} @@ -1076,7 +1085,7 @@ export class ImageRunModal extends React.Component { plusBtnAriaLabel={_("Increase timeout")} onMinus={() => this.onMinusOne('healthcheck_timeout')} onPlus={() => this.onPlusOne('healthcheck_timeout')} - onChange={ev => this.onValueChanged('healthcheck_timeout', parseInt(ev.target.value) < 0 ? 0 : ev.target.value)} /> + onChange={ev => this.onNumberValue('healthcheck_timeout', ev.target.value)} /> {_("seconds")} @@ -1101,7 +1110,7 @@ export class ImageRunModal extends React.Component { plusBtnAriaLabel={_("Increase start period")} onMinus={() => this.onMinusOne('healthcheck_start_period')} onPlus={() => this.onPlusOne('healthcheck_start_period')} - onChange={ev => this.onValueChanged('healthcheck_start_period', parseInt(ev.target.value) < 0 ? 0 : ev.target.value)} /> + onChange={ev => this.onNumberValue('healthcheck_start_period', ev.target.value)} /> {_("seconds")} @@ -1125,7 +1134,7 @@ export class ImageRunModal extends React.Component { plusBtnAriaLabel={_("Increase retries")} onMinus={() => this.onMinusOne('healthcheck_retries')} onPlus={() => this.onPlusOne('healthcheck_retries')} - onChange={ev => this.onValueChanged('healthcheck_retries', parseInt(ev.target.value) < 0 ? 0 : ev.target.value)} /> + onChange={ev => this.onNumberValue('healthcheck_retries', ev.target.value)} /> {version.localeCompare("4.3", undefined, { numeric: true, sensitivity: 'base' }) >= 0 &&