ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject [52/90] [abbrv] incubator-ignite git commit: # ignite-843 WIP.
Date Thu, 14 May 2015 04:49:35 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/32b52cb9/modules/webconfig/nodejs/routes/cluster.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/routes/cluster.js b/modules/webconfig/nodejs/routes/cluster.js
index ec3fa95..220bedf 100644
--- a/modules/webconfig/nodejs/routes/cluster.js
+++ b/modules/webconfig/nodejs/routes/cluster.js
@@ -3,7 +3,7 @@ var db = require('../db');
 var express = require('express');
 var router = express.Router();
 
-router.get('/cluster', function(req, res) {
+function selectAll(res) {
     db.Cluster.find(function(err, clusters) {
         // if there is an error retrieving, send the error. nothing after res.send(err) will
execute
         if (err)
@@ -11,19 +11,44 @@ router.get('/cluster', function(req, res) {
 
         res.json(clusters); // return all clusters in JSON format
     });
+}
+
+router.get('/cluster', function(req, res) {
+    selectAll(res);
 });
 
 router.post('/cluster/save', function(req, res) {
-    db.Cluster.create({
-        name: req.body.name
-    }, function (err, todo) {
+    if (req.body._id) {
+        var clusterId = req.body._id;
+
+        delete req.body._id;
+
+        db.Cluster.findByIdAndUpdate(clusterId, req.body, null, function(err) {
+            if (err)
+                res.send(err);
+            else
+                selectAll(res);
+        });
+    }
+    else {
+        var cluster = new db.Cluster(req.body);
+
+        cluster.save(function (err) {
+            if (err)
+                res.send(err);
+            else
+                selectAll(res);
+        });
+    }
+});
+
+router.post('/cluster/remove', function(req, res) {
+    db.Cluster.remove(req.body, function (err) {
         if (err)
             res.send(err);
-    });
+        else
+            selectAll(res);
+    })
 });
 
-//router.get('rest/cluster', function(req, res) {
-//    res.render('cluster', { });
-//});
-
 module.exports = router;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/32b52cb9/modules/webconfig/nodejs/routes/page.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/routes/page.js b/modules/webconfig/nodejs/routes/page.js
new file mode 100644
index 0000000..32d5733
--- /dev/null
+++ b/modules/webconfig/nodejs/routes/page.js
@@ -0,0 +1,20 @@
+var jade = require('jade');
+var express = require('express');
+var router = express.Router();
+
+/* GET home page. */
+router.get('/', function(req, res) {
+  res.render('index', { title: 'Dashboard' });
+});
+
+/* GET cluster page. */
+router.get('/cluster', function(req, res) {
+    res.render('cluster', { });
+});
+
+/* GET cluster edit popup. */
+router.get('/cluster/edit', function(req, res) {
+    res.render('clusterEdit', { });
+});
+
+module.exports = router;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/32b52cb9/modules/webconfig/nodejs/views/clusterEdit.jade
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/views/clusterEdit.jade b/modules/webconfig/nodejs/views/clusterEdit.jade
new file mode 100644
index 0000000..a643c86
--- /dev/null
+++ b/modules/webconfig/nodejs/views/clusterEdit.jade
@@ -0,0 +1,21 @@
+div(class=['modal', 'center'] tabindex='-1' role='dialog')
+   div.modal-dialog
+      div.modal-content
+         form(class=['form-horizontal'] ng-submit='submit()')
+            div.modal-header(ng-show='title')
+            div.modal-body
+               div.row
+                  div.form-group
+                     label(class=['col-sm-3', 'control-label']) Cluster name:
+                     div.col-sm-9
+                        input.form-control(type='text' ng-model='cluster.name')
+               div.row
+                  div.form-group
+                     label(class=['col-sm-3', 'control-label']) Discovery:
+                     div(class=['selectContainer', 'col-sm-9'])
+                        select.form-control(ng-model='cluster.discovery')
+                           option(ng-value='VM') VM
+                           option(ng-value='Multicast') Multicast
+            div.modal-footer
+               input(type='submit' class=['btn', 'btn-primary'] value='Save changes')
+               button(type="button" class=['btn', 'btn-default'] data-dismiss="modal" ng-click="$hide()")
Close

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/32b52cb9/modules/webconfig/nodejs/views/includes/footer.jade
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/views/includes/footer.jade b/modules/webconfig/nodejs/views/includes/footer.jade
index 54a9018..a4906f3 100644
--- a/modules/webconfig/nodejs/views/includes/footer.jade
+++ b/modules/webconfig/nodejs/views/includes/footer.jade
@@ -1,4 +1,7 @@
 nav(class=['navbar', 'navbar-default', 'navbar-fixed-bottom', 'navbar-style'])
-    div.container
+    div(class=['container', 'center'])
         p.navbar-brand
-            | Powered by Apache Ignite
\ No newline at end of file
+            | Powered by Apache Ignite
+//footer.main-footer
+//    //div(class=['pull-right', 'hidden-xs'])
+//    Powered by Apache Ignite

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/32b52cb9/modules/webconfig/nodejs/views/index.jade
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/views/index.jade b/modules/webconfig/nodejs/views/index.jade
index 5287cf8..bec7630 100644
--- a/modules/webconfig/nodejs/views/index.jade
+++ b/modules/webconfig/nodejs/views/index.jade
@@ -1,62 +1,25 @@
 extends layout
 
 block content
-    div.wrapper
-        include includes/header
-        aside.main-sidebar
-            section.sidebar
-                ul.sidebar-menu
-                    li.header HEADER
-                    li.acitve
-                        a(href="/cluster") Cluster
-                    li.treeview
-                        a(href="#")
-                            span Caches
-                            i(class=['fa', 'fa-angle-right', 'pull-left'])
-                        ul.treeview-menu
-                            li
-                                a(href="/caches") Caches level 2
-                            li
-                                a(href="/caches") Caches level 2
-                    li
-                        a(href="/persistence") Persistence
-                    li
-                        a(href="/sql") SQL
-                    li
-                        a(href="/clients") Clients
-
-                        //li
-                        //    div.dropdown
-                        //        button(class=['btn', 'btn-default', 'dropdown-toggle']
type='button' data-toggle='dropdown' aria-expanded='true')
-                        //            span.caret
-                        //        ul.dropdown-menu(role='menu')
-                        //            li(role='presentation')
-                        //                a(role='menuitem' href='#') Action
-                        //            li(role='presentation')
-                        //                a(role='menuitem' href='#') Another action
-                            //
-                            //<div class="dropdown">
-                            //<button class="btn btn-default dropdown-toggle" type="button"
id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true">
-                            //Dropdown
-                            //<span class="caret"></span>
-                            //</button>
-                            //<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
-                            //<li role="presentation"><a role="menuitem" tabindex="-1"
href="#">Action</a></li>
-                            //<li role="presentation"><a role="menuitem" tabindex="-1"
href="#">Another action</a></li>
-                            //<li role="presentation"><a role="menuitem" tabindex="-1"
href="#">Something else here</a></li>
-                            //<li role="presentation"><a role="menuitem" tabindex="-1"
href="#">Separated link</a></li>
-                            //</ul>
-                            //</div>
-                //aside.col-md-3
-                //    div.list-group
-                //        a.list-group-item(href='#')
-                //            h4.list-group-item-heading List group item heading
-                //            p.list-group-item-text  Text list group item heading
-                //        a.list-group-item(href='#')
-                //            h4.list-group-item-heading List group item heading 2
-                //            p.list-group-item-text  Text list group item heading 2
-                //        a.list-group-item(href='#')
-                //            h4.list-group-item-heading List group item heading 2
-                //            p.list-group-item-text  Text list group item heading 2
-                //section.col-md-9
-        include includes/footer
+    //div.wrapper
+    //    aside.main-sidebar
+    //        section.sidebar
+    //            ul.sidebar-menu
+    //                li.header HEADER
+    //                li.acitve
+    //                    a(href="/cluster") Cluster
+    //                li.treeview
+    //                    a(href="#")
+    //                        span Caches
+    //                        i(class=['fa', 'fa-angle-right', 'pull-left'])
+    //                    ul.treeview-menu
+    //                        li
+    //                            a(href="/caches") Caches level 2
+    //                        li
+    //                            a(href="/caches") Caches level 2
+    //                li
+    //                    a(href="/persistence") Persistence
+    //                li
+    //                    a(href="/sql") SQL
+    //                li
+    //                    a(href="/clients") Clients


Mime
View raw message