Repository: incubator-ignite Updated Branches: refs/heads/ignite-843 505bae0c2 -> 40e87e2ce
# ignite-843 Uniq name for new notebook Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/40e87e2c Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/40e87e2c Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/40e87e2c Branch: refs/heads/ignite-843 Commit: 40e87e2ce9dd066d259c573c669f15e1ff38e273 Parents: 505bae0 Author: Andrey <anovi...@gridgain.com> Authored: Fri Jul 31 16:16:32 2015 +0700 Committer: Andrey <anovi...@gridgain.com> Committed: Fri Jul 31 16:16:32 2015 +0700 ---------------------------------------------------------------------- .../src/main/js/controllers/models/sql.json | 2 +- .../control-center-web/src/main/js/routes/notebooks.js | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/40e87e2c/modules/control-center-web/src/main/js/controllers/models/sql.json ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/models/sql.json b/modules/control-center-web/src/main/js/controllers/models/sql.json index 93c821a..552e5d4 100644 --- a/modules/control-center-web/src/main/js/controllers/models/sql.json +++ b/modules/control-center-web/src/main/js/controllers/models/sql.json @@ -3,6 +3,6 @@ "Select cache and execute SQL queries." ], "missingClientTip": [ - "Please download and install client." + "Please download and install <a href='/agent/agent-1.2.1-SNAPSHOT.zip' target='_self'>client</a>." ] } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/40e87e2c/modules/control-center-web/src/main/js/routes/notebooks.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/routes/notebooks.js b/modules/control-center-web/src/main/js/routes/notebooks.js index 5b7ac8e..0560d3b 100644 --- a/modules/control-center-web/src/main/js/routes/notebooks.js +++ b/modules/control-center-web/src/main/js/routes/notebooks.js @@ -18,6 +18,7 @@ */ var router = require('express').Router(); +var crypto = require('crypto'); var db = require('../db'); /** @@ -76,6 +77,12 @@ router.post('/get', function (req, res) { }); }); +function _randomValueHex (len) { + return crypto.randomBytes(Math.ceil(len/2)) + .toString('hex') // convert to hexadecimal format + .slice(0,len); // return required number of characters +} + /** * Create new notebook for user account. * @@ -90,7 +97,9 @@ router.get('/new', function (req, res) { if (err) return res.status(500).send(err.message); - (new db.Notebook({space: space.id, name: 'Notebook', paragraph: []})).save(function (err, notebook) { + var name = 'Notebook' + ' ' + _randomValueHex(8); + + (new db.Notebook({space: space.id, name: name, paragraph: []})).save(function (err, notebook) { if (err) return res.status(500).send(err.message);