From b661e93b1a0cd27b5989f5a801a58c0d4c2d91cf Mon Sep 17 00:00:00 2001 From: Andrey Kuleshov Date: Fri, 6 Oct 2017 14:06:06 +0300 Subject: [PATCH] Migrate to new API --- 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 6c854bc..04f762f 100644 --- a/dist/dashboard-panel.js +++ b/dist/dashboard-panel.js @@ -59,7 +59,7 @@ var CustomExtensions; if (value.length) { var newDashboardId = value[0]; if (_this._dashboardControl.dashboardContainer() && _this._dashboardControl.dashboardContainer().id != newDashboardId) { - _this._dashboardControl.dashboardServiceClient.loadDashboard(newDashboardId); + _this._dashboardControl.loadDashboard(newDashboardId); } } }); @@ -95,7 +95,7 @@ var CustomExtensions; CustomDashboardPanelExtension.prototype.updateDashboardsList = function () { var _this = this; var dashboardContainer = this._dashboardControl.dashboardContainer(); - this._dashboardControl.dashboardServiceClient.requestDashboardList().done(function (availableDashboards) { + this._dashboardControl.requestDashboardList().done(function (availableDashboards) { _this.availableDashboards(availableDashboards); }); }; diff --git a/dist/dashboard-panel.min.js b/dist/dashboard-panel.min.js index d6dcdc3..9960d95 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("ViewerOnly"!==o.params.workingMode),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.dashboardServiceClient.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.dashboardServiceClient.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),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("ViewerOnly"!==o.params.workingMode),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 564a4a8..96a9072 100644 --- a/src/dashboard-panel.ts +++ b/src/dashboard-panel.ts @@ -46,7 +46,7 @@ module CustomExtensions { if(value.length) { var newDashboardId = value[0]; if(this._dashboardControl.dashboardContainer()&&this._dashboardControl.dashboardContainer().id!=newDashboardId) { - this._dashboardControl.dashboardServiceClient.loadDashboard(newDashboardId); + this._dashboardControl.loadDashboard(newDashboardId); } } }); @@ -86,7 +86,7 @@ module CustomExtensions { updateDashboardsList() { var dashboardContainer = this._dashboardControl.dashboardContainer(); - this._dashboardControl.dashboardServiceClient.requestDashboardList().done((availableDashboards: Array) => { + this._dashboardControl.requestDashboardList().done((availableDashboards: Array) => { this.availableDashboards(availableDashboards); }); }