From 7e7e88e91d3624920ff5906ea41623766c90537a Mon Sep 17 00:00:00 2001 From: Seven Du Date: Thu, 29 Mar 2018 17:39:39 +0800 Subject: [PATCH 01/10] fix(Admin): Fix shows incorrect Laravel version number --- app/Http/Controllers/Admin/SiteController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Admin/SiteController.php b/app/Http/Controllers/Admin/SiteController.php index 9ba2ce17f..c43d1004c 100644 --- a/app/Http/Controllers/Admin/SiteController.php +++ b/app/Http/Controllers/Admin/SiteController.php @@ -442,7 +442,7 @@ public function server(ResponseFactory $response) 'agent' => $_SERVER['HTTP_USER_AGENT'], 'protocol' => $_SERVER['SERVER_PROTOCOL'], 'method' => $_SERVER['REQUEST_METHOD'], - 'laravel_version' => app()::VERSION, + 'laravel_version' => app()->getLaravelVersion(), 'max_upload_size' => ini_get('upload_max_filesize'), 'execute_time' => ini_get('max_execution_time').'秒', 'server_date' => date('Y年n月j日 H:i:s'), From 863d1b1e762fd545a17034ae6e38841cd8205e04 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Thu, 29 Mar 2018 18:36:14 +0800 Subject: [PATCH 02/10] feat(Admin): Add web clients settings routes --- .../Admin/WebClientsController.php | 69 +++++++++++++++++++ .../Requests/Admin/UpdateWebClientRequest.php | 55 +++++++++++++++ routes/admin.php | 4 ++ 3 files changed, 128 insertions(+) create mode 100644 app/Http/Controllers/Admin/WebClientsController.php create mode 100644 app/Http/Requests/Admin/UpdateWebClientRequest.php diff --git a/app/Http/Controllers/Admin/WebClientsController.php b/app/Http/Controllers/Admin/WebClientsController.php new file mode 100644 index 000000000..309b19dfa --- /dev/null +++ b/app/Http/Controllers/Admin/WebClientsController.php @@ -0,0 +1,69 @@ + | + * | Homepage: www.thinksns.com | + * +----------------------------------------------------------------------+ + */ + +namespace Zhiyi\Plus\Http\Controllers\Admin; + +use Illuminate\Http\Response; +use Illuminate\Http\JsonResponse; +use Zhiyi\Plus\Support\Configuration; +use Zhiyi\Plus\Http\Requests\Admin\UpdateWebClientRequest; + +class WebClientsController +{ + /** + * Fetch web clients setting data. + * + * @return \Illuminate\Http\JsonResponse + * @author Seven Du + */ + public function fetch(): JsonResponse + { + return response()->json([ + 'web' => [ + 'open' => (bool) config('http.web.open', false), + 'url' => (string) config('http.web.url', ''), + ], + 'spa' => [ + 'open' => (bool) config('http.spa.open', false), + 'url' => (string) config('http.spa.url', ''), + ], + ], 200); + } + + /** + * Update web clients settings. + * + * @param \Zhiyi\Plus\Http\Requests\Admin\UpdateWebClientRequest $request + * @param \Zhiyi\Plus\Support\Configuration $config + * @return \Illuminate\Http\Response + * @author Seven Du + */ + public function update(UpdateWebClientRequest $request, Configuration $config): Response + { + $config->set([ + 'http.web.open' => (bool) $request->input('web.open'), + 'http.web.url' => $request->input('web.url'), + 'http.spa.open' => (bool) $request->input('spa.open'), + 'http.spa.url' => $request->input('spa.url'), + ]); + + return response('', 204); + } +} diff --git a/app/Http/Requests/Admin/UpdateWebClientRequest.php b/app/Http/Requests/Admin/UpdateWebClientRequest.php new file mode 100644 index 000000000..ce095e243 --- /dev/null +++ b/app/Http/Requests/Admin/UpdateWebClientRequest.php @@ -0,0 +1,55 @@ + | + * | Homepage: www.thinksns.com | + * +----------------------------------------------------------------------+ + */ + +namespace Zhiyi\Plus\Http\Requests\Admin; + +use Illuminate\Foundation\Http\FormRequest; + +class UpdateWebClientRequest extends FormRequest +{ + /** + * Determine if the user is authorized to make this request. + * + * @return bool + * @author Seven Du + */ + public function authorize(): bool + { + return true; + } + + /** + * Get the validation rules that apply to the request. + * + * @return array + * @author Seven Du + */ + public function rules(): array + { + return [ + 'web' => 'array', + 'web.url' => 'string|url', + 'web.open' => 'boolean', + 'spa' => 'array', + 'spa.url' => 'string|url', + 'spa.open' => 'boolean', + ]; + } +} diff --git a/routes/admin.php b/routes/admin.php index 4a5bab143..08567e7ab 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -155,6 +155,10 @@ */ $route->delete('/{sensitive}', 'SensitiveController@destroy'); }); + + // web clients + $route->get('settings/web-clients', 'WebClientsController@fetch'); + $route->patch('settings/web-clients', 'WebClientsController@update'); }); Route::middleware('auth:web') From 31220668da1aca408883e631bca4b7d56e478265 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Thu, 29 Mar 2018 18:50:19 +0800 Subject: [PATCH 03/10] feat(Admin): Add web client manager --- .../Requests/Admin/UpdateWebClientRequest.php | 8 +- package.json | 5 +- public/assets/mix-manifest.json | 92 ++++++++++++- .../assets/admin/component/setting/Base.vue | 8 ++ .../components/modules/setting/WebClients.vue | 127 ++++++++++++++++++ resources/assets/admin/index.js | 4 + 6 files changed, 237 insertions(+), 7 deletions(-) create mode 100644 resources/assets/admin/components/modules/setting/WebClients.vue diff --git a/app/Http/Requests/Admin/UpdateWebClientRequest.php b/app/Http/Requests/Admin/UpdateWebClientRequest.php index ce095e243..5616487b1 100644 --- a/app/Http/Requests/Admin/UpdateWebClientRequest.php +++ b/app/Http/Requests/Admin/UpdateWebClientRequest.php @@ -45,11 +45,11 @@ public function rules(): array { return [ 'web' => 'array', - 'web.url' => 'string|url', - 'web.open' => 'boolean', + 'web.url' => 'nullable|string|url', + 'web.open' => 'nullable|boolean', 'spa' => 'array', - 'spa.url' => 'string|url', - 'spa.open' => 'boolean', + 'spa.url' => 'nullable|string|url', + 'spa.open' => 'nullable|boolean', ]; } } diff --git a/package.json b/package.json index 907944a9e..0668ab2af 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,8 @@ "markdown-it": "^8.4.0", "opencollective": "^1.0.3", "plus-message-bundle": "^1.0", - "vue": "^2.5.13", + "simkit-bootstrap-ui-kit": "^0.0.3", + "vue": "^2.5.16", "vue-echarts-v3": "^1.0.18", "vue-router": "^3.0.1", "vuex": "^3.0.1", @@ -41,4 +42,4 @@ "url": "https://opencollective.com/thinksns-plus", "logo": "https://opencollective.com/thinksns-plus/logo.txt" } -} \ No newline at end of file +} diff --git a/public/assets/mix-manifest.json b/public/assets/mix-manifest.json index 68e5c2b22..2c97f1b16 100644 --- a/public/assets/mix-manifest.json +++ b/public/assets/mix-manifest.json @@ -3,5 +3,95 @@ "/js/installer.js": "/js/installer.js", "/js/bootstrap.js": "/js/bootstrap.js", "/css/bootstrap.css": "/css/bootstrap.css", - "/installer/logo.png": "/installer/logo.png" + "/installer/logo.png": "/installer/logo.png", + "/0.4f53e8de84109e15cabc.hot-update.js": "/0.4f53e8de84109e15cabc.hot-update.js", + "/0.a30e9ffa59184c8df19d.hot-update.js": "/0.a30e9ffa59184c8df19d.hot-update.js", + "/0.b9bb586d6e4fd97c0e37.hot-update.js": "/0.b9bb586d6e4fd97c0e37.hot-update.js", + "/0.2fa4bb74f905df5f370d.hot-update.js": "/0.2fa4bb74f905df5f370d.hot-update.js", + "/0.71fdc00c21730073477e.hot-update.js": "/0.71fdc00c21730073477e.hot-update.js", + "/0.b7cf7829d525b1ba507d.hot-update.js": "/0.b7cf7829d525b1ba507d.hot-update.js", + "/0.080246d4a4394bfc2ca8.hot-update.js": "/0.080246d4a4394bfc2ca8.hot-update.js", + "/0.5a71860e681ca95f7cdc.hot-update.js": "/0.5a71860e681ca95f7cdc.hot-update.js", + "/0.5e0e4a6859e1d33e52c4.hot-update.js": "/0.5e0e4a6859e1d33e52c4.hot-update.js", + "/0.d113f116a5a6959d1df0.hot-update.js": "/0.d113f116a5a6959d1df0.hot-update.js", + "/0.21e660ef7e322d6595c0.hot-update.js": "/0.21e660ef7e322d6595c0.hot-update.js", + "/0.4f1017cc078bbf243160.hot-update.js": "/0.4f1017cc078bbf243160.hot-update.js", + "/0.252e048e8da464b2a45f.hot-update.js": "/0.252e048e8da464b2a45f.hot-update.js", + "/0.22ffeac5fe58f98dd937.hot-update.js": "/0.22ffeac5fe58f98dd937.hot-update.js", + "/0.40f06741e23c6aee465d.hot-update.js": "/0.40f06741e23c6aee465d.hot-update.js", + "/0.609c57e4641a7384a90e.hot-update.js": "/0.609c57e4641a7384a90e.hot-update.js", + "/0.bea6104b2ec4d1e9cbc4.hot-update.js": "/0.bea6104b2ec4d1e9cbc4.hot-update.js", + "/0.c7fd9f2f813435530cee.hot-update.js": "/0.c7fd9f2f813435530cee.hot-update.js", + "/0.f15bf279393cbcfb8b64.hot-update.js": "/0.f15bf279393cbcfb8b64.hot-update.js", + "/0.ed195030b08f2936de99.hot-update.js": "/0.ed195030b08f2936de99.hot-update.js", + "/0.c721034fbd026fb5ad43.hot-update.js": "/0.c721034fbd026fb5ad43.hot-update.js", + "/0.4bdfad40ed26bf8c5c4e.hot-update.js": "/0.4bdfad40ed26bf8c5c4e.hot-update.js", + "/0.022c5563331ec506682e.hot-update.js": "/0.022c5563331ec506682e.hot-update.js", + "/0.3fc607bc09fdb443fe9f.hot-update.js": "/0.3fc607bc09fdb443fe9f.hot-update.js", + "/0.07a514262aa9bfc73bd4.hot-update.js": "/0.07a514262aa9bfc73bd4.hot-update.js", + "/0.9a45322427a0b546fe67.hot-update.js": "/0.9a45322427a0b546fe67.hot-update.js", + "/0.667f0dbc6be2640ce04f.hot-update.js": "/0.667f0dbc6be2640ce04f.hot-update.js", + "/0.22ad2a5d41c94630e431.hot-update.js": "/0.22ad2a5d41c94630e431.hot-update.js", + "/0.d2d66922183bd24723a2.hot-update.js": "/0.d2d66922183bd24723a2.hot-update.js", + "/0.14c64ce49632781ea8b9.hot-update.js": "/0.14c64ce49632781ea8b9.hot-update.js", + "/0.5148857a613451bdc551.hot-update.js": "/0.5148857a613451bdc551.hot-update.js", + "/0.c0d284539fb80ede4e78.hot-update.js": "/0.c0d284539fb80ede4e78.hot-update.js", + "/0.10eaa6c78de38c746faf.hot-update.js": "/0.10eaa6c78de38c746faf.hot-update.js", + "/0.eff5dab9f950aeccc79b.hot-update.js": "/0.eff5dab9f950aeccc79b.hot-update.js", + "/0.601326bcdb7c9be31948.hot-update.js": "/0.601326bcdb7c9be31948.hot-update.js", + "/0.021c9f5e6e65efc645ce.hot-update.js": "/0.021c9f5e6e65efc645ce.hot-update.js", + "/0.ebf9abfa02fbf3574347.hot-update.js": "/0.ebf9abfa02fbf3574347.hot-update.js", + "/0.1066aa0784544ec1b6ff.hot-update.js": "/0.1066aa0784544ec1b6ff.hot-update.js", + "/0.e146510c9da39ca4237f.hot-update.js": "/0.e146510c9da39ca4237f.hot-update.js", + "/0.623e3e579e047f91b341.hot-update.js": "/0.623e3e579e047f91b341.hot-update.js", + "/0.e00e2717900f9da88c71.hot-update.js": "/0.e00e2717900f9da88c71.hot-update.js", + "/0.ae6686a4ca4709cce1af.hot-update.js": "/0.ae6686a4ca4709cce1af.hot-update.js", + "/0.39725d9c108ac388a292.hot-update.js": "/0.39725d9c108ac388a292.hot-update.js", + "/0.ab76bc9d042685a245ac.hot-update.js": "/0.ab76bc9d042685a245ac.hot-update.js", + "/0.e4723bb9e1c6c4ff2fdc.hot-update.js": "/0.e4723bb9e1c6c4ff2fdc.hot-update.js", + "/0.612af90a564dbe1db21a.hot-update.js": "/0.612af90a564dbe1db21a.hot-update.js", + "/0.c39c5abd8d7a05aa089c.hot-update.js": "/0.c39c5abd8d7a05aa089c.hot-update.js", + "/0.273111ec738e6a688871.hot-update.js": "/0.273111ec738e6a688871.hot-update.js", + "/0.3098e11d334c75cdfa38.hot-update.js": "/0.3098e11d334c75cdfa38.hot-update.js", + "/0.f2c9a959f198bf0ee9f8.hot-update.js": "/0.f2c9a959f198bf0ee9f8.hot-update.js", + "/0.c627165b2ad97fef3ebd.hot-update.js": "/0.c627165b2ad97fef3ebd.hot-update.js", + "/0.cea78a4a125b15ccb6d3.hot-update.js": "/0.cea78a4a125b15ccb6d3.hot-update.js", + "/0.220f54d91d3ea5427ace.hot-update.js": "/0.220f54d91d3ea5427ace.hot-update.js", + "/0.1181f7af6ce21411f516.hot-update.js": "/0.1181f7af6ce21411f516.hot-update.js", + "/0.ef87b4b97c188dda7175.hot-update.js": "/0.ef87b4b97c188dda7175.hot-update.js", + "/0.54283ce5c8b45b0c8fe0.hot-update.js": "/0.54283ce5c8b45b0c8fe0.hot-update.js", + "/0.28ba04cf6820348ed062.hot-update.js": "/0.28ba04cf6820348ed062.hot-update.js", + "/0.6087ce33d47abe5847f0.hot-update.js": "/0.6087ce33d47abe5847f0.hot-update.js", + "/0.28734f8131fc31ea9389.hot-update.js": "/0.28734f8131fc31ea9389.hot-update.js", + "/0.19ebe008455b7b678806.hot-update.js": "/0.19ebe008455b7b678806.hot-update.js", + "/0.50ac3448ab4b037e77a2.hot-update.js": "/0.50ac3448ab4b037e77a2.hot-update.js", + "/0.36813bf5698a6ae5411f.hot-update.js": "/0.36813bf5698a6ae5411f.hot-update.js", + "/0.bcc23db36790ad68f4c3.hot-update.js": "/0.bcc23db36790ad68f4c3.hot-update.js", + "/0.1e2d01d613a12e12e4e2.hot-update.js": "/0.1e2d01d613a12e12e4e2.hot-update.js", + "/0.7fce5021f5afd873167b.hot-update.js": "/0.7fce5021f5afd873167b.hot-update.js", + "/0.edf47907105fec3535a3.hot-update.js": "/0.edf47907105fec3535a3.hot-update.js", + "/0.0709c40daea8ef33918d.hot-update.js": "/0.0709c40daea8ef33918d.hot-update.js", + "/0.75527b4aba85c6fc1d5b.hot-update.js": "/0.75527b4aba85c6fc1d5b.hot-update.js", + "/0.2915e4a235c44de2fe48.hot-update.js": "/0.2915e4a235c44de2fe48.hot-update.js", + "/0.a776a5451592954ebea5.hot-update.js": "/0.a776a5451592954ebea5.hot-update.js", + "/0.b14b8a0705ae8f4097d1.hot-update.js": "/0.b14b8a0705ae8f4097d1.hot-update.js", + "/0.404b820a1c31c2ffc955.hot-update.js": "/0.404b820a1c31c2ffc955.hot-update.js", + "/0.0918481f4859742474f5.hot-update.js": "/0.0918481f4859742474f5.hot-update.js", + "/0.ce817f0ff365ccfbe6d1.hot-update.js": "/0.ce817f0ff365ccfbe6d1.hot-update.js", + "/0.708de67c7130776fc256.hot-update.js": "/0.708de67c7130776fc256.hot-update.js", + "/0.0a039315a996f6df3c6e.hot-update.js": "/0.0a039315a996f6df3c6e.hot-update.js", + "/0.606569d2cfef032e3b28.hot-update.js": "/0.606569d2cfef032e3b28.hot-update.js", + "/0.61ecfe3c315b486a6f68.hot-update.js": "/0.61ecfe3c315b486a6f68.hot-update.js", + "/0.e2f01ff6091016570ada.hot-update.js": "/0.e2f01ff6091016570ada.hot-update.js", + "/0.164dd5727a791f52f63a.hot-update.js": "/0.164dd5727a791f52f63a.hot-update.js", + "/0.587ebd5c71f3b10dfb5a.hot-update.js": "/0.587ebd5c71f3b10dfb5a.hot-update.js", + "/0.4078385e1e6232d84285.hot-update.js": "/0.4078385e1e6232d84285.hot-update.js", + "/0.e3ae50f54fc4c98f2771.hot-update.js": "/0.e3ae50f54fc4c98f2771.hot-update.js", + "/0.205021b09489193a6952.hot-update.js": "/0.205021b09489193a6952.hot-update.js", + "/0.4eda6e49e7b605ac1e5d.hot-update.js": "/0.4eda6e49e7b605ac1e5d.hot-update.js", + "/0.f3de8363e3dec2d00572.hot-update.js": "/0.f3de8363e3dec2d00572.hot-update.js", + "/0.1998bae23f65fc0aab8b.hot-update.js": "/0.1998bae23f65fc0aab8b.hot-update.js", + "/0.d6785ea93bd712a8ee60.hot-update.js": "/0.d6785ea93bd712a8ee60.hot-update.js", + "/0.8a11f7363fa1e852a37d.hot-update.js": "/0.8a11f7363fa1e852a37d.hot-update.js", + "/0.329b713ed6b114d06e05.hot-update.js": "/0.329b713ed6b114d06e05.hot-update.js" } \ No newline at end of file diff --git a/resources/assets/admin/component/setting/Base.vue b/resources/assets/admin/component/setting/Base.vue index d3768fd22..6ec4f843a 100644 --- a/resources/assets/admin/component/setting/Base.vue +++ b/resources/assets/admin/component/setting/Base.vue @@ -78,14 +78,22 @@ + + + + diff --git a/resources/assets/admin/index.js b/resources/assets/admin/index.js index 9b9c73806..338123b1c 100644 --- a/resources/assets/admin/index.js +++ b/resources/assets/admin/index.js @@ -3,6 +3,7 @@ import { sync } from 'vuex-router-sync'; import App from './App.vue'; import store from './store'; import router from './router'; +import BootstrapKit from 'simkit-bootstrap-ui-kit'; import './component/commons'; // Filters @@ -27,6 +28,9 @@ import './components/commons'; // this registers `store.state.route` sync(store, router); +// Using `slimkit-bootstrap-ui-kit` package. +Vue.use(BootstrapKit); + // create the app instance. // here we inject the router and store to all child components, // making them available everywhere as `this.$router` and `this.$store`. From 64e0194aa650d9b26f7a13edb7b8bf04396a4282 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Fri, 30 Mar 2018 11:26:44 +0800 Subject: [PATCH 04/10] chore: Add global alert module --- resources/assets/admin/component/Home.vue | 5 ++++- resources/assets/admin/components/modules/Alert.vue | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/assets/admin/component/Home.vue b/resources/assets/admin/component/Home.vue index af4ba8d53..afc29fe8b 100644 --- a/resources/assets/admin/component/Home.vue +++ b/resources/assets/admin/component/Home.vue @@ -75,6 +75,7 @@ $lefyNavWidth: 240px; + @@ -86,6 +87,7 @@ import DefaultAvatar from '../icons/default-avatar'; // components. import Nav from './Nav'; +import Alert from '../components/modules/Alert'; const home = { computed: { @@ -98,7 +100,8 @@ const home = { }, components: { 'system-nav': Nav, - 'default-avatar': DefaultAvatar + 'default-avatar': DefaultAvatar, + [Alert.name]: Alert, } }; diff --git a/resources/assets/admin/components/modules/Alert.vue b/resources/assets/admin/components/modules/Alert.vue index a2a7ffa45..a8bc33886 100644 --- a/resources/assets/admin/components/modules/Alert.vue +++ b/resources/assets/admin/components/modules/Alert.vue @@ -4,6 +4,7 @@ top:0; width:100%; z-index:9999; + border-radius: 0; }