Skip to content

Node.js based forum software built for the modern web

installer: database error messages

psychobunny45e216edef61
diff --git a/install/web.js b/install/web.js
index 4ccce7efdb..8beadbf673 100644
--- a/install/web.js
+++ b/install/web.js
@@ -9,7 +9,8 @@ var winston = require('winston'),
async = require('async'),
uglify = require('uglify-js'),
nconf = require('nconf'),
- app = express();
+ app = express(),
+ server;
var web = {},
scripts = [
@@ -39,7 +40,7 @@ web.install = function(port) {
function launchExpress(port) {
- var server = app.listen(port, function() {
+ server = app.listen(port, function() {
var host = server.address().address;
winston.info('Web installer listening on http://%s:%s', host, port);
});
@@ -48,6 +49,7 @@ function launchExpress(port) {
function setupRoutes() {
app.get('/', welcome);
app.post('/', install);
+ app.post('/launch', launch);
}
function welcome(req, res) {
@@ -92,6 +94,10 @@ function install(req, res) {
});
}
+function launch(req, res) {
+
+}
+
function compileLess(callback) {
if ((nconf.get('from-file') || '').indexOf('less') !== -1) {
winston.info('LESS compilation skipped');
diff --git a/public/src/installer/install.js b/public/src/installer/install.js
index 7739f228ed..876d6bb4d3 100644
--- a/public/src/installer/install.js
+++ b/public/src/installer/install.js
@@ -25,6 +25,13 @@ $('document').ready(function() {
$('form').submit(validateAll);
activate('database', $('[name="database"]'));
+
+ if ($('#database-error').length) {
+ $('[name="database"]').parents('.input-row').addClass('error');
+ $('html, body').animate({
+ scrollTop: ($('#database-error').offset().top + 100) + 'px'
+ }, 400);
+ }
}
function validateAll(ev) {
diff --git a/src/views/install/index.tpl b/src/views/install/index.tpl
index 3fbff54144..4866745126 100644
--- a/src/views/install/index.tpl
+++ b/src/views/install/index.tpl
@@ -84,6 +84,10 @@
</div>
</div>
+ <!-- IF error -->
+ <a id="database-error"></a>
+ <!-- ENDIF error -->
+
<div class="database">
<p>
<h1><small>Configure your database</small></h1>
@@ -98,6 +102,7 @@
<option value="mongo">MongoDB</option>
</select>
</div>
+ <!-- IF error --><div class="col-sm-5 help-text">There was an error connecting to your database. Please try again.</div><!-- ENDIF error -->
</div>
<div id="database-config"></div>
@@ -107,6 +112,15 @@
</form>
</div>
+
+ <div class="container <!-- IF !success -->hide<!-- ENDIF !success -->">
+ <p>
+ <h1>Congratulations! Your NodeBB has been set-up.</h1>
+
+ <button id="launch" class="btn btn-lg btn-success">Launch NodeBB <i class="fa fa-spinner fa-spin hide"></i></button>
+ </p>
+ </div>
+
<div class="hide">
<!-- BEGIN databases -->
<div data-database="{databases.name}">