From a6eb277a27658cb9403d9d2b521eab0d3b2cae6b Mon Sep 17 00:00:00 2001 From: "Mohammad K. Zia" Date: Tue, 9 Jul 2019 17:21:49 -0400 Subject: [PATCH 1/3] Add chart link button to metric explorer --- html/gui/css/viewer.css | 3 ++ html/gui/images/chart_bar_link.png | Bin 0 -> 880 bytes html/gui/js/PortalModule.js | 43 ++++++++++++++++-- .../modules/metric_explorer/MetricExplorer.js | 23 +++++++++- 4 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 html/gui/images/chart_bar_link.png diff --git a/html/gui/css/viewer.css b/html/gui/css/viewer.css index be672dfed0..ab092a7fd2 100644 --- a/html/gui/css/viewer.css +++ b/html/gui/css/viewer.css @@ -352,6 +352,9 @@ h3 { .blank { background-image: url(../images/s.gif) !important; } +.chart_bar_link { + background-image: url(../images/chart_bar_link.png) !important; +} .xd-toolbar { background-color:#ffffff !important; background-image: none !important; diff --git a/html/gui/images/chart_bar_link.png b/html/gui/images/chart_bar_link.png new file mode 100644 index 0000000000000000000000000000000000000000..9eb6b8eba59eb0fd64daa7323b20b36509cd8d22 GIT binary patch literal 880 zcmV-$1CRWPP)ZRTze!z4ku8^Gg?w z5rh{>+KdiOnRU^O1YHEh2^5hu!zKs=Me!yo5C?@Wf}#j-A_{`Kh;kIdqA)MUIgLY1 zG;nkhrJw0I`<#8|j5Bl2*?(*G?PFR=YxC`owbr-Z?|t93tP3L#qAkO%VYEJ_qqty< z!LlrDTa9N;^z2>!5)beCoQ|-GGWvGClL>7?TN5jdkx$2QVawjV(Dy4W+{;fNeOTzy zO$K(Kp(j|zGXFG7hB~xwnhxK=(MsAU3=)u#`rBtA3P^=M{m-4IGg!fiBP{L!=xo7( z(JAr*l8TiSfTcBdCWF$kM2HHSM*F^rqDT~)Q@7{ z;P6^>PNZuVgP7hZl!giYNVgZ$0$>~6R-DM{&7~w;MAB0#IA+eXYNc>OIsDF!Ly()J zq3FHS~(HGb?R?1KE%;9akesqjK=I6P) zZw*RhuwgTq`fp79ki-;KcL8s)&WYnEn324WXM{ zWdh<=D?HNe;VO%!@3UC1<81upRn8s>F{;62@d7)yZ>+0;hFPqQPSXrT1ELP^{f8XO(tKQbFk9{h} zt{)m2YO|@;YTl(wrF|Cv9S=z4{xwgoy7YJczrD+U2`~U2j*({s#YEEp0000 1 && employSeparator) { + moduleConfig.tbar.addItem('-'); + } + moduleConfig.tbar.addItem(createChartLinkButton(self.module_id)); + } + + break; + default: if (moduleConfig.tbar.items.getCount() > 1 && employSeparator) diff --git a/html/gui/js/modules/metric_explorer/MetricExplorer.js b/html/gui/js/modules/metric_explorer/MetricExplorer.js index d4ae35d26e..c240f03073 100644 --- a/html/gui/js/modules/metric_explorer/MetricExplorer.js +++ b/html/gui/js/modules/metric_explorer/MetricExplorer.js @@ -2007,7 +2007,8 @@ Ext.extend(XDMoD.Module.MetricExplorer, XDMoD.PortalModule, { durationSelector: true, exportMenu: true, printButton: true, - reportCheckbox: true + reportCheckbox: true, + chartLinkButton: true }, @@ -5494,6 +5495,8 @@ Ext.extend(XDMoD.Module.MetricExplorer, XDMoD.PortalModule, { self.getReportCheckbox().setDisabled(noData); + self.getChartLinkButton().setDisabled(noData); + var reportGeneratorMeta = chartStore.getAt(0).get('reportGeneratorMeta'); self.getReportCheckbox().storeChartArguments(reportGeneratorMeta.chart_args, @@ -6236,6 +6239,20 @@ Ext.extend(XDMoD.Module.MetricExplorer, XDMoD.PortalModule, { // --------------------------------------------------------- + self.on('chart_link_clicked', function () { + var encodedData = window.btoa(JSON.stringify(this.getConfig())); + var link = window.location.protocol + '//' + window.location.host + '/#main_tab_panel:metric_explorer?config=' + encodedData; + var msg = 'Use the following link to share the current chart.
We recommend using Chrome or Firefox if the link does not work in Internet Explorer.
' + link + ''; + Ext.Msg.show({ + title: 'Link to Chart', + minWidth: 700, + msg: msg, + buttons: Ext.Msg.OK + }); + }); // self.on('chart_link_clicked', ... + + // --------------------------------------------------------- + this.loadAll = function() { this.queries_store_loaded_handler = function() { this.createQueryFunc.call(this, null, null, null, null, null, null, false); @@ -6286,6 +6303,10 @@ Ext.extend(XDMoD.Module.MetricExplorer, XDMoD.PortalModule, { listeners: { activate: function( /*panel*/ ) { this.updateRawDataWindowVisibility(); + if (location.hash.split('config=')[1]) { + var config = JSON.parse(window.atob(location.hash.split('config=')[1])); + XDMoD.Module.MetricExplorer.setConfig(config, config.title, false); + } }, // activate deactivate: function( /*panel*/ ) { From 03f49149dba8d866bda3324165c63c06a66c0714 Mon Sep 17 00:00:00 2001 From: "Mohammad K. Zia" Date: Fri, 12 Jul 2019 15:18:40 -0400 Subject: [PATCH 2/3] Update link message --- html/gui/js/modules/metric_explorer/MetricExplorer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/gui/js/modules/metric_explorer/MetricExplorer.js b/html/gui/js/modules/metric_explorer/MetricExplorer.js index c240f03073..8f9db13fa2 100644 --- a/html/gui/js/modules/metric_explorer/MetricExplorer.js +++ b/html/gui/js/modules/metric_explorer/MetricExplorer.js @@ -6242,7 +6242,7 @@ Ext.extend(XDMoD.Module.MetricExplorer, XDMoD.PortalModule, { self.on('chart_link_clicked', function () { var encodedData = window.btoa(JSON.stringify(this.getConfig())); var link = window.location.protocol + '//' + window.location.host + '/#main_tab_panel:metric_explorer?config=' + encodedData; - var msg = 'Use the following link to share the current chart.
We recommend using Chrome or Firefox if the link does not work in Internet Explorer.
' + link + ''; + var msg = 'Use the following link to share the current chart. Note that the link does no override the access controls. So if you send the link to someone who does not have access to the data, they will still not be able to see the data.
We recommend using Chrome or Firefox if the link does not work in Internet Explorer.
' + link + ''; Ext.Msg.show({ title: 'Link to Chart', minWidth: 700, From 4b4ae0a2084a279d1372eecaa3f800d01896b89c Mon Sep 17 00:00:00 2001 From: "Mohammad K. Zia" Date: Fri, 12 Jul 2019 16:30:11 -0400 Subject: [PATCH 3/3] fix typo --- html/gui/js/modules/metric_explorer/MetricExplorer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/gui/js/modules/metric_explorer/MetricExplorer.js b/html/gui/js/modules/metric_explorer/MetricExplorer.js index 8f9db13fa2..121669d8f7 100644 --- a/html/gui/js/modules/metric_explorer/MetricExplorer.js +++ b/html/gui/js/modules/metric_explorer/MetricExplorer.js @@ -6242,7 +6242,7 @@ Ext.extend(XDMoD.Module.MetricExplorer, XDMoD.PortalModule, { self.on('chart_link_clicked', function () { var encodedData = window.btoa(JSON.stringify(this.getConfig())); var link = window.location.protocol + '//' + window.location.host + '/#main_tab_panel:metric_explorer?config=' + encodedData; - var msg = 'Use the following link to share the current chart. Note that the link does no override the access controls. So if you send the link to someone who does not have access to the data, they will still not be able to see the data.
We recommend using Chrome or Firefox if the link does not work in Internet Explorer.
' + link + ''; + var msg = 'Use the following link to share the current chart. Note that the link does not override the access controls. So if you send the link to someone who does not have access to the data, they will still not be able to see the data.
We recommend using Chrome or Firefox if the link does not work in Internet Explorer.
' + link + ''; Ext.Msg.show({ title: 'Link to Chart', minWidth: 700,