diff --git a/packages/content-management/content_insights/content_insights_public/src/components/activity_view.tsx b/packages/content-management/content_insights/content_insights_public/src/components/activity_view.tsx index 360ccc1757581..f4bceeee3c765 100644 --- a/packages/content-management/content_insights/content_insights_public/src/components/activity_view.tsx +++ b/packages/content-management/content_insights/content_insights_public/src/components/activity_view.tsx @@ -22,12 +22,15 @@ import { import { getUserDisplayName } from '@kbn/user-profile-components'; import { Item } from '../types'; +import { useServices } from '../services'; export interface ActivityViewProps { item: Pick, 'createdBy' | 'createdAt' | 'updatedBy' | 'updatedAt' | 'managed'>; + entityNamePlural?: string; } -export const ActivityView = ({ item }: ActivityViewProps) => { +export const ActivityView = ({ item, entityNamePlural }: ActivityViewProps) => { + const isKibanaVersioningEnabled = useServices()?.isKibanaVersioningEnabled ?? false; const showLastUpdated = Boolean(item.updatedAt && item.updatedAt !== item.createdAt); const UnknownUserLabel = ( @@ -62,7 +65,10 @@ export const ActivityView = ({ item }: ActivityViewProps) => { ) : ( <> {UnknownUserLabel} - + ) } @@ -85,7 +91,10 @@ export const ActivityView = ({ item }: ActivityViewProps) => { ) : ( <> {UnknownUserLabel} - + ) } diff --git a/packages/content-management/content_insights/content_insights_public/src/components/views_stats/views_stats.tsx b/packages/content-management/content_insights/content_insights_public/src/components/views_stats/views_stats.tsx index 59e548e401490..f19ddc548b12f 100644 --- a/packages/content-management/content_insights/content_insights_public/src/components/views_stats/views_stats.tsx +++ b/packages/content-management/content_insights/content_insights_public/src/components/views_stats/views_stats.tsx @@ -73,24 +73,39 @@ export const ViewsStats = ({ item }: { item: Item }) => { ); }; -const NoViewsTip = () => ( - - } - /> -); +const NoViewsTip = () => { + const isKibanaVersioningEnabled = useServices()?.isKibanaVersioningEnabled ?? false; + return ( + + + {isKibanaVersioningEnabled && ( + <> + {' '} + + + )} + + } + /> + ); +}; export function getTotalDays(stats: ContentInsightsStats) { return moment.utc().diff(moment.utc(stats.from), 'days'); diff --git a/packages/content-management/content_insights/content_insights_public/src/services.tsx b/packages/content-management/content_insights/content_insights_public/src/services.tsx index ea7e67bf5cd9f..7a9e86e01dbad 100644 --- a/packages/content-management/content_insights/content_insights_public/src/services.tsx +++ b/packages/content-management/content_insights/content_insights_public/src/services.tsx @@ -17,6 +17,11 @@ import { ContentInsightsClientPublic } from './client'; */ export interface ContentInsightsServices { contentInsightsClient: ContentInsightsClientPublic; + /** + * Whether versioning is enabled for the current kibana instance. (aka is Serverless) + * This is used to determine if we should show the version mentions in the help text. + */ + isKibanaVersioningEnabled: boolean; } const ContentInsightsContext = React.createContext(null); @@ -34,7 +39,10 @@ export const ContentInsightsProvider: FC {children} diff --git a/packages/content-management/table_list_view_table/src/__jest__/tests.helpers.tsx b/packages/content-management/table_list_view_table/src/__jest__/tests.helpers.tsx index 8120e18731b83..cf28019f820d0 100644 --- a/packages/content-management/table_list_view_table/src/__jest__/tests.helpers.tsx +++ b/packages/content-management/table_list_view_table/src/__jest__/tests.helpers.tsx @@ -32,6 +32,7 @@ export const getMockServices = (overrides?: Partial false, bulkGetUserProfiles: async () => [], getUserProfile: async () => ({ uid: '', enabled: true, data: {}, user: { username: '' } }), + isKibanaVersioningEnabled: false, ...overrides, }; diff --git a/packages/content-management/table_list_view_table/src/components/content_editor_activity_row.tsx b/packages/content-management/table_list_view_table/src/components/content_editor_activity_row.tsx index 83c1b993296ce..f7a74d88fa8fa 100644 --- a/packages/content-management/table_list_view_table/src/components/content_editor_activity_row.tsx +++ b/packages/content-management/table_list_view_table/src/components/content_editor_activity_row.tsx @@ -16,7 +16,10 @@ import { ActivityView, ViewsStats } from '@kbn/content-management-content-insigh /** * This component is used as an extension for the ContentEditor to render the ActivityView and ViewsStats inside the flyout without depending on them directly */ -export const ContentEditorActivityRow: FC<{ item: UserContentCommonSchema }> = ({ item }) => { +export const ContentEditorActivityRow: FC<{ + item: UserContentCommonSchema; + entityNamePlural?: string; +}> = ({ item, entityNamePlural }) => { return ( = ( } > <> - + diff --git a/packages/content-management/table_list_view_table/src/components/table.tsx b/packages/content-management/table_list_view_table/src/components/table.tsx index 66c0eaec4d1f8..c4a51ff979618 100644 --- a/packages/content-management/table_list_view_table/src/components/table.tsx +++ b/packages/content-management/table_list_view_table/src/components/table.tsx @@ -113,7 +113,7 @@ export function Table({ favoritesEnabled, }: Props) { const euiTheme = useEuiTheme(); - const { getTagList, isTaggingEnabled } = useServices(); + const { getTagList, isTaggingEnabled, isKibanaVersioningEnabled } = useServices(); const renderToolsLeft = useCallback(() => { if (!deleteItems || selectedIds.length === 0) { @@ -340,6 +340,8 @@ export function Table({ }} selectedUsers={tableFilter.createdBy} showNoUserOption={showNoUserOption} + isKibanaVersioningEnabled={isKibanaVersioningEnabled} + entityNamePlural={entityNamePlural} > (null); @@ -44,7 +46,13 @@ export const UserFilterPanel: FC<{}> = () => { if (!componentContext) throw new Error('UserFilterPanel must be used within a UserFilterContextProvider'); - const { onSelectedUsersChange, selectedUsers, showNoUserOption } = componentContext; + const { + onSelectedUsersChange, + selectedUsers, + showNoUserOption, + isKibanaVersioningEnabled, + entityNamePlural, + } = componentContext; const [isPopoverOpen, setPopoverOpen] = React.useState(false); const [searchTerm, setSearchTerm] = React.useState(''); @@ -126,7 +134,12 @@ export const UserFilterPanel: FC<{}> = () => { id="contentManagement.tableList.listing.userFilter.emptyMessage" defaultMessage="None of the dashboards have creators" /> - {} + { + + }

), nullOptionLabel: i18n.translate( @@ -136,7 +149,12 @@ export const UserFilterPanel: FC<{}> = () => { } ), nullOptionProps: { - append: , + append: ( + + ), }, clearButtonLabel: ( {}) => getTagIdsFromReferences: () => [], isTaggingEnabled: () => true, isFavoritesEnabled: () => false, + isKibanaVersioningEnabled: false, ...params, }; diff --git a/packages/content-management/table_list_view_table/src/services.tsx b/packages/content-management/table_list_view_table/src/services.tsx index a8c3d3cc9f60b..9db14069107e8 100644 --- a/packages/content-management/table_list_view_table/src/services.tsx +++ b/packages/content-management/table_list_view_table/src/services.tsx @@ -79,6 +79,9 @@ export interface Services { /** Handler to return the url to navigate to the kibana tags management */ getTagManagementUrl: () => string; getTagIdsFromReferences: (references: SavedObjectsReference[]) => string[]; + /** Whether versioning is enabled for the current kibana instance. (aka is Serverless) + This is used to determine if we should show the version mentions in the help text.*/ + isKibanaVersioningEnabled: boolean; } const TableListViewContext = React.createContext(null); @@ -185,6 +188,12 @@ export interface TableListViewKibanaDependencies { * Content insights client to enable content insights features. */ contentInsightsClient?: ContentInsightsClientPublic; + + /** + * Flag to indicate if Kibana versioning is enabled. (aka not Serverless) + * Used to determine if we should show the version mentions in the help text. + */ + isKibanaVersioningEnabled?: boolean; } /** @@ -251,7 +260,10 @@ export const TableListViewKibanaProvider: FC< - + { @@ -282,6 +294,7 @@ export const TableListViewKibanaProvider: FC< itemHasTags={itemHasTags} getTagIdsFromReferences={getTagIdsFromReferences} getTagManagementUrl={() => core.http.basePath.prepend(TAG_MANAGEMENT_APP_URL)} + isKibanaVersioningEnabled={services.isKibanaVersioningEnabled ?? false} > {children} diff --git a/packages/content-management/table_list_view_table/src/table_list_view_table.tsx b/packages/content-management/table_list_view_table/src/table_list_view_table.tsx index c7653c668f0df..011f00256d979 100644 --- a/packages/content-management/table_list_view_table/src/table_list_view_table.tsx +++ b/packages/content-management/table_list_view_table/src/table_list_view_table.tsx @@ -376,6 +376,7 @@ function TableListViewTableComp({ DateFormatterComp, getTagList, isFavoritesEnabled, + isKibanaVersioningEnabled, } = useServices(); const openContentEditor = useOpenContentEditor(); @@ -578,7 +579,7 @@ function TableListViewTableComp({ appendRows: contentInsightsServices && ( // have to "REWRAP" in the provider here because it will be rendered in a different context - + ), }); @@ -591,6 +592,7 @@ function TableListViewTableComp({ tableItemsRowActions, fetchItems, contentInsightsServices, + entityNamePlural, ] ); @@ -646,7 +648,7 @@ function TableListViewTableComp({ ) : record.managed ? ( ) : ( - + ), sortable: false /* createdBy column is not sortable because it doesn't make sense to sort by id*/, @@ -753,6 +755,7 @@ function TableListViewTableComp({ inspectItem, entityName, isFavoritesEnabled, + isKibanaVersioningEnabled, ]); const itemsById = useMemo(() => { diff --git a/packages/content-management/user_profiles/src/components/user_missing_tip.tsx b/packages/content-management/user_profiles/src/components/user_missing_tip.tsx index 602e9cc228975..08612e731f816 100644 --- a/packages/content-management/user_profiles/src/components/user_missing_tip.tsx +++ b/packages/content-management/user_profiles/src/components/user_missing_tip.tsx @@ -7,29 +7,67 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ +import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import { EuiIconTip, IconType } from '@elastic/eui'; import React from 'react'; -export const NoCreatorTip = (props: { iconType?: IconType }) => ( +const fallbackEntityNamePlural = i18n.translate( + 'contentManagement.userProfiles.fallbackEntityNamePlural', + { defaultMessage: 'objects' } +); + +export const NoCreatorTip = (props: { + iconType?: IconType; + includeVersionTip?: boolean; + entityNamePlural?: string; +}) => ( + props.includeVersionTip ? ( + + ) : ( + + ) } {...props} /> ); -export const NoUpdaterTip = (props: { iconType?: string }) => ( +export const NoUpdaterTip = (props: { + iconType?: string; + includeVersionTip?: boolean; + entityNamePlural?: string; +}) => ( + props.includeVersionTip ? ( + + ) : ( + + ) } {...props} /> diff --git a/src/plugins/dashboard/public/dashboard_listing/dashboard_listing.tsx b/src/plugins/dashboard/public/dashboard_listing/dashboard_listing.tsx index f6072169e5bda..7a8e5a40bb274 100644 --- a/src/plugins/dashboard/public/dashboard_listing/dashboard_listing.tsx +++ b/src/plugins/dashboard/public/dashboard_listing/dashboard_listing.tsx @@ -19,6 +19,7 @@ import { DASHBOARD_APP_ID, DASHBOARD_CONTENT_ID } from '../dashboard_constants'; import { coreServices, savedObjectsTaggingService, + serverlessService, usageCollectionService, } from '../services/kibana_services'; import { DashboardUnsavedListing } from './dashboard_unsaved_listing'; @@ -65,6 +66,7 @@ export const DashboardListing = ({ FormattedRelative, favorites: dashboardFavoritesClient, contentInsightsClient, + isKibanaVersioningEnabled: !serverlessService, }} > {...tableListViewTableProps}> diff --git a/src/plugins/dashboard/public/dashboard_listing/dashboard_listing_table.tsx b/src/plugins/dashboard/public/dashboard_listing/dashboard_listing_table.tsx index 96d9025f822ff..efcc0fe2cc644 100644 --- a/src/plugins/dashboard/public/dashboard_listing/dashboard_listing_table.tsx +++ b/src/plugins/dashboard/public/dashboard_listing/dashboard_listing_table.tsx @@ -16,7 +16,11 @@ import { import { FormattedRelative, I18nProvider } from '@kbn/i18n-react'; import { useExecutionContext } from '@kbn/kibana-react-plugin/public'; -import { coreServices, savedObjectsTaggingService } from '../services/kibana_services'; +import { + coreServices, + savedObjectsTaggingService, + serverlessService, +} from '../services/kibana_services'; import { DashboardUnsavedListing } from './dashboard_unsaved_listing'; import { useDashboardListingTable } from './hooks/use_dashboard_listing_table'; import { DashboardListingProps, DashboardSavedObjectUserContent } from './types'; @@ -57,6 +61,7 @@ export const DashboardListingTable = ({ savedObjectsTagging={savedObjectsTaggingService?.getTaggingApi()} FormattedRelative={FormattedRelative} contentInsightsClient={contentInsightsClient} + isKibanaVersioningEnabled={!serverlessService} > <>