diff --git a/INSTALL.md b/INSTALL.md index a8d3b6d..c196a72 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -16,9 +16,7 @@ mongo use admin - db.addUser({user: 'rpadmin', pwd: 'password', roles: ['readWriteAnyDatabase', 'userAdminAnyDatabase', 'dbAdminAnyDatabase', 'clusterAdmin']}) - use RootPanel - db.addUser({user: 'rpadmin', pwd: 'password', roles: ['readWrite']}) + db.addUser({user: 'rpadmin', pwd: 'password', roles: ['readWriteAnyDatabase', 'userAdminAnyDatabase', 'dbAdminAnyDatabase']}) vi /etc/mongodb.conf diff --git a/config.coffee b/config.coffee index 50cb17c..a73ac41 100644 --- a/config.coffee +++ b/config.coffee @@ -21,7 +21,7 @@ module.exports = ] plugin: - availablePlugin: ['linux', 'ssh', 'phpfpm', 'mysql', 'nginx', 'memcached'] + availablePlugin: ['linux', 'ssh', 'phpfpm', 'mysql', 'nginx', 'memcached', 'mongodb'] plans: all: @@ -29,7 +29,7 @@ module.exports = t_name: '所有服务(默认)' t_service: '支持所有服务' t_resources: '磁盘: 520MB, 内存: 27MB, 流量: 37GB' - services: ['linux', 'ssh', 'phpfpm', 'mysql', 'nginx', 'memcached'] + services: ['linux', 'ssh', 'phpfpm', 'mysql', 'nginx', 'memcached', 'mongodb'] resources: cpu: 144 storage: 520 diff --git a/plugin/mongodb/API.md b/plugin/mongodb/API.md new file mode 100644 index 0000000..e69de29 diff --git a/plugin/mongodb/action.coffee b/plugin/mongodb/action.coffee new file mode 100644 index 0000000..92d5db3 --- /dev/null +++ b/plugin/mongodb/action.coffee @@ -0,0 +1,5 @@ +{assertInService} = require '../../core/router/middleware' + +module.exports = exports = express.Router() + +exports.use assertInService 'mongodb' diff --git a/plugin/mongodb/index.coffee b/plugin/mongodb/index.coffee new file mode 100644 index 0000000..4aaf55b --- /dev/null +++ b/plugin/mongodb/index.coffee @@ -0,0 +1,13 @@ +action = require './action' +service = require './service' + +module.exports = + name: 'mongodb' + type: 'service' + + action: action + service: service + + panel_widgets: [ + service.widget + ] diff --git a/plugin/mongodb/locale/zh_CN.json b/plugin/mongodb/locale/zh_CN.json new file mode 100644 index 0000000..83885e3 --- /dev/null +++ b/plugin/mongodb/locale/zh_CN.json @@ -0,0 +1,4 @@ +{ + "name": "MongoDB", + "description": "MongoDB 是世界上最流行的非关系型数据库之一" +} diff --git a/plugin/mongodb/service.coffee b/plugin/mongodb/service.coffee new file mode 100644 index 0000000..6cb1d90 --- /dev/null +++ b/plugin/mongodb/service.coffee @@ -0,0 +1,22 @@ +jade = require 'jade' +path = require 'path' +async = require 'async' + +config = require '../../config' + +mAccount = require '../../core/model/account' + +module.exports = + enable: (account, callback) -> + callback() + + delete: (account, callback) -> + callback() + + widget: (account, callback) -> + jade.renderFile path.join(__dirname, 'view/widget.jade'), {}, (err, html) -> + callback html + + preview: (callback) -> + jade.renderFile path.join(__dirname, 'view/preview.jade'), {}, (err, html) -> + callback html diff --git a/plugin/mongodb/view/preview.jade b/plugin/mongodb/view/preview.jade new file mode 100644 index 0000000..3f5c55f --- /dev/null +++ b/plugin/mongodb/view/preview.jade @@ -0,0 +1,2 @@ +header MongoDB +p MongoDB 是世界上最流行的非关系型数据库之一。 diff --git a/plugin/mongodb/view/widget.jade b/plugin/mongodb/view/widget.jade new file mode 100644 index 0000000..49812ab --- /dev/null +++ b/plugin/mongodb/view/widget.jade @@ -0,0 +1,33 @@ +header MongoDB +.col-md-6 + .panel.panel-success + .panel-heading + h3.panel-title 新建数据库 + .panel-body + .input-group#mongodb-create + input.form-control(value='jysperm_') + span.input-group-btn + button.btn.btn-default(type='button') 提交 + .panel.panel-warning + .panel-heading + h3.panel-title 设置 MongoDB 密码 + .panel-body + .input-group#mongodb-input + input.form-control(type='password') + span.input-group-btn + button.btn.btn-default(type='button') 提交 + +.col-md-6 + table(style= 'table-layout: fixed;').table.table-hover + thead + tr + td(style= 'width: 200px;') 数据库 + td 体积 + td + tbody + tr + td(style= 'white-space: nowrap; overflow: hidden;', title= 'jysperm_test') jysperm_test + td 10M + td + button.nginx-remove-btn.btn.btn-danger.btn-xs + span.glyphicon.glyphicon-remove-sign