Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dashboard embeddable #194892

Merged
merged 127 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
15c2fdd
[dashboard] decouple DashboardCreationOptions from DashboardContainer
nreese Oct 3, 2024
4e1a481
eslint
nreese Oct 3, 2024
4d76de9
clean up useControlGroupIntegration
nreese Oct 3, 2024
44f4194
create_dashboard_api
nreese Oct 4, 2024
27349bb
remove dashboard factory
nreese Oct 4, 2024
b1e828c
type
nreese Oct 4, 2024
f0bc15a
replacePanel
nreese Oct 4, 2024
e086063
data views
nreese Oct 4, 2024
1a0ab99
unified search
nreese Oct 4, 2024
67ddc4f
unified search cleanup
nreese Oct 4, 2024
7c08835
view mode
nreese Oct 4, 2024
042f9e5
Merge branch 'main' into remove_dashboard_embeddable
elasticmachine Oct 5, 2024
b227a72
addFromLibrary
nreese Oct 5, 2024
e5efbd0
asyncResetToLastSavedState
nreese Oct 5, 2024
f39b17b
Merge branch 'main' into remove_dashboard_embeddable
elasticmachine Oct 7, 2024
87cb66c
asyncResetToLastSavedState
nreese Oct 7, 2024
8493394
unified search reset
nreese Oct 7, 2024
685b89d
clean up
nreese Oct 7, 2024
90ac340
merge with main
nreese Oct 9, 2024
14da4d4
more settings
nreese Oct 9, 2024
baff7c0
finish getDashboardApi
nreese Oct 10, 2024
6f357a0
replace managed$ with isManaged
nreese Oct 10, 2024
7b8de20
move useMargins$ to settings
nreese Oct 10, 2024
71855ba
track unsaved changes part1
nreese Oct 10, 2024
8190f3e
finish up unsaved changes
nreese Oct 10, 2024
3ccb006
rename
nreese Oct 10, 2024
b957cb0
back up unsaved changes to session storage
nreese Oct 10, 2024
53411a2
fix use margins
nreese Oct 10, 2024
fa7addb
remove diff folder
nreese Oct 10, 2024
da30148
render control group
nreese Oct 10, 2024
2089adb
runQuickSave
nreese Oct 11, 2024
0d69445
isManaged
nreese Oct 11, 2024
15210a7
Merge branch 'main' into remove_dashboard_embeddable
elasticmachine Oct 21, 2024
ebf1113
arePanelsLayoutEqual
nreese Oct 21, 2024
b8500dd
remove circular setting in unified search
nreese Oct 21, 2024
b6aef8d
run interactive save initial work
nreese Oct 21, 2024
2ec44fe
run interactive save
nreese Oct 21, 2024
ce35116
rename to openSaveModal
nreese Oct 21, 2024
1cdd03a
fix save issues
nreese Oct 21, 2024
97c3e6c
duplicatePanel
nreese Oct 22, 2024
8df7a98
remove addOrUpdateEmbeddable
nreese Oct 22, 2024
da37f3d
searchSessionId
nreese Oct 22, 2024
92846a8
clean up
nreese Oct 22, 2024
8fb7171
query_performance_tracking
nreese Oct 23, 2024
9b24fbd
track number of times dashboard is loaded
nreese Oct 23, 2024
05fd5e2
add incomingEmbeddable to panels
nreese Oct 23, 2024
6362c4a
clean up
nreese Oct 23, 2024
16bf41e
remove createDashboard
nreese Oct 23, 2024
494cf53
Merge branch 'main' into remove_dashboard_embeddable
elasticmachine Oct 23, 2024
0480ab8
viewMode comparators
nreese Oct 24, 2024
6b5b05a
Merge branch 'main' into remove_dashboard_embeddable
elasticmachine Oct 24, 2024
45c4bf3
TrackContentfulRender
nreese Oct 24, 2024
09c5384
tslint
nreese Oct 24, 2024
80451dc
rename loadDashboard to loadDashboardApiu
nreese Oct 24, 2024
b1cae7f
tslint
nreese Oct 24, 2024
4b40e9d
remove redux reducers
nreese Oct 24, 2024
5203570
mock
nreese Oct 25, 2024
5ad25aa
remove usage of CONTACT_CARD_EMBEDDABLE
nreese Oct 25, 2024
3e2f9a6
merge with main
nreese Oct 25, 2024
52968ed
tslint
nreese Oct 25, 2024
63cc22a
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Oct 25, 2024
c211bd0
clean up
nreese Oct 25, 2024
5201e14
i18n
nreese Oct 25, 2024
88a86c8
clean up
nreese Oct 25, 2024
8c363e5
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Oct 25, 2024
1e53efd
dashboardContainer class
nreese Oct 25, 2024
334fe56
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Oct 25, 2024
dc38bee
unifiedSearchFilters$
nreese Oct 26, 2024
3391344
eslint
nreese Oct 26, 2024
b59feb9
merge with main
nreese Oct 28, 2024
47ec9a4
fix dashboard time test
nreese Oct 28, 2024
53a5541
fix view mode test
nreese Oct 29, 2024
90fa1f1
apply pinned filters to dashboard on open
nreese Oct 29, 2024
dbcdfa2
cleanup
nreese Oct 29, 2024
19184e7
Merge branch 'main' into remove_dashboard_embeddable
elasticmachine Oct 30, 2024
00b1cd7
unsavedChangesDiffingFunctions
nreese Oct 30, 2024
5953356
cleanup
nreese Oct 30, 2024
6ac4507
fix jest test
nreese Oct 30, 2024
723b027
fix test dashboard unsaved listing loses unsaved changes to new dash…
nreese Oct 30, 2024
90ea556
add execution context to api
nreese Oct 30, 2024
d8e8b77
Merge branch 'main' into remove_dashboard_embeddable
elasticmachine Oct 31, 2024
7c23b48
locator
nreese Oct 31, 2024
c32a775
Merge branch 'main' into remove_dashboard_embeddable
elasticmachine Nov 1, 2024
362277d
fix jest test
nreese Nov 1, 2024
e191fc3
merge with main
nreese Nov 4, 2024
1760e38
preserve pinned filters on reset
nreese Nov 4, 2024
c50e12c
Merge branch 'main' into remove_dashboard_embeddable
elasticmachine Nov 7, 2024
cc53f1b
merge with main
nreese Nov 12, 2024
61babc7
tslint
nreese Nov 12, 2024
b97ee06
merge with main
nreese Nov 18, 2024
c83706a
Merge branch 'main' into remove_dashboard_embeddable
elasticmachine Nov 19, 2024
f311661
tslint
nreese Nov 19, 2024
9cf697f
revert changes to cm_services
nreese Nov 19, 2024
1e3e247
Merge branch 'main' into remove_dashboard_embeddable
Heenawter Nov 21, 2024
613c232
Merge branch 'main' into remove_dashboard_embeddable
elasticmachine Nov 22, 2024
beb14ca
Merge branch 'main' into remove_dashboard_embeddable
elasticmachine Nov 25, 2024
92d5330
Merge branch 'main' into remove_dashboard_embeddable
elasticmachine Nov 26, 2024
ba88eac
eslint
nreese Nov 26, 2024
224c09e
fix dashboard_esql_no_data test
nreese Nov 26, 2024
a8b76dc
fix explore_data_panel_action
nreese Nov 26, 2024
f169390
fix async_search/save_search_session
nreese Nov 26, 2024
844abc1
Merge branch 'main' into remove_dashboard_embeddable
elasticmachine Nov 26, 2024
3803564
fix dashboard_esql_no_data
nreese Nov 27, 2024
944b1cd
Merge branch 'main' into remove_dashboard_embeddable
elasticmachine Dec 2, 2024
385cc1c
Merge branch 'main' into remove_dashboard_embeddable
elasticmachine Dec 4, 2024
608541c
Update src/plugins/dashboard/public/dashboard_api/data_views_manager.ts
nreese Dec 4, 2024
668a4a5
Update src/plugins/dashboard/public/dashboard_api/get_dashboard_api.ts
nreese Dec 4, 2024
239f4ec
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Dec 4, 2024
5a94715
Merge remote-tracking branch 'upstream/main' into remove_dashboard_em…
nreese Dec 5, 2024
31496cd
make panelsManager and unsavedChangesManager consts
nreese Dec 5, 2024
6073680
update DashboardState to extend from DashboardOptions
nreese Dec 5, 2024
91e0ed9
remove next from reload$
nreese Dec 5, 2024
4f33c5a
merge with main
nreese Dec 6, 2024
3dfd29b
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Dec 6, 2024
edfda60
Update src/plugins/dashboard/public/dashboard_api/load_dashboard_api.ts
nreese Dec 6, 2024
e2cf5d2
rename showPage to hideNoDataPage
nreese Dec 6, 2024
4ee0ad5
link TODO with issue
nreese Dec 6, 2024
98f5bcf
move animatePanelTransforms into useBatchedPublishingSubjects
nreese Dec 6, 2024
d09c923
tslint
nreese Dec 7, 2024
c937414
Merge branch 'main' into remove_dashboard_embeddable
elasticmachine Dec 7, 2024
5a3c705
Merge remote-tracking branch 'upstream/main' into remove_dashboard_em…
nreese Dec 9, 2024
4ddd878
add log to test to get more info on failure
nreese Dec 9, 2024
4d81372
fix test/functional/apps/dashboard/group6/dashboard_esql_no_data.ts
nreese Dec 9, 2024
117db41
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Dec 9, 2024
cf23d20
merge with main
nreese Dec 10, 2024
7a6417c
eslint
nreese Dec 10, 2024
dc0df9c
Merge remote-tracking branch 'upstream/main' into remove_dashboard_em…
nreese Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/presentation/presentation_containers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export {
export {
canTrackContentfulRender,
type TrackContentfulRender,
type TracksQueryPerformance,
} from './interfaces/performance_trackers';
export {
apiIsPresentationContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,3 @@ export interface TrackContentfulRender {
export const canTrackContentfulRender = (root: unknown): root is TrackContentfulRender => {
return root !== null && typeof root === 'object' && 'trackContentfulRender' in root;
};

export interface TracksQueryPerformance {
firstLoad: boolean;
creationStartTime?: number;
creationEndTime?: number;
lastLoadStartTime?: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import { OverlayRef } from '@kbn/core-mount-utils-browser';

interface TracksOverlaysOptions {
export interface TracksOverlaysOptions {
/**
* If present, the panel with this ID will be focused when the overlay is opened. This can be used in tandem with a push
* flyout to edit a panel's settings in context
Expand Down
1 change: 1 addition & 0 deletions packages/presentation/presentation_publishing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export {
initializeTimeRange,
type SerializedTimeRange,
} from './interfaces/fetch/initialize_time_range';
export { apiPublishesReload, type PublishesReload } from './interfaces/fetch/publishes_reload';
export {
apiPublishesFilters,
apiPublishesPartialUnifiedSearch,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { PublishingSubject } from '../../publishing_subject';
import { Observable } from 'rxjs';

export interface PublishesReload {
reload$: PublishingSubject<void>;
reload$: Omit<Observable<void>, 'next'>;
}

export const apiPublishesReload = (unknownApi: null | unknown): unknownApi is PublishesReload => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,15 @@ export const initializeTitles = (
const panelDescription = new BehaviorSubject<string | undefined>(rawState.description);
const hidePanelTitle = new BehaviorSubject<boolean | undefined>(rawState.hidePanelTitles);

const setPanelTitle = (value: string | undefined) => panelTitle.next(value);
const setHidePanelTitle = (value: boolean | undefined) => hidePanelTitle.next(value);
const setPanelDescription = (value: string | undefined) => panelDescription.next(value);
const setPanelTitle = (value: string | undefined) => {
if (value !== panelTitle.value) panelTitle.next(value);
};
const setHidePanelTitle = (value: boolean | undefined) => {
if (value !== hidePanelTitle.value) hidePanelTitle.next(value);
};
const setPanelDescription = (value: string | undefined) => {
if (value !== panelDescription.value) panelDescription.next(value);
};

const titleComparators: StateComparators<SerializedTitles> = {
title: [panelTitle, setPanelTitle],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,14 @@
*/

import { isEmpty, xor } from 'lodash';
import moment, { Moment } from 'moment';
import fastIsEqual from 'fast-deep-equal';

import { DashboardPanelMap } from '../../../../common';

const convertTimeToUTCString = (time?: string | Moment): undefined | string => {
if (moment(time).isValid()) {
return moment(time).utc().format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
} else {
// If it's not a valid moment date, then it should be a string representing a relative time
// like 'now' or 'now-15m'.
return time as string;
}
};

export const areTimesEqual = (
timeA?: string | Moment | undefined,
timeB?: string | Moment | undefined
) => {
return convertTimeToUTCString(timeA) === convertTimeToUTCString(timeB);
};

export const defaultDiffFunction = (a: unknown, b: unknown) => fastIsEqual(a, b);
import { DashboardPanelMap } from '../../common';

/**
* Checks whether the panel maps have the same keys, and if they do, whether all of the other keys inside each panel
* are equal. Skips explicit input as that needs to be handled asynchronously.
*/
export const getPanelLayoutsAreEqual = (
export const arePanelLayoutsEqual = (
originalPanels: DashboardPanelMap,
newPanels: DashboardPanelMap
) => {
Expand All @@ -57,7 +36,7 @@ export const getPanelLayoutsAreEqual = (
];
for (const key of keys) {
if (key === undefined) continue;
if (!defaultDiffFunction(originalObj[key], newObj[key])) differences[key] = newObj[key];
if (!fastIsEqual(originalObj[key], newObj[key])) differences[key] = newObj[key];
}
return differences;
};
Expand Down
61 changes: 61 additions & 0 deletions src/plugins/dashboard/public/dashboard_api/data_loading_manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { BehaviorSubject, debounceTime, first, map } from 'rxjs';
import {
PublishesDataLoading,
PublishingSubject,
apiPublishesDataLoading,
} from '@kbn/presentation-publishing';
import { combineCompatibleChildrenApis } from '@kbn/presentation-containers';

export function initializeDataLoadingManager(
children$: PublishingSubject<{ [key: string]: unknown }>
) {
const dataLoading$ = new BehaviorSubject<boolean | undefined>(undefined);

const dataLoadingSubscription = combineCompatibleChildrenApis<
PublishesDataLoading,
boolean | undefined
>(
{ children$ },
'dataLoading',
apiPublishesDataLoading,
undefined,
// flatten method
(values) => {
return values.some((isLoading) => isLoading);
}
).subscribe((isAtLeastOneChildLoading) => {
dataLoading$.next(isAtLeastOneChildLoading);
});

return {
api: {
dataLoading: dataLoading$,
},
internalApi: {
waitForPanelsToLoad$: dataLoading$.pipe(
// debounce to give time for panels to start loading if they are going to load
debounceTime(300),
first((isLoading: boolean | undefined) => {
return !isLoading;
}),
map(() => {
// Observable notifies subscriber when loading is finished
// Return void to not expose internal implementation details of observable
return;
})
),
},
cleanup: () => {
dataLoadingSubscription.unsubscribe();
},
};
}
72 changes: 72 additions & 0 deletions src/plugins/dashboard/public/dashboard_api/data_views_manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { uniqBy } from 'lodash';
import { BehaviorSubject, combineLatest, Observable, of, switchMap } from 'rxjs';

import { DataView } from '@kbn/data-views-plugin/common';
import { combineCompatibleChildrenApis } from '@kbn/presentation-containers';
import {
apiPublishesDataViews,
PublishesDataViews,
PublishingSubject,
} from '@kbn/presentation-publishing';

import { ControlGroupApi } from '@kbn/controls-plugin/public';
import { dataService } from '../services/kibana_services';

export function initializeDataViewsManager(
controlGroupApi$: PublishingSubject<ControlGroupApi | undefined>,
children$: PublishingSubject<{ [key: string]: unknown }>
) {
const dataViews = new BehaviorSubject<DataView[] | undefined>([]);

const controlGroupDataViewsPipe: Observable<DataView[] | undefined> = controlGroupApi$.pipe(
switchMap((controlGroupApi) => {
return controlGroupApi ? controlGroupApi.dataViews : of([]);
nreese marked this conversation as resolved.
Show resolved Hide resolved
})
);

const childDataViewsPipe = combineCompatibleChildrenApis<PublishesDataViews, DataView[]>(
{ children$ },
'dataViews',
apiPublishesDataViews,
[]
);

const dataViewsSubscription = combineLatest([controlGroupDataViewsPipe, childDataViewsPipe])
.pipe(
switchMap(async ([controlGroupDataViews, childDataViews]) => {
const allDataViews = [...(controlGroupDataViews ?? []), ...childDataViews];
if (allDataViews.length === 0) {
try {
const defaultDataView = await dataService.dataViews.getDefaultDataView();
if (defaultDataView) {
allDataViews.push(defaultDataView);
}
} catch (error) {
// ignore error getting default data view
}
}
return uniqBy(allDataViews, 'id');
})
)
.subscribe((newDataViews) => {
dataViews.next(newDataViews);
});

return {
api: {
dataViews,
},
cleanup: () => {
dataViewsSubscription.unsubscribe();
},
};
}
Loading
Loading