mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[embeddable rebuild] PublishesSettings interface (#179976)
Closes https://github.com/elastic/kibana/issues/179839 --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
eaef7753bf
commit
001f24c6b0
3 changed files with 43 additions and 5 deletions
|
@ -13,17 +13,16 @@ import {
|
|||
PublishingSubject,
|
||||
} from '@kbn/presentation-publishing';
|
||||
import { apiCanAddNewPanel, CanAddNewPanel } from './can_add_new_panel';
|
||||
import { PublishesSettings } from './publishes_settings';
|
||||
|
||||
export interface PanelPackage {
|
||||
panelType: string;
|
||||
initialState?: object;
|
||||
}
|
||||
|
||||
export interface PresentationContainer extends Partial<PublishesViewMode>, CanAddNewPanel {
|
||||
addNewPanel: <ApiType extends unknown = unknown>(
|
||||
panel: PanelPackage,
|
||||
displaySuccessMessage?: boolean
|
||||
) => Promise<ApiType | undefined>;
|
||||
export interface PresentationContainer
|
||||
extends Partial<PublishesViewMode & PublishesSettings>,
|
||||
CanAddNewPanel {
|
||||
removePanel: (panelId: string) => void;
|
||||
canRemovePanels?: () => boolean;
|
||||
replacePanel: (idToRemove: string, newPanel: PanelPackage) => Promise<string>;
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* 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 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 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { PublishingSubject } from '@kbn/presentation-publishing';
|
||||
|
||||
export interface PublishesSettings {
|
||||
settings: Record<string, PublishingSubject<boolean | undefined>>;
|
||||
}
|
||||
|
||||
export const apiPublishesSettings = (
|
||||
unknownApi: null | unknown
|
||||
): unknownApi is PublishesSettings => {
|
||||
return Boolean(unknownApi && typeof (unknownApi as PublishesSettings)?.settings === 'object');
|
||||
};
|
|
@ -11,6 +11,7 @@ import { Reference } from '@kbn/content-management-utils';
|
|||
import type { ControlGroupContainer } from '@kbn/controls-plugin/public';
|
||||
import type { KibanaExecutionContext, OverlayRef } from '@kbn/core/public';
|
||||
import {
|
||||
type PublishingSubject,
|
||||
apiPublishesPanelTitle,
|
||||
apiPublishesUnsavedChanges,
|
||||
getPanelTitle,
|
||||
|
@ -136,6 +137,7 @@ export class DashboardContainer
|
|||
public publishingSubscription: Subscription = new Subscription();
|
||||
public diffingSubscription: Subscription = new Subscription();
|
||||
public controlGroup?: ControlGroupContainer;
|
||||
public settings: Record<string, PublishingSubject<boolean | undefined>>;
|
||||
|
||||
public searchSessionId?: string;
|
||||
public searchSessionId$ = new BehaviorSubject<string | undefined>(undefined);
|
||||
|
@ -245,6 +247,24 @@ export class DashboardContainer
|
|||
})
|
||||
);
|
||||
this.startAuditingReactEmbeddableChildren();
|
||||
|
||||
this.settings = {
|
||||
syncColors$: embeddableInputToSubject<boolean | undefined, DashboardContainerInput>(
|
||||
this.publishingSubscription,
|
||||
this,
|
||||
'syncColors'
|
||||
),
|
||||
syncCursor$: embeddableInputToSubject<boolean | undefined, DashboardContainerInput>(
|
||||
this.publishingSubscription,
|
||||
this,
|
||||
'syncCursor'
|
||||
),
|
||||
syncTooltips$: embeddableInputToSubject<boolean | undefined, DashboardContainerInput>(
|
||||
this.publishingSubscription,
|
||||
this,
|
||||
'syncTooltips'
|
||||
),
|
||||
};
|
||||
this.timeslice$ = embeddableInputToSubject<
|
||||
[number, number] | undefined,
|
||||
DashboardContainerInput
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue