Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Heenawter committed Aug 21, 2023
1 parent c8d4ab5 commit 4712e57
Show file tree
Hide file tree
Showing 25 changed files with 54 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { isQuery, isTimeRange } from '@kbn/data-plugin/common';
import { Filter, isFilterPinned, Query, TimeRange } from '@kbn/es-query';
import { EmbeddableInput, IEmbeddable } from '@kbn/embeddable-plugin/public';
import { DashboardDrilldownOptions } from '@kbn/presentation-util-plugin/public';
import { DashboardDrilldownOptions } from '@kbn/presentation-util-plugin/common';

import { DashboardAppLocatorParams } from './locator';

Expand All @@ -19,7 +19,7 @@ interface EmbeddableQueryInput extends EmbeddableInput {
timeRange?: TimeRange;
}

export const getDashboardLocatorParams = (
export const getEmbeddableParams = (
source: IEmbeddable<EmbeddableQueryInput>,
options: DashboardDrilldownOptions
): Partial<DashboardAppLocatorParams> => {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/dashboard/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export {
type DashboardAppLocatorParams,
cleanEmptyKeys,
} from './dashboard_app/locator/locator';
export { getDashboardLocatorParams } from './dashboard_app/locator/get_dashboard_locator_params';
export { getEmbeddableParams } from './dashboard_app/locator/get_dashboard_locator_params';

export function plugin(initializerContext: PluginInitializerContext) {
return new DashboardPlugin(initializerContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* Side Public License, v 1.
*/

import { UrlDrilldownOptions } from '@kbn/ui-actions-enhanced-plugin/public';
import { DashboardDrilldownOptions } from '@kbn/presentation-util-plugin/public';
import { UrlDrilldownOptions } from '@kbn/ui-actions-enhanced-plugin/common';
import { DashboardDrilldownOptions } from '@kbn/presentation-util-plugin/common';

/**
* Link types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import type {
SavedObjectCreateOptions,
SavedObjectUpdateOptions,
} from '@kbn/content-management-utils';
import { UrlDrilldownOptions } from '@kbn/ui-actions-enhanced-plugin/public';
import { DashboardDrilldownOptions } from '@kbn/presentation-util-plugin/public';
import { UrlDrilldownOptions } from '@kbn/ui-actions-enhanced-plugin/common';
import { DashboardDrilldownOptions } from '@kbn/presentation-util-plugin/common';
import { NavigationEmbeddableContentType } from '../../types';
import {
DASHBOARD_LINK_TYPE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import useAsync from 'react-use/lib/useAsync';
import React, { useMemo, useState } from 'react';

import { EuiButtonEmpty, EuiListGroupItem, EuiToolTip } from '@elastic/eui';
import { DashboardDrilldownOptions } from '@kbn/presentation-util-plugin/public';
import { DashboardDrilldownOptions } from '@kbn/presentation-util-plugin/common';
import { DashboardContainer } from '@kbn/dashboard-plugin/public/dashboard_container';

import {
Expand Down Expand Up @@ -110,15 +110,18 @@ export const DashboardLinkComponent = ({
})}
onClick={
link.destination === parentDashboardId
? undefined
? undefined // no `onClick` event should exist if the link points to the current dashboard
: (event) => {
// TODO: As part of https://github.com/elastic/kibana/issues/154381, connect to drilldown
const options = link.options as DashboardDrilldownOptions;
clickLink(navEmbeddable, {
...link,
options: {
...DEFAULT_DASHBOARD_LINK_OPTIONS,
...options,
/**
* the app state should be sent via URL if either (a) the `openInNewTab` setting is `true`
* or if (b) the ctrl/shift/meta (command on Mac) key is pressed on click.
*/
openInNewTab:
options.openInNewTab || event.ctrlKey || event.metaKey || event.shiftKey,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@ import {
EuiFlyoutHeader,
EuiRadioGroupOption,
} from '@elastic/eui';
import { UrlDrilldownOptions } from '@kbn/ui-actions-enhanced-plugin/common';
import { DashboardContainer } from '@kbn/dashboard-plugin/public/dashboard_container';
import {
UrlDrilldownOptions,
UrlDrilldownOptionsComponent,
} from '@kbn/ui-actions-enhanced-plugin/public';
import { UrlDrilldownOptionsComponent } from '@kbn/ui-actions-enhanced-plugin/public';
import {
withSuspense,
DashboardDrilldownOptions,
LazyDashboardDrilldownOptionsComponent,
} from '@kbn/presentation-util-plugin/public';
import { DashboardDrilldownOptions } from '@kbn/presentation-util-plugin/common';

import {
NavigationLinkType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import {
cleanEmptyKeys,
DashboardAppLocatorParams,
getDashboardLocatorParams,
getEmbeddableParams,
} from '@kbn/dashboard-plugin/public';
import { isFilterPinned } from '@kbn/es-query';
import { KibanaLocation } from '@kbn/share-plugin/public';
import { setStateToKbnUrl } from '@kbn/kibana-utils-plugin/common';
import { DashboardDrilldownOptions } from '@kbn/presentation-util-plugin/public';
import { DashboardDrilldownOptions } from '@kbn/presentation-util-plugin/common';

import {
DASHBOARD_LINK_TYPE,
Expand All @@ -32,14 +32,12 @@ export const clickLink = async (
if (link.type === DASHBOARD_LINK_TYPE) {
const params: DashboardAppLocatorParams = {
dashboardId: link.destination,
...getDashboardLocatorParams(
...getEmbeddableParams(
embeddable,
(link.options as DashboardDrilldownOptions) ?? DEFAULT_DASHBOARD_LINK_OPTIONS
),
};

console.log(params);

const locator = dashboardServices.locator; // TODO: Make this a generic locator that is coming from the dashboard container through some sort of getter
if (locator) {
const { app, path, state }: KibanaLocation<DashboardAppLocatorParams> =
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/navigation_embeddable/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
"@kbn/saved-objects-plugin",
"@kbn/core-saved-objects-server",
"@kbn/saved-objects-plugin",
"@kbn/ui-actions-enhanced-plugin",
"@kbn/es-query",
"@kbn/share-plugin",
"@kbn/kibana-utils-plugin"
],
"exclude": ["target/**/*"]
}
10 changes: 10 additions & 0 deletions src/plugins/presentation_util/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,13 @@ export {
encode,
parseDataUrl,
} from './lib';

/**
* Dashboard drilldown options, which are each controlled by a toggle
*/
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type DashboardDrilldownOptions = {
useCurrentFilters: boolean;
useCurrentDateRange: boolean;
openInNewTab: boolean;
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

import React from 'react';
import { EuiFormRow, EuiSwitch } from '@elastic/eui';
import { DashboardDrilldownOptions } from '../types';
import { DashboardDrilldownOptions } from '../../../common';
import { dashboardDrilldownConfigStrings } from '../../i18n/dashboard_drilldown_config';

interface DashboardDrilldownOptionsProps {
export interface DashboardDrilldownOptionsProps {
options: DashboardDrilldownOptions;
onOptionChange: (newOptions: Partial<DashboardDrilldownOptions>) => void;
}
Expand Down
10 changes: 0 additions & 10 deletions src/plugins/presentation_util/public/components/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,3 @@ export interface ExpressionInputProps

onEditorDidMount?: OnExpressionInputEditorDidMount;
}

/**
* Dashboard drilldown options, which are each controlled by a toggle
*/
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type DashboardDrilldownOptions = {
useCurrentFilters: boolean;
useCurrentDateRange: boolean;
openInNewTab: boolean;
};
2 changes: 1 addition & 1 deletion src/plugins/presentation_util/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export type {
} from './services/create';
export { PluginServices, PluginServiceProvider, PluginServiceRegistry } from './services/create';

export type { SaveModalDashboardProps } from './components/types';
export type { PresentationUtilPluginSetup, PresentationUtilPluginStart } from './types';
export type { SaveModalDashboardProps, DashboardDrilldownOptions } from './components/types';

export {
LazyExpressionInput,
Expand Down
1 change: 1 addition & 0 deletions src/plugins/ui_actions_enhanced/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ export type {
SerializedAction,
SerializedEvent,
DynamicActionsState,
UrlDrilldownOptions,
} from './types';
5 changes: 5 additions & 0 deletions src/plugins/ui_actions_enhanced/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

import type { SerializableRecord } from '@kbn/utility-types';

export type UrlDrilldownOptions = {
openInNewTab: boolean;
encodeUrl?: boolean;
};

export type BaseActionConfig = SerializableRecord;

export type SerializedAction<Config extends BaseActionConfig = BaseActionConfig> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,7 @@
*/

import React, { useRef } from 'react';
import {
EuiFormRow,
EuiLink,
EuiSwitch,
EuiAccordion,
EuiSpacer,
EuiPanel,
EuiTextColor,
} from '@elastic/eui';
import { EuiFormRow, EuiLink, EuiAccordion, EuiSpacer, EuiPanel } from '@elastic/eui';
import { monaco } from '@kbn/monaco';
import { UrlTemplateEditor, UrlTemplateEditorVariable } from '@kbn/kibana-react-plugin/public';
import { UrlDrilldownConfig } from '../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import React from 'react';
import { EuiFormRow, EuiSpacer, EuiSwitch, EuiTextColor } from '@elastic/eui';
import { UrlDrilldownOptions } from '../../types';
import { UrlDrilldownOptions } from '../../../../../common';
import {
txtUrlTemplateEncodeDescription,
txtUrlTemplateEncodeUrl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@
* Side Public License, v 1.
*/

export type {
UrlDrilldownConfig,
UrlDrilldownGlobalScope,
UrlDrilldownOptions,
UrlDrilldownScope,
} from './types';
export type { UrlDrilldownConfig, UrlDrilldownGlobalScope, UrlDrilldownScope } from './types';
export { UrlDrilldownCollectConfig, UrlDrilldownOptionsComponent } from './components';
export {
validateUrlTemplate as urlDrilldownValidateUrlTemplate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
* Side Public License, v 1.
*/

export type UrlDrilldownOptions = {
openInNewTab: boolean;
encodeUrl?: boolean;
};
import { UrlDrilldownOptions } from '../../../common';

export type UrlDrilldownConfig = {
url: { format?: 'handlebars_v1'; template: string };
Expand Down
1 change: 0 additions & 1 deletion src/plugins/ui_actions_enhanced/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export type {
export type {
UrlDrilldownConfig,
UrlDrilldownGlobalScope,
UrlDrilldownOptions,
UrlDrilldownScope,
} from './drilldowns/url_drilldown';
export {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import React from 'react';
import { EuiFormRow, EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui';
import {
LazyDashboardDrilldownOptionsComponent,
withSuspense,
LazyDashboardDrilldownOptionsComponent,
} from '@kbn/presentation-util-plugin/public';

import { DrilldownConfig } from '../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { KibanaLocation } from '@kbn/share-plugin/public';
import {
cleanEmptyKeys,
DashboardAppLocatorParams,
getDashboardLocatorParams as getSourceParams,
getEmbeddableParams,
} from '@kbn/dashboard-plugin/public';
import { setStateToKbnUrl } from '@kbn/kibana-utils-plugin/public';
import { APPLY_FILTER_TRIGGER } from '@kbn/data-plugin/public';
Expand Down Expand Up @@ -49,7 +49,7 @@ export class EmbeddableToDashboardDrilldown extends AbstractDashboardDrilldown<C
if (context.embeddable) {
params = {
...params,
...getSourceParams(context.embeddable, config),
...getEmbeddableParams(context.embeddable, config),
};
}

Expand Down
15 changes: 5 additions & 10 deletions x-pack/plugins/dashboard_enhanced/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"outDir": "target/types"
},
"include": [
"common/**/*",
"public/**/*",
"server/**/*",
],
"include": ["common/**/*", "public/**/*", "server/**/*"],
"kbn_references": [
"@kbn/kibana-react-plugin",
"@kbn/kibana-utils-plugin",
Expand All @@ -22,9 +18,8 @@
"@kbn/es-query",
"@kbn/unified-search-plugin",
"@kbn/ui-actions-plugin",
"@kbn/image-embeddable-plugin"
"@kbn/image-embeddable-plugin",
"@kbn/presentation-util-plugin"
],
"exclude": [
"target/**/*",
]
"exclude": ["target/**/*"]
}
3 changes: 0 additions & 3 deletions x-pack/plugins/translations/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -40275,9 +40275,6 @@
"xpack.cloudLinks.setupGuide": "Guides de configuration",
"xpack.cloudLinks.userMenuLinks.profileLinkText": "Modifier le profil",
"xpack.dashboard.components.DashboardDrilldownConfig.chooseDestinationDashboard": "Choisir le tableau de bord de destination",
"xpack.dashboard.components.DashboardDrilldownConfig.openInNewTab": "Ouvrir le tableau de bord dans un nouvel onglet",
"xpack.dashboard.components.DashboardDrilldownConfig.useCurrentDateRange": "Utiliser la plage de dates du tableau de bord d'origine",
"xpack.dashboard.components.DashboardDrilldownConfig.useCurrentFilters": "Utiliser les filtres et la requête du tableau de bord d'origine",
"xpack.dashboard.drilldown.errorDestinationDashboardIsMissing": "Le tableau de bord de destination (\"{dashboardId}\") n'existe plus. Choisissez un autre tableau de bord.",
"xpack.dashboard.drilldown.goToDashboard": "Accéder au tableau de bord",
"xpack.dashboard.FlyoutCreateDrilldownAction.displayName": "Créer une recherche",
Expand Down
3 changes: 0 additions & 3 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -40266,9 +40266,6 @@
"xpack.cloudLinks.setupGuide": "セットアップガイド",
"xpack.cloudLinks.userMenuLinks.profileLinkText": "プロフィールを編集",
"xpack.dashboard.components.DashboardDrilldownConfig.chooseDestinationDashboard": "対象ダッシュボードを選択",
"xpack.dashboard.components.DashboardDrilldownConfig.openInNewTab": "新しいタブでダッシュボードを開く",
"xpack.dashboard.components.DashboardDrilldownConfig.useCurrentDateRange": "元のダッシュボードから日付範囲を使用",
"xpack.dashboard.components.DashboardDrilldownConfig.useCurrentFilters": "元のダッシュボードからフィルターとクエリを使用",
"xpack.dashboard.drilldown.errorDestinationDashboardIsMissing": "対象ダッシュボード('{dashboardId}')は存在しません。別のダッシュボードを選択してください。",
"xpack.dashboard.drilldown.goToDashboard": "ダッシュボードに移動",
"xpack.dashboard.FlyoutCreateDrilldownAction.displayName": "ドリルダウンを作成",
Expand Down
3 changes: 0 additions & 3 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -40260,9 +40260,6 @@
"xpack.cloudLinks.setupGuide": "设置指南",
"xpack.cloudLinks.userMenuLinks.profileLinkText": "编辑配置文件",
"xpack.dashboard.components.DashboardDrilldownConfig.chooseDestinationDashboard": "选择目标仪表板",
"xpack.dashboard.components.DashboardDrilldownConfig.openInNewTab": "在新选项卡中打开仪表板",
"xpack.dashboard.components.DashboardDrilldownConfig.useCurrentDateRange": "使用源仪表板的日期范围",
"xpack.dashboard.components.DashboardDrilldownConfig.useCurrentFilters": "使用源仪表板的筛选和查询",
"xpack.dashboard.drilldown.errorDestinationDashboardIsMissing": "目标仪表板(“{dashboardId}”)已不存在。选择其他仪表板。",
"xpack.dashboard.drilldown.goToDashboard": "前往仪表板",
"xpack.dashboard.FlyoutCreateDrilldownAction.displayName": "创建向下钻取",
Expand Down

0 comments on commit 4712e57

Please sign in to comment.