From e4e0b1a4f2658f324d7e17a0d959bd6e570a454e Mon Sep 17 00:00:00 2001 From: Katia Aresti Date: Wed, 18 Oct 2023 15:15:56 +0200 Subject: [PATCH] ISPN-14698 create and delete role --- .github/workflows/pull_requests.yml | 2 +- cypress/e2e/1_acess_management.cy.js | 21 ++ package-lock.json | 120 +++--- package.json | 22 +- src/app/AccessManagement/AccessManager.tsx | 4 +- src/app/AccessManagement/CreateRole.tsx | 346 ++++++++++++++++++ src/app/AccessManagement/DeleteRole.tsx | 54 +++ src/app/AccessManagement/RoleTableDisplay.tsx | 321 ++++++++++------ src/app/CacheManagers/CounterTableDisplay.tsx | 8 +- src/app/Caches/DetailCache.tsx | 15 +- src/app/Caches/Entries/CacheEntries.tsx | 6 +- .../Entries/CreateOrUpdateEntryForm.tsx | 2 +- src/app/Caches/Entries/DeleteEntry.tsx | 4 +- src/app/Caches/Query/QueryEntries.tsx | 1 - src/app/Counters/CreateCounter.tsx | 1 + src/app/app.css | 4 +- src/app/assets/languages/en.json | 40 +- src/app/services/rolesHook.ts | 50 +++ src/app/utils/searchFilter.ts | 23 -- src/services/cacheConfigUtils.ts | 8 +- src/services/securityService.ts | 32 ++ 21 files changed, 857 insertions(+), 227 deletions(-) create mode 100644 src/app/AccessManagement/CreateRole.tsx create mode 100644 src/app/AccessManagement/DeleteRole.tsx diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index 33d9b955b..4b97b3f32 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 18.18.0 + node-version: 20.7.0 cache: 'npm' - name: Install diff --git a/cypress/e2e/1_acess_management.cy.js b/cypress/e2e/1_acess_management.cy.js index 5222b4b24..454faf3db 100644 --- a/cypress/e2e/1_acess_management.cy.js +++ b/cypress/e2e/1_acess_management.cy.js @@ -8,4 +8,25 @@ describe('Global stats', () => { cy.contains('admin'); cy.contains('Superuser'); }); + + it('successfully creates and removes a role', () => { + // create + cy.get('button[data-cy="createRoleButton"]').click(); + cy.get("[aria-label=role-name-input]").type("aRole"); + cy.get("[aria-label=role-description-input]").type("aRole description"); + cy.get("[data-cy=dropdown-button-permissions").click(); + cy.get("#select-multi-typeahead-ALL").click(); + cy.get("[aria-label=Create]").click(); + cy.contains('Role aRole has been created'); + cy.contains('aRole description'); + + // remove + cy.get("[aria-label=aRole-menu]").click(); + cy.get("[aria-label=deleteRole]").click(); + cy.get("[aria-label=Delete]").click(); + cy.contains('Role aRole has been deleted'); + cy.contains('aRole description').should('not.exist'); + }); + + }); diff --git a/package-lock.json b/package-lock.json index 09ca3423c..176fbf243 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,24 +9,22 @@ "version": "15.0.0", "license": "Apache-2.0", "dependencies": { - "@patternfly/react-charts": "^7.0.0", - "@patternfly/react-code-editor": "^5.0.0", - "@patternfly/react-core": "^5.0.0", - "@patternfly/react-icons": "^5.0.0", + "@patternfly/react-charts": "^7.1.1", + "@patternfly/react-code-editor": "^5.1.0", + "@patternfly/react-core": "^5.1.1", + "@patternfly/react-icons": "^5.1.1", "@patternfly/react-log-viewer": "^5.0.0", - "@patternfly/react-styles": "^5.0.0", - "@patternfly/react-table": "^5.0.0", - "@patternfly/react-tokens": "^5.0.0", - "i18next": "^23.4.4", + "@patternfly/react-styles": "^5.1.1", + "@patternfly/react-table": "^5.1.1", + "@patternfly/react-tokens": "^5.1.1", + "i18next": "^23.5.1", "i18next-browser-languagedetector": "^7.1.0", - "i18next-http-backend": "^2.2.1", + "i18next-http-backend": "^2.2.2", "keycloak-js": "^22.0.1", - "monaco-editor": "^0.34.0", "numeral": "^2.0.6", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-i18next": "^13.0.3", - "react-monaco-editor": "^0.51.0", + "react-i18next": "^13.3.0", "react-syntax-highlighter": "^15.5.0" }, "devDependencies": { @@ -1634,12 +1632,12 @@ } }, "node_modules/@patternfly/react-charts": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@patternfly/react-charts/-/react-charts-7.0.0.tgz", - "integrity": "sha512-lRR5iXJeTWbEqMlIcqnVA9DHurn8MJNDnwtEDcrzCH5g28MCXGosQjhXqsnz3LVGtHcBsQcpxMIv8WO5rfJHOA==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@patternfly/react-charts/-/react-charts-7.1.1.tgz", + "integrity": "sha512-X5T+wlbh+sNKIVScx3ykivu1+EIEcQvEdjv6vfyBlsBU8CzACgMRQff4buBL6um3Zv2kT4LPefd6zxoaerJdkg==", "dependencies": { - "@patternfly/react-styles": "^5.0.0", - "@patternfly/react-tokens": "^5.0.0", + "@patternfly/react-styles": "^5.1.1", + "@patternfly/react-tokens": "^5.1.1", "hoist-non-react-statics": "^3.3.0", "lodash": "^4.17.19", "tslib": "^2.5.0", @@ -1667,13 +1665,13 @@ } }, "node_modules/@patternfly/react-code-editor": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@patternfly/react-code-editor/-/react-code-editor-5.0.0.tgz", - "integrity": "sha512-Ya1nuw2Zcor/MET+s0+VuYq2VsRb+VzKpZQ8Y1MbrXJdlWV6QS5Wf1M7jDl9lYkiJaS3pjG7eXNeVX2YJ+mQiw==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@patternfly/react-code-editor/-/react-code-editor-5.1.1.tgz", + "integrity": "sha512-Y7+rr8O3BdomCDUnp3hoBnw1j08G18Q5GOXx1bX3Zksc8P2T3oZa+TL3zyDMIEZfEftRfkSGXtaACUFwmXlQIQ==", "dependencies": { - "@patternfly/react-core": "^5.0.0", - "@patternfly/react-icons": "^5.0.0", - "@patternfly/react-styles": "^5.0.0", + "@patternfly/react-core": "^5.1.1", + "@patternfly/react-icons": "^5.1.1", + "@patternfly/react-styles": "^5.1.1", "react-dropzone": "14.2.3", "tslib": "^2.5.0" }, @@ -1684,14 +1682,14 @@ } }, "node_modules/@patternfly/react-core": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@patternfly/react-core/-/react-core-5.0.0.tgz", - "integrity": "sha512-kewRVFhLw0Dvt8250pqrO47sVRx8E93sMGZbHQomJnZdachYeQ9STnQTP2gvOBq/GPnMei0LZLv0T99g8mPE4w==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@patternfly/react-core/-/react-core-5.1.1.tgz", + "integrity": "sha512-9DbgQMXYmF8A4aCNLKXwIN1H07SIPoPaVLvx+yiDuJfDx4Qi0T+H7j5cx0VfDfxuCpqea3POJWqBQn1HnwS4wQ==", "dependencies": { - "@patternfly/react-icons": "^5.0.0", - "@patternfly/react-styles": "^5.0.0", - "@patternfly/react-tokens": "^5.0.0", - "focus-trap": "7.4.3", + "@patternfly/react-icons": "^5.1.1", + "@patternfly/react-styles": "^5.1.1", + "@patternfly/react-tokens": "^5.1.1", + "focus-trap": "7.5.2", "react-dropzone": "^14.2.3", "tslib": "^2.5.0" }, @@ -1701,9 +1699,9 @@ } }, "node_modules/@patternfly/react-icons": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@patternfly/react-icons/-/react-icons-5.0.0.tgz", - "integrity": "sha512-GG5Y/UYl0h346MyDU9U650Csaq4Mxk8S6U8XC7ERk/xIrRr2RF67O2uY7zKBDMTNLYdBvPzgc2s3OMV1+d2/mg==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@patternfly/react-icons/-/react-icons-5.1.1.tgz", + "integrity": "sha512-9gCxkWz2xcdi0rtXu2F0L68w4tLIlsgGTACo1ggr4aVng9jRX++o1PlCOqscOd9o0NiFnFD7BLlZUGvJWaYEZg==", "peerDependencies": { "react": "^17 || ^18", "react-dom": "^17 || ^18" @@ -1725,19 +1723,19 @@ } }, "node_modules/@patternfly/react-styles": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@patternfly/react-styles/-/react-styles-5.0.0.tgz", - "integrity": "sha512-xbSCgjx+fPrXbIzUznwTFWtJEbzVS0Wn4zrejdKJYQTY+4YcuPlFkeq2tl3syzwGsaYMpHiFwQiTaKyTvlwtuw==" + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@patternfly/react-styles/-/react-styles-5.1.1.tgz", + "integrity": "sha512-swO9X+WixYYDsMVsEJp1V8QUfhEQY91QfFm4phfYP4jc2TQ2opIFYdUIHkc+yrZwBhrgb/pPUUfemyqAoSbZcA==" }, "node_modules/@patternfly/react-table": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@patternfly/react-table/-/react-table-5.0.0.tgz", - "integrity": "sha512-Q3MBo9+ZmBvLJzVHxmV9f/4qQAz5Si743zVLHRwjh+tjbn/DrcbxJdT8Uxa3NGKkpvszzgi/LPeXipJOHOELug==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@patternfly/react-table/-/react-table-5.1.1.tgz", + "integrity": "sha512-9tAtHj16hemJ6YRBWIm2O+QRNoFWYQt8ZLQ1G0KBwpg2t2G2CbGsS2RG+BamO4IVE6IPo3Yoo39p4UCNRiGVpA==", "dependencies": { - "@patternfly/react-core": "^5.0.0", - "@patternfly/react-icons": "^5.0.0", - "@patternfly/react-styles": "^5.0.0", - "@patternfly/react-tokens": "^5.0.0", + "@patternfly/react-core": "^5.1.1", + "@patternfly/react-icons": "^5.1.1", + "@patternfly/react-styles": "^5.1.1", + "@patternfly/react-tokens": "^5.1.1", "lodash": "^4.17.19", "tslib": "^2.5.0" }, @@ -1747,9 +1745,9 @@ } }, "node_modules/@patternfly/react-tokens": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@patternfly/react-tokens/-/react-tokens-5.0.0.tgz", - "integrity": "sha512-to2CXIZ6WTuzBcjLZ+nXi5LhnYkSIDu3RBMRZwrplmECOoUWv87CC+2T0EVxtASRtpQfikjD2PDKMsif5i0BxQ==" + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@patternfly/react-tokens/-/react-tokens-5.1.1.tgz", + "integrity": "sha512-cHuNkzNA9IY9aDwfjSEkitQoVEvRhOJRKhH0yIRlRByEkbdoV9jJZ9xj20hNShE+bxmNuom+MCTQSkpkN1bV8A==" }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", @@ -6561,11 +6559,11 @@ "dev": true }, "node_modules/focus-trap": { - "version": "7.4.3", - "resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-7.4.3.tgz", - "integrity": "sha512-BgSSbK4GPnS2VbtZ50VtOv1Sti6DIkj3+LkVjiWMNjLeAp1SH1UlLx3ULu/DCu4vq5R4/uvTm+zrvsMsuYmGLg==", + "version": "7.5.2", + "resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-7.5.2.tgz", + "integrity": "sha512-p6vGNNWLDGwJCiEjkSK6oERj/hEyI9ITsSwIUICBoKLlWiTWXJRfQibCwcoi50rTZdbi87qDtUlMCmQwsGSgPw==", "dependencies": { - "tabbable": "^6.1.2" + "tabbable": "^6.2.0" } }, "node_modules/follow-redirects": { @@ -7423,9 +7421,9 @@ } }, "node_modules/i18next": { - "version": "23.4.4", - "resolved": "https://registry.npmjs.org/i18next/-/i18next-23.4.4.tgz", - "integrity": "sha512-+c9B0txp/x1m5zn+QlwHaCS9vyFtmIAEXbVSFzwCX7vupm5V7va8F9cJGNJZ46X9ZtoGzhIiRC7eTIIh93TxPA==", + "version": "23.5.1", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-23.5.1.tgz", + "integrity": "sha512-JelYzcaCoFDaa+Ysbfz2JsGAKkrHiMG6S61+HLBUEIPaF40WMwW9hCPymlQGrP+wWawKxKPuSuD71WZscCsWHg==", "funding": [ { "type": "individual", @@ -7453,9 +7451,9 @@ } }, "node_modules/i18next-http-backend": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/i18next-http-backend/-/i18next-http-backend-2.2.1.tgz", - "integrity": "sha512-ZXIdn/8NJIBJ0X4hzXfc3STYxKrCKh1fYjji9HPyIpEJfvTvy8/ZlTl8RuTizzCPj2ZcWrfaecyOMKs6bQ7u5A==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/i18next-http-backend/-/i18next-http-backend-2.2.2.tgz", + "integrity": "sha512-mJu4ZqzDtBiU3O4GV9AbK5ekEqoDMdMnCl3pkdXmb5b8yoIH//u8FsmIe6C5qXb3teZu+j6VMi20tjUgzeABiw==", "dependencies": { "cross-fetch": "3.1.6" } @@ -10283,7 +10281,8 @@ "node_modules/monaco-editor": { "version": "0.34.1", "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.34.1.tgz", - "integrity": "sha512-FKc80TyiMaruhJKKPz5SpJPIjL+dflGvz4CpuThaPMc94AyN7SeC9HQ8hrvaxX7EyHdJcUY5i4D0gNyJj1vSZQ==" + "integrity": "sha512-FKc80TyiMaruhJKKPz5SpJPIjL+dflGvz4CpuThaPMc94AyN7SeC9HQ8hrvaxX7EyHdJcUY5i4D0gNyJj1vSZQ==", + "peer": true }, "node_modules/monaco-editor-webpack-plugin": { "version": "7.1.0", @@ -12137,9 +12136,9 @@ "integrity": "sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ==" }, "node_modules/react-i18next": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-13.0.3.tgz", - "integrity": "sha512-/t4kt4Y2o+21hbvx+o9zpVnmoiud7KLDncyZFGN0U6TGAWYaXdTsp/ytAHFcKKSAODg4noIMaOO3X7bMgCqLHw==", + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-13.3.0.tgz", + "integrity": "sha512-FlR9xjYHSPIJfQspEmkN0yOlxgRyNuiJKJ8gCaZH08UJ7SZHG+VrptEPcpEMEchjNoCOZdKcvJ3PnmHEZhkeXg==", "dependencies": { "@babel/runtime": "^7.22.5", "html-parse-stringify": "^3.0.1" @@ -12166,6 +12165,7 @@ "version": "0.51.0", "resolved": "https://registry.npmjs.org/react-monaco-editor/-/react-monaco-editor-0.51.0.tgz", "integrity": "sha512-6jx1V8p6gHVKJHFaTvicOtmlhFjOJhekobeNd92ZAo7F5UvAin1cF7bxWLCKgtxClYZ7CB3Ar284Kpbhj22FpQ==", + "peer": true, "dependencies": { "prop-types": "^15.8.1" }, diff --git a/package.json b/package.json index e6305adf0..763c9b247 100644 --- a/package.json +++ b/package.json @@ -81,24 +81,22 @@ "webpack-merge": "^5.9.0" }, "dependencies": { - "@patternfly/react-charts": "^7.0.0", - "@patternfly/react-code-editor": "^5.0.0", - "@patternfly/react-core": "^5.0.0", - "@patternfly/react-icons": "^5.0.0", + "@patternfly/react-charts": "^7.1.1", + "@patternfly/react-code-editor": "^5.1.0", + "@patternfly/react-core": "^5.1.1", + "@patternfly/react-icons": "^5.1.1", "@patternfly/react-log-viewer": "^5.0.0", - "@patternfly/react-styles": "^5.0.0", - "@patternfly/react-table": "^5.0.0", - "@patternfly/react-tokens": "^5.0.0", - "i18next": "^23.4.4", + "@patternfly/react-styles": "^5.1.1", + "@patternfly/react-table": "^5.1.1", + "@patternfly/react-tokens": "^5.1.1", + "i18next": "^23.5.1", "i18next-browser-languagedetector": "^7.1.0", - "i18next-http-backend": "^2.2.1", + "i18next-http-backend": "^2.2.2", "keycloak-js": "^22.0.1", - "monaco-editor": "^0.34.0", "numeral": "^2.0.6", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-i18next": "^13.0.3", - "react-monaco-editor": "^0.51.0", + "react-i18next": "^13.3.0", "react-syntax-highlighter": "^15.5.0" } } diff --git a/src/app/AccessManagement/AccessManager.tsx b/src/app/AccessManagement/AccessManager.tsx index 1c8239711..2a5173fe7 100644 --- a/src/app/AccessManagement/AccessManager.tsx +++ b/src/app/AccessManagement/AccessManager.tsx @@ -33,9 +33,7 @@ const AccessManager = () => { setShowAccessControl(tabIndex == '1'); }; const buildTabs = () => { - const tabs: AccessTab[] = [ - { name: t('access-management.tab-roles'), key: '0' }, - ]; + const tabs: AccessTab[] = [{ name: t('access-management.tab-roles'), key: '0' }]; return (