From 36e1b5450ae0588656ef31c68fff12caa9edbd51 Mon Sep 17 00:00:00 2001 From: Devon A Thomson Date: Tue, 25 Aug 2020 14:22:19 -0400 Subject: [PATCH] Removed old translations --- .../public/application/actions/index.ts | 5 -- .../actions/library_notification_action.tsx | 70 ------------------- src/plugins/dashboard/public/plugin.tsx | 17 ++--- .../lib/panel/panel_header/panel_header.tsx | 13 +--- .../translations/translations/ja-JP.json | 2 - .../translations/translations/zh-CN.json | 2 - 6 files changed, 6 insertions(+), 103 deletions(-) delete mode 100644 src/plugins/dashboard/public/application/actions/library_notification_action.tsx diff --git a/src/plugins/dashboard/public/application/actions/index.ts b/src/plugins/dashboard/public/application/actions/index.ts index cd32c2025456..4343a3409b69 100644 --- a/src/plugins/dashboard/public/application/actions/index.ts +++ b/src/plugins/dashboard/public/application/actions/index.ts @@ -42,8 +42,3 @@ export { UnlinkFromLibraryActionContext, ACTION_UNLINK_FROM_LIBRARY, } from './unlink_from_library_action'; -export { - LibraryNotificationActionContext, - LibraryNotificationAction, - ACTION_LIBRARY_NOTIFICATION, -} from './library_notification_action'; diff --git a/src/plugins/dashboard/public/application/actions/library_notification_action.tsx b/src/plugins/dashboard/public/application/actions/library_notification_action.tsx deleted file mode 100644 index 6006060a3b44..000000000000 --- a/src/plugins/dashboard/public/application/actions/library_notification_action.tsx +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { i18n } from '@kbn/i18n'; -import { IEmbeddable, ViewMode, isReferenceOrValueEmbeddable } from '../../embeddable_plugin'; -import { ActionByType, IncompatibleActionError } from '../../ui_actions_plugin'; - -export const ACTION_LIBRARY_NOTIFICATION = 'ACTION_LIBRARY_NOTIFICATION'; - -export interface LibraryNotificationActionContext { - embeddable: IEmbeddable; -} - -export class LibraryNotificationAction implements ActionByType { - public readonly id = ACTION_LIBRARY_NOTIFICATION; - public readonly type = ACTION_LIBRARY_NOTIFICATION; - public readonly order = 1; - - public getDisplayName({ embeddable }: LibraryNotificationActionContext) { - if (!embeddable.getRoot() || !embeddable.getRoot().isContainer) { - throw new IncompatibleActionError(); - } - return i18n.translate('dashboard.panel.LibraryNotification', { - defaultMessage: 'Library', - }); - } - - public getIconType({ embeddable }: LibraryNotificationActionContext) { - if (!embeddable.getRoot() || !embeddable.getRoot().isContainer) { - throw new IncompatibleActionError(); - } - return 'folderCheck'; - } - - public getDisplayNameTooltip = ({ embeddable }: LibraryNotificationActionContext) => { - if (!embeddable.getRoot() || !embeddable.getRoot().isContainer) { - throw new IncompatibleActionError(); - } - return i18n.translate('dashboard.panel.libraryNotification.toolTip', { - defaultMessage: - 'This panel is linked to a Library item. Editing the panel might affect other dashboards.', - }); - }; - - public isCompatible = async ({ embeddable }: LibraryNotificationActionContext) => { - return Boolean( - embeddable.getInput()?.viewMode !== ViewMode.VIEW && - isReferenceOrValueEmbeddable(embeddable) && - embeddable.inputIsRefType(embeddable.getInput()) - ); - }; - - public execute = async () => {}; -} diff --git a/src/plugins/dashboard/public/plugin.tsx b/src/plugins/dashboard/public/plugin.tsx index b52b9806af56..a788b06f9190 100644 --- a/src/plugins/dashboard/public/plugin.tsx +++ b/src/plugins/dashboard/public/plugin.tsx @@ -40,7 +40,6 @@ import { EmbeddableStart, SavedObjectEmbeddableInput, EmbeddableInput, - PANEL_NOTIFICATION_TRIGGER, } from '../../embeddable/public'; import { DataPublicPluginSetup, DataPublicPluginStart, esFilters } from '../../data/public'; import { SharePluginSetup, SharePluginStart, UrlGeneratorContract } from '../../share/public'; @@ -84,12 +83,6 @@ import { ACTION_UNLINK_FROM_LIBRARY, UnlinkFromLibraryActionContext, UnlinkFromLibraryAction, - ACTION_ADD_TO_LIBRARY, - AddToLibraryActionContext, - AddToLibraryAction, - ACTION_LIBRARY_NOTIFICATION, - LibraryNotificationActionContext, - LibraryNotificationAction, } from './application'; import { createDashboardUrlGenerator, @@ -102,6 +95,11 @@ import { addEmbeddableToDashboardUrl } from './url_utils/url_helper'; import { PlaceholderEmbeddableFactory } from './application/embeddable/placeholder'; import { UrlGeneratorState } from '../../share/public'; import { AttributeService } from '.'; +import { + AddToLibraryAction, + ACTION_ADD_TO_LIBRARY, + AddToLibraryActionContext, +} from './application/actions/add_to_library_action'; declare module '../../share/public' { export interface UrlGeneratorStateMapping { @@ -164,7 +162,6 @@ declare module '../../../plugins/ui_actions/public' { [ACTION_CLONE_PANEL]: ClonePanelActionContext; [ACTION_ADD_TO_LIBRARY]: AddToLibraryActionContext; [ACTION_UNLINK_FROM_LIBRARY]: UnlinkFromLibraryActionContext; - [ACTION_LIBRARY_NOTIFICATION]: LibraryNotificationActionContext; } } @@ -440,10 +437,6 @@ export class DashboardPlugin const unlinkFromLibraryAction = new UnlinkFromLibraryAction(); uiActions.registerAction(unlinkFromLibraryAction); uiActions.attachAction(CONTEXT_MENU_TRIGGER, unlinkFromLibraryAction.id); - - const libraryNotificationAction = new LibraryNotificationAction(); - uiActions.registerAction(libraryNotificationAction); - uiActions.attachAction(PANEL_NOTIFICATION_TRIGGER, libraryNotificationAction.id); } const savedDashboardLoader = createSavedDashboardLoader({ diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx index 9dbe10168758..5d7daaa7217e 100644 --- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx @@ -64,19 +64,8 @@ function renderNotifications( ) { return notifications.map((notification) => { const context = { embeddable }; - const iconType = notification.getIconType({ ...context, trigger: panelNotificationTrigger }); - let badge = iconType ? ( - - {notification.getDisplayName({ ...context, trigger: panelNotificationTrigger })} - - ) : ( + let badge = (