-
Notifications
You must be signed in to change notification settings - Fork 917
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
[workspace]Fix/UI of assets table #8519
Changes from 8 commits
4947b00
13be456
22e868d
d4ce21c
ef28e15
636a6d2
1f8c391
06a6080
63243bb
9c91505
8b9dc6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fix: | ||
- Adds badge when there are more than one workspaces and updates the icon ([#8519](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8519)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,7 +109,6 @@ import { DataPublicPluginStart } from '../../../../../plugins/data/public'; | |
import { DuplicateObject } from '../types'; | ||
import { formatWorkspaceIdParams } from '../../utils'; | ||
import { NavigationPublicPluginStart } from '../../../../navigation/public'; | ||
import { WorkspaceObject } from '../../../../workspaces/public'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why this import been removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for spotting the error already reverted. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems it should import from core now: import { WorkspaceObject } from '../../../../../core/public'; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This import is correct, sorry I haven't made a double check. already updated There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No problem, I guess the export location was changed in another PR, thanks for fixing this. |
||
|
||
interface ExportAllOption { | ||
id: string; | ||
|
@@ -1174,7 +1173,6 @@ export class SavedObjectsTable extends Component<SavedObjectsTableProps, SavedOb | |
searchThreshold: 1, | ||
}); | ||
} | ||
|
||
return ( | ||
<EuiPageContent horizontalPosition="center" paddingSize={useUpdatedUX ? 'm' : undefined}> | ||
{this.renderFlyout()} | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,8 +3,8 @@ | |||||
* SPDX-License-Identifier: Apache-2.0 | ||||||
*/ | ||||||
|
||||||
import React from 'react'; | ||||||
import { EuiText } from '@elastic/eui'; | ||||||
import React, { useState } from 'react'; | ||||||
import { EuiText, EuiBadge, EuiPopover } from '@elastic/eui'; | ||||||
import useObservable from 'react-use/lib/useObservable'; | ||||||
import { i18n } from '@osd/i18n'; | ||||||
import { WorkspaceAttribute, CoreSetup } from '../../../../../core/public'; | ||||||
|
@@ -17,16 +17,65 @@ | |||||
|
||||||
export function WorkspaceColumn({ coreSetup, workspaces }: WorkspaceColumnProps) { | ||||||
const workspaceList = useObservable(coreSetup.workspaces.workspaceList$); | ||||||
|
||||||
const [showBadgePopover, setShowBadgePopover] = useState(false); | ||||||
const wsLookUp = workspaceList?.reduce((map, ws) => { | ||||||
return map.set(ws.id, ws.name); | ||||||
}, new Map<string, string>()); | ||||||
|
||||||
const workspaceNames = workspaces?.map((wsId) => wsLookUp?.get(wsId)).join(' | '); | ||||||
const workspaceNames = workspaces?.map((wsId) => wsLookUp?.get(wsId)).filter((ws) => ws); | ||||||
|
||||||
return <EuiText>{workspaceNames}</EuiText>; | ||||||
} | ||||||
const toggleBadgePopover = () => { | ||||||
setShowBadgePopover(!showBadgePopover); | ||||||
}; | ||||||
|
||||||
const closeBadgePopover = () => { | ||||||
setShowBadgePopover(false); | ||||||
}; | ||||||
|
||||||
if (workspaceNames) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for comment, updated |
||||||
const displayedWorkspaces = workspaceNames.slice(0, 1); | ||||||
const remainingWorkspacesCount = workspaceNames.length - 1; | ||||||
return ( | ||||||
<> | ||||||
<EuiText size="s">{displayedWorkspaces}</EuiText> | ||||||
{remainingWorkspacesCount > 0 && ( | ||||||
<> | ||||||
| ||||||
<EuiBadge | ||||||
color="hollow" | ||||||
iconType="popout" | ||||||
iconSide="right" | ||||||
onClick={toggleBadgePopover} | ||||||
iconOnClick={toggleBadgePopover} | ||||||
iconOnClickAriaLabel="Open workspaces popover" | ||||||
onClickAriaLabel="Open workspaces popover" | ||||||
data-test-subj="workspace-column-more-workspaces-badge" | ||||||
> | ||||||
+ {remainingWorkspacesCount} more | ||||||
</EuiBadge> | ||||||
{showBadgePopover && ( | ||||||
<EuiPopover | ||||||
isOpen={showBadgePopover} | ||||||
closePopover={closeBadgePopover} | ||||||
anchorPosition="rightCenter" | ||||||
panelPaddingSize="s" | ||||||
data-test-subj="workspace-column-popover" | ||||||
> | ||||||
{workspaceNames.slice(1).map((ws) => ( | ||||||
<EuiText key={ws} size="xs"> | ||||||
{ws} | ||||||
</EuiText> | ||||||
))} | ||||||
</EuiPopover> | ||||||
)} | ||||||
</> | ||||||
)} | ||||||
</> | ||||||
); | ||||||
} else { | ||||||
return <EuiText size="s">—</EuiText>; | ||||||
} | ||||||
} | ||||||
export function getWorkspaceColumn( | ||||||
coreSetup: CoreSetup | ||||||
): SavedObjectsManagementColumn<WorkspaceAttribute | undefined> { | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason to remove this assertion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for spotting the error, I think it is an accidental delete. already reverted.