提交 d102d0b1 编写于 作者: R rsercano

subscription improvements

上级 9570e72a
......@@ -219,23 +219,33 @@
<h1>
<img width="225" height="150" src="/logo/new/image_with_text2.png"/>
</h1>
<small>
<p>
Subscribe to Mongoclient Newsletter by filling your e-mail address to below input,
{{#if isSubscribed}}
<small>
Connect to your database, by clicking <b>Connect</b> button.
</small>
<br/>
<br/>
<button type="button" class="btn btn-primary ladda-button" disabled
data-style="contract">Thanks for subscription
</button>
{{else}}
<small>
Subscribe to Mongoclient Newsletter by filling your e-mail address to below
input,
and pressing <b>Subscribe</b>
</p>
</small>
<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"/>
</small>
<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>
</div>
<br/>
<button id="btnSubscribe" type="button" class="btn btn-primary ladda-button"
data-style="contract">Subscribe
</button>
<br/>
<button id="btnSubscribe" type="button" class="btn btn-primary ladda-button"
data-style="contract">Subscribe
</button>
{{/if}}
</div>
</div>
</div>
......
......@@ -21,7 +21,8 @@ const Ladda = require('ladda');
*/
/*global moment*/
let interval = null;
let memoryChart = null, connectionsChart = null, networkChart = null, opCountersChart = null, queuedReadWriteChart = null, activeReadWriteChart = null;
let memoryChart = null, connectionsChart = null, networkChart = null, opCountersChart = null,
queuedReadWriteChart = null, activeReadWriteChart = null;
let previousTopData = {};
const lineOptions = {
......@@ -110,7 +111,8 @@ const fetchStatus = function () {
}
else {
Session.set(Helper.strSessionServerStatus, result.result);
const memoryData = [], connectionsData = [], networkData = [], opCountersData = [], queuedReadWriteData = [], activeReadWriteData = [];
const memoryData = [], connectionsData = [], networkData = [], opCountersData = [],
queuedReadWriteData = [], activeReadWriteData = [];
const memoryText = populateMemoryData(result.result, memoryData, settings);
const availableConnections = populateConnectionData(result.result, connectionsData);
const totalRequests = populateNetworkData(result.result, networkData, settings);
......@@ -645,6 +647,7 @@ Template.databaseStats.events({
toastr.error("Failed: " + err.message);
}
else {
Meteor.call("subscribed");
toastr.success("Thank you for subscription !");
}
......@@ -683,6 +686,10 @@ Template.databaseStats.onDestroyed(function () {
});
Template.databaseStats.helpers({
isSubscribed (){
return Settings.findOne().subscribed;
},
getServerStatus () {
if (Settings.findOne().showDBStats) {
if (Session.get(Helper.strSessionServerStatus) == undefined) {
......
......@@ -98,6 +98,12 @@ const saveConnectionToDB = function (connection) {
};
Meteor.methods({
subscribed(){
Settings.update({}, {
$set: {subscribed: true}
});
},
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,}))$/;
......@@ -122,7 +128,7 @@ Meteor.methods({
try {
const response = HTTP.get('https://api.github.com/repos/mongoclient/mongoclient/releases/latest', {headers: {"User-Agent": "Mongoclient"}});
if (response && response.data && response.data.name && response.data.name !== packageJson.version) {
return "There's a new version of mongoclient: " + response.data.name + ", <a href='https://github.com/mongoclient/mongoclient/releases/latest'>download here</a>";
return "There's a new version of mongoclient: " + response.data.name + ", <a href='https://github.com/mongoclient/mongoclient/releases/latest' target='_blank'>download here</a>, if you're using docker just use pull !";
}
} catch (e) {
return null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册