From efae9c3be3a1358578a9de730f1aed80da8e24fa Mon Sep 17 00:00:00 2001 From: Muslimjon Kholjuraev Date: Mon, 17 Jul 2023 12:34:47 +0200 Subject: [PATCH 1/3] fix(SPM-2082): properly update URL params in useGetEntities hook --- src/Utilities/Hooks.js | 469 +---------------------------------------- 1 file changed, 2 insertions(+), 467 deletions(-) diff --git a/src/Utilities/Hooks.js b/src/Utilities/Hooks.js index c8c7c3cb7..456a6daa7 100644 --- a/src/Utilities/Hooks.js +++ b/src/Utilities/Hooks.js @@ -19,470 +19,6 @@ import { createSystemsSortBy } from './SystemsHelpers'; // eslint-disable-next-line no-unused-vars import { useFlag, useFlagsStatus } from '@unleash/proxy-client-react'; -/*const mockedSystems1 = { - data: [ - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Applicable', - tags: [] - }, - id: '1234', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Applicable', - tags: [] - }, - id: '5678', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '9101', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '2131', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '4151', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '6171', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '8192', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '0212', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '2232', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '4252', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '6272', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '8293', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '0313', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '2333', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '4353', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '6373', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '8394', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '0414', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '2434', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '4454', - type: 'system' - }, - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '6474', - type: 'system' - } - ], - meta: { - filter: { - stale: { - op: 'eq', - values: ['false'] - }, - status: { - op: 'in', - values: ['Applicable', 'Installable'] - } - }, - has_systems: true, - limit: 20, - offset: 0, - sort: ['-last_upload'], - total_items: 21 - }, - status: 200 -}; - -const mockedSystems2 = { - data: [ - { - attributes: { - baseline_id: 0, - baseline_name: '', - created: '2023-05-31T18:34:25.073767Z', - culled_timestamp: '2023-06-15T23:34:24.83586Z', - display_name: 'rhel8-rhui-test.aig1lzmjp4mejkbwrqwbe45sre.cx.internal.cloudapp.net', - last_upload: '2023-05-31T18:34:25.228098Z', - os: 'RHEL 8.6', - rhsm: '', - stale: false, - stale_timestamp: '2023-06-01T23:34:24.83586Z', - stale_warning_timestamp: '2023-06-08T23:34:24.83586Z', - status: 'Installable', - tags: [] - }, - id: '6474', - type: 'system' - } - ], - meta: { - filter: { - stale: { - op: 'eq', - values: ['false'] - }, - status: { - op: 'in', - values: ['Applicable', 'Installable'] - } - }, - has_systems: true, - limit: 20, - offset: 1, - sort: ['-last_upload'], - total_items: 21 - }, - status: 200 -};*/ - export const useSetPage = (limit, callback) => { const onSetPage = React.useCallback((_, page) => callback({ offset: getOffsetFromPageLimit(page, limit) }) @@ -669,7 +205,6 @@ export const useGetEntities = (fetchApi, apply, config, history, applyMetadata, ...id && { id } || {}, ...packageName && { package_name: packageName } || {} }); - //const items = page === 1 ? mockedSystems1 : mockedSystems2; apply({ page, @@ -680,12 +215,12 @@ export const useGetEntities = (fetchApi, apply, config, history, applyMetadata, applyMetadata && applyMetadata(items.meta); applyGlobalFilter && applyGlobalFilter(selectedTags); - history.push(encodeURLParams({ + history.search = encodeURLParams({ page, perPage, sort, ...patchParams - })); + }); return { results: items.data.map(row => ({ ...row, ...row.attributes, id: row.id ?? row.inventory_id })), From d8d1fa469e1b6bcbe7f7334507df1840379e4589 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Aug 2023 08:23:06 +0000 Subject: [PATCH 2/3] chore(deps-dev): bump @redhat-cloud-services/frontend-components-config-utilities Bumps [@redhat-cloud-services/frontend-components-config-utilities](https://github.com/RedHatInsights/frontend-components) from 2.0.3 to 2.1.0. - [Commits](https://github.com/RedHatInsights/frontend-components/commits) --- updated-dependencies: - dependency-name: "@redhat-cloud-services/frontend-components-config-utilities" dependency-type: indirect update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 34ae3c831..a69d5a277 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3646,9 +3646,10 @@ } }, "node_modules/@redhat-cloud-services/frontend-components-config-utilities": { - "version": "2.0.3", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@redhat-cloud-services/frontend-components-config-utilities/-/frontend-components-config-utilities-2.1.0.tgz", + "integrity": "sha512-RQcXn+0WEVzBk98XHHOA3SIatT7qw30h/7UW/oWAYfGGceXeE5/5IjdRIZmuUaNym9v24nv1F4M9+RTdvXrWPA==", "dev": true, - "license": "Apache-2.0", "dependencies": { "@openshift/dynamic-plugin-sdk-webpack": "^3.0.0", "chalk": "^4.1.2", @@ -31752,7 +31753,9 @@ } }, "@redhat-cloud-services/frontend-components-config-utilities": { - "version": "2.0.3", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@redhat-cloud-services/frontend-components-config-utilities/-/frontend-components-config-utilities-2.1.0.tgz", + "integrity": "sha512-RQcXn+0WEVzBk98XHHOA3SIatT7qw30h/7UW/oWAYfGGceXeE5/5IjdRIZmuUaNym9v24nv1F4M9+RTdvXrWPA==", "dev": true, "requires": { "@openshift/dynamic-plugin-sdk-webpack": "^3.0.0", From fb968c558879f15874364a32782228365a368ae3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Oct 2023 17:24:59 +0000 Subject: [PATCH 3/3] chore(deps-dev): bump @patternfly/patternfly from 4.224.2 to 5.0.4 Bumps [@patternfly/patternfly](https://github.com/patternfly/patternfly) from 4.224.2 to 5.0.4. - [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/prerelease-v4.224.2...patch-v5.0.4) --- updated-dependencies: - dependency-name: "@patternfly/patternfly" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 13 ++++++++----- package.json | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index a69d5a277..c021328a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,7 +48,7 @@ "@cypress/code-coverage": "^3.10.3", "@cypress/react": "^6.2.1", "@formatjs/cli": "^3.2.0", - "@patternfly/patternfly": "^4.224.2", + "@patternfly/patternfly": "^5.0.4", "@redhat-cloud-services/frontend-components-config": "^5.0.4", "@rollup/plugin-commonjs": "^17.1.0", "@rollup/plugin-image": "^2.1.1", @@ -3412,9 +3412,10 @@ "license": "ISC" }, "node_modules/@patternfly/patternfly": { - "version": "4.224.2", - "dev": true, - "license": "MIT" + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@patternfly/patternfly/-/patternfly-5.0.4.tgz", + "integrity": "sha512-8akdWzFpG384Q6Es8lzkfuhAlzVGrNK7TJqXGecHDAg8u1JsYn3+Nw6gLRviI88z8Kjxmg5YKirILjpclGxkIA==", + "dev": true }, "node_modules/@patternfly/react-core": { "version": "4.267.14", @@ -30974,7 +30975,9 @@ } }, "@patternfly/patternfly": { - "version": "4.224.2", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@patternfly/patternfly/-/patternfly-5.0.4.tgz", + "integrity": "sha512-8akdWzFpG384Q6Es8lzkfuhAlzVGrNK7TJqXGecHDAg8u1JsYn3+Nw6gLRviI88z8Kjxmg5YKirILjpclGxkIA==", "dev": true }, "@patternfly/react-core": { diff --git a/package.json b/package.json index 778b16e58..aa52d2a39 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "@cypress/code-coverage": "^3.10.3", "@cypress/react": "^6.2.1", "@formatjs/cli": "^3.2.0", - "@patternfly/patternfly": "^4.224.2", + "@patternfly/patternfly": "^5.0.4", "@redhat-cloud-services/frontend-components-config": "^5.0.4", "@rollup/plugin-commonjs": "^17.1.0", "@rollup/plugin-image": "^2.1.1",