2024-05-07 16:03:38: merge [main:f12f95d2c0f18ebd6bfbaacdf654f7f07a40006e];
This commit is contained in:
1 parent
a6f4c85231
commit
2989c66a65
16 files changed
+1068
-527
No files matched your search
Generated
+269
-7
@@ -1,20 +1,22 @@
|
||||
{
|
||||
"name": "isp-admin-ui",
|
||||
"version": "0.8.1",
|
||||
"version": "0.10.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "isp-admin-ui",
|
||||
"version": "0.8.1",
|
||||
"version": "0.10.1",
|
||||
"dependencies": {
|
||||
"@reduxjs/toolkit": "^2.2.3",
|
||||
"@types/react-router-dom": "^5.3.3",
|
||||
"axios": "^1.6.8",
|
||||
"clipboard": "^2.0.11",
|
||||
"compare-versions": "^6.1.0",
|
||||
"isp-ui-kit": "github:txix-open/isp-ui-kit",
|
||||
"moment": "^2.30.1",
|
||||
"compare-versions": "^6.1.0",
|
||||
"react": "^18.2.0",
|
||||
"react-copy-to-clipboard": "^5.1.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-hook-form": "^7.51.2",
|
||||
"react-redux": "^9.1.0",
|
||||
@@ -27,6 +29,7 @@
|
||||
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
||||
"@types/node": "^20.12.4",
|
||||
"@types/react": "^18.2.74",
|
||||
"@types/react-copy-to-clipboard": "^5.0.7",
|
||||
"@types/react-dom": "^18.2.24",
|
||||
"@types/react-resizable": "^3.0.7",
|
||||
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
||||
@@ -3913,6 +3916,15 @@
|
||||
"csstype": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/react-copy-to-clipboard": {
|
||||
"version": "5.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/react-copy-to-clipboard/-/react-copy-to-clipboard-5.0.7.tgz",
|
||||
"integrity": "sha512-Gft19D+as4M+9Whq1oglhmK49vqPhcLzk8WfvfLvaYMIPYanyfLy0+CwFucMJfdKoSFyySPmkkWn8/E6voQXjQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/react": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/react-dom": {
|
||||
"version": "18.2.24",
|
||||
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.24.tgz",
|
||||
@@ -4578,6 +4590,11 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/asap": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
|
||||
"integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA=="
|
||||
},
|
||||
"node_modules/async-validator": {
|
||||
"version": "4.2.5",
|
||||
"resolved": "https://registry.npmjs.org/async-validator/-/async-validator-4.2.5.tgz",
|
||||
@@ -4917,6 +4934,16 @@
|
||||
"resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz",
|
||||
"integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow=="
|
||||
},
|
||||
"node_modules/clipboard": {
|
||||
"version": "2.0.11",
|
||||
"resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.11.tgz",
|
||||
"integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==",
|
||||
"dependencies": {
|
||||
"good-listener": "^1.2.2",
|
||||
"select": "^1.1.2",
|
||||
"tiny-emitter": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/clsx": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz",
|
||||
@@ -4939,6 +4966,18 @@
|
||||
"@codemirror/view": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/color": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz",
|
||||
"integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==",
|
||||
"dependencies": {
|
||||
"color-convert": "^2.0.1",
|
||||
"color-string": "^1.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
@@ -4951,8 +4990,32 @@
|
||||
"node_modules/color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="
|
||||
},
|
||||
"node_modules/color-string": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz",
|
||||
"integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==",
|
||||
"dependencies": {
|
||||
"color-name": "^1.0.0",
|
||||
"simple-swizzle": "^0.2.2"
|
||||
}
|
||||
},
|
||||
"node_modules/color/node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"dependencies": {
|
||||
"color-name": "~1.1.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/color/node_modules/color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||
},
|
||||
"node_modules/combined-stream": {
|
||||
"version": "1.0.8",
|
||||
@@ -5073,6 +5136,14 @@
|
||||
"resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz",
|
||||
"integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g=="
|
||||
},
|
||||
"node_modules/cross-fetch": {
|
||||
"version": "3.1.8",
|
||||
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz",
|
||||
"integrity": "sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==",
|
||||
"dependencies": {
|
||||
"node-fetch": "^2.6.12"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
@@ -5213,6 +5284,11 @@
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/delegate": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
|
||||
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
|
||||
},
|
||||
"node_modules/dir-glob": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
|
||||
@@ -6144,6 +6220,33 @@
|
||||
"reusify": "^1.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/fbemitter": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fbemitter/-/fbemitter-3.0.0.tgz",
|
||||
"integrity": "sha512-KWKaceCwKQU0+HPoop6gn4eOHk50bBv/VxjJtGMfwmJt3D29JpN4H4eisCtIPA+a8GVBam+ldMMpMjJUvpDyHw==",
|
||||
"dependencies": {
|
||||
"fbjs": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/fbjs": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmjs.org/fbjs/-/fbjs-3.0.5.tgz",
|
||||
"integrity": "sha512-ztsSx77JBtkuMrEypfhgc3cI0+0h+svqeie7xHbh1k/IKdcydnvadp/mUaGgjAOXQmQSxsqgaRhS3q9fy+1kxg==",
|
||||
"dependencies": {
|
||||
"cross-fetch": "^3.1.5",
|
||||
"fbjs-css-vars": "^1.0.0",
|
||||
"loose-envify": "^1.0.0",
|
||||
"object-assign": "^4.1.0",
|
||||
"promise": "^7.1.1",
|
||||
"setimmediate": "^1.0.5",
|
||||
"ua-parser-js": "^1.0.35"
|
||||
}
|
||||
},
|
||||
"node_modules/fbjs-css-vars": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/fbjs-css-vars/-/fbjs-css-vars-1.0.2.tgz",
|
||||
"integrity": "sha512-b2XGFAFdWZWg0phtAWLHCk836A1Xann+I+Dgd3Gk64MHKZO44FfoD1KxyvbSh0qZsIoXQGGlVztIY+oitJPpRQ=="
|
||||
},
|
||||
"node_modules/file-entry-cache": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
|
||||
@@ -6204,6 +6307,18 @@
|
||||
"integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/flux": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/flux/-/flux-4.0.4.tgz",
|
||||
"integrity": "sha512-NCj3XlayA2UsapRpM7va6wU1+9rE5FIL7qoMcmxWHRzbp0yujihMBm9BBHZ1MDIk5h5o2Bl6eGiCe8rYELAmYw==",
|
||||
"dependencies": {
|
||||
"fbemitter": "^3.0.0",
|
||||
"fbjs": "^3.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^15.0.2 || ^16.0.0 || ^17.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.15.6",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
|
||||
@@ -6476,6 +6591,14 @@
|
||||
"integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/good-listener": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",
|
||||
"integrity": "sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==",
|
||||
"dependencies": {
|
||||
"delegate": "^3.1.2"
|
||||
}
|
||||
},
|
||||
"node_modules/gopd": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
|
||||
@@ -7062,20 +7185,35 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/isp-ui-kit": {
|
||||
"version": "0.3.4",
|
||||
"resolved": "git+ssh://git@github.com/txix-open/isp-ui-kit.git#ee517a533f9e4934d08bf6d70cdfda31198cba4c",
|
||||
"version": "0.5.2",
|
||||
"resolved": "git+ssh://git@github.com/txix-open/isp-ui-kit.git#b49acfe2e535398a8716407e75865e4b2e9dd84a",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@codemirror/lang-javascript": "^6.2.1",
|
||||
"@codemirror/lang-json": "^6.0.1",
|
||||
"@uiw/react-codemirror": "^4.21.21",
|
||||
"antd": "^5.12.2",
|
||||
"flux": "^4.0.4",
|
||||
"react": "^18.2.0",
|
||||
"react-base16-styling": "^0.10.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-hook-form": "^7.49.1",
|
||||
"react-lifecycles-compat": "^3.0.4",
|
||||
"react-textarea-autosize": "^6.1.0",
|
||||
"simplebar-react": "^3.2.4"
|
||||
}
|
||||
},
|
||||
"node_modules/isp-ui-kit/node_modules/react-textarea-autosize": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/react-textarea-autosize/-/react-textarea-autosize-6.1.0.tgz",
|
||||
"integrity": "sha512-F6bI1dgib6fSvG8so1HuArPUv+iVEfPliuLWusLF+gAKz0FbB4jLrWUrTAeq1afnPT2c9toEZYUdz/y1uKMy4A==",
|
||||
"dependencies": {
|
||||
"prop-types": "^15.6.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=0.14.0 <17.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/iterator.prototype": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.2.tgz",
|
||||
@@ -7426,6 +7564,25 @@
|
||||
"tslib": "^2.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/node-releases": {
|
||||
"version": "2.0.14",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz",
|
||||
@@ -7820,6 +7977,14 @@
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/promise": {
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz",
|
||||
"integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==",
|
||||
"dependencies": {
|
||||
"asap": "~2.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/prop-types": {
|
||||
"version": "15.8.1",
|
||||
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
|
||||
@@ -8460,6 +8625,29 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/react-base16-styling": {
|
||||
"version": "0.10.0",
|
||||
"resolved": "https://registry.npmjs.org/react-base16-styling/-/react-base16-styling-0.10.0.tgz",
|
||||
"integrity": "sha512-H1k2eFB6M45OaiRru3PBXkuCcn2qNmx+gzLb4a9IPMR7tMH8oBRXU5jGbPDYG1Hz+82d88ED0vjR8BmqU3pQdg==",
|
||||
"dependencies": {
|
||||
"@types/lodash": "^4.17.0",
|
||||
"color": "^4.2.3",
|
||||
"csstype": "^3.1.3",
|
||||
"lodash-es": "^4.17.21"
|
||||
}
|
||||
},
|
||||
"node_modules/react-copy-to-clipboard": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/react-copy-to-clipboard/-/react-copy-to-clipboard-5.1.0.tgz",
|
||||
"integrity": "sha512-k61RsNgAayIJNoy9yDsYzDe/yAZAzEbEgcz3DZMhF686LEyukcE1hzurxe85JandPUG+yTfGVFzuEw3xt8WP/A==",
|
||||
"dependencies": {
|
||||
"copy-to-clipboard": "^3.3.1",
|
||||
"prop-types": "^15.8.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^15.3.0 || 16 || 17 || 18"
|
||||
}
|
||||
},
|
||||
"node_modules/react-dom": {
|
||||
"version": "18.2.0",
|
||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz",
|
||||
@@ -8505,6 +8693,11 @@
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
||||
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
|
||||
},
|
||||
"node_modules/react-lifecycles-compat": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
|
||||
"integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA=="
|
||||
},
|
||||
"node_modules/react-redux": {
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.1.0.tgz",
|
||||
@@ -8911,6 +9104,11 @@
|
||||
"compute-scroll-into-view": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/select": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
|
||||
"integrity": "sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA=="
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "7.6.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz",
|
||||
@@ -8987,6 +9185,11 @@
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/setimmediate": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
|
||||
"integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA=="
|
||||
},
|
||||
"node_modules/shebang-command": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
@@ -9026,6 +9229,19 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/simple-swizzle": {
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
|
||||
"integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==",
|
||||
"dependencies": {
|
||||
"is-arrayish": "^0.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/simple-swizzle/node_modules/is-arrayish": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
|
||||
"integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ=="
|
||||
},
|
||||
"node_modules/simplebar": {
|
||||
"version": "6.2.5",
|
||||
"resolved": "https://registry.npmjs.org/simplebar/-/simplebar-6.2.5.tgz",
|
||||
@@ -9336,6 +9552,11 @@
|
||||
"node": ">=12.22"
|
||||
}
|
||||
},
|
||||
"node_modules/tiny-emitter": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
|
||||
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
|
||||
},
|
||||
"node_modules/to-fast-properties": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
|
||||
@@ -9362,6 +9583,11 @@
|
||||
"resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz",
|
||||
"integrity": "sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ=="
|
||||
},
|
||||
"node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
||||
},
|
||||
"node_modules/ts-api-utils": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz",
|
||||
@@ -9534,6 +9760,28 @@
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/ua-parser-js": {
|
||||
"version": "1.0.37",
|
||||
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.37.tgz",
|
||||
"integrity": "sha512-bhTyI94tZofjo+Dn8SN6Zv8nBDvyXTymAdM3LDI/0IboIUwTu1rEhW7v2TfiVsoYWgkQ4kOVqnI8APUFbIQIFQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/ua-parser-js"
|
||||
},
|
||||
{
|
||||
"type": "paypal",
|
||||
"url": "https://paypal.me/faisalman"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/faisalman"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/unbox-primitive": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz",
|
||||
@@ -9811,6 +10059,20 @@
|
||||
"resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz",
|
||||
"integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ=="
|
||||
},
|
||||
"node_modules/webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
|
||||
},
|
||||
"node_modules/whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
||||
"dependencies": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
|
||||
+4
-1
@@ -17,10 +17,12 @@
|
||||
"@reduxjs/toolkit": "^2.2.3",
|
||||
"@types/react-router-dom": "^5.3.3",
|
||||
"axios": "^1.6.8",
|
||||
"clipboard": "^2.0.11",
|
||||
"compare-versions": "^6.1.0",
|
||||
"moment": "^2.30.1",
|
||||
"isp-ui-kit": "github:txix-open/isp-ui-kit",
|
||||
"moment": "^2.30.1",
|
||||
"react": "^18.2.0",
|
||||
"react-copy-to-clipboard": "^5.1.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-hook-form": "^7.51.2",
|
||||
"react-redux": "^9.1.0",
|
||||
@@ -33,6 +35,7 @@
|
||||
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
||||
"@types/node": "^20.12.4",
|
||||
"@types/react": "^18.2.74",
|
||||
"@types/react-copy-to-clipboard": "^5.0.7",
|
||||
"@types/react-dom": "^18.2.24",
|
||||
"@types/react-resizable": "^3.0.7",
|
||||
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
@import "src/constants/style/styleConst";
|
||||
|
||||
.applications-content {
|
||||
padding: $basic-padding *2 $basic-padding;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
.column-content {
|
||||
margin-left: $basic-margin;
|
||||
}
|
||||
&__add-btn {
|
||||
max-width: 240px;
|
||||
margin-left: auto;
|
||||
@@ -16,4 +18,10 @@
|
||||
display: flex;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.link-btn {
|
||||
color: $blue-color;
|
||||
&:hover {
|
||||
color: $text-color-blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,59 +1,66 @@
|
||||
import {
|
||||
EditOutlined,
|
||||
DeleteOutlined,
|
||||
PlusSquareOutlined
|
||||
} from '@ant-design/icons'
|
||||
import {Button, message, Spin, Table} from 'antd'
|
||||
import { ColumnsType } from 'antd/es/table'
|
||||
import { LinkOutlined } from '@ant-design/icons'
|
||||
import { List, message, Spin, Tooltip } from 'antd'
|
||||
import { FormComponents, Layout } from 'isp-ui-kit'
|
||||
import { FC, useState } from 'react'
|
||||
import { ColumnItem } from 'isp-ui-kit/dist/Layout/Column/column.type'
|
||||
import { Dispatch, FC, SetStateAction, useState } from 'react'
|
||||
import { useForm } from 'react-hook-form'
|
||||
import { useNavigate, useParams, useSearchParams } from 'react-router-dom'
|
||||
|
||||
import { ValidationRules } from '@constants/form/validationRules.ts'
|
||||
|
||||
import Modal from '@widgets/Modal'
|
||||
|
||||
import CanEdit from '@components/CanEdit'
|
||||
import TokenContent from '@components/TokenContent'
|
||||
|
||||
import {
|
||||
ApplicationAppType,
|
||||
ApplicationsServiceType,
|
||||
ApplicationTokenType,
|
||||
NewApplicationAppType,
|
||||
NewApplicationTokenType,
|
||||
UpdateApplicationAppType
|
||||
} from '@pages/ApplicationsPage/applications.type.ts'
|
||||
|
||||
import { setSearchValue, setSelectedItemId } from '@utils/columnLayoutUtils.ts'
|
||||
import { filterFirstColumnItems } from '@utils/firstColumnUtils.ts'
|
||||
|
||||
import applicationsApi from '@services/applicationsService.ts'
|
||||
import tokensApi from '@services/tokensService.ts'
|
||||
|
||||
import { routePaths } from '@routes/routePaths.ts'
|
||||
|
||||
import './applications-content.scss'
|
||||
|
||||
const { FormInput, FormSelect } = FormComponents
|
||||
const { EmptyData } = Layout
|
||||
const { FormInput } = FormComponents
|
||||
const { EmptyData, Column, ContentColumn } = Layout
|
||||
|
||||
interface ApplicationsContentPropTypes {
|
||||
id: number
|
||||
selectedItemId: number
|
||||
currentApplicationsApp: number
|
||||
setCurrentApplicationsApp: Dispatch<SetStateAction<number>>
|
||||
}
|
||||
|
||||
const ApplicationsContent: FC<ApplicationsContentPropTypes> = (id) => {
|
||||
const ApplicationsContent: FC<ApplicationsContentPropTypes> = ({
|
||||
selectedItemId,
|
||||
currentApplicationsApp,
|
||||
setCurrentApplicationsApp
|
||||
}) => {
|
||||
const { data: applications, isLoading: isLoadingApplicationsContent = [] } =
|
||||
applicationsApi.useGetApplicationsByServiceIdQuery(id)
|
||||
applicationsApi.useGetApplicationsByServiceIdQuery({
|
||||
id: selectedItemId
|
||||
})
|
||||
|
||||
const [createApplicationService] =
|
||||
applicationsApi.useCreateApplicationServiceMutation()
|
||||
applicationsApi.useCreateApplicationServiceMutation()
|
||||
const [updateApplication] =
|
||||
applicationsApi.useUpdateApplicationsServiceMutation()
|
||||
applicationsApi.useUpdateApplicationsServiceMutation()
|
||||
const [removeApplicationsService] =
|
||||
applicationsApi.useRemoveApplicationsServiceMutation()
|
||||
const [createToken] = tokensApi.useCreateTokenMutation()
|
||||
applicationsApi.useRemoveApplicationsServiceMutation()
|
||||
const [showApplicationsModal, setShowApplicationsModal] = useState({
|
||||
addModal: false,
|
||||
updateModal: false,
|
||||
addToken: false
|
||||
updateModal: false
|
||||
})
|
||||
const [currentApplicationsApp, setCurrentApplicationsApp] =
|
||||
useState<ApplicationAppType>()
|
||||
const [searchParams, setSearchParams] = useSearchParams('')
|
||||
const searchAppValue = searchParams.get('appSearch') || ''
|
||||
const navigate = useNavigate()
|
||||
const { appId } = useParams()
|
||||
|
||||
const {
|
||||
handleSubmit,
|
||||
@@ -62,55 +69,53 @@ const ApplicationsContent: FC<ApplicationsContentPropTypes> = (id) => {
|
||||
} = useForm<ApplicationAppType>({
|
||||
mode: 'onChange'
|
||||
})
|
||||
|
||||
const { handleSubmit: handleSubmitTokens, control: controlTokens } =
|
||||
useForm<ApplicationTokenType>({
|
||||
mode: 'onChange'
|
||||
})
|
||||
|
||||
const handleShowUpdateModalApplicationApp = (data: ApplicationAppType) => {
|
||||
const updateApplicationModal = () => {
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
updateModal: true
|
||||
})
|
||||
setCurrentApplicationsApp(data)
|
||||
}
|
||||
const handleShowCreateModalApplicationApp = () => {
|
||||
const addApplicationModal = () => {
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
addModal: true
|
||||
})
|
||||
}
|
||||
const handleShowAddModalToken = (data: ApplicationAppType) => {
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
addToken: true
|
||||
})
|
||||
setCurrentApplicationsApp(data)
|
||||
const renderTokenContent = () => {
|
||||
if (!currentApplicationsApp) {
|
||||
return <EmptyData />
|
||||
}
|
||||
|
||||
return (
|
||||
<TokenContent key={currentApplicationsApp} id={currentApplicationsApp} />
|
||||
)
|
||||
}
|
||||
|
||||
const handleUpdateApplicationApp = (data: UpdateApplicationAppType) => {
|
||||
if (currentApplicationsApp) {
|
||||
const currentElement = applications?.filter(
|
||||
(el) => el.app.id === Number(appId)
|
||||
)[0].app
|
||||
if (currentElement) {
|
||||
const updateApplications: UpdateApplicationAppType = {
|
||||
id: currentApplicationsApp.id,
|
||||
id: currentElement.id,
|
||||
name: data.name,
|
||||
description: data.description
|
||||
? data.description
|
||||
: currentApplicationsApp.description,
|
||||
serviceId: id.id,
|
||||
? data.description
|
||||
: currentElement.description,
|
||||
serviceId: selectedItemId,
|
||||
type: 'SYSTEM'
|
||||
}
|
||||
updateApplication({ ...currentApplicationsApp, ...updateApplications })
|
||||
.unwrap()
|
||||
.then(() => {
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
updateModal: false
|
||||
})
|
||||
reset()
|
||||
message.info('Элемент сохранен')
|
||||
updateApplication({ ...currentElement, ...updateApplications })
|
||||
.unwrap()
|
||||
.then(() => {
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
updateModal: false
|
||||
})
|
||||
.catch(() => message.error('Ошибка обновления элемента'))
|
||||
reset()
|
||||
message.info('Элемент сохранен')
|
||||
})
|
||||
.catch(() => message.error('Ошибка обновления элемента'))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,14 +123,14 @@ const ApplicationsContent: FC<ApplicationsContentPropTypes> = (id) => {
|
||||
const newApplicationApp: NewApplicationAppType = {
|
||||
name: data.name,
|
||||
description: data.description,
|
||||
serviceId: id.id,
|
||||
serviceId: selectedItemId,
|
||||
type: 'SYSTEM'
|
||||
}
|
||||
|
||||
createApplicationService(newApplicationApp)
|
||||
.unwrap()
|
||||
.then(message.info('Элемент сохранен'))
|
||||
.catch((e) => message.error(e))
|
||||
.unwrap()
|
||||
.then(message.info('Элемент сохранен'))
|
||||
.catch((e) => message.error(e))
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
addModal: false
|
||||
@@ -133,227 +138,128 @@ const ApplicationsContent: FC<ApplicationsContentPropTypes> = (id) => {
|
||||
reset()
|
||||
}
|
||||
const handleRemoveApplicationApp = (id: number) =>
|
||||
removeApplicationsService([id])
|
||||
.then(() => {
|
||||
message.info('Элемент удален')
|
||||
})
|
||||
.catch(message.error('Ошибка добавления элемента'))
|
||||
removeApplicationsService([id])
|
||||
.unwrap()
|
||||
.then(() => message.success('Элемент удален'))
|
||||
.catch(() => message.info('Ошибка удаления элемента'))
|
||||
|
||||
const handleCreateToken = (data: NewApplicationTokenType) => {
|
||||
if (currentApplicationsApp) {
|
||||
const newToken: NewApplicationTokenType = {
|
||||
expireTimeMs: data.expireTimeMs,
|
||||
appId: currentApplicationsApp.id
|
||||
}
|
||||
|
||||
createToken(newToken)
|
||||
.then(() => {
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
addToken: false
|
||||
})
|
||||
reset()
|
||||
message.info('Элемент добавлен')
|
||||
})
|
||||
.catch(() => {
|
||||
message.error('Ошибка добавления элемента')
|
||||
})
|
||||
}
|
||||
const renderColumnItems = (item: ColumnItem<any>) => {
|
||||
return (
|
||||
<List.Item>
|
||||
<Tooltip mouseEnterDelay={1} title={item.name}>
|
||||
<List.Item.Meta title={item.name} />
|
||||
<div
|
||||
className="link-btn"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
navigate(`/appAccess/${item.id}`)
|
||||
}}
|
||||
>
|
||||
<LinkOutlined />
|
||||
</div>
|
||||
</Tooltip>
|
||||
</List.Item>
|
||||
)
|
||||
}
|
||||
|
||||
const columns: ColumnsType<ApplicationsServiceType> = [
|
||||
{
|
||||
title: 'id',
|
||||
dataIndex: ['app', 'id'],
|
||||
key: 'id'
|
||||
},
|
||||
{
|
||||
title: 'Наименование',
|
||||
dataIndex: ['app', 'name'],
|
||||
key: 'name'
|
||||
},
|
||||
{
|
||||
title: 'Описание',
|
||||
dataIndex: ['app', 'description'],
|
||||
key: 'description'
|
||||
},
|
||||
{
|
||||
title: 'Type',
|
||||
dataIndex: ['app', 'type'],
|
||||
key: 'Type'
|
||||
},
|
||||
{
|
||||
title: 'Количество токенов',
|
||||
dataIndex: 'tokens',
|
||||
key: 'tokensAmount',
|
||||
render: (value) => {
|
||||
return value.length
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Действия',
|
||||
dataIndex: 'app',
|
||||
key: 'actions',
|
||||
render: (record) => {
|
||||
return (
|
||||
<CanEdit>
|
||||
<Button
|
||||
danger
|
||||
className="applications-content__update-btn"
|
||||
onClick={() => {
|
||||
handleShowUpdateModalApplicationApp(record)
|
||||
}}
|
||||
icon={<EditOutlined />}
|
||||
/>
|
||||
<Button
|
||||
onClick={() => handleRemoveApplicationApp(record.id)}
|
||||
icon={<DeleteOutlined />}
|
||||
/>
|
||||
</CanEdit>
|
||||
)
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
const tokensOptions = [
|
||||
{
|
||||
value: -1,
|
||||
label: 'Бессрочно'
|
||||
},
|
||||
{
|
||||
value: 3600000,
|
||||
label: 'Один час'
|
||||
},
|
||||
{
|
||||
value: 86400000,
|
||||
label: 'Один день'
|
||||
},
|
||||
{
|
||||
value: 2592000000,
|
||||
label: '30 дней'
|
||||
},
|
||||
{
|
||||
value: 31536000000,
|
||||
label: 'Один год'
|
||||
}
|
||||
]
|
||||
|
||||
if (!id) {
|
||||
if (!selectedItemId) {
|
||||
return <EmptyData />
|
||||
}
|
||||
|
||||
if (isLoadingApplicationsContent) {
|
||||
return <Spin className="spin" />
|
||||
}
|
||||
if (selectedItemId)
|
||||
if (isLoadingApplicationsContent) {
|
||||
return <Spin className="spin" />
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="applications-content">
|
||||
<CanEdit>
|
||||
<Button
|
||||
className="applications-content__add-btn"
|
||||
type="primary"
|
||||
onClick={handleShowCreateModalApplicationApp}
|
||||
>
|
||||
Добавить
|
||||
</Button>
|
||||
</CanEdit>
|
||||
<Table
|
||||
expandable={{
|
||||
expandedRowRender: (record) => (
|
||||
<CanEdit>
|
||||
<Button
|
||||
className="applications-content__addToken-btn"
|
||||
onClick={() => handleShowAddModalToken(record.app)}
|
||||
>
|
||||
<PlusSquareOutlined /> Добавить токен
|
||||
</Button>
|
||||
</CanEdit>
|
||||
)
|
||||
}}
|
||||
className="appliactions-content__table"
|
||||
rowKey={(record) => record.app.id}
|
||||
pagination={false}
|
||||
dataSource={applications}
|
||||
columns={columns}
|
||||
/>
|
||||
<section className="applications-content">
|
||||
<Column
|
||||
title="Приложения"
|
||||
onUpdateItem={updateApplicationModal}
|
||||
showUpdateBtn={!!appId}
|
||||
onAddItem={addApplicationModal}
|
||||
onRemoveItem={() => handleRemoveApplicationApp(Number(appId))}
|
||||
items={filterFirstColumnItems(
|
||||
applications?.map((el) => {
|
||||
return el.app
|
||||
}) as unknown as ColumnItem<ApplicationsServiceType>[],
|
||||
searchAppValue
|
||||
)}
|
||||
renderItems={renderColumnItems}
|
||||
searchValue={searchAppValue}
|
||||
selectedItemId={currentApplicationsApp.toString()}
|
||||
setSelectedItemId={(itemId: string) => {
|
||||
setCurrentApplicationsApp(Number(itemId))
|
||||
setSelectedItemId(
|
||||
`${routePaths.applicationsGroup}/${selectedItemId}/${routePaths.application}`,
|
||||
itemId.toString(),
|
||||
searchAppValue,
|
||||
navigate
|
||||
)
|
||||
}}
|
||||
onChangeSearchValue={(value: string) => {
|
||||
setSearchValue(
|
||||
value.trim().toLowerCase(),
|
||||
setSearchParams,
|
||||
'appSearch'
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<ContentColumn>{renderTokenContent()}</ContentColumn>
|
||||
|
||||
<Modal
|
||||
onOk={handleSubmit(handleUpdateApplicationApp)}
|
||||
title="Редактировать"
|
||||
open={showApplicationsModal.updateModal}
|
||||
footer={{ onCanselText: 'Отмена', onOkText: 'Сохранить' }}
|
||||
onClose={() =>
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
updateModal: false
|
||||
})
|
||||
}
|
||||
>
|
||||
<form>
|
||||
<FormInput
|
||||
control={controlApplicationApp}
|
||||
name="name"
|
||||
label="Наименование"
|
||||
rules={{ required: ValidationRules.required }}
|
||||
/>
|
||||
<FormInput
|
||||
control={controlApplicationApp}
|
||||
label="Описание"
|
||||
name="description"
|
||||
/>
|
||||
</form>
|
||||
</Modal>
|
||||
<Modal
|
||||
onOk={handleSubmit(handleUpdateApplicationApp)}
|
||||
title="Редактировать"
|
||||
open={showApplicationsModal.updateModal}
|
||||
footer={{ onCanselText: 'Отмена', onOkText: 'Сохранить' }}
|
||||
onClose={() =>
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
updateModal: false
|
||||
})
|
||||
}
|
||||
>
|
||||
<form>
|
||||
<FormInput
|
||||
control={controlApplicationApp}
|
||||
name="name"
|
||||
label="Наименование"
|
||||
rules={{ required: ValidationRules.required }}
|
||||
/>
|
||||
<FormInput
|
||||
control={controlApplicationApp}
|
||||
label="Описание"
|
||||
name="description"
|
||||
/>
|
||||
</form>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
onOk={handleSubmit(handleCreateApplicationApp)}
|
||||
title="Добавить"
|
||||
open={showApplicationsModal.addModal}
|
||||
footer={{ onCanselText: 'Отмена', onOkText: 'Сохранить' }}
|
||||
onClose={() =>
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
addModal: false
|
||||
})
|
||||
}
|
||||
>
|
||||
<form>
|
||||
<FormInput
|
||||
control={controlApplicationApp}
|
||||
name="name"
|
||||
label="Наименование"
|
||||
rules={{ required: ValidationRules.required }}
|
||||
/>
|
||||
<FormInput
|
||||
control={controlApplicationApp}
|
||||
label="Описание"
|
||||
name="description"
|
||||
/>
|
||||
</form>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
onOk={handleSubmitTokens(handleCreateToken)}
|
||||
title="Добавить"
|
||||
open={showApplicationsModal.addToken}
|
||||
footer={{ onCanselText: 'Отмена', onOkText: 'Сохранить' }}
|
||||
onClose={() =>
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
addToken: false
|
||||
})
|
||||
}
|
||||
>
|
||||
<form>
|
||||
<FormSelect
|
||||
options={tokensOptions}
|
||||
name="expireTimeMs"
|
||||
control={controlTokens}
|
||||
label="Время действия"
|
||||
rules={{ required: ValidationRules.required }}
|
||||
/>
|
||||
</form>
|
||||
</Modal>
|
||||
</section>
|
||||
<Modal
|
||||
onOk={handleSubmit(handleCreateApplicationApp)}
|
||||
title="Добавить"
|
||||
open={showApplicationsModal.addModal}
|
||||
footer={{ onCanselText: 'Отмена', onOkText: 'Сохранить' }}
|
||||
onClose={() =>
|
||||
setShowApplicationsModal({
|
||||
...showApplicationsModal,
|
||||
addModal: false
|
||||
})
|
||||
}
|
||||
>
|
||||
<form>
|
||||
<FormInput
|
||||
control={controlApplicationApp}
|
||||
name="name"
|
||||
label="Наименование"
|
||||
rules={{ required: ValidationRules.required }}
|
||||
/>
|
||||
<FormInput
|
||||
control={controlApplicationApp}
|
||||
label="Описание"
|
||||
name="description"
|
||||
/>
|
||||
</form>
|
||||
</Modal>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ const { Content, Sider } = Layout
|
||||
const LayoutComponent = () => {
|
||||
const [collapsed, setCollapsed] = useState<boolean>(false)
|
||||
const [selectedMenuKeys, setSelectedMenuKeys] = useState<MenuItemKeysType[]>(
|
||||
[]
|
||||
[]
|
||||
)
|
||||
const [title, setTitle] = useState('')
|
||||
const [openKeys, setOpenKeys] = useState<string[]>([])
|
||||
@@ -88,7 +88,7 @@ const LayoutComponent = () => {
|
||||
},
|
||||
{
|
||||
label: 'Группа приложений',
|
||||
key: 'applications',
|
||||
key: 'applications_group',
|
||||
className: hideItem([PermissionKeysType.read]),
|
||||
icon: <AppstoreAddOutlined />
|
||||
},
|
||||
@@ -137,9 +137,9 @@ const LayoutComponent = () => {
|
||||
useEffect(() => {
|
||||
ConfigProvider.config({
|
||||
holderRender: (children) => (
|
||||
<ConfigProvider prefixCls="static" theme={theme}>
|
||||
{children}
|
||||
</ConfigProvider>
|
||||
<ConfigProvider prefixCls="static" theme={theme}>
|
||||
{children}
|
||||
</ConfigProvider>
|
||||
)
|
||||
})
|
||||
}, [theme])
|
||||
@@ -191,8 +191,8 @@ const LayoutComponent = () => {
|
||||
case MenuItemKeysType.modules:
|
||||
navigate(routePaths.modules)
|
||||
break
|
||||
case MenuItemKeysType.applications:
|
||||
navigate(routePaths.applications)
|
||||
case MenuItemKeysType.applicationsGroup:
|
||||
navigate(routePaths.applicationsGroup)
|
||||
break
|
||||
default:
|
||||
}
|
||||
@@ -203,40 +203,40 @@ const LayoutComponent = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<section>
|
||||
<Header title={title} />
|
||||
<Layout className="layout" data-cy="homePage">
|
||||
{status === StateProfileStatus.pending ? (
|
||||
<Spin size="large" />
|
||||
) : (
|
||||
<>
|
||||
<Sider
|
||||
width="250px"
|
||||
data-cy="aside"
|
||||
theme="light"
|
||||
collapsible
|
||||
collapsed={collapsed}
|
||||
onCollapse={(value) => setCollapsed(value)}
|
||||
>
|
||||
<Menu
|
||||
onOpenChange={(keys) => setOpenKeys(keys)}
|
||||
openKeys={openKeys}
|
||||
selectedKeys={selectedMenuKeys}
|
||||
onClick={handlerOnClickMenu}
|
||||
theme="light"
|
||||
mode="inline"
|
||||
items={menuItems}
|
||||
/>
|
||||
</Sider>
|
||||
<Layout className="site-layout">
|
||||
<Content className="site-layout__content">
|
||||
<Outlet />
|
||||
</Content>
|
||||
</Layout>
|
||||
</>
|
||||
)}
|
||||
</Layout>
|
||||
</section>
|
||||
<section>
|
||||
<Header title={title} />
|
||||
<Layout className="layout" data-cy="homePage">
|
||||
{status === StateProfileStatus.pending ? (
|
||||
<Spin size="large" />
|
||||
) : (
|
||||
<>
|
||||
<Sider
|
||||
width="250px"
|
||||
data-cy="aside"
|
||||
theme="light"
|
||||
collapsible
|
||||
collapsed={collapsed}
|
||||
onCollapse={(value) => setCollapsed(value)}
|
||||
>
|
||||
<Menu
|
||||
onOpenChange={(keys) => setOpenKeys(keys)}
|
||||
openKeys={openKeys}
|
||||
selectedKeys={selectedMenuKeys}
|
||||
onClick={handlerOnClickMenu}
|
||||
theme="light"
|
||||
mode="inline"
|
||||
items={menuItems}
|
||||
/>
|
||||
</Sider>
|
||||
<Layout className="site-layout">
|
||||
<Content className="site-layout__content">
|
||||
<Outlet />
|
||||
</Content>
|
||||
</Layout>
|
||||
</>
|
||||
)}
|
||||
</Layout>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ export enum MenuItemKeysType {
|
||||
logout = 'logout',
|
||||
profile = 'profile',
|
||||
modules = 'modules',
|
||||
applications = 'applications'
|
||||
applicationsGroup = 'applications_group'
|
||||
}
|
||||
export enum MenuItemLabelsType {
|
||||
users = 'Пользователи',
|
||||
@@ -19,14 +19,15 @@ export enum MenuItemLabelsType {
|
||||
roles = 'Роли',
|
||||
profile = 'Профиль',
|
||||
modules = 'Модули',
|
||||
applications = 'Группа приложений',
|
||||
logout = 'Выход',
|
||||
applications_group = 'Группа приложений'
|
||||
}
|
||||
|
||||
interface MenuItem {
|
||||
key: MenuItemKeysType
|
||||
parent: string[]
|
||||
}
|
||||
|
||||
export const menuKeys: Record<MenuItemKeysType, MenuItem> = {
|
||||
[MenuItemKeysType.users]: {
|
||||
key: MenuItemKeysType.users,
|
||||
@@ -60,8 +61,8 @@ export const menuKeys: Record<MenuItemKeysType, MenuItem> = {
|
||||
key: MenuItemKeysType.modules,
|
||||
parent: []
|
||||
},
|
||||
[MenuItemKeysType.applications]: {
|
||||
key: MenuItemKeysType.applications,
|
||||
[MenuItemKeysType.applicationsGroup]: {
|
||||
key: MenuItemKeysType.applicationsGroup,
|
||||
parent: ['']
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
import { CopyOutlined, DeleteOutlined } from '@ant-design/icons'
|
||||
import { Button, message, Popconfirm, Spin, Table } from 'antd'
|
||||
import { ColumnsType } from 'antd/es/table'
|
||||
import ClipboardJS from 'clipboard'
|
||||
import dayjs from 'dayjs'
|
||||
import 'dayjs/locale/ru'
|
||||
import duration from 'dayjs/plugin/duration'
|
||||
import relativeTime from 'dayjs/plugin/relativeTime'
|
||||
import { Layout, FormComponents } from 'isp-ui-kit'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useForm } from 'react-hook-form'
|
||||
|
||||
import { ValidationRules } from '@constants/form/validationRules.ts'
|
||||
|
||||
import Modal from '@widgets/Modal'
|
||||
|
||||
// import CanEdit from '@components/CanEdit'
|
||||
import {
|
||||
ApplicationTokenType,
|
||||
NewApplicationTokenType
|
||||
} from '@pages/ApplicationsPage/applications.type.ts'
|
||||
|
||||
import tokensApi from '@services/tokensService.ts'
|
||||
|
||||
import './tokens.scss'
|
||||
import CanEdit from '@components/CanEdit'
|
||||
|
||||
const { FormSelect } = FormComponents
|
||||
const { EmptyData } = Layout
|
||||
|
||||
interface TokenPropTypes {
|
||||
id: number
|
||||
}
|
||||
|
||||
// eslint-disable-next-line import/no-named-as-default-member
|
||||
dayjs.locale('ru')
|
||||
dayjs.extend(duration)
|
||||
dayjs.extend(relativeTime)
|
||||
|
||||
const TokenContent = ({ id }: TokenPropTypes) => {
|
||||
const [showApplicationsModal, setShowApplicationsModal] = useState(false)
|
||||
const {
|
||||
handleSubmit: handleSubmitTokens,
|
||||
control: controlTokens,
|
||||
reset
|
||||
} = useForm<ApplicationTokenType>({
|
||||
mode: 'onChange'
|
||||
})
|
||||
|
||||
const { data, isLoading } = tokensApi.useGetTokensByAppIdQuery({ id })
|
||||
const [createToken] = tokensApi.useCreateTokenMutation()
|
||||
const [revokeToken] = tokensApi.useRevokeTokensMutation()
|
||||
|
||||
useEffect(() => {
|
||||
const clipboard = new ClipboardJS('.copy-btn')
|
||||
clipboard.on('success', () => {
|
||||
message.success('Токен скопирован в буфер обмена')
|
||||
})
|
||||
clipboard.on('error', () => {
|
||||
message.error('Ошибка копирования')
|
||||
})
|
||||
|
||||
return () => {
|
||||
clipboard.destroy()
|
||||
}
|
||||
}, [])
|
||||
|
||||
const handleCreateToken = (data: any) => {
|
||||
if (id) {
|
||||
const newToken: NewApplicationTokenType = {
|
||||
expireTimeMs: data.expireTime,
|
||||
appId: Number(id)
|
||||
}
|
||||
|
||||
createToken(newToken)
|
||||
.then(() => {
|
||||
setShowApplicationsModal(false)
|
||||
reset()
|
||||
message.info('Элемент добавлен')
|
||||
})
|
||||
.catch(() => {
|
||||
message.error('Ошибка добавления элемента')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function shortenString(longString: string) {
|
||||
if (longString.length <= 6) {
|
||||
return <span>{longString}</span>
|
||||
} else {
|
||||
return (
|
||||
<span>
|
||||
{longString.slice(0, 3)}...{longString.slice(-3)}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const handleRevokeToken = (elem: ApplicationTokenType) => {
|
||||
const currentRemoveToken = {
|
||||
appId: id,
|
||||
tokens: [elem.token]
|
||||
}
|
||||
|
||||
revokeToken(currentRemoveToken)
|
||||
.unwrap()
|
||||
.then(() => message.success('Элемент удален'))
|
||||
.catch(() => message.info('Ошибка удаления элемента'))
|
||||
}
|
||||
|
||||
const columns: ColumnsType<ApplicationTokenType> = [
|
||||
{
|
||||
title: 'Токен',
|
||||
dataIndex: 'token',
|
||||
key: 'token',
|
||||
render: (record) => <div>{shortenString(record)}</div>
|
||||
},
|
||||
{
|
||||
title: 'Дата/Время выпуска',
|
||||
dataIndex: 'createdAt',
|
||||
key: 'createdAt',
|
||||
render: (record) => {
|
||||
const FULL_DATE_FORMAT = 'DD-MM-YYYY/HH:mm'
|
||||
const formatTime = dayjs(record.createdAt).format(FULL_DATE_FORMAT)
|
||||
return <div>{formatTime}</div>
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Срок действия',
|
||||
dataIndex: 'expireTime',
|
||||
key: 'expireTime',
|
||||
render: (value) => {
|
||||
const time = dayjs.duration(value).humanize()
|
||||
if (value > 0) {
|
||||
return <div>{time}</div>
|
||||
}
|
||||
return <div>Отсутствует</div>
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Истекает',
|
||||
dataIndex: 'expireTime',
|
||||
key: 'expireTime',
|
||||
render: (value, record) => {
|
||||
const FULL_DATE_FORMAT = 'DD-MM-YYYY, HH:mm'
|
||||
const formatTime = dayjs(record.createdAt)
|
||||
.add(record.expireTime)
|
||||
.format(FULL_DATE_FORMAT)
|
||||
|
||||
return value > 0 ? <span>{formatTime}</span> : <span> Никогда </span>
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Скопировать',
|
||||
dataIndex: 'token',
|
||||
key: 'copyToken',
|
||||
align: 'center',
|
||||
render: (record) => {
|
||||
return (
|
||||
<Button className="copy-btn" data-clipboard-text={record}>
|
||||
<CopyOutlined />
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Отозвать',
|
||||
dataIndex: 'appId',
|
||||
key: 'recall',
|
||||
align: 'center',
|
||||
render: (_, record) => {
|
||||
return (
|
||||
<Popconfirm
|
||||
title="Закончить эту сессию?"
|
||||
onConfirm={() => handleRevokeToken(record)}
|
||||
>
|
||||
<Button danger>
|
||||
<DeleteOutlined />
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
)
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
const tokensOptions = [
|
||||
{
|
||||
value: -1,
|
||||
label: 'Бессрочно'
|
||||
},
|
||||
{
|
||||
value: 3600000,
|
||||
label: 'Один час'
|
||||
},
|
||||
{
|
||||
value: 86400000,
|
||||
label: 'Один день'
|
||||
},
|
||||
{
|
||||
value: 2592000000,
|
||||
label: '30 дней'
|
||||
},
|
||||
{
|
||||
value: 31536000000,
|
||||
label: 'Один год'
|
||||
}
|
||||
]
|
||||
if (!id) {
|
||||
return <EmptyData />
|
||||
}
|
||||
|
||||
if (isLoading) {
|
||||
return <Spin className="spin" />
|
||||
}
|
||||
|
||||
const handleShowAddModalToken = () => {
|
||||
setShowApplicationsModal(true)
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="token-content">
|
||||
<CanEdit>
|
||||
<Button
|
||||
className="applications-content__add-btn"
|
||||
type="primary"
|
||||
onClick={handleShowAddModalToken}
|
||||
>
|
||||
Добавить токен
|
||||
</Button>
|
||||
</CanEdit>
|
||||
|
||||
<Table
|
||||
className="appliactions-tokent__table"
|
||||
rowKey={(record) => record.createdAt}
|
||||
pagination={false}
|
||||
columns={columns}
|
||||
dataSource={data}
|
||||
/>
|
||||
|
||||
<Modal
|
||||
onOk={handleSubmitTokens(handleCreateToken)}
|
||||
title="Добавить"
|
||||
open={showApplicationsModal}
|
||||
footer={{ onCanselText: 'Отмена', onOkText: 'Сохранить' }}
|
||||
onClose={() => setShowApplicationsModal(false)}
|
||||
>
|
||||
<form>
|
||||
<FormSelect
|
||||
options={tokensOptions}
|
||||
name="expireTime"
|
||||
control={controlTokens}
|
||||
label="Время действия"
|
||||
rules={{ required: ValidationRules.required }}
|
||||
/>
|
||||
</form>
|
||||
</Modal>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
export default TokenContent
|
||||
@@ -0,0 +1,7 @@
|
||||
@import "src/constants/style/styleConst";
|
||||
.token-content {
|
||||
padding: $basic-padding *2 $basic-padding;
|
||||
.copy-btn {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
@import "src/constants/style/styleConst";
|
||||
|
||||
.applications-page {
|
||||
height: 100%;
|
||||
height: 100vh;
|
||||
.column-content {
|
||||
max-height: 100vh;
|
||||
}
|
||||
.three-columns {
|
||||
display: flex;
|
||||
background: #fff;
|
||||
|
||||
@@ -1,39 +1,57 @@
|
||||
export interface ApplicationsGroupType {
|
||||
createdAt: string,
|
||||
description: string,
|
||||
domainId: number,
|
||||
id: number,
|
||||
name: string,
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
description: string
|
||||
domainId: number
|
||||
id: number
|
||||
name: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
export type NewApplicationsGroupType = Omit<ApplicationsGroupType, 'id' | 'createdAt' | 'updatedAt'>
|
||||
export type UpdateApplicationsGroupType = Omit<ApplicationsGroupType, 'createdAt' | 'updatedAt'>
|
||||
export type NewApplicationsGroupType = Omit<
|
||||
ApplicationsGroupType,
|
||||
'id' | 'createdAt' | 'updatedAt'
|
||||
>
|
||||
export type UpdateApplicationsGroupType = Omit<
|
||||
ApplicationsGroupType,
|
||||
'createdAt' | 'updatedAt'
|
||||
>
|
||||
|
||||
export interface ApplicationsServiceType {
|
||||
app:ApplicationAppType
|
||||
tokens: ApplicationTokenType[]
|
||||
app: ApplicationAppType
|
||||
tokens: ApplicationTokenType[]
|
||||
}
|
||||
|
||||
export type NewApplicationTokenType = Omit<ApplicationTokenType, 'createdAt' | 'token'>
|
||||
export interface ApplicationAppType {
|
||||
createdAt: string,
|
||||
description: string,
|
||||
id: number,
|
||||
name: string,
|
||||
serviceId: number,
|
||||
type: string,
|
||||
updatedAt: string
|
||||
export type NewApplicationTokenType = {
|
||||
appId: number
|
||||
expireTimeMs: number
|
||||
}
|
||||
|
||||
export interface ApplicationAppType {
|
||||
createdAt: string
|
||||
description: string
|
||||
id: number
|
||||
name: string
|
||||
serviceId: number
|
||||
type: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
export type UpdateApplicationAppType = Omit<ApplicationAppType, 'createdAt' | 'updatedAt'>
|
||||
export type NewApplicationAppType = Omit<ApplicationAppType, 'id' | 'createdAt' | 'updatedAt'>
|
||||
export type UpdateApplicationAppType = Omit<
|
||||
ApplicationAppType,
|
||||
'createdAt' | 'updatedAt'
|
||||
>
|
||||
export type NewApplicationAppType = Omit<
|
||||
ApplicationAppType,
|
||||
'id' | 'createdAt' | 'updatedAt'
|
||||
>
|
||||
export type RevokeTokenType = {
|
||||
appId: number
|
||||
tokens: string[]
|
||||
}
|
||||
|
||||
export interface ApplicationTokenType {
|
||||
appId: number,
|
||||
createdAt: string,
|
||||
expireTimeMs: number,
|
||||
token: string
|
||||
appId: number
|
||||
createdAt: string
|
||||
expireTime: number
|
||||
token: string
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ const ApplicationsPage = () => {
|
||||
const { id: selectedItemId = '' } = useParams()
|
||||
const [searchParams, setSearchParams] = useSearchParams('')
|
||||
const { hasPermission } = useRole()
|
||||
const [currentApplicationsApp, setCurrentApplicationsApp] = useState(0)
|
||||
|
||||
const {
|
||||
data: applicationsGroup = [],
|
||||
@@ -55,6 +56,7 @@ const ApplicationsPage = () => {
|
||||
applicationsGroupApi.useRemoveApplicationsGroupMutation()
|
||||
|
||||
const isPageAvailable = hasPermission(PermissionKeysType.read)
|
||||
// const hasRevokePermission = hasPermission(PermissionKeysType.write)
|
||||
|
||||
useEffect(() => {
|
||||
if (!isPageAvailable) {
|
||||
@@ -128,21 +130,36 @@ const ApplicationsPage = () => {
|
||||
message.info('Сервис успешно отредактирован')
|
||||
}
|
||||
|
||||
const handleRemoveApplicationsGtoup = () => {
|
||||
deleteApplicationsGroup([Number(selectedItemId)])
|
||||
.unwrap()
|
||||
.then(() => message.success('Элемент удален'))
|
||||
.catch(() => message.info('Ошибка удаления элемента'))
|
||||
}
|
||||
|
||||
const renderMainContent = () => {
|
||||
if (!selectedItemId) {
|
||||
return <EmptyData />
|
||||
}
|
||||
return <ApplicationsContent id={Number(selectedItemId)} />
|
||||
|
||||
return (
|
||||
<ApplicationsContent
|
||||
selectedItemId={Number(selectedItemId)}
|
||||
currentApplicationsApp={currentApplicationsApp}
|
||||
setCurrentApplicationsApp={setCurrentApplicationsApp}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="applications-page ">
|
||||
<main className="applications-page">
|
||||
<div className="applications-page__wrap three-columns">
|
||||
<Column
|
||||
title="Группа приложений"
|
||||
onUpdateItem={updateApplicationModal}
|
||||
showUpdateBtn={!!selectedItemId}
|
||||
onAddItem={addApplicationModal}
|
||||
onRemoveItem={() => deleteApplicationsGroup([Number(selectedItemId)])}
|
||||
onRemoveItem={handleRemoveApplicationsGtoup}
|
||||
items={filterFirstColumnItems(
|
||||
applicationsGroup as unknown as ColumnItem<ApplicationsGroupType>[],
|
||||
searchValue
|
||||
@@ -151,8 +168,9 @@ const ApplicationsPage = () => {
|
||||
searchValue={searchValue}
|
||||
selectedItemId={selectedItemId}
|
||||
setSelectedItemId={(itemId) => {
|
||||
setCurrentApplicationsApp(0)
|
||||
setSelectedItemId(
|
||||
`${routePaths.applications}`,
|
||||
`${routePaths.applicationsGroup}`,
|
||||
itemId,
|
||||
searchValue,
|
||||
navigate
|
||||
|
||||
+161
-142
@@ -23,156 +23,175 @@ const Connections = lazy(() => import('@components/Connections'))
|
||||
const ApplicationsPage = lazy(() => import('@pages/ApplicationsPage'))
|
||||
|
||||
const Routers = () => {
|
||||
return (
|
||||
<Routes>
|
||||
<Route element={<PrivateRoute />}>
|
||||
<Route path={routePaths.home} element={<Layout />}>
|
||||
<Route
|
||||
index
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<HomePage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path={`${routePaths.profile}`}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<ProfilePage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path={routePaths.users}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<UsersPage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path={`${routePaths.users}/:id`}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<UserEditor />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path={routePaths.roles}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<RolesPage />
|
||||
</Suspense>
|
||||
}
|
||||
>
|
||||
return (
|
||||
<Routes>
|
||||
<Route element={<PrivateRoute />}>
|
||||
<Route path={routePaths.home} element={<Layout />}>
|
||||
<Route
|
||||
index
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<HomePage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path={`${routePaths.profile}`}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<ProfilePage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path={routePaths.users}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<UsersPage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path={`${routePaths.users}/:id`}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<UserEditor />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path={routePaths.roles}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<RolesPage />
|
||||
</Suspense>
|
||||
}
|
||||
>
|
||||
<Route
|
||||
path=":id"
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<RolesPage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
</Route>
|
||||
<Route
|
||||
path={routePaths.applicationsGroup}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<ApplicationsPage />
|
||||
</Suspense>
|
||||
}
|
||||
>
|
||||
<Route
|
||||
path=":id"
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<ApplicationsPage />
|
||||
</Suspense>
|
||||
}
|
||||
>
|
||||
<Route
|
||||
path={routePaths.application}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<ApplicationsPage />
|
||||
</Suspense>
|
||||
}
|
||||
>
|
||||
<Route
|
||||
path=":appId"
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<ApplicationsPage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
</Route>
|
||||
</Route>
|
||||
</Route>
|
||||
|
||||
<Route
|
||||
path={routePaths.sessions}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<SessionsPage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path={routePaths.securityLog}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<SecurityLogPage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path={`${routePaths.appAccess}`}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<AppAccessPage />
|
||||
</Suspense>
|
||||
}
|
||||
>
|
||||
<Route
|
||||
path=":id"
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<AppAccessPage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
</Route>
|
||||
<Route
|
||||
path={routePaths.modules}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<ModulesPage />
|
||||
</Suspense>
|
||||
}
|
||||
>
|
||||
<Route path=":id">
|
||||
<Route
|
||||
path="configurations"
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<div>Configurations</div>
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="connections"
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<Connections />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
</Route>
|
||||
</Route>
|
||||
</Route>
|
||||
</Route>
|
||||
<Route
|
||||
path=":id"
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<RolesPage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
</Route>
|
||||
<Route
|
||||
path={routePaths.applications}
|
||||
path={routePaths.error}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<ApplicationsPage />
|
||||
<ErrorPage />
|
||||
</Suspense>
|
||||
}
|
||||
>
|
||||
<Route
|
||||
path=":id"
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<ApplicationsPage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
</Route>
|
||||
<Route
|
||||
path={routePaths.sessions}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<SessionsPage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path={routePaths.securityLog}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<SecurityLogPage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path={`${routePaths.appAccess}`}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<AppAccessPage />
|
||||
</Suspense>
|
||||
}
|
||||
>
|
||||
<Route
|
||||
path=":id"
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<AppAccessPage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
</Route>
|
||||
<Route
|
||||
path={routePaths.modules}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<ModulesPage />
|
||||
</Suspense>
|
||||
}
|
||||
>
|
||||
<Route path=":id">
|
||||
<Route
|
||||
path="configurations"
|
||||
<Route
|
||||
path={routePaths.login}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<div>Configurations</div>
|
||||
</Suspense>
|
||||
<Suspense fallback={<Spin />}>
|
||||
<LoginPage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="connections"
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<Connections />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
</Route>
|
||||
</Route>
|
||||
</Route>
|
||||
</Route>
|
||||
<Route
|
||||
path={routePaths.error}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<ErrorPage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path={routePaths.login}
|
||||
element={
|
||||
<Suspense fallback={<Spin />}>
|
||||
<LoginPage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
</Routes>
|
||||
)
|
||||
/>
|
||||
</Routes>
|
||||
)
|
||||
}
|
||||
|
||||
export default Routers
|
||||
@@ -9,8 +9,10 @@ type RoutePaths =
|
||||
| 'securityLog'
|
||||
| 'roles'
|
||||
| 'appAccess'
|
||||
| 'applicationsGroup'
|
||||
| 'configuration'
|
||||
| 'modules'
|
||||
| 'applications'
|
||||
| 'application'
|
||||
|
||||
export const routePaths: Record<RoutePaths, string> = {
|
||||
home: '/',
|
||||
@@ -23,6 +25,8 @@ export const routePaths: Record<RoutePaths, string> = {
|
||||
securityLog: '/securityLog',
|
||||
roles: '/roles',
|
||||
appAccess: '/appAccess',
|
||||
applicationsGroup: '/applications_group',
|
||||
configuration: '/configuration',
|
||||
modules: '/modules',
|
||||
applications: '/applications'
|
||||
application: 'application'
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
import { createApi } from '@reduxjs/toolkit/query/react'
|
||||
|
||||
import { apiPaths } from '@constants/api/apiPaths.ts'
|
||||
|
||||
import {
|
||||
ApplicationAppType,
|
||||
ApplicationsServiceType, NewApplicationAppType,
|
||||
ApplicationsServiceType,
|
||||
NewApplicationAppType,
|
||||
UpdateApplicationAppType
|
||||
} from '@pages/ApplicationsPage/applications.type.ts'
|
||||
|
||||
@@ -15,56 +17,65 @@ const applicationsApi = createApi({
|
||||
tagTypes: ['Applications'],
|
||||
baseQuery: axiosBaseQuery({ baseUrl: apiPaths.baseSystemUrl }),
|
||||
endpoints: (builder) => ({
|
||||
|
||||
getAllApplicationsService: builder.query<
|
||||
ApplicationsServiceType[],
|
||||
{ id: string }
|
||||
ApplicationsServiceType[],
|
||||
{ id: string }
|
||||
>({
|
||||
query: () => ({ url: apiPaths.getAllApplications }),
|
||||
providesTags: () => ['Applications']
|
||||
}),
|
||||
|
||||
createApplicationService: builder.mutation<
|
||||
ApplicationAppType,
|
||||
NewApplicationAppType
|
||||
ApplicationAppType,
|
||||
NewApplicationAppType
|
||||
>({
|
||||
query: ( NewApplicationsService) => ({
|
||||
query: (NewApplicationsService) => ({
|
||||
url: apiPaths.createUpdateApplication,
|
||||
data: NewApplicationsService
|
||||
data: NewApplicationsService
|
||||
}),
|
||||
invalidatesTags: ['Applications']
|
||||
}),
|
||||
|
||||
getApplicationsServiceById: builder.query<ApplicationsServiceType, { id : number}>({
|
||||
getApplicationsServiceById: builder.query<
|
||||
ApplicationsServiceType,
|
||||
{ id: number }
|
||||
>({
|
||||
query: (id) => ({
|
||||
url: apiPaths.getApplicationById,
|
||||
data: id
|
||||
}),
|
||||
providesTags: () => ['Applications']
|
||||
}),
|
||||
|
||||
getApplicationsByServiceId: builder.query<ApplicationsServiceType[], { id : number}>({
|
||||
getApplicationsByServiceId: builder.query<
|
||||
ApplicationsServiceType[],
|
||||
{ id: number }
|
||||
>({
|
||||
query: (id) => ({
|
||||
url: apiPaths.getApplicationsByServiceId,
|
||||
data: id
|
||||
}),
|
||||
providesTags: () => ['Applications']
|
||||
}),
|
||||
|
||||
updateApplicationsService: builder.mutation<void, UpdateApplicationAppType>({
|
||||
query: (updateApplications) => ({
|
||||
url: apiPaths.createUpdateApplication,
|
||||
data: updateApplications
|
||||
}),
|
||||
invalidatesTags: ['Applications']
|
||||
}),
|
||||
updateApplicationsService: builder.mutation<void, UpdateApplicationAppType>(
|
||||
{
|
||||
query: (updateApplications) => ({
|
||||
url: apiPaths.createUpdateApplication,
|
||||
data: updateApplications
|
||||
}),
|
||||
invalidatesTags: ['Applications']
|
||||
}
|
||||
),
|
||||
|
||||
removeApplicationsService: builder.mutation<void, number[]>({
|
||||
query: ([id]) => ({
|
||||
url: apiPaths.deleteApplication,
|
||||
data: [ id]
|
||||
data: [id]
|
||||
}),
|
||||
invalidatesTags: ['Applications']
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
export default applicationsApi
|
||||
export default applicationsApi
|
||||
@@ -1,9 +1,11 @@
|
||||
import { createApi } from '@reduxjs/toolkit/query/react'
|
||||
|
||||
import { apiPaths } from '@constants/api/apiPaths.ts'
|
||||
|
||||
import {
|
||||
ApplicationTokenType,
|
||||
NewApplicationTokenType,
|
||||
RevokeTokenType
|
||||
} from '@pages/ApplicationsPage/applications.type.ts'
|
||||
|
||||
import { axiosBaseQuery } from '@utils/apiUtils.ts'
|
||||
@@ -15,16 +17,31 @@ const tokensApi = createApi({
|
||||
baseQuery: axiosBaseQuery({ baseUrl: apiPaths.baseSystemUrl }),
|
||||
endpoints: (builder) => ({
|
||||
createToken: builder.mutation<
|
||||
ApplicationTokenType,
|
||||
NewApplicationTokenType
|
||||
ApplicationTokenType,
|
||||
NewApplicationTokenType
|
||||
>({
|
||||
query: ( NewApplicationTokenType) => ({
|
||||
query: (NewApplicationTokenType) => ({
|
||||
url: apiPaths.createToken,
|
||||
data: NewApplicationTokenType
|
||||
data: NewApplicationTokenType
|
||||
}),
|
||||
invalidatesTags: ['Tokens']
|
||||
}),
|
||||
|
||||
getTokensByAppId: builder.query<ApplicationTokenType[], { id: number }>({
|
||||
query: (id) => ({
|
||||
url: apiPaths.getTokensByAppId,
|
||||
data: id
|
||||
}),
|
||||
providesTags: ['Tokens']
|
||||
}),
|
||||
revokeTokens: builder.mutation<void, RevokeTokenType>({
|
||||
query: (el) => ({
|
||||
url: apiPaths.revokeTokens,
|
||||
data: el
|
||||
}),
|
||||
invalidatesTags: ['Tokens']
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
export default tokensApi
|
||||
export default tokensApi
|
||||
@@ -12,6 +12,7 @@ import roleApi from '@services/roleService.ts'
|
||||
import routeApi from '@services/routeService.ts'
|
||||
import securityLogServiceApi from '@services/securityLogService.ts'
|
||||
import sessionServiceApi from '@services/sessionService.ts'
|
||||
import tokensApi from '@services/tokensService.ts'
|
||||
import userServiceApi from '@services/userService.ts'
|
||||
|
||||
import profileReducer from './redusers/ProfileSlice.ts'
|
||||
@@ -39,7 +40,8 @@ const rootReducer = combineReducers({
|
||||
[routeApi.reducerPath]: routeApi.reducer,
|
||||
[modulesServiceApi.reducerPath]: modulesServiceApi.reducer,
|
||||
[applicationsGroupApi.reducerPath]: applicationsGroupApi.reducer,
|
||||
[applicationsApi.reducerPath]: applicationsApi.reducer
|
||||
[applicationsApi.reducerPath]: applicationsApi.reducer,
|
||||
[tokensApi.reducerPath]: tokensApi.reducer
|
||||
})
|
||||
|
||||
export const setupStore = () =>
|
||||
@@ -57,7 +59,8 @@ export const setupStore = () =>
|
||||
sessionServiceApi.middleware,
|
||||
modulesServiceApi.middleware,
|
||||
applicationsGroupApi.middleware,
|
||||
applicationsApi.middleware
|
||||
applicationsApi.middleware,
|
||||
tokensApi.middleware
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user