From f138656cd6d3416ff7996c64d684812f8c6e74ad Mon Sep 17 00:00:00 2001 From: Dmitry Rudnev Date: Thu, 23 Nov 2017 16:59:41 +0300 Subject: [PATCH] fix T579718 - ASPxWebDashboard - The dashboards list is not updated when calling the ASPxClientDashboard.SwitchToViewer method (https://www.devexpress.com/Support/Center/Question/Details/T579718/aspxwebdashboard-the-dashboards-list-is-not-updated-when-calling-the-aspxclientdashboard) fix T576518 - ASPxDashboard - It is impossible to open a dashboard using DashboardPanelExtension after calling the close method (https://www.devexpress.com/Support/Center/Question/Details/T576518/aspxdashboard-it-is-impossible-to-open-a-dashboard-using-dashboardpanelextension-after ) --- dist/dashboard-panel.js | 4 ++-- dist/dashboard-panel.min.js | 2 +- src/dashboard-panel.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/dashboard-panel.js b/dist/dashboard-panel.js index 8b7915f..308d430 100644 --- a/dist/dashboard-panel.js +++ b/dist/dashboard-panel.js @@ -18,6 +18,7 @@ var CustomExtensions; this.showPanelAsync = function (options) { var def = $.Deferred(); _this.visible(true); + _this.updateDashboardsList(); setTimeout(function () { options.surfaceLeft = _this.panelWidth; def.resolve(options); @@ -35,7 +36,6 @@ var CustomExtensions; }; this.switchToViewer = function () { _this._dashboardControl.switchToViewer(); - _this.updateDashboardsList(); }; this.switchToDesigner = function () { _this._dashboardControl.switchToDesigner(); @@ -58,7 +58,7 @@ var CustomExtensions; this.selectedItemKeys.subscribe(function (value) { if (value.length) { var newDashboardId = value[0]; - if (_this._dashboardControl.dashboardContainer() && _this._dashboardControl.dashboardContainer().id != newDashboardId) { + if (!_this._dashboardControl.dashboardContainer() || _this._dashboardControl.dashboardContainer().id !== newDashboardId) { _this._dashboardControl.loadDashboard(newDashboardId); } } diff --git a/dist/dashboard-panel.min.js b/dist/dashboard-panel.min.js index f4fdcd1..5f34c68 100644 --- a/dist/dashboard-panel.min.js +++ b/dist/dashboard-panel.min.js @@ -1 +1 @@ -var CustomExtensions;!function(o){var t=function(){function o(o){var t=this;this._dashboardControl=o,this.name="custom-dashboard-panel",this._customTemplate={name:"dashboard-custom-panel-extension",data:this},this.panelWidth=250,this.visible=ko.observable(!1),this.allowSwitchToDesigner=ko.observable(!0),this.selectedItemKeys=ko.observableArray(),this.availableDashboards=ko.observableArray(),this.showPanelAsync=function(o){var e=$.Deferred();return t.visible(!0),setTimeout(function(){o.surfaceLeft=t.panelWidth,e.resolve(o)},500),e.promise()},this.hidePanelAsync=function(o){var e=$.Deferred();return t.visible(!1),setTimeout(function(){o.surfaceLeft=0,e.resolve(o)},500),e.promise()},this.switchToViewer=function(){t._dashboardControl.switchToViewer(),t.updateDashboardsList()},this.switchToDesigner=function(){t._dashboardControl.switchToDesigner()},this._toolbarElement=new DevExpress.Dashboard.DashboardToolbarGroup("viewer-button","",100);var e=new DevExpress.Dashboard.DashboardToolbarItem("toviewer",function(){return t.switchToViewer()});e.template="dashboard-custom-panel-extension-viewer-button",e.disabled=ko.pureComputed(function(){return!!t._dashboardControl.dashboard()}),this.allowSwitchToDesigner(o.allowSwitchToDesigner),this._toolbarElement.items.push(e),this.desingerToViewerAction={orderNo:60,action:this.showPanelAsync},this.viewerToDesignerAction={orderNo:20,action:this.hidePanelAsync},this.visible(!this._dashboardControl.isDesignMode()),this.selectedItemKeys.subscribe(function(o){if(o.length){var e=o[0];t._dashboardControl.dashboardContainer()&&t._dashboardControl.dashboardContainer().id!=e&&t._dashboardControl.loadDashboard(e)}})}return o.prototype.start=function(){var o=this;this._dashboardControl.customTemplates.push(this._customTemplate);var t=this._dashboardControl.findExtension("toolbox");t&&t.toolbarGroups.push(this._toolbarElement),this._dashboardControl.dashboardContainer.subscribe(function(t){t&&o._validateSelection(t,o.availableDashboards())}),this.availableDashboards.subscribe(function(t){return o._validateSelection(o._dashboardControl.dashboardContainer(),t)}),this._dashboardControl.isDesignMode()||this._dashboardControl.surfaceLeft(this.panelWidth),this.left=ko.computed(function(){return o.visible()?0:-o.panelWidth}),this.updateDashboardsList()},o.prototype.stop=function(){var o=this._dashboardControl.findExtension("toolbox");o&&o.toolbarGroups.remove(this._toolbarElement),this._dashboardControl.customTemplates.remove(this._customTemplate)},o.prototype.updateDashboardsList=function(){var o=this;this._dashboardControl.dashboardContainer();this._dashboardControl.requestDashboardList().done(function(t){o.availableDashboards(t)})},o.prototype._validateSelection=function(o,t){if(o){var e=t.filter(function(t){return t.id===o.id})[0];e&&this.selectedItemKeys([e.id])}},o}();o.CustomDashboardPanelExtension=t}(CustomExtensions||(CustomExtensions={})); \ No newline at end of file +var CustomExtensions;!function(o){var t=function(){function o(o){var t=this;this._dashboardControl=o,this.name="custom-dashboard-panel",this._customTemplate={name:"dashboard-custom-panel-extension",data:this},this.panelWidth=250,this.visible=ko.observable(!1),this.allowSwitchToDesigner=ko.observable(!0),this.selectedItemKeys=ko.observableArray(),this.availableDashboards=ko.observableArray(),this.showPanelAsync=function(o){var e=$.Deferred();return t.visible(!0),t.updateDashboardsList(),setTimeout(function(){o.surfaceLeft=t.panelWidth,e.resolve(o)},500),e.promise()},this.hidePanelAsync=function(o){var e=$.Deferred();return t.visible(!1),setTimeout(function(){o.surfaceLeft=0,e.resolve(o)},500),e.promise()},this.switchToViewer=function(){t._dashboardControl.switchToViewer()},this.switchToDesigner=function(){t._dashboardControl.switchToDesigner()},this._toolbarElement=new DevExpress.Dashboard.DashboardToolbarGroup("viewer-button","",100);var e=new DevExpress.Dashboard.DashboardToolbarItem("toviewer",function(){return t.switchToViewer()});e.template="dashboard-custom-panel-extension-viewer-button",e.disabled=ko.pureComputed(function(){return!!t._dashboardControl.dashboard()}),this.allowSwitchToDesigner(o.allowSwitchToDesigner),this._toolbarElement.items.push(e),this.desingerToViewerAction={orderNo:60,action:this.showPanelAsync},this.viewerToDesignerAction={orderNo:20,action:this.hidePanelAsync},this.visible(!this._dashboardControl.isDesignMode()),this.selectedItemKeys.subscribe(function(o){if(o.length){var e=o[0];t._dashboardControl.dashboardContainer()&&t._dashboardControl.dashboardContainer().id===e||t._dashboardControl.loadDashboard(e)}})}return o.prototype.start=function(){var o=this;this._dashboardControl.customTemplates.push(this._customTemplate);var t=this._dashboardControl.findExtension("toolbox");t&&t.toolbarGroups.push(this._toolbarElement),this._dashboardControl.dashboardContainer.subscribe(function(t){t&&o._validateSelection(t,o.availableDashboards())}),this.availableDashboards.subscribe(function(t){return o._validateSelection(o._dashboardControl.dashboardContainer(),t)}),this._dashboardControl.isDesignMode()||this._dashboardControl.surfaceLeft(this.panelWidth),this.left=ko.computed(function(){return o.visible()?0:-o.panelWidth}),this.updateDashboardsList()},o.prototype.stop=function(){var o=this._dashboardControl.findExtension("toolbox");o&&o.toolbarGroups.remove(this._toolbarElement),this._dashboardControl.customTemplates.remove(this._customTemplate)},o.prototype.updateDashboardsList=function(){var o=this;this._dashboardControl.dashboardContainer();this._dashboardControl.requestDashboardList().done(function(t){o.availableDashboards(t)})},o.prototype._validateSelection=function(o,t){if(o){var e=t.filter(function(t){return t.id===o.id})[0];e&&this.selectedItemKeys([e.id])}},o}();o.CustomDashboardPanelExtension=t}(CustomExtensions||(CustomExtensions={})); \ No newline at end of file diff --git a/src/dashboard-panel.ts b/src/dashboard-panel.ts index b705944..d5947d7 100644 --- a/src/dashboard-panel.ts +++ b/src/dashboard-panel.ts @@ -45,7 +45,7 @@ module CustomExtensions { this.selectedItemKeys.subscribe(value => { if(value.length) { var newDashboardId = value[0]; - if(this._dashboardControl.dashboardContainer()&&this._dashboardControl.dashboardContainer().id!=newDashboardId) { + if(!this._dashboardControl.dashboardContainer() || this._dashboardControl.dashboardContainer().id !== newDashboardId) { this._dashboardControl.loadDashboard(newDashboardId); } } @@ -102,6 +102,7 @@ module CustomExtensions { showPanelAsync = (options: DevExpress.Dashboard.IWorkingModeSwitchingOptions) => { var def = $.Deferred(); this.visible(true); + this.updateDashboardsList(); setTimeout(() => { options.surfaceLeft = this.panelWidth; def.resolve(options); @@ -119,7 +120,6 @@ module CustomExtensions { } switchToViewer = (): void => { this._dashboardControl.switchToViewer(); - this.updateDashboardsList(); } switchToDesigner = (): void => { this._dashboardControl.switchToDesigner();