Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0450A185C3 for ; Mon, 22 Jun 2015 14:54:20 +0000 (UTC) Received: (qmail 35291 invoked by uid 500); 22 Jun 2015 14:54:19 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 35262 invoked by uid 500); 22 Jun 2015 14:54:19 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 35253 invoked by uid 99); 22 Jun 2015 14:54:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Jun 2015 14:54:19 +0000 X-ASF-Spam-Status: No, hits=-2001.4 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 22 Jun 2015 14:52:04 +0000 Received: (qmail 33563 invoked by uid 99); 22 Jun 2015 14:53:50 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Jun 2015 14:53:50 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E3D11E03D2; Mon, 22 Jun 2015 14:53:49 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sevdokimov@apache.org To: commits@ignite.incubator.apache.org Date: Mon, 22 Jun 2015 14:53:49 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/2] incubator-ignite git commit: # IGNITE-843 Create control to show generated configuration. X-Virus-Checked: Checked by ClamAV on apache.org Repository: incubator-ignite Updated Branches: refs/heads/ignite-843 b7019fc12 -> 39980fe98 # IGNITE-843 Create control to show generated configuration. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4ac1832a Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4ac1832a Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4ac1832a Branch: refs/heads/ignite-843 Commit: 4ac1832aa05c0ff71c6d00474816b6507c946a63 Parents: 359ee91 Author: sevdokimov Authored: Mon Jun 22 17:51:40 2015 +0300 Committer: sevdokimov Committed: Mon Jun 22 17:51:40 2015 +0300 ---------------------------------------------------------------------- modules/webconfig/nodejs/app.js | 2 + .../public/javascripts/controllers/summary.js | 45 ++- .../nodejs/public/stylesheets/style.css | 2 +- .../nodejs/public/stylesheets/style.less | 8 +- .../webconfig/nodejs/routes/configGenerator.js | 289 +++++++++++++++++++ modules/webconfig/nodejs/views/summary.jade | 21 +- 6 files changed, 346 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4ac1832a/modules/webconfig/nodejs/app.js ---------------------------------------------------------------------- diff --git a/modules/webconfig/nodejs/app.js b/modules/webconfig/nodejs/app.js index 30178dd..e2021f6 100644 --- a/modules/webconfig/nodejs/app.js +++ b/modules/webconfig/nodejs/app.js @@ -29,6 +29,7 @@ var pageRoutes = require('./routes/pages'); var clustersRouter = require('./routes/clusters'); var cachesRouter = require('./routes/caches'); var authRouter = require('./routes/auth'); +var configGenerator = require('./routes/configGenerator'); var passport = require('passport'); @@ -88,6 +89,7 @@ app.use('/', pageRoutes); app.use('/rest/clusters', clustersRouter); app.use('/rest/caches', cachesRouter); app.use('/rest/auth', authRouter); +app.use('/rest/configGenerator', configGenerator); // catch 404 and forward to error handler //app.use(function (req, res, next) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4ac1832a/modules/webconfig/nodejs/public/javascripts/controllers/summary.js ---------------------------------------------------------------------- diff --git a/modules/webconfig/nodejs/public/javascripts/controllers/summary.js b/modules/webconfig/nodejs/public/javascripts/controllers/summary.js index 09c9bd3..b00aee2 100644 --- a/modules/webconfig/nodejs/public/javascripts/controllers/summary.js +++ b/modules/webconfig/nodejs/public/javascripts/controllers/summary.js @@ -16,18 +16,39 @@ */ configuratorModule.controller('clustersList', ['$scope', '$http', function ($scope, $http) { - $http.get('/rest/clusters') - .success(function(data) { - $scope.caches = data.caches; - $scope.spaces = data.spaces; - $scope.clusters = data.clusters; + $http.get('/rest/clusters').success(function (data) { + $scope.caches = data.caches; + $scope.spaces = data.spaces; + $scope.clusters = data.clusters; + }); + + $scope.cfgLang = 'xml'; + + $scope.generateConfig = function(cluster) { + $scope.loading = true; + + $http.get('/rest/configGenerator', {params: {name: cluster.name, lang: $scope.cfgLang}}).success( + function (data) { + $scope.resultCfg = data; + + $scope.loading = false; + }).error(function (data) { + $scope.generateError = "Failed to generate config: " + data; + + $scope.loading = false; }); -}]); + }; + + $scope.setSelectedCluster = function(cluster) { + $scope.currCluster = cluster; -configuratorModule.service('configGenerator', function(){ - return { - generateXml: function(cluster) { - - } + $scope.generateConfig(cluster) + }; + + $scope.setCfgLang = function(lang) { + $scope.cfgLang = lang; + + if ($scope.currCluster) + $scope.generateConfig($scope.currCluster) } -}); \ No newline at end of file +}]); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4ac1832a/modules/webconfig/nodejs/public/stylesheets/style.css ---------------------------------------------------------------------- diff --git a/modules/webconfig/nodejs/public/stylesheets/style.css b/modules/webconfig/nodejs/public/stylesheets/style.css index 49b2e92..1a74451 100644 --- a/modules/webconfig/nodejs/public/stylesheets/style.css +++ b/modules/webconfig/nodejs/public/stylesheets/style.css @@ -1 +1 @@ -.main-header .logo{height:auto}.main-sidebar{padding-top:60px}.navbar-default .navbar-brand,.navbar-default .navbar-brand:hover{position:absolute;width:100%;left:0;text-align:center}.modal-backdrop.am-fade{opacity:.5;transition:opacity .15s linear}.modal-backdrop.am-fade.ng-enter{opacity:0}.modal-backdrop.am-fade.ng-enter.ng-enter-active{opacity:.5}.modal-backdrop.am-fade.ng-leave{opacity:.5}.modal-backdrop.am-fade.ng-leave.ng-leave-active{opacity:0}.modal.center .modal-dialog{position:fixed;top:40%;left:50%;min-width:320px;max-width:630px;width:50%;transform:translateX(-50%) translateY(-50%)}.border-left{box-shadow:1px 0 0 0 #eee inset}.border-right{box-shadow:1px 0 0 0 #eee}.theme-line{background-color:#f9f9f9}.theme-line header{background-color:#fff}.theme-line header a.btn{border:0 none;padding:10px 25px;background-color:rgba(0,0,0,0.15)}.theme-line header a.btn:hover{background-color:rgba(0,0,0,0.25)}.theme-line header a.btn.btn-link{background:transparent;color:rgba(255,255,25 5,0.8)}.theme-line header a.btn.btn-link:hover{color:#fff;text-decoration:none}.theme-line .navbar-nav a{background-color:transparent}.theme-line .navbar-nav a:hover,.theme-line .navbar-nav a:active,.theme-line .navbar-nav a:focus{background-color:transparent}.theme-line .main-links{padding-top:50px}.theme-line .main-links h3{margin-top:0;font-size:17px}.theme-line .main-links .links a{color:#888}.theme-line .main-links .links a:hover{text-decoration:none}.theme-line #category-columns,.theme-solid #category-columns{margin:50px 30px 0}.theme-line #category-columns h4{text-transform:uppercase;font-weight:300;color:#999;font-size:14px}.theme-line #category-columns ul{list-style:none;padding:0;margin-bottom:15px}.theme-line #category-columns ul li a{padding:4px 0;display:block;font-size:16px}.theme-line #category-columns ul .view-all{font-size:0.85em}.theme-line .docs-header{color:#999;overflow:hidden}.theme-line .docs-header h1{color:#444;margin-top:0;font-size:25px}.theme-line .btn-pr imary{border:0 none;background-color:#ec1c24}.theme-line .btn-primary:hover{background-color:#950d12}.theme-line .main-content .nav-horizontal a{box-shadow:0 0;border:0 none;background-color:#fff;border-radius:0;color:#aaa;padding:6px;margin:0 14px}.theme-line .main-content .nav-horizontal a:hover{color:#999;border-bottom:4px solid #ddd}.theme-line .main-content .nav-horizontal a.active{border-bottom:4px solid #888}.theme-line .sidebar-nav{color:#474a54;padding-bottom:30px}.theme-line .sidebar-nav ul{padding:0;list-style:none;font-size:13px;margin:3px 0 0}.theme-line .sidebar-nav ul li a{padding:3px 0;display:block;color:#666;position:relative;white-space:nowrap;overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis}.theme-line .sidebar-nav ul li a:before{top:0;content:" ";display:block;width:6px;height:100%;position:absolute;left:-30px}.theme-line .sidebar-nav ul li a:hover{text-decoration:none}.theme-line .select li a{color:#666}.theme-line .select li a:hover,.theme-line .select .active{color:#ec1c24;background-color:white}.theme-line .sidebar-nav ul li .subcategory{padding-left:15px}.theme-line .sidebar-nav h4{margin-top:2em;font-weight:normal;text-transform:uppercase;font-size:11px;margin-bottom:10px;color:#bbb}.theme-line .sidebar-nav h4:first-child{margin-top:0}.theme-line .sidebar-nav .ask{width:100%;text-align:center;padding:10px}.theme-line .border-left .sidebar-nav{padding-left:15px}.theme-line .suggest{padding:4px;display:inline-block;font-size:12px}.header{padding:15px}.header .has-github{padding-right:136px}.header h1.navbar-brand{height:40px;width:200px;padding:0;margin:5px 15px 0 0}.header h1.navbar-brand a{text-indent:-99999px;background:no-repeat center center;display:block;width:100%;height:100%;background-size:contain}.header .nav.navbar-nav.pull-right{position:relative;right:-30px}.header .nav.navbar-nav .not-link{padding:15px;display:inline-block}.header .nav.navbar-nav .stable,.header .nav.navbar-nav .beta,.header .nav.navbar-na v .private{font-size:9px;padding:3px 5px;display:inline-block;line-height:8px;border-radius:3px;margin-left:6px;color:#fff;top:-2px;position:relative;opacity:0.6;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=60)";filter:alpha(opacity=60)}.header .nav.navbar-nav a:hover>.stable,.header .nav.navbar-nav a:hover>.beta,.header .nav.navbar-nav a:hover>.private{opacity:1;-ms-filter:none;filter:none}.header .nav.navbar-nav .beta{background-color:#59c3d1}.header .nav.navbar-nav .stable{background-color:#41b841}.header .nav.navbar-nav .private{background-color:#333}.theme-line header{border-bottom:8px solid}.theme-line header h2{color:#aaa}.theme-line header p{color:#666}.theme-line header{border-bottom-color:#ec1c24}.theme-line .navbar-nav{color:#888}.theme-line .navbar-nav a{color:#bbb}.theme-line header a.btn{background-color:#ec1c24}.theme-line header a.btn:hover{background-color:#950d12}.theme-line header .navbar-nav .tt-cursor{background-color:#ec1c24}.theme-line header .n avbar-nav a:hover,.theme-line header .navbar-nav .open>a{color:#ec1c24}.theme-line .navbar-nav .active a{color:#ec1c24}.theme-line .navbar-nav .active a:hover{color:#950d12}.theme-line .main-links .links a:hover{color:#ec1c24}.theme-line .main-content a{color:#666}.theme-line .main-content a:hover{color:#950d12}.theme-line .sidebar-nav ul li a.active:before{background-color:#ec1c24}.theme-line .sidebar-nav ul li a.active{color:#ec1c24}.theme-line .sidebar-nav ul li a:hover,.theme-line .sidebar-nav ul li a.active:hover{color:#950d12}.theme-line .main-content .nav-horizontal a.active{border-color:#ec1c24;color:#ec1c24}.theme-line .main-content .nav-horizontal a:hover{color:#950d12}.theme-line .main-content .nav-horizontal a.active:hover{border-color:#950d12}.theme-line header .navbar-nav a.active,.theme-line #versions-list li a:hover strong,.theme-line #versions-list li a.active .current,.theme-line #versions-list li a:active .current{color:#ec1c24}.theme-line.body-threes .section-rig ht .threes-nav .btn-default:hover,.theme-line.page-docs.body-threes .section-right .threes-nav .pull-right a:hover{color:#ec1c24;border-color:#ec1c24}.theme-line .section-right{padding-left:30px}.body-overlap .main-content{margin-top:30px}.body-box .main-content,.body-overlap .main-content{padding:30px;box-shadow:0 0 0 1px rgba(0,0,0,0.1);background-color:#fff}body{font-weight:400;font-family:Roboto Slab, serif}h1,h2,h3,h4,h5,h6{font-weight:700;font-family:Roboto Slab, serif}.submit-vote.submit-vote-parent.voted a.submit-vote-button,.submit-vote.submit-vote-parent a.submit-vote-button:hover{background-color:#ec1c24}div.submit-vote.submit-vote-parent.voted a.submit-vote-button:hover{background-color:#950d12}a,.link .title{color:#ec1c24}a:hover,.link:hover .title{color:#950d12}.header h1.navbar-brand a{background-image:url("https://www.filepicker.io/api/file/QagunjDGRFul2JgNCAli")}.header h1.navbar-brand{width:96px}.block-edit-parameters{text-align:right;padding-bottom:5px}.ng-table-p ager{display:none}.container-footer{margin-top:20px}.vcenter{display:inline-block;vertical-align:middle;float:none}.vcenter2{position:relative;top:50%;transform:translateY(-50%)}.modal{display:block;overflow:hidden}.modal .close{position:absolute;top:0.65em;right:0.65em;float:none}.modal-header .close{margin-right:-2px}.modal .modal-dialog{width:610px}.modal .modal-content{border-radius:0;background-color:#f7f7f7}.modal .modal-content .modal-header{background-color:#fff;text-align:center;color:#555;padding:24px;font-family:"myriad-pro",sans-serif}.modal .modal-content .modal-header h4{font-family:"myriad-pro",sans-serif;font-size:22px}.modal .modal-content .modal-header h4 .fa{display:block;font-size:41px;color:#ddd;margin-bottom:5px}.modal .modal-content .modal-header p{color:#aaa;font-size:1em;margin:3px 0 0}.modal .modal-content .modal-spacer{padding:10px 10px 0 10px}.modal .modal-content .modal-footer{margin-top:0}.modal-body{padding-top:30px}h1.ignite-logo{background-image:url( "https://www.filepicker.io/api/file/QagunjDGRFul2JgNCAli")}.st-sort-ascent:after{font-family:FontAwesome, serif;content:'\f077'}.st-sort-descent:after{font-family:FontAwesome, serif;content:'\f078'}.block-display-image img{max-width:100%;max-height:450px;margin:auto;display:block}.greedy{min-height:200px;height:calc(100vh - 230px)}@media (min-width:768px){.navbar-nav>li>a{padding-top:20px;padding-bottom:10px}}.details-row{padding-left:1.3em}.details-table-row{padding:0}.details-row,.settings-row{display:block;margin:0.65em 0;line-height:28px}.details-row [class*="col-"],.settings-row [class*="col-"]{display:inline-block;vertical-align:middle;float:none;padding-left:0 !important;padding-right:0 !important}.details-row input[type="checkbox"],.settings-row input[type="checkbox"]{line-height:20px;margin-right:4px}.details-row .checkbox label,.settings-row .checkbox label{line-height:20px;vertical-align:middle}button{margin-right:4px}h1,h2,h3{user-select:none;font-weight:normal;line-heig ht:1}h3{color:black;font-size:1.2em;margin-top:0;margin-bottom:1.5em}table tr:hover{cursor:pointer}.input-group{display:inline-block}.input-group .form-control{width:auto;margin-left:0;margin-right:0}.form-control{display:inline-block;text-align:left;padding:3px 3px;height:28px}.form-control button{text-align:left}.table-form-control{width:auto}.form-horizontal .control-label{padding-top:4px}button .caret{float:right;margin-left:0;margin-top:7px}.theme-line .panel-heading{padding:10px 10px;margin:0}.theme-line .panel-heading h3{margin-bottom:0}.theme-line .panel-heading h3>a{color:black;cursor:pointer}.theme-line .panel-title a{color:#ec1c24}.theme-line .panel-title h3{margin-bottom:1.3em}.theme-line .panel-body{padding:0.65em 1.3em}.theme-line .main-content a.customize{color:#ec1c24;cursor:pointer}.theme-line .panel-collapse{margin:0}.theme-line .links table,.theme-line table.links-edit{display:table;table-layout:fixed;margin-bottom:10px}.theme-line .links table td,.theme-line tabl e.links-edit td{padding-left:18px}.theme-line .links table .active a,.theme-line table.links-edit .active a{color:#ec1c24;font-weight:bold}.theme-line .links table a:hover,.theme-line table.links-edit a:hover{color:#950d12}.theme-line .links table a,.theme-line table.links-edit a{color:#666}.theme-line table.links-edit label{line-height:28px;color:#666}.btn{padding:3px 6px}.panel-title a{font-size:14px}.panel-details{margin-top:1.3em;margin-bottom:0.65em;padding:0.65em;border-radius:4px;border:thin dotted lightgrey}.tooltip.right .tooltip-arrow{border-right-color:#ec1c24}.tooltip>.tooltip-inner{max-width:400px;text-align:left;background-color:#ec1c24}label{font-weight:normal;line-height:14px;margin-bottom:0}.form-horizontal .checkbox{padding-top:0}.input-tip{display:block;overflow:hidden;padding-right:4px}.labelField{float:left;margin-right:4px}.tipField{float:right;line-height:28px;margin-right:5px}.tipLabel{margin-left:4px}.fieldButton{float:right;margin-left:4px;margin-right:0}.t able-nowrap{table-layout:fixed}.td-overflow{max-width:100px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fa-edit{cursor:pointer}.fa-remove{color:red;margin-left:5px;margin-right:5px;cursor:pointer}label.required:after{color:#ec1c24;content:' *';display:inline}.blank{visibility:hidden}.alert{outline:0}.alert.bottom,.alert.bottom-left,.alert.bottom-right,.alert.top,.alert.top-left,.alert.top-right{position:fixed;z-index:1050;margin:20px}.alert.top,.alert.top-left,.alert.top-right{top:50px}.alert.top{right:0;left:0}.alert.top-right{right:0}.alert.top-right .close{padding-left:10px}.alert.top-left{left:0}.alert.top-left .close{padding-right:10px}.alert.bottom,.alert.bottom-left,.alert.bottom-right{bottom:0}.alert.bottom{right:0;left:0}.alert.bottom-right{right:0}.alert.bottom-right .close{padding-left:10px}.alert.bottom-left{left:0}.alert.bottom-left .close{padding-right:10px} \ No newline at end of file +.main-header .logo{height:auto}.main-sidebar{padding-top:60px}.navbar-default .navbar-brand,.navbar-default .navbar-brand:hover{position:absolute;width:100%;left:0;text-align:center}.modal-backdrop.am-fade{opacity:.5;transition:opacity .15s linear}.modal-backdrop.am-fade.ng-enter{opacity:0}.modal-backdrop.am-fade.ng-enter.ng-enter-active{opacity:.5}.modal-backdrop.am-fade.ng-leave{opacity:.5}.modal-backdrop.am-fade.ng-leave.ng-leave-active{opacity:0}.modal.center .modal-dialog{position:fixed;top:40%;left:50%;min-width:320px;max-width:630px;width:50%;transform:translateX(-50%) translateY(-50%)}.border-left{box-shadow:1px 0 0 0 #eee inset}.border-right{box-shadow:1px 0 0 0 #eee}.theme-line{background-color:#f9f9f9}.theme-line header{background-color:#fff}.theme-line header a.btn{border:0 none;padding:10px 25px;background-color:rgba(0,0,0,0.15)}.theme-line header a.btn:hover{background-color:rgba(0,0,0,0.25)}.theme-line header a.btn.btn-link{background:transparent;color:rgba(255,255,25 5,0.8)}.theme-line header a.btn.btn-link:hover{color:#fff;text-decoration:none}.theme-line .navbar-nav a{background-color:transparent}.theme-line .navbar-nav a:hover,.theme-line .navbar-nav a:active,.theme-line .navbar-nav a:focus{background-color:transparent}.theme-line .main-links{padding-top:50px}.theme-line .main-links h3{margin-top:0;font-size:17px}.theme-line .main-links .links a{color:#888}.theme-line .main-links .links a:hover{text-decoration:none}.theme-line #category-columns,.theme-solid #category-columns{margin:50px 30px 0}.theme-line #category-columns h4{text-transform:uppercase;font-weight:300;color:#999;font-size:14px}.theme-line #category-columns ul{list-style:none;padding:0;margin-bottom:15px}.theme-line #category-columns ul li a{padding:4px 0;display:block;font-size:16px}.theme-line #category-columns ul .view-all{font-size:0.85em}.theme-line .docs-header{color:#999;overflow:hidden}.theme-line .docs-header h1{color:#444;margin-top:0;font-size:25px}.theme-line .btn-pr imary{border:0 none;background-color:#ec1c24}.theme-line .btn-primary:hover{background-color:#950d12}.theme-line .main-content .nav-horizontal a{box-shadow:0 0;border:0 none;background-color:#fff;border-radius:0;color:#aaa;padding:6px;margin:0 14px}.theme-line .main-content .nav-horizontal a:hover{color:#999;border-bottom:4px solid #ddd}.theme-line .main-content .nav-horizontal a.active{border-bottom:4px solid #888}.theme-line .sidebar-nav{color:#474a54;padding-bottom:30px}.theme-line .sidebar-nav ul{padding:0;list-style:none;font-size:13px;margin:3px 0 0}.theme-line .sidebar-nav ul li a{padding:3px 0;display:block;color:#666;position:relative;white-space:nowrap;overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis}.theme-line .sidebar-nav ul li a:before{top:0;content:" ";display:block;width:6px;height:100%;position:absolute;left:-30px}.theme-line .sidebar-nav ul li a:hover{text-decoration:none}.theme-line .select li a{color:#666}.theme-line .select li a:hover,.theme-line .select .active{color:#ec1c24;background-color:white}.theme-line .sidebar-nav ul li .subcategory{padding-left:15px}.theme-line .sidebar-nav h4{margin-top:2em;font-weight:normal;text-transform:uppercase;font-size:11px;margin-bottom:10px;color:#bbb}.theme-line .sidebar-nav h4:first-child{margin-top:0}.theme-line .sidebar-nav .ask{width:100%;text-align:center;padding:10px}.theme-line .border-left .sidebar-nav{padding-left:15px}.theme-line .suggest{padding:4px;display:inline-block;font-size:12px}.header{padding:15px}.header .has-github{padding-right:136px}.header h1.navbar-brand{height:40px;width:200px;padding:0;margin:5px 15px 0 0}.header h1.navbar-brand a{text-indent:-99999px;background:no-repeat center center;display:block;width:100%;height:100%;background-size:contain}.header .nav.navbar-nav.pull-right{position:relative;right:-30px}.header .nav.navbar-nav .not-link{padding:15px;display:inline-block}.header .nav.navbar-nav .stable,.header .nav.navbar-nav .beta,.header .nav.navbar-na v .private{font-size:9px;padding:3px 5px;display:inline-block;line-height:8px;border-radius:3px;margin-left:6px;color:#fff;top:-2px;position:relative;opacity:0.6;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=60)";filter:alpha(opacity=60)}.header .nav.navbar-nav a:hover>.stable,.header .nav.navbar-nav a:hover>.beta,.header .nav.navbar-nav a:hover>.private{opacity:1;-ms-filter:none;filter:none}.header .nav.navbar-nav .beta{background-color:#59c3d1}.header .nav.navbar-nav .stable{background-color:#41b841}.header .nav.navbar-nav .private{background-color:#333}.theme-line header{border-bottom:8px solid}.theme-line header h2{color:#aaa}.theme-line header p{color:#666}.theme-line header{border-bottom-color:#ec1c24}.theme-line .navbar-nav{color:#888}.theme-line .navbar-nav a{color:#bbb}.theme-line header a.btn{background-color:#ec1c24}.theme-line header a.btn:hover{background-color:#950d12}.theme-line header .navbar-nav .tt-cursor{background-color:#ec1c24}.theme-line header .n avbar-nav a:hover,.theme-line header .navbar-nav .open>a{color:#ec1c24}.theme-line .navbar-nav .active a{color:#ec1c24}.theme-line .navbar-nav .active a:hover{color:#950d12}.theme-line .main-links .links a:hover{color:#ec1c24}.theme-line .main-content a{color:#666}.theme-line .main-content a:hover{color:#950d12}.theme-line .sidebar-nav ul li a.active:before{background-color:#ec1c24}.theme-line .sidebar-nav ul li a.active{color:#ec1c24}.theme-line .sidebar-nav ul li a:hover,.theme-line .sidebar-nav ul li a.active:hover{color:#950d12}.theme-line .main-content .nav-horizontal a.active{border-color:#ec1c24;color:#ec1c24}.theme-line .main-content .nav-horizontal a:hover{color:#950d12}.theme-line .main-content .nav-horizontal a.active:hover{border-color:#950d12}.theme-line header .navbar-nav a.active,.theme-line #versions-list li a:hover strong,.theme-line #versions-list li a.active .current,.theme-line #versions-list li a:active .current{color:#ec1c24}.theme-line.body-threes .section-rig ht .threes-nav .btn-default:hover,.theme-line.page-docs.body-threes .section-right .threes-nav .pull-right a:hover{color:#ec1c24;border-color:#ec1c24}.theme-line .section-right{padding-left:30px}.body-overlap .main-content{margin-top:30px}.body-box .main-content,.body-overlap .main-content{padding:30px;box-shadow:0 0 0 1px rgba(0,0,0,0.1);background-color:#fff}body{font-weight:400;font-family:Roboto Slab, serif}h1,h2,h3,h4,h5,h6{font-weight:700;font-family:Roboto Slab, serif}.submit-vote.submit-vote-parent.voted a.submit-vote-button,.submit-vote.submit-vote-parent a.submit-vote-button:hover{background-color:#ec1c24}div.submit-vote.submit-vote-parent.voted a.submit-vote-button:hover{background-color:#950d12}a,.link .title{color:#ec1c24}a:hover,.link:hover .title{color:#950d12}.header h1.navbar-brand a{background-image:url("https://www.filepicker.io/api/file/QagunjDGRFul2JgNCAli")}.header h1.navbar-brand{width:96px}.block-edit-parameters{text-align:right;padding-bottom:5px}.ng-table-p ager{display:none}.container-footer{margin-top:20px}.vcenter{display:inline-block;vertical-align:middle;float:none}.vcenter2{position:relative;top:50%;transform:translateY(-50%)}.modal{display:block;overflow:hidden}.modal .close{position:absolute;top:0.65em;right:0.65em;float:none}.modal-header .close{margin-right:-2px}.modal .modal-dialog{width:610px}.modal .modal-content{border-radius:0;background-color:#f7f7f7}.modal .modal-content .modal-header{background-color:#fff;text-align:center;color:#555;padding:24px;font-family:"myriad-pro",sans-serif}.modal .modal-content .modal-header h4{font-family:"myriad-pro",sans-serif;font-size:22px}.modal .modal-content .modal-header h4 .fa{display:block;font-size:41px;color:#ddd;margin-bottom:5px}.modal .modal-content .modal-header p{color:#aaa;font-size:1em;margin:3px 0 0}.modal .modal-content .modal-spacer{padding:10px 10px 0 10px}.modal .modal-content .modal-footer{margin-top:0}.modal-body{padding-top:30px}h1.ignite-logo{background-image:url( "https://www.filepicker.io/api/file/QagunjDGRFul2JgNCAli")}.st-sort-ascent:after{font-family:FontAwesome, serif;content:'\f077'}.st-sort-descent:after{font-family:FontAwesome, serif;content:'\f078'}.block-display-image img{max-width:100%;max-height:450px;margin:auto;display:block}.greedy{min-height:200px;height:calc(100vh - 230px)}@media (min-width:768px){.navbar-nav>li>a{padding-top:20px;padding-bottom:10px}}.details-row{padding-left:1.3em}.details-table-row{padding:0}.details-row,.settings-row{display:block;margin:0.65em 0;line-height:28px}.details-row [class*="col-"],.settings-row [class*="col-"]{display:inline-block;vertical-align:middle;float:none;padding-left:0 !important;padding-right:0 !important}.details-row input[type="checkbox"],.settings-row input[type="checkbox"]{line-height:20px;margin-right:4px}.details-row .checkbox label,.settings-row .checkbox label{line-height:20px;vertical-align:middle}button{margin-right:4px}h1,h2,h3{user-select:none;font-weight:normal;line-heig ht:1}h3{color:black;font-size:1.2em;margin-top:0;margin-bottom:1.5em}table tr:hover{cursor:pointer}.input-group{display:inline-block}.input-group .form-control{width:auto;margin-left:0;margin-right:0}.form-control{display:inline-block;text-align:left;padding:3px 3px;height:28px}.form-control button{text-align:left}.table-form-control{width:auto}.form-horizontal .control-label{padding-top:4px}button .caret{float:right;margin-left:0;margin-top:7px}.theme-line .panel-heading{padding:10px 10px;margin:0}.theme-line .panel-heading h3{margin-bottom:0}.theme-line .panel-heading h3>a{color:black;cursor:pointer}.theme-line .panel-title a{color:#ec1c24}.theme-line .panel-title h3{margin-bottom:1.3em}.theme-line .panel-body{padding:0.65em 1.3em}.theme-line .main-content a.customize{color:#ec1c24;cursor:pointer}.theme-line .panel-collapse{margin:0}.theme-line .links table,.theme-line table.links-edit{display:table;table-layout:fixed;margin-bottom:10px}.theme-line .links table td,.theme-line tabl e.links-edit td{padding-left:18px}.theme-line .links table .active a,.theme-line table.links-edit .active a{color:#ec1c24;font-weight:bold}.theme-line .links table a:hover,.theme-line table.links-edit a:hover{color:#950d12}.theme-line .links table a,.theme-line table.links-edit a{color:#666}.theme-line table.links-edit label{line-height:28px;color:#666}.btn{padding:3px 6px}.panel-title a{font-size:14px}.panel-details{margin-top:1.3em;margin-bottom:0.65em;padding:0.65em;border-radius:4px;border:thin dotted lightgrey}.tooltip.right .tooltip-arrow{border-right-color:#ec1c24}.tooltip>.tooltip-inner{max-width:400px;text-align:left;background-color:#ec1c24}label{font-weight:normal;line-height:14px;margin-bottom:0}.form-horizontal .checkbox{padding-top:0}.input-tip{display:block;overflow:hidden;padding-right:4px}.labelField{float:left;margin-right:4px}.tipField{float:right;line-height:28px;margin-right:5px}.tipLabel{margin-left:4px}.fieldButton{float:right;margin-left:4px;margin-right:0}.t able-nowrap{table-layout:fixed}.td-overflow{max-width:100px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fa-edit{cursor:pointer}.fa-remove{color:red;margin-left:5px;margin-right:5px;cursor:pointer}label.required:after{color:#ec1c24;content:' *';display:inline}.blank{visibility:hidden}.alert{outline:0}.alert.bottom,.alert.bottom-left,.alert.bottom-right,.alert.top,.alert.top-left,.alert.top-right{position:fixed;z-index:1050;margin:20px}.alert.top,.alert.top-left,.alert.top-right{top:50px}.alert.top{right:0;left:0}.alert.top-right{right:0}.alert.top-right .close{padding-left:10px}.alert.top-left{left:0}.alert.top-left .close{padding-right:10px}.alert.bottom,.alert.bottom-left,.alert.bottom-right{bottom:0}.alert.bottom{right:0;left:0}.alert.bottom-right{right:0}.alert.bottom-right .close{padding-left:10px}.alert.bottom-left{left:0}.alert.bottom-left .close{padding-right:10px}#cfgResult textarea{font-family:monospace;font-size:12px} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4ac1832a/modules/webconfig/nodejs/public/stylesheets/style.less ---------------------------------------------------------------------- diff --git a/modules/webconfig/nodejs/public/stylesheets/style.less b/modules/webconfig/nodejs/public/stylesheets/style.less index 73e9e3a..fd2e3c3 100644 --- a/modules/webconfig/nodejs/public/stylesheets/style.less +++ b/modules/webconfig/nodejs/public/stylesheets/style.less @@ -926,4 +926,10 @@ label.required:after { .alert.bottom-left .close { padding-right: 10px -} \ No newline at end of file +} + +// Summary page +#cfgResult textarea { + font-family: monospace; + font-size: 12px; +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4ac1832a/modules/webconfig/nodejs/routes/configGenerator.js ---------------------------------------------------------------------- diff --git a/modules/webconfig/nodejs/routes/configGenerator.js b/modules/webconfig/nodejs/routes/configGenerator.js new file mode 100644 index 0000000..101d881 --- /dev/null +++ b/modules/webconfig/nodejs/routes/configGenerator.js @@ -0,0 +1,289 @@ +/* + * 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. + */ + +var db = require('../db'); + +var router = require('express').Router(); + +router.get('/', function(req, res) { + var lang = req.query.lang; + var name = req.query.name; + + var user_id = req.user._id; + + db.Space.find({$or: [{owner: user_id}, {usedBy: {$elemMatch: {account: user_id}}}]}, function (err, spaces) { + if (err) + return res.status(500).send(err.message); + + var space_ids = spaces.map(function(value) { + return value._id; + }); + + // Get all clusters for spaces. + db.Cluster.find({name: name, space: {$in: space_ids}}, function (err, clusters) { + if (err) + return res.status(500).send(err.message); + + if (clusters.length == 0) { + res.sendStatus(404); + + return + } + + var cluster = clusters[0]; + + try { + switch (lang) { + case 'xml': + res.send(generateXml(cluster)); + break; + + case 'java': + res.send(generateJava(cluster)); + break; + + default: + res.status(404).send("Unknown language: " + lang); + break; + } + } + catch (e) { + res.status(500).send(e); + } + }); + }); +}); + +function generateJava(cluster) { + return "java"; +} + +function multicast(res, multicast) { + +} + +function builder() { + var res = []; + + res.deep = 0; + res.lineStart = true; + + res.append = function(s) { + if (this.lineStart) { + for (var i = 0; i < this.deep; i++) + this.push(' '); + + this.lineStart = false; + } + + this.push(s); + + return this; + }; + + res.line = function(s) { + if (s) + this.append(s); + + this.push('\n'); + this.lineStart = true; + + return this; + }; + + res.startBlock = function(s) { + if (s) + this.append(s); + + this.push('\n'); + this.lineStart = true; + this.deep++; + + return this; + }; + + res.endBlock = function(s) { + this.deep--; + + if (s) + this.append(s); + + this.push('\n'); + this.lineStart = true; + + return this; + }; + + return res; +} + +function escapeAttr(s) { + return s.replace(/&/g, '&').replace(/"/g, '"'); +} + +function generateXml(cluster) { + var res = builder(); + + res.push('' + + '\n' + + '\n' + + ' \n'); + + res.deep = 2; + + if (cluster.discovery) { + res.startBlock(''); + res.startBlock(''); + res.startBlock(''); + + var className; + + var d = cluster.discovery; + + switch (d.kind) { + case 'Multicast': + var m = d.Multicast; + + res.startBlock(''); + + if (m.multicastGroup) + res.line(''); + + if (m.multicastPort) + res.line(''); + + if (m.responseWaitTime) + res.line(''); + + if (m.addressRequestAttempts) + res.line(''); + + if (m.localAddress) + res.line(''); + + res.endBlock(''); + + break; + + case 'Vm': + if (d.Vm.addresses.length > 0) { + res.startBlock(''); + + res.line(''); + res.line(' '); + + for (var i = 0; i < d.Vm.addresses.length; i++) { + res.line('' + escapeAttr(d.Vm.addresses[i]) + ''); + } + + res.line(' '); + res.line(''); + + res.endBlock(''); + } + else { + res.line(''); + } + + break; + + case 'S3': + res.startBlock(''); + + if (d.S3 && d.S3.bucketName) + res.line(''); + + res.endBlock(''); + + break; + + case 'Cloud': + res.startBlock(''); + + if (d.Cloud.credential) + res.line(''); + + if (d.Cloud.credentialPath) + res.line(''); + + if (d.Cloud.identity) + res.line(''); + + if (d.Cloud.provider) + res.line(''); + + res.endBlock(''); + + break; + + case 'GoogleStorage': + res.startBlock(''); + + if (d.GoogleStorage.projectName) + res.line(''); + + if (d.GoogleStorage.bucketName) + res.line(''); + + if (d.GoogleStorage.serviceAccountP12FilePath) + res.line(''); + + //if (d.GoogleStorage.addrReqAttempts) todo ???? + // res.line(''); + + res.endBlock(''); + + break; + + case 'Jdbc': + res.startBlock(''); + res.line(''); + res.endBlock(''); + + break; + + case 'SharedFs': + if (d.SharedFs.initSchema != null) { + res.startBlock(''); + res.line(''); + res.endBlock(''); + } + else { + res.line(''); + } + + break; + + default: + throw "Unknown discovery kind: " + d.kind; + } + + res.endBlock(''); + res.endBlock(''); + res.endBlock(''); + } + + res.push(' \n'); + res.push(''); + + return res.join(''); +} + +module.exports = router; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4ac1832a/modules/webconfig/nodejs/views/summary.jade ---------------------------------------------------------------------- diff --git a/modules/webconfig/nodejs/views/summary.jade b/modules/webconfig/nodejs/views/summary.jade index f926fa4..200316b 100644 --- a/modules/webconfig/nodejs/views/summary.jade +++ b/modules/webconfig/nodejs/views/summary.jade @@ -33,12 +33,19 @@ block content div(ng-hide='clusters.length == 0') p Following cluster configurations are created, you can download its as xml, java code or as docker file - div(ng-repeat='row in clusters', style='padding-left: 20px') {{row.name}} + div(ng-repeat='row in clusters', style='padding-left: 20px') span.clusterName {{row.name}} |  - a(href='#') .xml - |   - a(href='#') java code - |   - a(href='#') docker - + a(href, ng-click='setSelectedCluster(row)') Generate configuration + + #cfgResult.configBox(ng-show='currCluster && !generateError && !loading', style='margin-top: 20px') + ul.nav.nav-tabs + li(ng-class="{active: cfgLang=='xml'}") + a(href, ng-click='setCfgLang("xml")') XML + li(ng-class="{active: cfgLang=='java'}") + a(href, ng-click='setCfgLang("java")') Java + + textarea(style='width: 100%', rows=30, readonly=true) + | {{resultCfg}} + + div(ng-show='generateError') {{generateError}} \ No newline at end of file