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

[Dashboard] Reorganize panel actions #178596

Merged
merged 37 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
6ac40bf
Remove replace panel action
cqliu1 Mar 13, 2024
e30ef4d
Add grouping to delete panel action
cqliu1 Mar 13, 2024
b3dec86
Update context menu order
cqliu1 Mar 13, 2024
5d6c1bb
Merge branch 'main' into dashboard/actions-menu-reorg
cqliu1 Mar 21, 2024
1857d4f
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Mar 21, 2024
2ecb655
Update actions copy
cqliu1 Mar 22, 2024
ac46316
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Mar 22, 2024
38ef88e
Fix typos
cqliu1 Mar 22, 2024
acd5616
Merge branch 'dashboard/actions-menu-reorg' of https://github.com/cql…
cqliu1 Mar 22, 2024
f1d1be2
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Mar 26, 2024
8b4573b
Fix actions sorting
cqliu1 Mar 26, 2024
79b3799
Remove unused import
cqliu1 Mar 26, 2024
2de949e
Delete replace panel flyout
cqliu1 Mar 26, 2024
4d14fde
Fix typo
cqliu1 Mar 26, 2024
fcc4a02
Update case functional tests
cqliu1 Mar 26, 2024
e3d159e
Delete replace panel action functional tests
cqliu1 Mar 26, 2024
0f36f72
Fix drilldown actions
cqliu1 Mar 26, 2024
ee4798f
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Mar 26, 2024
14151ae
Fix dashboard container string
cqliu1 Mar 27, 2024
5902519
Fix clone panel test
cqliu1 Mar 27, 2024
5019df6
Remove replace panel action tests
cqliu1 Mar 28, 2024
ec32439
fix drilldown test
cqliu1 Mar 28, 2024
151945d
fix merge conflict
cqliu1 Mar 28, 2024
1197fde
Fix clone action
cqliu1 Mar 28, 2024
526908e
Remove replace panel test
cqliu1 Mar 28, 2024
ba5f5d4
Fix image embeddable test
cqliu1 Mar 28, 2024
77a6b94
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Mar 28, 2024
40527fc
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Apr 1, 2024
856a7fd
Fix remaining tests
cqliu1 Apr 1, 2024
063026c
Remove unused services
cqliu1 Apr 1, 2024
081d4e0
Merge branch 'main' into dashboard/actions-menu-reorg
cqliu1 Apr 2, 2024
9f6b195
Clean up
cqliu1 Apr 2, 2024
d88bac0
Merge branch 'dashboard/actions-menu-reorg' of https://github.com/cql…
cqliu1 Apr 2, 2024
92c887b
Fix panel action sorting
cqliu1 Apr 2, 2024
696852f
Merge branch 'main' into dashboard/actions-menu-reorg
cqliu1 Apr 3, 2024
86cdf73
Remove panel hover shadow in edit mode
cqliu1 Apr 3, 2024
151f463
Merge branch 'main' into dashboard/actions-menu-reorg
cqliu1 Apr 3, 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
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ export const dashboardAddToLibraryActionStrings = {
export const dashboardClonePanelActionStrings = {
getDisplayName: () =>
i18n.translate('dashboard.panel.clonePanel', {
defaultMessage: 'Clone panel',
defaultMessage: 'Duplicate',
}),
getClonedTag: () =>
i18n.translate('dashboard.panel.title.clonedTag', {
defaultMessage: 'copy',
}),
getSuccessMessage: () =>
i18n.translate('dashboard.panel.clonedToast', {
defaultMessage: 'Cloned panel',
defaultMessage: 'Duplicated panel',
}),
};

Expand All @@ -70,14 +70,14 @@ export const dashboardExpandPanelActionStrings = {
}),
getMaximizeTitle: () =>
i18n.translate('dashboard.actions.toggleExpandPanelMenuItem.notExpandedDisplayName', {
defaultMessage: 'Maximize panel',
defaultMessage: 'Maximize',
}),
};

export const dashboardExportCsvActionStrings = {
getDisplayName: () =>
i18n.translate('dashboard.actions.DownloadCreateDrilldownAction.displayName', {
defaultMessage: 'Download as CSV',
defaultMessage: 'Download CSV',
}),
getUntitledFilename: () =>
i18n.translate('dashboard.actions.downloadOptionsUnsavedFilename', {
Expand Down Expand Up @@ -118,35 +118,6 @@ export const dashboardLibraryNotificationStrings = {
}),
};

export const dashboardReplacePanelActionStrings = {
getDisplayName: () =>
i18n.translate('dashboard.panel.removePanel.replacePanel', {
defaultMessage: 'Replace panel',
}),
getFlyoutHeader: (panelName?: string) =>
i18n.translate('dashboard.panel.replacePanel.flyoutHeader', {
defaultMessage: 'Replace panel {panelName} with:',
values: {
panelName: `'${panelName}'`,
},
}),
getSuccessMessage: (savedObjectName?: string) =>
savedObjectName
? i18n.translate('dashboard.addPanel.savedObjectAddedToContainerSuccessMessageTitle', {
defaultMessage: '{savedObjectName} was added',
values: {
savedObjectName: `'${savedObjectName}'`,
},
})
: i18n.translate('dashboard.addPanel.panelAddedToContainerSuccessMessageTitle', {
defaultMessage: 'A panel was added',
}),
getNoMatchingObjectsMessage: () =>
i18n.translate('dashboard.addPanel.noMatchingObjectsMessage', {
defaultMessage: 'No matching objects found.',
}),
};

export const dashboardFilterNotificationActionStrings = {
getDisplayName: () =>
i18n.translate('dashboard.panel.filters', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const isApiCompatible = (api: unknown | null): api is AddPanelToLibraryActionApi
export class AddToLibraryAction implements Action<EmbeddableApiContext> {
public readonly type = ACTION_ADD_TO_LIBRARY;
public readonly id = ACTION_ADD_TO_LIBRARY;
public order = 15;
public order = 8;

private toastsService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Expand panel action', () => {
});

it('returns the correct display name based on expanded panel id', async () => {
expect(await action.getDisplayName(context)).toBe('Maximize panel');
expect(await action.getDisplayName(context)).toBe('Maximize');
context.embeddable.parentApi.expandedPanelId = new BehaviorSubject<string | undefined>(
'superPanelId'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const isApiCompatible = (api: unknown | null): api is ExportCsvActionApi =>
export class ExportCSVAction implements Action<ExportContext> {
public readonly id = ACTION_EXPORT_CSV;
public readonly type = ACTION_EXPORT_CSV;
public readonly order = 5;
public readonly order = 18; // right after Export in discover which is 19

private fieldFormats;
private uiSettings;
Expand Down
19 changes: 1 addition & 18 deletions src/plugins/dashboard/public/dashboard_actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@

import { CoreStart } from '@kbn/core/public';
import { CONTEXT_MENU_TRIGGER, PANEL_NOTIFICATION_TRIGGER } from '@kbn/embeddable-plugin/public';
import {
getSavedObjectFinder,
SavedObjectFinderProps,
} from '@kbn/saved-objects-finder-plugin/public';

import { DashboardStartDependencies } from '../plugin';
import { AddToLibraryAction } from './add_to_library_action';
Expand All @@ -22,7 +18,6 @@ import { ExpandPanelAction } from './expand_panel_action';
import { ExportCSVAction } from './export_csv_action';
import { FiltersNotificationAction } from './filters_notification_action';
import { LegacyLibraryNotificationAction } from './legacy_library_notification_action';
import { ReplacePanelAction } from './replace_panel_action';
import { UnlinkFromLibraryAction } from './unlink_from_library_action';
import { LegacyUnlinkFromLibraryAction } from './legacy_unlink_from_library_action';
import { LibraryNotificationAction } from './library_notification_action';
Expand All @@ -33,28 +28,16 @@ interface BuildAllDashboardActionsProps {
plugins: DashboardStartDependencies;
}

export type ReplacePanelSOFinder = (props: Omit<SavedObjectFinderProps, 'services'>) => JSX.Element;

export const buildAllDashboardActions = async ({
core,
plugins,
allowByValueEmbeddables,
}: BuildAllDashboardActionsProps) => {
const { uiActions, share, savedObjectsTaggingOss, contentManagement } = plugins;
const { uiActions, share } = plugins;

const clonePanelAction = new ClonePanelAction();
uiActions.registerAction(clonePanelAction);
uiActions.attachAction(CONTEXT_MENU_TRIGGER, clonePanelAction.id);

const SavedObjectFinder = getSavedObjectFinder(
contentManagement.client,
core.uiSettings,
savedObjectsTaggingOss?.getTaggingApi()
);
const changeViewAction = new ReplacePanelAction(SavedObjectFinder as ReplacePanelSOFinder);
uiActions.registerAction(changeViewAction);
uiActions.attachAction(CONTEXT_MENU_TRIGGER, changeViewAction.id);

const expandPanelAction = new ExpandPanelAction();
uiActions.registerAction(expandPanelAction);
uiActions.attachAction(CONTEXT_MENU_TRIGGER, expandPanelAction.id);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading