Skip to content

Commit

Permalink
Fix broken initial uiState set (elastic#15630)
Browse files Browse the repository at this point in the history
  • Loading branch information
timroes authored Dec 16, 2017
1 parent bb09492 commit 769bb66
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/ui/public/visualize/visualization.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { uiModules } from 'ui/modules';
import { ResizeCheckerProvider } from 'ui/resize_checker';
import visualizationTemplate from 'ui/visualize/visualization.html';
import { getUpdateStatus } from 'ui/vis/update_status';
import { PersistedState } from 'ui/persisted_state';
import 'angular-sanitize';

uiModules
Expand Down Expand Up @@ -35,9 +36,12 @@ uiModules

$scope.addLegend = false;

// Set the passed in uiState to the vis object, so we don't require any
// users of the <visualization/> directive to manually set the uiState.
if (!$scope.uiState) $scope.uiState = new PersistedState({});
$scope.vis.setUiState($scope.uiState);
// Whenever the uiState changed, that the visualization should use,
// attach it to the actual Vis class. Thus we don't require any users
// of the <visualization/> directive to manuallay set the uiState.
// attach it to the actual Vis class.
$scope.$watch('uiState', (uiState) => {
$scope.vis.setUiState(uiState);
});
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/dashboard/_dashboard_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export default function ({ getService, getPageObjects }) {
expect(headers[1]).to.be('agent');
});

it.skip('Tile map with no changes will update with visualization changes', async () => {
it('Tile map with no changes will update with visualization changes', async () => {
await PageObjects.dashboard.gotoDashboardLandingPage();

await PageObjects.dashboard.clickNewDashboard();
Expand Down

0 comments on commit 769bb66

Please sign in to comment.