Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
-布谷鸟-
nosqlclient
提交
0a8d7b8e
N
nosqlclient
项目概览
-布谷鸟-
/
nosqlclient
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
nosqlclient
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0a8d7b8e
编写于
3月 27, 2017
作者:
R
rsercano
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
email subscribe
上级
56849e10
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
61 addition
and
2 deletion
+61
-2
.meteor/packages
.meteor/packages
+1
-0
.meteor/versions
.meteor/versions
+1
-0
client/imports/views/pages/database_stats/database_stats.html
...nt/imports/views/pages/database_stats/database_stats.html
+18
-1
client/imports/views/pages/database_stats/database_stats.js
client/imports/views/pages/database_stats/database_stats.js
+19
-0
server/imports/internal/internal_methods.js
server/imports/internal/internal_methods.js
+21
-0
server/imports/internal/startup.js
server/imports/internal/startup.js
+1
-1
未找到文件。
.meteor/packages
浏览文件 @
0a8d7b8e
...
...
@@ -33,3 +33,4 @@ kadira:flow-router
kadira:blaze-layout
arillo:flow-router-helpers
reactive-var@1.0.11
universe:mailchimp-v3-api
.meteor/versions
浏览文件 @
0a8d7b8e
...
...
@@ -80,6 +80,7 @@ tracker@1.1.2
twbs:bootstrap@3.3.6
ui@1.0.12
underscore@1.0.10
universe:mailchimp-v3-api@1.0.2
url@1.1.0
webapp@1.3.14
webapp-hashing@1.0.9
...
...
client/imports/views/pages/database_stats/database_stats.html
浏览文件 @
0a8d7b8e
...
...
@@ -220,10 +220,27 @@
Welcome to Mongoclient world !
</h1>
<small>
You can connect a new database by pressing
<strong>
Connect
</strong>
button.
<p>
You can connect a new database by pressing
<strong>
Connect
</strong>
button.
</p>
<p>
Subscribe to Mongoclient Newsletter by filling your e-mail address to below input,
and pressing
<b>
Subscribe
</b>
</p>
</small>
<br/>
<div
class=
"row"
>
<div
class=
"col-lg-offset-4 col-lg-4"
>
<input
id=
"txtEmailToSubscribe"
type=
"email"
placeholder=
"E-mail, don't worry we hate spam !"
class=
"form-control required"
/>
</div>
</div>
<br/>
<button
id=
"btnSubscribe"
type=
"button"
class=
"btn btn-primary ladda-button"
data-style=
"contract"
>
Subscribe
</button>
</div>
</div>
</div>
...
...
client/imports/views/pages/database_stats/database_stats.js
浏览文件 @
0a8d7b8e
...
...
@@ -14,6 +14,8 @@ require('datatables.net-buttons-bs')(window, $);
require
(
'
datatables.net-responsive-bs
'
)(
window
,
$
);
require
(
'
bootstrap-filestyle
'
);
const
toastr
=
require
(
'
toastr
'
);
const
Ladda
=
require
(
'
ladda
'
);
/**
* Created by RSercan on 26.12.2015.
*/
...
...
@@ -634,6 +636,23 @@ const initMemoryChart = function (data, text) {
}
};
Template
.
databaseStats
.
events
({
'
click #btnSubscribe
'
(){
Ladda
.
create
(
document
.
querySelector
(
'
#btnSubscribe
'
)).
start
();
Meteor
.
call
(
"
handleSubscriber
"
,
$
(
'
#txtEmailToSubscribe
'
).
val
(),
function
(
err
)
{
if
(
err
)
{
toastr
.
error
(
"
Failed:
"
+
err
.
message
);
}
else
{
toastr
.
success
(
"
Thank you for subscription !
"
);
}
Ladda
.
stopAll
();
});
}
});
Template
.
databaseStats
.
onRendered
(
function
()
{
let
settings
=
this
.
subscribe
(
'
settings
'
);
let
connections
=
this
.
subscribe
(
'
connections
'
);
...
...
server/imports/internal/internal_methods.js
浏览文件 @
0a8d7b8e
...
...
@@ -7,6 +7,7 @@ import {QueryHistory} from "/lib/imports/collections/query_history";
import
{
Dumps
}
from
"
/lib/imports/collections/dumps
"
;
import
{
Settings
}
from
"
/lib/imports/collections/settings
"
;
import
{
Connections
}
from
"
/lib/imports/collections/connections
"
;
import
mailchimpAPI
from
"
meteor/universe:mailchimp-v3-api
"
;
import
SchemaAnalyzeResult
from
"
/lib/imports/collections/schema_analyze_result
"
;
import
{
HTTP
}
from
"
meteor/http
"
;
import
LOGGER
from
"
../internal/logger
"
;
...
...
@@ -97,6 +98,26 @@ const saveConnectionToDB = function (connection) {
};
Meteor
.
methods
({
handleSubscriber
(
email
){
LOGGER
.
info
(
'
[subscriber]
'
,
email
);
const
regex
=
/^
(([^
<>()
\[\]\\
.,;:
\s
@"
]
+
(\.[^
<>()
\[\]\\
.,;:
\s
@"
]
+
)
*
)
|
(
".+"
))
@
((\[[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}
]
)
|
(([
a-zA-Z
\-
0-9
]
+
\.)
+
[
a-zA-Z
]{2,}))
$/
;
if
(
!
regex
.
test
(
email
))
{
LOGGER
.
error
(
'
[subscriber]
'
,
'
not valid email:
'
+
email
);
throw
new
Meteor
.
Error
(
400
,
'
Not a valid email address !
'
);
}
return
mailchimpAPI
.
setApiKey
(
'
96b3d560f7ce4cdf78a65383375ee73b-us15
'
).
addANewListMember
({
list_id
:
'
ff8b28a54d
'
,
body
:
{
email_address
:
email
,
status
:
'
subscribed
'
}
}).
then
(
null
,
function
(
reason
)
{
LOGGER
.
error
(
'
[subscribe]
'
,
reason
.
response
.
statusCode
,
JSON
.
parse
(
reason
.
response
.
content
).
title
);
throw
new
Meteor
.
Error
(
reason
.
response
.
statusCode
,
JSON
.
parse
(
reason
.
response
.
content
).
title
);
});
},
checkMongoclientVersion
(){
try
{
const
response
=
HTTP
.
get
(
'
https://api.github.com/repos/mongoclient/mongoclient/releases/latest
'
,
{
headers
:
{
"
User-Agent
"
:
"
Mongoclient
"
}});
...
...
server/imports/internal/startup.js
浏览文件 @
0a8d7b8e
...
...
@@ -139,7 +139,7 @@ Meteor.startup(function () {
connectionTimeoutInSeconds
:
3
,
dbStatsScheduler
:
3000
,
showDBStats
:
true
,
showLiveChat
:
fals
e
,
showLiveChat
:
tru
e
,
singleTabResultSets
:
false
,
dumpPath
:
home
+
"
/myDumps/
"
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录