Skip to content

Commit

Permalink
[Dashboard] Un-skip Show Underlying Data Tests (#148409)
Browse files Browse the repository at this point in the history
Fix tracking of refresh interval setting in dashboard state
unskip show underlying data tests
  • Loading branch information
ThomThomson authored Jan 10, 2023
1 parent 0da7113 commit 95a3313
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ export const dashboardDiffingFunctions: DashboardDiffFunctions = {
return true;
},

refreshInterval: ({ currentValue, lastValue, currentInput }) => {
if (!currentInput.timeRestore) return true; // if time restore is set to false, refresh interval doesn't count as a change.
return fastIsEqual(currentValue, lastValue);
},

controlGroupInput: ({ currentValue, lastValue }) =>
persistableControlGroupInputIsEqual(currentValue, lastValue),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { merge, Subject } from 'rxjs';
import { Subject } from 'rxjs';
import { distinctUntilChanged, finalize, switchMap, tap } from 'rxjs/operators';

import type { Filter, Query } from '@kbn/es-query';
Expand Down Expand Up @@ -35,7 +35,7 @@ export function syncUnifiedSearchState(
getState,
dispatch,
onStateChange,
actions: { setFiltersAndQuery, setTimeRange },
actions: { setFiltersAndQuery, setTimeRange, setRefreshInterval },
} = this.getReduxEmbeddableTools();

// get Observable for when the dashboard's saved filters or query change.
Expand Down Expand Up @@ -76,10 +76,13 @@ export function syncUnifiedSearchState(
}
);

const timeRefreshSubscription = merge(
timefilterService.getRefreshIntervalUpdate$(),
timefilterService.getTimeUpdate$()
).subscribe(() => dispatch(setTimeRange(timefilterService.getTime())));
const timeUpdateSubscription = timefilterService
.getTimeUpdate$()
.subscribe(() => dispatch(setTimeRange(timefilterService.getTime())));

const refreshIntervalSubscription = timefilterService
.getRefreshIntervalUpdate$()
.subscribe(() => dispatch(setRefreshInterval(timefilterService.getRefreshInterval())));

const autoRefreshSubscription = timefilterService
.getAutoRefreshFetch$()
Expand All @@ -96,7 +99,8 @@ export function syncUnifiedSearchState(

const stopSyncingUnifiedSearchState = () => {
autoRefreshSubscription.unsubscribe();
timeRefreshSubscription.unsubscribe();
timeUpdateSubscription.unsubscribe();
refreshIntervalSubscription.unsubscribe();
unsubscribeFromSavedFilterChanges();
stopSyncingAppFilters();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,15 @@ export const dashboardContainerReducers = {

state.explicitInput.tags = action.payload.tags;
state.explicitInput.title = action.payload.title;
state.explicitInput.timeRange = action.payload.timeRange;
state.explicitInput.description = action.payload.description;
state.explicitInput.timeRestore = action.payload.timeRestore;
state.explicitInput.refreshInterval = action.payload.refreshInterval;

if (action.payload.refreshInterval) {
state.explicitInput.refreshInterval = action.payload.refreshInterval;
}
if (action.payload.timeRange) {
state.explicitInput.timeRange = action.payload.timeRange;
}
},

setDescription: (
Expand Down Expand Up @@ -174,6 +179,13 @@ export const dashboardContainerReducers = {
state.explicitInput.timeRange = action.payload;
},

setRefreshInterval: (
state: DashboardReduxState,
action: PayloadAction<DashboardContainerByValueInput['refreshInterval']>
) => {
state.explicitInput.refreshInterval = action.payload;
},

setTimeslice: (
state: DashboardReduxState,
action: PayloadAction<DashboardContainerByValueInput['timeslice']>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const browser = getService('browser');
const retry = getService('retry');

// Failing: See https://github.com/elastic/kibana/issues/147625
describe.skip('lens show underlying data from dashboard', () => {
describe('lens show underlying data from dashboard', () => {
it('should show the open button for a compatible saved visualization', async () => {
await PageObjects.visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('lnsXYvis');
Expand Down

0 comments on commit 95a3313

Please sign in to comment.