Skip to content

Commit

Permalink
Fix timelion data-render-complete attribute on resize (elastic#29320)
Browse files Browse the repository at this point in the history
* Fix timelion missing renderer on resize

Adding a watch to the renderComplete promise to fix missing rendering of chart
when the resize observer detect a change in size.
Removed the existing resize observer.

* Revert removing observe resize

It's need on the timelion app to resize since that app doesn't use
visualize loader

* Change double watch to watchgroup

* Reenable skipped dashboard test
  • Loading branch information
markov00 committed Jan 25, 2019
1 parent 92fb20e commit 6a4b43a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,43 +26,44 @@ require('ui/modules')
scope: {
seriesList: '=chart', // The flot object, data, config and all
search: '=', // The function to execute to kick off a search
interval: '=' // Required for formatting x-axis ticks
interval: '=', // Required for formatting x-axis ticks
rerenderTrigger: '=',
},
link: function ($scope, $elem) {

const panelRegistry = Private(panelRegistryProvider);
let panelScope = $scope.$new(true);

function render(seriesList) {
function render() {
panelScope.$destroy();

if (!seriesList) return;
if (!$scope.seriesList) return;

seriesList.render = seriesList.render || {
$scope.seriesList.render = $scope.seriesList.render || {
type: 'timechart'
};

const panelSchema = panelRegistry.byName[seriesList.render.type];
const panelSchema = panelRegistry.byName[$scope.seriesList.render.type];

if (!panelSchema) {
$elem.text(
i18n('timelion.chart.seriesList.noSchemaWarning', {
defaultMessage: 'No such panel type: {renderType}',
values: { renderType: seriesList.render.type },
values: { renderType: $scope.seriesList.render.type },
})
);
return;
}

panelScope = $scope.$new(true);
panelScope.seriesList = seriesList;
panelScope.seriesList = $scope.seriesList;
panelScope.interval = $scope.interval;
panelScope.search = $scope.search;

panelSchema.render(panelScope, $elem);
}

$scope.$watch('seriesList', render);
$scope.$watchGroup(['seriesList', 'rerenderTrigger'], render);
}
};
});
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div ng-controller="TimelionVisController" class="timVis">
<div chart="esResponse.sheet[0]" class="timChart" interval="visState.params.interval"></div>
<div chart="esResponse.sheet[0]" rerender-trigger="renderComplete" class="timChart" interval="visState.params.interval"></div>
</div>

0 comments on commit 6a4b43a

Please sign in to comment.