ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject ignite git commit: IGNITE 843 Added module support in sidebar.
Date Tue, 17 Nov 2015 03:58:12 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843-rc1 8fc8442bf -> 9e0dede50


IGNITE 843 Added module support in sidebar.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9e0dede5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9e0dede5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9e0dede5

Branch: refs/heads/ignite-843-rc1
Commit: 9e0dede50ce3f3e9415dc7897796aa7e1351f21f
Parents: 8fc8442
Author: Andrey <anovikov@gridgain.com>
Authored: Tue Nov 17 10:58:03 2015 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Tue Nov 17 10:58:03 2015 +0700

----------------------------------------------------------------------
 modules/control-center-web/src/main/js/app.js   |  6 +++
 .../app/modules/configuration-sidebar/main.js   | 54 ++++++++++++++++++++
 .../src/main/js/controllers/common-module.js    |  3 +-
 .../src/main/js/gulpfile.js/tasks/copy.js       | 27 +++++++---
 .../main/js/gulpfile.js/tasks/inject-plugins.js |  4 +-
 .../src/main/js/gulpfile.js/tasks/jade.js       | 11 ++--
 .../control-center-web/src/main/js/package.json |  1 +
 .../main/js/views/configuration/sidebar.jade    | 24 ++++-----
 .../src/main/js/views/includes/header.jade      | 13 ++---
 .../src/main/js/views/templates/layout.jade     |  1 +
 10 files changed, 109 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9e0dede5/modules/control-center-web/src/main/js/app.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app.js b/modules/control-center-web/src/main/js/app.js
index b276c30..2872302 100644
--- a/modules/control-center-web/src/main/js/app.js
+++ b/modules/control-center-web/src/main/js/app.js
@@ -27,6 +27,7 @@ var session = require('express-session');
 var mongoStore = require('connect-mongo')(session);
 var forceSSL = require('express-force-ssl');
 var config = require('./helpers/configuration-loader.js');
+var shell = require('shelljs');
 
 var publicRoutes = require('./routes/public');
 var notebooksRoutes = require('./routes/notebooks');
@@ -142,6 +143,11 @@ app.use('/sql', mustAuthenticated, sqlRouter);
 
 app.use('/agent', mustAuthenticated, agentRouter);
 
+var modulesRoutes = shell.find(path.resolve(__dirname, 'ignite_modules'))
+    .filter(function(file) { return file.match(/\/routes\/.+\.js$/); });
+
+modulesRoutes.forEach(function(route) { require(route)(app); });
+
 // Catch 404 and forward to error handler.
 app.use(function (req, res, next) {
     var err = new Error('Not Found: ' + req.originalUrl);

http://git-wip-us.apache.org/repos/asf/ignite/blob/9e0dede5/modules/control-center-web/src/main/js/app/modules/configuration-sidebar/main.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/configuration-sidebar/main.js
b/modules/control-center-web/src/main/js/app/modules/configuration-sidebar/main.js
new file mode 100644
index 0000000..d4943a3
--- /dev/null
+++ b/modules/control-center-web/src/main/js/app/modules/configuration-sidebar/main.js
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+angular
+.module('ignite-web-console.configuration.sidebar', [
+
+])
+.provider('igniteConfigurationSidebar', function() {
+    var items = [
+        { label: 'Clusters', href: '/configuration/clusters' },
+        { label: 'Caches', href: '/configuration/caches' },
+        { label: 'Metadata', href: '/configuration/metadata' },
+        { label: 'IGFS', href: '/configuration/igfs' }
+    ];
+
+    this.push = function(data) {
+        items.push(data);
+    };
+
+    this.$get = [function() {
+        var r = angular.copy(items);
+
+        r.push({ label: 'Summary', href: '/configuration/summary' });
+
+        return r;
+    }]
+})
+.directive('igniteConfigurationSidebar', function(igniteConfigurationSidebar) {
+    function controller() {
+        var ctrl = this;
+
+        ctrl.items = igniteConfigurationSidebar;
+    }
+
+    return {
+        restrict: 'A',
+        controller: controller,
+        controllerAs: 'sidebar'
+    }
+});

http://git-wip-us.apache.org/repos/asf/ignite/blob/9e0dede5/modules/control-center-web/src/main/js/controllers/common-module.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/common-module.js b/modules/control-center-web/src/main/js/controllers/common-module.js
index 99c0a37..238a5c8 100644
--- a/modules/control-center-web/src/main/js/controllers/common-module.js
+++ b/modules/control-center-web/src/main/js/controllers/common-module.js
@@ -20,6 +20,7 @@ var consoleModule = angular.module('ignite-web-console',
         'ngAnimate', 'ngSanitize', 'mgcrea.ngStrap', 'smart-table', 'ui.ace', 'treeControl',
'darthwade.loading', 'agGrid', 'nvd3', 'dndLists'
         /* ignite:modules */
         , 'ignite-web-console.navbar'
+        , 'ignite-web-console.configuration.sidebar'
         /* endignite */
         /* ignite:plugins */
         /* endignite */
@@ -1950,7 +1951,7 @@ consoleModule.controller('activeLink', [
         ];
 
         $scope.isActive = function (path) {
-            return window.location.pathname.substr(0, path.length) == path;
+            return new RegExp(path).test(window.location.pathname);
         };
     }]);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/9e0dede5/modules/control-center-web/src/main/js/gulpfile.js/tasks/copy.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/gulpfile.js/tasks/copy.js b/modules/control-center-web/src/main/js/gulpfile.js/tasks/copy.js
index 25ebae9..67d9582 100644
--- a/modules/control-center-web/src/main/js/gulpfile.js/tasks/copy.js
+++ b/modules/control-center-web/src/main/js/gulpfile.js/tasks/copy.js
@@ -16,7 +16,7 @@
  */
 
 var gulp = require('gulp');
-var sequence = require('gulp-sequence');
+var gulpSequence = require('gulp-sequence');
 
 var paths = [
     './app/**/**/*.js',
@@ -29,13 +29,26 @@ var paths = [
     './public/**/*.js'
 ];
 
-gulp.task('copy', function() {
-    return gulp.src(paths)
-        .pipe(gulp.dest('./build'))
+var pluginPaths = [
+    './ignite_modules/**/main.js',
+    './ignite_modules/**/controllers/*.js',
+    './ignite_modules/**/controllers/models/*.json'
+];
+
+gulp.task('copy', function(cb) {
+    return gulpSequence('copy:source', 'copy:ignite_modules')(cb)
+});
+
+gulp.task('copy:source', function(cb) {
+    return gulp.src(paths).pipe(gulp.dest('./build'))
+});
+
+gulp.task('copy:ignite_modules', function(cb) {
+    return gulp.src(pluginPaths).pipe(gulp.dest('./build/ignite_modules'))
 });
 
-gulp.task('copy:watch', function() {
-    gulp.watch(paths, function(e) {
-        sequence('copy', 'inject:plugins:js')()
+gulp.task('copy:watch', function(cb) {
+    gulp.watch(paths, function(glob) {
+        gulpSequence('copy', 'inject:plugins:js')(cb)
     })
 });

http://git-wip-us.apache.org/repos/asf/ignite/blob/9e0dede5/modules/control-center-web/src/main/js/gulpfile.js/tasks/inject-plugins.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/gulpfile.js/tasks/inject-plugins.js b/modules/control-center-web/src/main/js/gulpfile.js/tasks/inject-plugins.js
index ae0a51f..6a05231 100644
--- a/modules/control-center-web/src/main/js/gulpfile.js/tasks/inject-plugins.js
+++ b/modules/control-center-web/src/main/js/gulpfile.js/tasks/inject-plugins.js
@@ -32,7 +32,7 @@ var js_targets = [
 ];
 
 var js_sources = [
-    './build/plugins/**/*.js'
+    './build/ignite_modules/**/main.js'
 ];
 
 gulp.task('inject:plugins:html', function() {
@@ -55,7 +55,7 @@ gulp.task('inject:plugins:js', function() {
             endtag: ' /* endignite */',
                 transform: function (filePath, file, i, length) {
                 // return file contents as string
-                return ", '" + filePath.replace(/.*plugins\/([^\/]+).*/mgi, '$1') + "'";
+                return ", 'ignite-web-console." + filePath.replace(/.*ignite_modules\/([^\/]+).*/mgi,
'$1') + "'";
             }
         }))
         .pipe(gulp.dest('./build'));

http://git-wip-us.apache.org/repos/asf/ignite/blob/9e0dede5/modules/control-center-web/src/main/js/gulpfile.js/tasks/jade.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/gulpfile.js/tasks/jade.js b/modules/control-center-web/src/main/js/gulpfile.js/tasks/jade.js
index f050825..919f6b9 100644
--- a/modules/control-center-web/src/main/js/gulpfile.js/tasks/jade.js
+++ b/modules/control-center-web/src/main/js/gulpfile.js/tasks/jade.js
@@ -25,13 +25,18 @@ var paths = [
     './views/**/*.jade'
 ];
 
+var pluginPaths = [
+    './ignite_modules/**/*.jade'
+];
+
 var options = {
 };
 
 gulp.task('jade', function() {
-    return gulp.src(paths)
-        .pipe(jade(options))
-        .pipe(gulp.dest('./build'))
+    return sequence(
+        gulp.src(paths).pipe(jade(options)).pipe(gulp.dest('./build')),
+        gulp.src(pluginPaths).pipe(jade(options)).pipe(gulp.dest('./build/ignite_modules'))
+    );
 });
 
 gulp.task('jade:watch', function () {

http://git-wip-us.apache.org/repos/asf/ignite/blob/9e0dede5/modules/control-center-web/src/main/js/package.json
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/package.json b/modules/control-center-web/src/main/js/package.json
index a209eef..18241dd 100644
--- a/modules/control-center-web/src/main/js/package.json
+++ b/modules/control-center-web/src/main/js/package.json
@@ -49,6 +49,7 @@
     "passport-local-mongoose": "3.1.0",
     "require-dir": "^0.3.0",
     "serve-favicon": "~2.3.0",
+    "shelljs": "^0.5.3",
     "ws": "~0.8.0"
   },
   "devDependencies": {

http://git-wip-us.apache.org/repos/asf/ignite/blob/9e0dede5/modules/control-center-web/src/main/js/views/configuration/sidebar.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/configuration/sidebar.jade b/modules/control-center-web/src/main/js/views/configuration/sidebar.jade
index a486f9f..a08a6cd 100644
--- a/modules/control-center-web/src/main/js/views/configuration/sidebar.jade
+++ b/modules/control-center-web/src/main/js/views/configuration/sidebar.jade
@@ -25,24 +25,20 @@ append scripts
     script(src='/generator/generator-xml.js')
     script(src='/generator/generator-java.js')
 
-mixin sidebar-item(ref, num, txt)
-    li
-        a(ng-class='{active: isActive("#{ref}")}' href='#{ref}')
-            span.fa-stack
-                i.fa.fa-circle-thin.fa-stack-2x
-                i.fa.fa-stack-1x #{num}
-            | #{txt}
-
 block container
     .row
         .col-xs-3.col-sm-3.col-md-2.border-right.section-left.greedy
             .sidebar-nav(bs-affix)
-                ul.menu(ng-controller='activeLink')
-                    +sidebar-item('/configuration/clusters', 1, 'Clusters')
-                    +sidebar-item('/configuration/caches', 2, 'Caches')
-                    +sidebar-item('/configuration/metadata', 3, 'Metadata')
-                    +sidebar-item('/configuration/igfs', 4, 'IGFS')
-                    +sidebar-item('/configuration/summary', 5, 'Summary')
+                ul.menu(ignite-configuration-sidebar ng-controller='activeLink')
+                    li(ng-repeat='item in sidebar.items')
+                        a(ng-class='{active: isActive("{{::item.href}}$")}' href='{{::item.href}}')
+                            span.fa-stack
+                                i.fa.fa-circle-thin.fa-stack-2x
+                                i.fa.fa-stack-1x {{::$index + 1}}
+                            | {{::item.label}}
+                        ul(ng-if='item.subItems' style='margin-left:30px')
+                            li(ng-repeat='subItem in item.subItems')
+                                a(ng-class='{active: isActive("{{::subItem.href}}")}' href='{{::subItem.href}}')
{{::subItem.label}}
 
         .col-xs-9.col-sm-9.col-md-10.border-left.section-right
             .docs-content

http://git-wip-us.apache.org/repos/asf/ignite/blob/9e0dede5/modules/control-center-web/src/main/js/views/includes/header.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/includes/header.jade b/modules/control-center-web/src/main/js/views/includes/header.jade
index f2a2ef8..9df984f 100644
--- a/modules/control-center-web/src/main/js/views/includes/header.jade
+++ b/modules/control-center-web/src/main/js/views/includes/header.jade
@@ -13,9 +13,6 @@
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-mixin header-item(active, ref, txt)
-    li
-        a(ng-class='{active: isActive("#{active}")}' href='#{ref}') #{txt}
 
 header#header.header
     .viewedUser(ng-show='$root.user.becomeUsed') Currently assuming "
@@ -26,18 +23,18 @@ header#header.header
         h1.navbar-brand
             a(href='/') Apache Ignite Web Console
         .navbar-collapse.collapse(ng-controller='activeLink')
-            ul.nav.navbar-nav(ng-show='$root.user')
+            ul.nav.navbar-nav(ignite-navbar ng-show='$root.user')
                 li
-                    a.dropdown-toggle(ng-class='{active: isActive("/configuration")}' data-toggle='dropdown'
bs-dropdown='configurationDropdown' data-placement='bottom-right') Configuration
+                    a.dropdown-toggle(ng-class='{active: isActive("/configuration.*")}' data-toggle='dropdown'
bs-dropdown='configurationDropdown' data-placement='bottom-right') Configuration
                         span.caret
-                
+
                 li(ng-controller='notebooks')
                     a.dropdown-toggle(ng-hide='$root.notebooks.length == 0' ng-class='{active:
isActive("/sql")}' data-toggle='dropdown' bs-dropdown='notebookDropdown' data-placement='bottom-left')
SQL
                         span.caret
                     a(ng-hide='$root.notebooks.length > 0' ng-click='inputNotebookName()')
SQL
-            ul.nav.navbar-nav(ignite-navbar='' ng-show='$root.user')
+
                 li(ng-repeat='item in navbar.items')
-                    a(ng-class='{active: isActive(item.href)}' ng-href='{{ item.href }}')
{{ item.title }}
+                    a(ng-class='{active: isActive(item.href)}' ng-href='{{::item.href}}')
{{::item.title}}
 
             ul.nav.navbar-nav.pull-right
                 li(ng-if='$root.user')

http://git-wip-us.apache.org/repos/asf/ignite/blob/9e0dede5/modules/control-center-web/src/main/js/views/templates/layout.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/templates/layout.jade b/modules/control-center-web/src/main/js/views/templates/layout.jade
index 593d942..5f0daf5 100644
--- a/modules/control-center-web/src/main/js/views/templates/layout.jade
+++ b/modules/control-center-web/src/main/js/views/templates/layout.jade
@@ -69,6 +69,7 @@ html(ng-app='ignite-web-console')
 
             // ignite:modules
             script(src='/modules/navbar/main.js')
+            script(src='/modules/configuration-sidebar/main.js')
             // endignite
 
             // ignite:plugins


Mime
View raw message