# IGNITE-843 Allow to download docker file as file.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/96922721 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/96922721 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/96922721 Branch: refs/heads/ignite-843 Commit: 969227211e634e30bf978cd0432de519a19ab7cb Parents: 3b48363 Author: sevdokimov <sergey.evdoki...@jetbrains.com> Authored: Sun Jun 28 20:11:17 2015 +0300 Committer: sevdokimov <sergey.evdoki...@jetbrains.com> Committed: Sun Jun 28 20:11:17 2015 +0300 ---------------------------------------------------------------------- .../public/javascripts/controllers/summary.js | 18 ++++++++++++++++++ modules/webconfig/nodejs/views/summary.jade | 3 +++ 2 files changed, 21 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96922721/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 25cd795..bbb78b8 100644 --- a/modules/webconfig/nodejs/public/javascripts/controllers/summary.js +++ b/modules/webconfig/nodejs/public/javascripts/controllers/summary.js @@ -53,6 +53,24 @@ configuratorModule.controller('clustersList', ['$scope', '$http', function ($sco os: 'debian:8' }; + $scope.downloadDocker = function() { + var dockerText = $scope.dockerFile(); + + if (dockerText.length == 0) + return; + + var pom = document.createElement('a'); + pom.setAttribute('href', 'data:application/octet-stream;charset=utf-8,' + encodeURIComponent(dockerText)); + pom.setAttribute('download', 'Dockerfile'); + + pom.style.display = 'none'; + document.body.appendChild(pom); + + pom.click(); + + document.body.removeChild(pom); + }; + $scope.dockerFile = function() { if (!$scope.currCluster || !$scope.dockerArg) { return ''; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96922721/modules/webconfig/nodejs/views/summary.jade ---------------------------------------------------------------------- diff --git a/modules/webconfig/nodejs/views/summary.jade b/modules/webconfig/nodejs/views/summary.jade index 5b9c53d..369d539 100644 --- a/modules/webconfig/nodejs/views/summary.jade +++ b/modules/webconfig/nodejs/views/summary.jade @@ -70,6 +70,9 @@ block content placeholder='Enter OS version', data-source='["debian:8", "ubuntu:12.04"]') .form-group + | Download as + a(href, ng-click='downloadDocker()') file + textarea.form-control(rows=30, readonly=true) | {{ dockerFile() }}