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-1257 Used same libs under summary page
Date Tue, 13 Oct 2015 10:05:11 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843-rc1 b056db0f6 -> 6e3bdf32e


IGNITE-1257 Used same libs under summary page


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

Branch: refs/heads/ignite-843-rc1
Commit: 6e3bdf32e6bbc2618245350014b55d1ea32ea225
Parents: b056db0
Author: Andrey <anovikov@gridgain.com>
Authored: Tue Oct 13 17:04:53 2015 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Tue Oct 13 17:04:53 2015 +0700

----------------------------------------------------------------------
 .../src/main/js/controllers/common-module.js    |  2 +-
 .../control-center-web/src/main/js/package.json |  1 -
 .../src/main/js/routes/agent.js                 |  8 ++---
 .../src/main/js/routes/summary.js               | 37 +++++++-------------
 4 files changed, 17 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6e3bdf32/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 957eb2f..f3ee655 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
@@ -1914,7 +1914,7 @@ consoleModule.controller('agent-download', [
         $scope.downloadAgent = function () {
             var lnk = document.createElement('a');
 
-            lnk.setAttribute('href', '/agent/download-zip');
+            lnk.setAttribute('href', '/agent/download/zip');
             lnk.style.display = 'none';
 
             document.body.appendChild(lnk);

http://git-wip-us.apache.org/repos/asf/ignite/blob/6e3bdf32/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 19e90d5..da0f51b 100644
--- a/modules/control-center-web/src/main/js/package.json
+++ b/modules/control-center-web/src/main/js/package.json
@@ -20,7 +20,6 @@
     "node": ">=0.12.4"
   },
   "dependencies": {
-    "archiver": "^0.15.1",
     "async": "1.4.2",
     "body-parser": "~1.14.1",
     "bootstrap-sass": "^3.3.5",

http://git-wip-us.apache.org/repos/asf/ignite/blob/6e3bdf32/modules/control-center-web/src/main/js/routes/agent.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/agent.js b/modules/control-center-web/src/main/js/routes/agent.js
index 4176855..3012754 100644
--- a/modules/control-center-web/src/main/js/routes/agent.js
+++ b/modules/control-center-web/src/main/js/routes/agent.js
@@ -44,15 +44,15 @@ router.get('/download', function (req, res) {
 });
 
 /* Get grid topology. */
-router.get('/download-zip', function (req, res) {
+router.get('/download/zip', function (req, res) {
     var fs = require('fs');
     var JSZip = require('jszip');
     var config = require('../helpers/configuration-loader.js');
 
-    var agentFld =  'ignite-web-agent-1.5.0-SNAPSHOT';
+    var agentFld = 'ignite-web-agent-1.5.0-SNAPSHOT';
     var agentZip =  agentFld + '.zip';
 
-    // read a zip file
+    // Read a zip file.
     fs.readFile('public/agent/' + agentZip, function(err, data) {
         if (err)
             return res.download('public/agent/' + agentZip, agentZip);
@@ -65,6 +65,7 @@ router.get('/download-zip', function (req, res) {
 
         prop.push('token=' + req.user.token);
         prop.push('server-uri=wss://' + host + ':' + config.get('agent-server:port'));
+        prop.push('#Uncomment following options if needed:');
         prop.push('#node-uri=http://localhost:8080');
         prop.push('#driver-folder=./jdbc-drivers');
         prop.push('#test-drive-metadata=true');
@@ -78,7 +79,6 @@ router.get('/download-zip', function (req, res) {
         res.attachment(agentZip);
 
         res.send(buffer);
-
     });
 });
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6e3bdf32/modules/control-center-web/src/main/js/routes/summary.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/summary.js b/modules/control-center-web/src/main/js/routes/summary.js
index 53a1286..bf728bf 100644
--- a/modules/control-center-web/src/main/js/routes/summary.js
+++ b/modules/control-center-web/src/main/js/routes/summary.js
@@ -45,42 +45,27 @@ router.post('/download', function (req, res) {
 
         var clientNearConfiguration = req.body.clientNearConfiguration;
 
-        var archiver = require('archiver');
+        var JSZip = require('jszip');
 
-        // Creating archive.
-        var zip = archiver('zip');
-
-        zip.on('error', function (err) {
-            res.status(500).send({error: err.message});
-        });
-
-        // On stream closed we can end the request.
-        res.on('close', function () {
-            return res.status(200).send('OK').end();
-        });
+        var zip = new JSZip();
 
         // Set the archive name.
         res.attachment(cluster.name + (clientNearConfiguration ? '-client' : '-server') +
'-configuration.zip');
 
-        // Send the file to the page output.
-        zip.pipe(res);
-
         var builder = $generatorProperties.sslProperties(cluster);
 
         if (!clientNearConfiguration) {
-            zip.append($generatorDocker.clusterDocker(cluster, req.body.os), {name: 'Dockerfile'});
+            zip.file('Dockerfile', $generatorDocker.clusterDocker(cluster, req.body.os));
 
             builder = $generatorProperties.dataSourcesProperties(cluster, builder);
         }
 
         if (builder)
-            zip.append(builder.asString(), {name: 'secret.properties'});
+            zip.file('secret.properties', builder.asString());
 
-        zip.append($generatorXml.cluster(cluster, clientNearConfiguration), {name: cluster.name
+ '.xml'})
-            .append($generatorJava.cluster(cluster, false, clientNearConfiguration),
-                {name: cluster.name + '.snippet.java'})
-            .append($generatorJava.cluster(cluster, true, clientNearConfiguration),
-                {name: 'ConfigurationFactory.java'});
+        zip.file(cluster.name + '.xml', $generatorXml.cluster(cluster, clientNearConfiguration));
+        zip.file(cluster.name + '.snippet.java', $generatorJava.cluster(cluster, false, clientNearConfiguration));
+        zip.file('ConfigurationFactory.java', $generatorJava.cluster(cluster, true, clientNearConfiguration));
 
         $generatorJava.pojos(cluster.caches, req.body.useConstructor, req.body.includeKeyFields);
 
@@ -90,12 +75,14 @@ router.post('/download', function (req, res) {
             var meta = metadatas[metaIx];
 
             if (meta.keyClass)
-                zip.append(meta.keyClass, {name: meta.keyType.replace(/\./g, '/') + '.java'});
+                zip.file(meta.keyType.replace(/\./g, '/') + '.java', meta.keyClass);
 
-            zip.append(meta.valueClass, {name: meta.valueType.replace(/\./g, '/') + '.java'});
+            zip.file(meta.valueType.replace(/\./g, '/') + '.java', meta.valueClass);
         }
 
-        zip.finalize();
+        var buffer = zip.generate({type:"nodebuffer"});
+
+        res.send(buffer);
     });
 });
 


Mime
View raw message