Skip to content

Commit

Permalink
Merge branch 'main' into telemtry-use-pit
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankHassanabad committed Feb 8, 2022
2 parents e5b5dab + 97230e9 commit 7e03126
Show file tree
Hide file tree
Showing 30 changed files with 890 additions and 639 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
} from '../../services/embeddable';

type BuildDashboardContainerProps = DashboardBuildContext & {
data: DashboardAppServices['data']; // the whole data service is required here because it is required by getUrlGeneratorState
data: DashboardAppServices['data']; // the whole data service is required here because it is required by getLocatorParams
savedDashboard: DashboardSavedObject;
initialDashboardState: DashboardState;
incomingEmbeddable?: EmbeddablePackageState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import { getDashboardListItemLink } from './get_dashboard_list_item_link';
import { ApplicationStart } from 'kibana/public';
import { createHashHistory } from 'history';
import { createKbnUrlStateStorage } from '../../../../kibana_utils/public';
import { GLOBAL_STATE_STORAGE_KEY } from '../../url_generator';
import { FilterStateStore } from '@kbn/es-query';
import { createKbnUrlStateStorage } from '../../../../kibana_utils/public';
import { GLOBAL_STATE_STORAGE_KEY } from '../../dashboard_constants';

const DASHBOARD_ID = '13823000-99b9-11ea-9eb6-d9e8adceb647';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
import { ApplicationStart } from 'kibana/public';
import { QueryState } from '../../../../data/public';
import { setStateToKbnUrl } from '../../../../kibana_utils/public';
import { createDashboardEditUrl, DashboardConstants } from '../../dashboard_constants';
import { GLOBAL_STATE_STORAGE_KEY } from '../../url_generator';
import {
DashboardConstants,
createDashboardEditUrl,
GLOBAL_STATE_STORAGE_KEY,
} from '../../dashboard_constants';
import { IKbnUrlStateStorage } from '../../services/kibana_utils';

export const getDashboardListItemLink = (
Expand Down
1 change: 1 addition & 0 deletions src/plugins/dashboard/public/dashboard_constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import type { ControlStyle } from '../../controls/public';

export const DASHBOARD_STATE_STORAGE_KEY = '_a';
export const GLOBAL_STATE_STORAGE_KEY = '_g';

export const DashboardConstants = {
LANDING_PAGE_PATH: '/list',
Expand Down
10 changes: 1 addition & 9 deletions src/plugins/dashboard/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,7 @@ export {
} from './application';
export { DashboardConstants, createDashboardEditUrl } from './dashboard_constants';

export type {
DashboardSetup,
DashboardStart,
DashboardUrlGenerator,
DashboardFeatureFlagConfig,
} from './plugin';

export type { DashboardUrlGeneratorState } from './url_generator';
export { DASHBOARD_APP_URL_GENERATOR, createDashboardUrlGenerator } from './url_generator';
export type { DashboardSetup, DashboardStart, DashboardFeatureFlagConfig } from './plugin';
export type { DashboardAppLocator, DashboardAppLocatorParams } from './locator';

export type { DashboardSavedObject } from './saved_dashboards';
Expand Down
45 changes: 1 addition & 44 deletions src/plugins/dashboard/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { PresentationUtilPluginStart } from './services/presentation_util';
import { FeatureCatalogueCategory, HomePublicPluginSetup } from './services/home';
import { NavigationPublicPluginStart as NavigationStart } from './services/navigation';
import { DataPublicPluginSetup, DataPublicPluginStart } from './services/data';
import { SharePluginSetup, SharePluginStart, UrlGeneratorContract } from './services/share';
import { SharePluginSetup, SharePluginStart } from './services/share';
import type { SavedObjectTaggingOssPluginStart } from './services/saved_objects_tagging_oss';
import type {
ScreenshotModePluginSetup,
Expand Down Expand Up @@ -70,29 +70,15 @@ import {
CopyToDashboardAction,
DashboardCapabilities,
} from './application';
import {
createDashboardUrlGenerator,
DASHBOARD_APP_URL_GENERATOR,
DashboardUrlGeneratorState,
} from './url_generator';
import { DashboardAppLocatorDefinition, DashboardAppLocator } from './locator';
import { createSavedDashboardLoader } from './saved_dashboards';
import { DashboardConstants } from './dashboard_constants';
import { PlaceholderEmbeddableFactory } from './application/embeddable/placeholder';
import { UrlGeneratorState } from '../../share/public';
import { ExportCSVAction } from './application/actions/export_csv_action';
import { dashboardFeatureCatalog } from './dashboard_strings';
import { replaceUrlHashQuery } from '../../kibana_utils/public';
import { SpacesPluginStart } from './services/spaces';

declare module '../../share/public' {
export interface UrlGeneratorStateMapping {
[DASHBOARD_APP_URL_GENERATOR]: UrlGeneratorState<DashboardUrlGeneratorState>;
}
}

export type DashboardUrlGenerator = UrlGeneratorContract<typeof DASHBOARD_APP_URL_GENERATOR>;

export interface DashboardFeatureFlagConfig {
allowByValueEmbeddables: boolean;
}
Expand Down Expand Up @@ -134,15 +120,6 @@ export interface DashboardStart {
getDashboardContainerByValueRenderer: () => ReturnType<
typeof createDashboardContainerByValueRenderer
>;
/**
* @deprecated Use dashboard locator instead. Dashboard locator is available
* under `.locator` key. This dashboard URL generator will be removed soon.
*
* ```ts
* plugins.dashboard.locator.getLocation({ ... });
* ```
*/
dashboardUrlGenerator?: DashboardUrlGenerator;
locator?: DashboardAppLocator;
dashboardFeatureFlagConfig: DashboardFeatureFlagConfig;
}
Expand All @@ -157,11 +134,6 @@ export class DashboardPlugin
private stopUrlTracking: (() => void) | undefined = undefined;
private currentHistory: ScopedHistory | undefined = undefined;
private dashboardFeatureFlagConfig?: DashboardFeatureFlagConfig;

/**
* @deprecated Use locator instead.
*/
private dashboardUrlGenerator?: DashboardUrlGenerator;
private locator?: DashboardAppLocator;

public setup(
Expand All @@ -178,20 +150,6 @@ export class DashboardPlugin
): DashboardSetup {
this.dashboardFeatureFlagConfig =
this.initializerContext.config.get<DashboardFeatureFlagConfig>();
const startServices = core.getStartServices();

if (share) {
this.dashboardUrlGenerator = share.urlGenerators.registerUrlGenerator(
createDashboardUrlGenerator(async () => {
const [coreStart, , selfStart] = await startServices;
return {
appBasePath: coreStart.application.getUrlForApp('dashboards'),
useHashedUrl: coreStart.uiSettings.get('state:storeInSessionStorage'),
savedDashboardLoader: selfStart.getSavedDashboardLoader(),
};
})
);
}

const getPlaceholderEmbeddableStartServices = async () => {
const [coreStart] = await core.getStartServices();
Expand Down Expand Up @@ -458,7 +416,6 @@ export class DashboardPlugin
factory: dashboardContainerFactory as DashboardContainerFactory,
});
},
dashboardUrlGenerator: this.dashboardUrlGenerator,
locator: this.locator,
dashboardFeatureFlagConfig: this.dashboardFeatureFlagConfig!,
};
Expand Down
6 changes: 1 addition & 5 deletions src/plugins/dashboard/public/services/share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,5 @@
* Side Public License, v 1.
*/

export type {
SharePluginStart,
SharePluginSetup,
UrlGeneratorContract,
} from '../../../share/public';
export type { SharePluginStart, SharePluginSetup } from '../../../share/public';
export { downloadMultipleAs } from '../../../share/public';
Loading

0 comments on commit 7e03126

Please sign in to comment.