Repository: ignite Updated Branches: refs/heads/master df48356de -> 08371f598
IGNITE-5641 Web Console: Added "Copy to clipboard" action on Queries screen. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/08371f59 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/08371f59 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/08371f59 Branch: refs/heads/master Commit: 08371f5989730438b6dca2ddc6971c9b137fcdd2 Parents: df48356 Author: alexdel <verba...@yandex.ru> Authored: Tue Nov 21 22:25:47 2017 +0700 Committer: Alexey Kuznetsov <akuznet...@apache.org> Committed: Tue Nov 21 22:25:47 2017 +0700 ---------------------------------------------------------------------- .../frontend/app/modules/sql/sql.controller.js | 15 +++++++++++---- modules/web-console/frontend/views/sql/sql.tpl.pug | 6 ++++-- 2 files changed, 15 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/08371f59/modules/web-console/frontend/app/modules/sql/sql.controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/sql/sql.controller.js b/modules/web-console/frontend/app/modules/sql/sql.controller.js index ea0a06d..a2ad912 100644 --- a/modules/web-console/frontend/app/modules/sql/sql.controller.js +++ b/modules/web-console/frontend/app/modules/sql/sql.controller.js @@ -214,8 +214,8 @@ class Paragraph { } // Controller for SQL notebook screen. -export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval', '$animate', '$location', '$anchorScroll', '$state', '$filter', '$modal', '$popover', 'IgniteLoading', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'AgentManager', 'IgniteChartColors', 'IgniteNotebook', 'IgniteNodes', 'uiGridExporterConstants', 'IgniteVersion', 'IgniteActivitiesData', 'JavaTypes', - function($root, $scope, $http, $q, $timeout, $interval, $animate, $location, $anchorScroll, $state, $filter, $modal, $popover, Loading, LegacyUtils, Messages, Confirm, agentMgr, IgniteChartColors, Notebook, Nodes, uiGridExporterConstants, Version, ActivitiesData, JavaTypes) { +export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval', '$animate', '$location', '$anchorScroll', '$state', '$filter', '$modal', '$popover', 'IgniteLoading', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'AgentManager', 'IgniteChartColors', 'IgniteNotebook', 'IgniteNodes', 'uiGridExporterConstants', 'IgniteVersion', 'IgniteActivitiesData', 'JavaTypes', 'IgniteCopyToClipboard', + function($root, $scope, $http, $q, $timeout, $interval, $animate, $location, $anchorScroll, $state, $filter, $modal, $popover, Loading, LegacyUtils, Messages, Confirm, agentMgr, IgniteChartColors, Notebook, Nodes, uiGridExporterConstants, Version, ActivitiesData, JavaTypes, IgniteCopyToClipboard) { const $ctrl = this; // Define template urls. @@ -1613,7 +1613,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval', .then(() => paragraph.ace && paragraph.ace.focus()); }; - const _export = (fileName, columnDefs, meta, rows) => { + const _export = (fileName, columnDefs, meta, rows, toClipBoard = false) => { let csvContent = ''; const cols = []; @@ -1652,7 +1652,10 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval', csvContent += cols.join(';') + '\n'; }); - LegacyUtils.download('text/csv', fileName, csvContent); + if (toClipBoard) + IgniteCopyToClipboard.copy(csvContent); + else + LegacyUtils.download('text/csv', fileName, csvContent); }; /** @@ -1671,6 +1674,10 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval', return `export-query-${paragraph.name}${all ? '-all' : ''}.csv`; }; + $scope.exportCsvToClipBoard = (paragraph) => { + _export(exportFileName(paragraph, false), paragraph.gridOptions.columnDefs, paragraph.meta, paragraph.rows, true); + }; + $scope.exportCsv = function(paragraph) { _export(exportFileName(paragraph, false), paragraph.gridOptions.columnDefs, paragraph.meta, paragraph.rows); http://git-wip-us.apache.org/repos/asf/ignite/blob/08371f59/modules/web-console/frontend/views/sql/sql.tpl.pug ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/views/sql/sql.tpl.pug b/modules/web-console/frontend/views/sql/sql.tpl.pug index a53a082..7714235 100644 --- a/modules/web-console/frontend/views/sql/sql.tpl.pug +++ b/modules/web-console/frontend/views/sql/sql.tpl.pug @@ -171,7 +171,7 @@ mixin table-result-heading-query i.fa.fa-fw.fa-refresh.fa-spin(ng-if='paragraph.csvIsPreparing') span Export - -var options = [{ text: "Export", click: 'exportCsv(paragraph)' }, { text: 'Export all', click: 'exportCsvAll(paragraph)' }] + -var options = [{ text: 'Export', click: 'exportCsv(paragraph)' }, { text: 'Export all', click: 'exportCsvAll(paragraph)' }, { divider: true }, { text: '<span title="Copy current result page to clipboard">Copy to clipboard</span>', click: 'exportCsvToClipBoard(paragraph)' }] button.btn.dropdown-toggle.btn-primary( ng-disabled='paragraph.loading' @@ -180,6 +180,7 @@ mixin table-result-heading-query data-toggle='dropdown' data-container='body' data-placement='bottom-right' + data-html='true' ) span.caret @@ -216,7 +217,7 @@ mixin table-result-heading-scan i.fa.fa-fw.fa-refresh.fa-spin(ng-if='paragraph.csvIsPreparing') span Export - -var options = [{ text: "Export", click: 'exportCsv(paragraph)' }, { text: 'Export all', click: 'exportCsvAll(paragraph)' }] + -var options = [{ text: "Export", click: 'exportCsv(paragraph)' }, { text: 'Export all', click: 'exportCsvAll(paragraph)' }, { divider: true }, { text: '<span title="Copy current result page to clipboard">Copy to clipboard</span>', click: 'exportCsvToClipBoard(paragraph)' }] button.btn.dropdown-toggle.btn-primary( ng-disabled='paragraph.loading || paragraph.csvIsPreparing' @@ -225,6 +226,7 @@ mixin table-result-heading-scan data-toggle='dropdown' data-container='body' data-placement='bottom-right' + data-html='true' ) span.caret