-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Legacy Input Controls] Show deprecation badge in Dashboard (#174302)
## Summary Closes #134050. This adds a deprecation badge to legacy input control panels on dashboards. This badge is only visible in edit mode. I've also added support for displaying tooltips on badges shown in the embeddable panel header when `getDisplayNameTooltip` is defined. <img width="468" alt="Screenshot 2024-01-04 at 3 43 15 PM" src="https://github.com/elastic/kibana/assets/1697105/c3e8c8d2-d2df-4880-acbb-f13c5c5222bc"> #### Testing In order to test this, set `disableCreate: false` in the `InputControlVis` vis type definition to add a legacy input control to a dashboard if you don't have an existing dashboard that contains a legacy input control. https://github.com/elastic/kibana/blob/46a58541fa8ce21f86a32408cbc759c1bf22487b/src/plugins/input_control_vis/public/input_control_vis_type.ts#L33 --------- Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
845cd06
commit 13fa875
Showing
5 changed files
with
94 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* 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 { Action } from '@kbn/ui-actions-plugin/public'; | ||
|
||
import { Embeddable, ViewMode } from '@kbn/embeddable-plugin/public'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { VisualizeInput } from '@kbn/visualizations-plugin/public'; | ||
|
||
export const ACTION_DEPRECATION_BADGE = 'ACTION_INPUT_CONTROL_DEPRECATION_BADGE'; | ||
|
||
export interface DeprecationBadgeActionContext { | ||
embeddable: Embeddable<VisualizeInput>; | ||
} | ||
|
||
export class InputControlDeprecationBadge implements Action<DeprecationBadgeActionContext> { | ||
public id = ACTION_DEPRECATION_BADGE; | ||
public type = ACTION_DEPRECATION_BADGE; | ||
public disabled = true; | ||
|
||
public getDisplayName() { | ||
return i18n.translate('inputControl.deprecationBadgeAction.deprecationBadgeLabel', { | ||
defaultMessage: 'Deprecated', | ||
}); | ||
} | ||
|
||
public getIconType() { | ||
return 'warning'; | ||
} | ||
|
||
public getDisplayNameTooltip() { | ||
return i18n.translate('inputControl.deprecationBadgeAction.deprecationWarningDescription', { | ||
defaultMessage: | ||
'Input controls are deprecated and will be removed in a future release. Use the new Controls to filter and interact with your dashboard data.', | ||
}); | ||
} | ||
|
||
public async isCompatible({ embeddable }: DeprecationBadgeActionContext) { | ||
return ( | ||
embeddable.getInput().viewMode === ViewMode.EDIT && | ||
embeddable.getInput()?.savedVis?.type === 'input_control_vis' | ||
); | ||
} | ||
|
||
public async execute() { | ||
// do nothing | ||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters