From ca8056911a2171636ce37005455323a1ae15827a Mon Sep 17 00:00:00 2001 From: Danny Gershman Date: Thu, 11 Jul 2024 23:10:59 +0300 Subject: [PATCH] Feature/react migration (#1095) --- .../Http/Controllers/AdminV2Controller.php | 15 +++++ src/app/Services/SettingsService.php | 2 +- src/composer.lock | 34 +++++----- src/package-lock.json | 62 +++++++++++-------- src/resources/js/pages/Users.js | 50 ++++++++++++++- src/resources/views/admin.blade.php | 14 +++++ src/routes/web.php | 3 + 7 files changed, 134 insertions(+), 46 deletions(-) create mode 100644 src/app/Http/Controllers/AdminV2Controller.php create mode 100644 src/resources/views/admin.blade.php diff --git a/src/app/Http/Controllers/AdminV2Controller.php b/src/app/Http/Controllers/AdminV2Controller.php new file mode 100644 index 000000000..f36f2b136 --- /dev/null +++ b/src/app/Http/Controllers/AdminV2Controller.php @@ -0,0 +1,15 @@ +with('baseUrl', sprintf("%s/adminv2", $request->getBaseUrl())) + ->with('rootUrl', $request->getBaseUrl()); + } +} diff --git a/src/app/Services/SettingsService.php b/src/app/Services/SettingsService.php index 1f00cc1a0..ecb305345 100644 --- a/src/app/Services/SettingsService.php +++ b/src/app/Services/SettingsService.php @@ -11,7 +11,7 @@ class SettingsService { - private string $version = "4.3.5"; + private string $version = "4.4.0"; private array $allowlist = [ 'announce_servicebody_volunteer_routing' => ['description' => '/helpline/announce_servicebody_volunteer_routing' , 'default' => false, 'overridable' => true, 'hidden' => false], 'blocklist' => ['description' => '/general/blocklist' , 'default' => '', 'overridable' => true, 'hidden' => false], diff --git a/src/composer.lock b/src/composer.lock index bb7334a7b..c1e45115d 100644 --- a/src/composer.lock +++ b/src/composer.lock @@ -276,16 +276,16 @@ }, { "name": "dflydev/dot-access-data", - "version": "v3.0.2", + "version": "v3.0.3", "source": { "type": "git", "url": "https://github.com/dflydev/dflydev-dot-access-data.git", - "reference": "f41715465d65213d644d3141a6a93081be5d3549" + "reference": "a23a2bf4f31d3518f3ecb38660c95715dfead60f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/f41715465d65213d644d3141a6a93081be5d3549", - "reference": "f41715465d65213d644d3141a6a93081be5d3549", + "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/a23a2bf4f31d3518f3ecb38660c95715dfead60f", + "reference": "a23a2bf4f31d3518f3ecb38660c95715dfead60f", "shasum": "" }, "require": { @@ -345,9 +345,9 @@ ], "support": { "issues": "https://github.com/dflydev/dflydev-dot-access-data/issues", - "source": "https://github.com/dflydev/dflydev-dot-access-data/tree/v3.0.2" + "source": "https://github.com/dflydev/dflydev-dot-access-data/tree/v3.0.3" }, - "time": "2022-10-27T11:44:00+00:00" + "time": "2024-07-08T12:26:09+00:00" }, { "name": "doctrine/annotations", @@ -1267,16 +1267,16 @@ }, { "name": "laravel/framework", - "version": "v10.48.15", + "version": "v10.48.16", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "1723e038c9ec99b434e5bed9c27f044bd50a4ffb" + "reference": "f9a3a50fae399d75e125b0eea637dda90c99eae7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/1723e038c9ec99b434e5bed9c27f044bd50a4ffb", - "reference": "1723e038c9ec99b434e5bed9c27f044bd50a4ffb", + "url": "https://api.github.com/repos/laravel/framework/zipball/f9a3a50fae399d75e125b0eea637dda90c99eae7", + "reference": "f9a3a50fae399d75e125b0eea637dda90c99eae7", "shasum": "" }, "require": { @@ -1470,7 +1470,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-07-02T18:01:24+00:00" + "time": "2024-07-09T15:25:22+00:00" }, { "name": "laravel/prompts", @@ -6142,16 +6142,16 @@ }, { "name": "zircote/swagger-php", - "version": "4.10.2", + "version": "4.10.3", "source": { "type": "git", "url": "https://github.com/zircote/swagger-php.git", - "reference": "4756339cbfc774149d9fbd1dcd39cda35366dfe3" + "reference": "ad3f913d39b2a4dfb6e59ee4babb35a6b4a2b998" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zircote/swagger-php/zipball/4756339cbfc774149d9fbd1dcd39cda35366dfe3", - "reference": "4756339cbfc774149d9fbd1dcd39cda35366dfe3", + "url": "https://api.github.com/repos/zircote/swagger-php/zipball/ad3f913d39b2a4dfb6e59ee4babb35a6b4a2b998", + "reference": "ad3f913d39b2a4dfb6e59ee4babb35a6b4a2b998", "shasum": "" }, "require": { @@ -6217,9 +6217,9 @@ ], "support": { "issues": "https://github.com/zircote/swagger-php/issues", - "source": "https://github.com/zircote/swagger-php/tree/4.10.2" + "source": "https://github.com/zircote/swagger-php/tree/4.10.3" }, - "time": "2024-07-03T20:49:02+00:00" + "time": "2024-07-04T07:53:11+00:00" } ], "packages-dev": [ diff --git a/src/package-lock.json b/src/package-lock.json index 26782df3f..929abfdeb 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -2846,18 +2846,20 @@ } }, "node_modules/@mui/core-downloads-tracker": { - "version": "5.15.21", - "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.15.21.tgz", - "integrity": "sha512-dp9lXBaJZzJYeJfQY3Ow4Rb49QaCEdkl2KKYscdQHQm6bMJ+l4XPY3Cd9PCeeJTsHPIDJ60lzXbeRgs6sx/rpw==", + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.16.0.tgz", + "integrity": "sha512-8SLffXYPRVpcZx5QzxNE8fytTqzp+IuU3deZbQWg/vSaTlDpR5YVrQ4qQtXTi5cRdhOufV5INylmwlKK+//nPw==", + "license": "MIT", "funding": { "type": "opencollective", "url": "https://opencollective.com/mui-org" } }, "node_modules/@mui/icons-material": { - "version": "5.15.21", - "resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-5.15.21.tgz", - "integrity": "sha512-yqkq1MbdkmX5ZHyvZTBuAaA6RkvoqkoAgwBSx9Oh0L0jAfj9T/Ih/NhMNjkl8PWVSonjfDUkKroBnjRyo/1M9Q==", + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-5.16.0.tgz", + "integrity": "sha512-6ISoOhkp9w5gD0PEW9JklrcbyARDkFWNTBdwXZ1Oy5IGlyu9B0zG0hnUIe4H17IaF1Vgj6C8VI+v4tkSdK0veg==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.23.9" }, @@ -2880,16 +2882,17 @@ } }, "node_modules/@mui/material": { - "version": "5.15.21", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.15.21.tgz", - "integrity": "sha512-nTyCcgduKwHqiuQ/B03EQUa+utSMzn2sQp0QAibsnYe4tvc3zkMbO0amKpl48vhABIY3IvT6w9615BFIgMt0YA==", + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.16.0.tgz", + "integrity": "sha512-DbR1NckTLpjt9Zut9EGQ70th86HfN0BYQgyYro6aXQrNfjzSwe3BJS1AyBQ5mJ7TdL6YVRqohfukxj9JlqZZUg==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.23.9", "@mui/base": "5.0.0-beta.40", - "@mui/core-downloads-tracker": "^5.15.21", - "@mui/system": "^5.15.20", + "@mui/core-downloads-tracker": "^5.16.0", + "@mui/system": "^5.16.0", "@mui/types": "^7.2.14", - "@mui/utils": "^5.15.20", + "@mui/utils": "^5.16.0", "@types/react-transition-group": "^4.4.10", "clsx": "^2.1.0", "csstype": "^3.1.3", @@ -2924,12 +2927,13 @@ } }, "node_modules/@mui/private-theming": { - "version": "5.15.20", - "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.15.20.tgz", - "integrity": "sha512-BK8F94AIqSrnaPYXf2KAOjGZJgWfvqAVQ2gVR3EryvQFtuBnG6RwodxrCvd3B48VuMy6Wsk897+lQMUxJyk+6g==", + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.16.0.tgz", + "integrity": "sha512-sYpubkO1MZOnxNyVOClrPNOTs0MfuRVVnAvCeMaOaXt6GimgQbnUcshYv2pSr6PFj+Mqzdff/FYOBceK8u5QgA==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.23.9", - "@mui/utils": "^5.15.20", + "@mui/utils": "^5.16.0", "prop-types": "^15.8.1" }, "engines": { @@ -2953,6 +2957,7 @@ "version": "5.15.14", "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.15.14.tgz", "integrity": "sha512-RILkuVD8gY6PvjZjqnWhz8fu68dVkqhM5+jYWfB5yhlSQKg+2rHkmEwm75XIeAqI3qwOndK6zELK5H6Zxn4NHw==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.23.9", "@emotion/cache": "^11.11.0", @@ -2981,15 +2986,16 @@ } }, "node_modules/@mui/system": { - "version": "5.15.20", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.15.20.tgz", - "integrity": "sha512-LoMq4IlAAhxzL2VNUDBTQxAb4chnBe8JvRINVNDiMtHE2PiPOoHlhOPutSxEbaL5mkECPVWSv6p8JEV+uykwIA==", + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.16.0.tgz", + "integrity": "sha512-9YbkC2m3+pNumAvubYv+ijLtog6puJ0fJ6rYfzfLCM47pWrw3m+30nXNM8zMgDaKL6vpfWJcCXm+LPaWBpy7sw==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.23.9", - "@mui/private-theming": "^5.15.20", + "@mui/private-theming": "^5.16.0", "@mui/styled-engine": "^5.15.14", "@mui/types": "^7.2.14", - "@mui/utils": "^5.15.20", + "@mui/utils": "^5.16.0", "clsx": "^2.1.0", "csstype": "^3.1.3", "prop-types": "^15.8.1" @@ -3033,9 +3039,10 @@ } }, "node_modules/@mui/utils": { - "version": "5.15.20", - "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.15.20.tgz", - "integrity": "sha512-mAbYx0sovrnpAu1zHc3MDIhPqL8RPVC5W5xcO1b7PiSCJPtckIZmBkp8hefamAvUiAV8gpfMOM6Zb+eSisbI2A==", + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.16.0.tgz", + "integrity": "sha512-kLLi5J1xY+mwtUlMb8Ubdxf4qFAA1+U7WPBvjM/qQ4CIwLCohNb0sHo1oYPufjSIH/Z9+dhVxD7dJlfGjd1AVA==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.23.9", "@types/prop-types": "^15.7.11", @@ -13142,10 +13149,11 @@ "dev": true }, "node_modules/sass": { - "version": "1.77.6", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.77.6.tgz", - "integrity": "sha512-ByXE1oLD79GVq9Ht1PeHWCPMPB8XHpBuz1r85oByKHjZY6qV6rWnQovQzXJXuQ/XyE1Oj3iPk3lo28uzaRA2/Q==", + "version": "1.77.7", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.77.7.tgz", + "integrity": "sha512-9ywH75cO+rLjbrZ6en3Gp8qAMwPGBapFtlsMJoDTkcMU/bSe5a6cjKVUn5Jr4Gzg5GbP3HE8cm+02pLCgcoMow==", "dev": true, + "license": "MIT", "dependencies": { "chokidar": ">=3.0.0 <4.0.0", "immutable": "^4.0.0", diff --git a/src/resources/js/pages/Users.js b/src/resources/js/pages/Users.js index 1cf7452f0..f9f180f43 100644 --- a/src/resources/js/pages/Users.js +++ b/src/resources/js/pages/Users.js @@ -1,6 +1,54 @@ +import React, {useEffect, useState} from "react"; +import {Button, Card, Table, TableBody, TableCell, TableContainer, TableHead, TableRow} from "@mui/material"; + function Users() { + const [loading, setLoading] = useState(false); + const [list, setList] = useState([]); + + const getUsers = async() => { + setLoading(true) + let response = await fetch(`${rootUrl}/api/v1/users`) + let responseData = await response.json() + setList(responseData) + setLoading(false) + } + + useEffect(() => { + getUsers() + }, []) + return ( -

Users

+ !loading && list.length > 0 ? + + + + + Username + Name + Service Bodies + Permissions + Admin + Date Created + + + + {list.map((item) => ( + + + {item.username} + + {item.name} + {item.service_bodies} + {item.permissions} + {item.is_admin} + {item.created_on} + + ))} + +
+
: "Loading..." ) } diff --git a/src/resources/views/admin.blade.php b/src/resources/views/admin.blade.php new file mode 100644 index 000000000..92bb0bc38 --- /dev/null +++ b/src/resources/views/admin.blade.php @@ -0,0 +1,14 @@ + + + + + + + {{ env('APP_NAME') }} + + +
+ + + + diff --git a/src/routes/web.php b/src/routes/web.php index 31f0200fd..095fd9c22 100644 --- a/src/routes/web.php +++ b/src/routes/web.php @@ -14,6 +14,8 @@ Route::post("/admin/login", 'App\Http\Controllers\AdminController@login'); Route::get("/admin/{page}", 'App\Http\Controllers\AdminController@index') ->middleware("authForAdminPortal"); +Route::get("/adminv2{page}", 'App\Http\Controllers\AdminV2Controller@index') + ->where('page', '.*'); Route::get("/bots/getMeetings", 'App\Http\Controllers\BotController@getMeetings'); Route::get("/bots/getServiceBodyCoverage", 'App\Http\Controllers\BotController@getServiceBodyCoverage'); Route::get("/msr/{latitude}/{longitude}", ['uses' => 'App\Http\Controllers\MeetingResultsController@index']) @@ -90,3 +92,4 @@ ->where('ext', $ext); Route::match(array('GET', 'POST'), "/helpline-dialer{ext}", 'App\Http\Controllers\HelplineController@dial') ->where('ext', $ext); +Route::get("/callWidget", 'App\Http\Controllers\CallWidgetController@index');