From 30e4665beb1a9b3ed159b6997b6dcfdac9936a2d Mon Sep 17 00:00:00 2001 From: OldHawk Date: Fri, 26 Jan 2018 19:27:58 +0800 Subject: [PATCH] feat(core): admin system control panel client side routs, policy, controllers, services, menu --- config/env/torrents.js | 3 ++ modules/core/client/app/trans-string-en.js | 8 +++++ modules/core/client/app/trans-string-zh.js | 8 +++++ .../config/systems-admin.client.menu.js | 20 ++++++++++++ .../config/systems-admin.client.routes.js | 32 +++++++++++++++++++ .../ststems-config.client.controller.js | 25 +++++++++++++++ modules/systems/client/less/systems.less | 25 +++++++++++++++ .../client/services/systems.client.service.js | 23 +++++++++++++ .../systems/client/systems.client.module.js | 9 ++++++ .../client/views/config.client.view.html | 14 ++++++++ .../client/views/panel.client.view.html | 13 ++++++++ .../client/views/template.client.view.html | 11 +++++++ .../admin/torrents-admin.client.menu.js | 3 +- 13 files changed, 192 insertions(+), 2 deletions(-) create mode 100644 modules/systems/client/config/systems-admin.client.menu.js create mode 100644 modules/systems/client/config/systems-admin.client.routes.js create mode 100644 modules/systems/client/controllers/ststems-config.client.controller.js create mode 100644 modules/systems/client/less/systems.less create mode 100644 modules/systems/client/services/systems.client.service.js create mode 100644 modules/systems/client/systems.client.module.js create mode 100644 modules/systems/client/views/config.client.view.html create mode 100644 modules/systems/client/views/panel.client.view.html create mode 100644 modules/systems/client/views/template.client.view.html diff --git a/config/env/torrents.js b/config/env/torrents.js index 4320590c..0292a0fa 100644 --- a/config/env/torrents.js +++ b/config/env/torrents.js @@ -1,6 +1,8 @@ 'use strict'; module.exports = { + + //[!config_content]// meanTorrentConfig: { /** * @app @@ -1218,4 +1220,5 @@ module.exports = { ] } } + //[!config_content]// }; diff --git a/modules/core/client/app/trans-string-en.js b/modules/core/client/app/trans-string-en.js index 47d3409c..4ea0e074 100644 --- a/modules/core/client/app/trans-string-en.js +++ b/modules/core/client/app/trans-string-en.js @@ -33,6 +33,7 @@ MENU_ADMIN_MESSAGES: 'System Messages', MENU_ADMIN_TRACE: 'System Traces', MENU_ADMIN_FORUMS_CONFIGURE: 'Forums Configure', + MENU_ADMIN_SYSTEMS: 'System control panel', MENU_USERS_ADMIN: 'Manage User', MENU_UPLOAD: 'Upload', MENU_FORUMS: 'Forums', @@ -223,6 +224,7 @@ ADMIN_FORUMS_MANAGEMENT: 'Forums Management', ADMIN_OFFICIAL_INVITATION: 'Official invitations', ADMIN_BACKUP: 'System Backup Files Manager', + ADMIN_SYSTEMS: 'System Control Panel', PASSWORD_FORGOT: 'Password forgot', PASSWORD_RESET: 'Password reset', MESSAGES_BOX: 'Message Box', @@ -1254,6 +1256,12 @@ PAGE_NOT_FOUND: 'Page Or Resources Not Found' }, + //systems control panel + SYSTEMS: { + TORRENTS_CONFIG: 'System configure', + TEMPLATE_EDIT: 'Template editor' + }, + /////////////////////////resources tag fields/////////////////////////////////// RESOURCESTAGS: { TYPE: { diff --git a/modules/core/client/app/trans-string-zh.js b/modules/core/client/app/trans-string-zh.js index 61a5deca..3960a992 100644 --- a/modules/core/client/app/trans-string-zh.js +++ b/modules/core/client/app/trans-string-zh.js @@ -33,6 +33,7 @@ MENU_ADMIN_MESSAGES: '系统消息', MENU_ADMIN_TRACE: '系统日志', MENU_ADMIN_FORUMS_CONFIGURE: '论坛配置管理', + MENU_ADMIN_SYSTEMS: '系统控制面板', MENU_USERS_ADMIN: '用户管理', MENU_UPLOAD: '发布', MENU_FORUMS: '论坛', @@ -223,6 +224,7 @@ ADMIN_FORUMS_MANAGEMENT: '论坛管理', ADMIN_OFFICIAL_INVITATION: '官方邀请', ADMIN_BACKUP: '系统备份文件管理', + ADMIN_SYSTEMS: '系统控制面板', PASSWORD_FORGOT: '找回密码', PASSWORD_RESET: '重设密码', MESSAGES_BOX: '站内消息', @@ -1254,6 +1256,12 @@ PAGE_NOT_FOUND: '没有找到页面或资源' }, + //systems control panel + SYSTEMS: { + TORRENTS_CONFIG: '系统配置调整', + TEMPLATE_EDIT: '模板在线编辑' + }, + /////////////////////////resources tag fields/////////////////////////////////// RESOURCESTAGS: { TYPE: { diff --git a/modules/systems/client/config/systems-admin.client.menu.js b/modules/systems/client/config/systems-admin.client.menu.js new file mode 100644 index 00000000..18c8429f --- /dev/null +++ b/modules/systems/client/config/systems-admin.client.menu.js @@ -0,0 +1,20 @@ +(function () { + 'use strict'; + + // Configuring the Articles Admin module + angular + .module('systems.admin') + .run(menuConfig); + + menuConfig.$inject = ['menuService']; + + function menuConfig(menuService) { + menuService.addSubMenuItem('topbar', 'admin', { + title: 'MENU_ADMIN_SYSTEMS', + state: 'admin.systems.config', + position: 1000, + roles: ['admin'], + divider: true + }); + } +}()); diff --git a/modules/systems/client/config/systems-admin.client.routes.js b/modules/systems/client/config/systems-admin.client.routes.js new file mode 100644 index 00000000..d26cc8ca --- /dev/null +++ b/modules/systems/client/config/systems-admin.client.routes.js @@ -0,0 +1,32 @@ +(function () { + 'use strict'; + + // Setting up route + angular + .module('systems.admin.routes') + .config(routeConfig); + + routeConfig.$inject = ['$stateProvider']; + + function routeConfig($stateProvider) { + $stateProvider + .state('admin.systems', { + url: '/systems', + abstract: true, + templateUrl: '/modules/systems/client/views/panel.client.view.html', + data: { + pageTitle: 'PAGETITLE.ADMIN_SYSTEMS', + roles: ['admin'] + } + }) + .state('admin.systems.config', { + url: '/config', + templateUrl: '/modules/systems/client/views/config.client.view.html' + }) + .state('admin.systems.template', { + url: '/template', + templateUrl: '/modules/systems/client/views/template.client.view.html' + }); + } +}()); + diff --git a/modules/systems/client/controllers/ststems-config.client.controller.js b/modules/systems/client/controllers/ststems-config.client.controller.js new file mode 100644 index 00000000..8ebf3d64 --- /dev/null +++ b/modules/systems/client/controllers/ststems-config.client.controller.js @@ -0,0 +1,25 @@ +(function () { + 'use strict'; + + angular + .module('systems') + .controller('SystemConfigController', SystemConfigController); + + SystemConfigController.$inject = ['$scope', '$state', '$timeout', '$translate', 'Authentication', 'SystemsService']; + + function SystemConfigController($scope, $state, $timeout, $translate, Authentication, SystemsService) { + var vm = this; + vm.user = Authentication.user; + + /** + * getConfigFile + */ + vm.getConfigFile = function () { + SystemsService.getSystemConfig(function (res) { + vm.systemConfigContent = res.configContent; + }, function (err) { + + }); + }; + } +}()); diff --git a/modules/systems/client/less/systems.less b/modules/systems/client/less/systems.less new file mode 100644 index 00000000..786423e0 --- /dev/null +++ b/modules/systems/client/less/systems.less @@ -0,0 +1,25 @@ +@import (reference) "../../../core/client/less/mt-var.less"; + +.system-panel { + .panel-heading { + font-size: 18px; + font-weight: 500; + small { + color: #888; + font-weight: 400; + } + } + .panel-desc { + border-bottom: solid 1px #ddd; + background-color: #fafbfc; + height: 100px; + } + .panel-body { + padding: 5px; + .config-content { + min-height: 400px; + max-height: 800px; + resize: vertical; + } + } +} \ No newline at end of file diff --git a/modules/systems/client/services/systems.client.service.js b/modules/systems/client/services/systems.client.service.js new file mode 100644 index 00000000..1739ad09 --- /dev/null +++ b/modules/systems/client/services/systems.client.service.js @@ -0,0 +1,23 @@ +(function () { + 'use strict'; + + angular + .module('systems.services') + .factory('SystemsService', SystemsService); + + SystemsService.$inject = ['$resource']; + + function SystemsService($resource) { + return $resource('/api/systems/:systemId', { + requestId: '@_id' + }, { + update: { + method: 'PUT' + }, + getSystemConfig: { + method: 'GET', + url: '/api/systems/systemConfig' + } + }); + } +}()); diff --git a/modules/systems/client/systems.client.module.js b/modules/systems/client/systems.client.module.js new file mode 100644 index 00000000..cedf52cc --- /dev/null +++ b/modules/systems/client/systems.client.module.js @@ -0,0 +1,9 @@ +(function (app) { + 'use strict'; + + app.registerModule('systems', ['core']);// The core module is required for special route handling; see /core/client/config/core.client.routes + app.registerModule('systems.admin', ['core.admin']); + app.registerModule('systems.admin.routes', ['core.admin.routes']); + app.registerModule('systems.services'); + app.registerModule('systems.routes', ['ui.router', 'core.routes', 'systems.services']); +}(ApplicationConfiguration)); diff --git a/modules/systems/client/views/config.client.view.html b/modules/systems/client/views/config.client.view.html new file mode 100644 index 00000000..3d865f08 --- /dev/null +++ b/modules/systems/client/views/config.client.view.html @@ -0,0 +1,14 @@ +
+
{{'SYSTEMS.TORRENTS_CONFIG' | translate}} - /config/env/torrent.js
+
+ +
+
+ +
+ +
\ No newline at end of file diff --git a/modules/systems/client/views/panel.client.view.html b/modules/systems/client/views/panel.client.view.html new file mode 100644 index 00000000..86b0a5ba --- /dev/null +++ b/modules/systems/client/views/panel.client.view.html @@ -0,0 +1,13 @@ +
+ +
diff --git a/modules/systems/client/views/template.client.view.html b/modules/systems/client/views/template.client.view.html new file mode 100644 index 00000000..27fef6b9 --- /dev/null +++ b/modules/systems/client/views/template.client.view.html @@ -0,0 +1,11 @@ +
+
+ {{'SYSTEMS.TEMPLATE_EDIT' | translate}} +
+
+ +
+
+

...

+
+
\ No newline at end of file diff --git a/modules/torrents/client/config/admin/torrents-admin.client.menu.js b/modules/torrents/client/config/admin/torrents-admin.client.menu.js index ff0d1566..152dd894 100644 --- a/modules/torrents/client/config/admin/torrents-admin.client.menu.js +++ b/modules/torrents/client/config/admin/torrents-admin.client.menu.js @@ -24,8 +24,7 @@ menuService.addSubMenuItem('topbar', 'admin', { title: 'MENU_TORRENTS_ADMIN_EDAU', state: 'admin.announce', - position: 1000, - divider: true + position: 60 }); } }());