update vis icon on save

This commit is contained in:
ppisljar 2016-12-24 20:20:05 +01:00
parent ec9a614d70
commit 401ed70df6
2 changed files with 8 additions and 0 deletions

View file

@ -47,6 +47,13 @@ module.directive('vislibSeries', function ($parse, $compile) {
});
$scope.vis.params.seriesParams = $scope.vis.params.seriesParams.slice(0, serieCount);
});
$scope.$watch(() => {
return $scope.vis.params.seriesParams.map(series => series.type).join();
}, () => {
const types = _.uniq(_.map($scope.vis.params.seriesParams, 'type'));
$scope.savedVis.type = types.length === 1 ? types[0] : 'histogram';
});
}
};
});

View file

@ -293,6 +293,7 @@ function VisEditor($scope, $route, timefilter, AppState, $window, kbnUrl, courie
$scope.doSave = function () {
// vis.title was not bound and it's needed to reflect title into visState
$state.vis.title = savedVis.title;
$state.vis.type = savedVis.type || $state.vis.type;
savedVis.visState = $state.vis;
savedVis.uiStateJSON = angular.toJson($scope.uiState.getChanges());