-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Workplace Search] Update personal dashboard (#91136)
* Remove "Add a private content source" sidebar link * Update groupsSentence to cover different number of groups Different cases: 1 group: You have access to the following sources through the group Default. 2 groups: You have access to the following sources through the groups Default and Engineering. (no comma before 'and') 3+ groups: You have access to the following sources through the groups Default, Marketing, and Engineering. (comma before 'and') * Create PrivateSourcesLayout as a copy of Layout In this commit PrivateSourcesLayout is a full copy of Layout. It's going to be updated in later commits. * Remove unused code from PrivateSourcesLayout * Update read-only mode warning copy for end-users * Move copy to constants file * Add width styles to new sidebar Also moved private_sources_layout styles to sources.scss file. Having separate files for that little amount of custom styles is unnecessary. * Move top-level header to sidebar * Add missing padding to sidebar * Replace ViewContentHeader with ContentSection props * Move variables over the components * Remove unused classnames * DRY out privateSourcesTable and privateSourcesEmptyState by extracting privateSourcesSection that contains common markup. * DRY out sharedSourcesTable and sharedSourcesEmptyState by extracting sharedSourcesSection that contains common markup. * Reorder code blocks inside the file To match the order the components appear in UI * Add newline to the groups enumeration sentence So it looks good with any number of groups * Update x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/private_sources_layout.tsx Co-authored-by: Scotty Bollinger <scotty.bollinger@elastic.co> Co-authored-by: Scotty Bollinger <scotty.bollinger@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
90049b0
commit 7da7b10
Showing
6 changed files
with
152 additions
and
98 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
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
66 changes: 66 additions & 0 deletions
66
...rch/public/applications/workplace_search/views/content_sources/private_sources_layout.tsx
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,66 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { useValues } from 'kea'; | ||
|
||
import { EuiPage, EuiPageSideBar, EuiPageBody, EuiCallOut } from '@elastic/eui'; | ||
|
||
import { AppLogic } from '../../app_logic'; | ||
import { ViewContentHeader } from '../../components/shared/view_content_header'; | ||
|
||
import { | ||
PRIVATE_DASHBOARD_READ_ONLY_MODE_WARNING, | ||
PRIVATE_CAN_CREATE_PAGE_TITLE, | ||
PRIVATE_VIEW_ONLY_PAGE_TITLE, | ||
PRIVATE_VIEW_ONLY_PAGE_DESCRIPTION, | ||
PRIVATE_CAN_CREATE_PAGE_DESCRIPTION, | ||
} from './constants'; | ||
|
||
import './sources.scss'; | ||
|
||
interface LayoutProps { | ||
restrictWidth?: boolean; | ||
readOnlyMode?: boolean; | ||
} | ||
|
||
export const PrivateSourcesLayout: React.FC<LayoutProps> = ({ | ||
children, | ||
restrictWidth, | ||
readOnlyMode, | ||
}) => { | ||
const { | ||
account: { canCreatePersonalSources }, | ||
} = useValues(AppLogic); | ||
|
||
const PAGE_TITLE = canCreatePersonalSources | ||
? PRIVATE_CAN_CREATE_PAGE_TITLE | ||
: PRIVATE_VIEW_ONLY_PAGE_TITLE; | ||
const PAGE_DESCRIPTION = canCreatePersonalSources | ||
? PRIVATE_CAN_CREATE_PAGE_DESCRIPTION | ||
: PRIVATE_VIEW_ONLY_PAGE_DESCRIPTION; | ||
|
||
return ( | ||
<EuiPage className="enterpriseSearchLayout privateSourcesLayout"> | ||
<EuiPageSideBar className="enterpriseSearchLayout__sideBar privateSourcesLayout__sideBar"> | ||
<ViewContentHeader title={PAGE_TITLE} description={PAGE_DESCRIPTION} /> | ||
</EuiPageSideBar> | ||
<EuiPageBody className="enterpriseSearchLayout__body" restrictWidth={restrictWidth}> | ||
{readOnlyMode && ( | ||
<EuiCallOut | ||
className="enterpriseSearchLayout__readOnlyMode" | ||
color="warning" | ||
iconType="lock" | ||
title={PRIVATE_DASHBOARD_READ_ONLY_MODE_WARNING} | ||
/> | ||
)} | ||
{children} | ||
</EuiPageBody> | ||
</EuiPage> | ||
); | ||
}; |
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