Skip to content
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 workspace assets page UI bugs #8265

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
2 changes: 2 additions & 0 deletions changelogs/fragments/8265.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- [Workspace]Fix workspace assets page UI bugs ([#8265](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8265))

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
EuiComboBox,
EuiFormRow,
EuiCheckbox,
EuiText,
} from '@elastic/eui';
import { HttpSetup, NotificationsStart, WorkspacesStart } from 'opensearch-dashboards/public';
import { i18n } from '@osd/i18n';
Expand All @@ -36,6 +35,7 @@ export interface ShowDuplicateModalProps {
notifications: NotificationsStart;
selectedSavedObjects: DuplicateObject[];
onClose: () => void;
useUpdatedUX?: boolean;
}

interface State {
Expand Down Expand Up @@ -128,10 +128,11 @@ export class SavedObjectsDuplicateModal extends React.Component<ShowDuplicateMod
<EuiModalHeaderTitle>
<FormattedMessage
id="savedObjectsManagement.objectsTable.duplicateModal.title"
defaultMessage="Copy {objectCount, plural, =1 {{objectName}} other {# objects}} to another workspace?"
defaultMessage="Copy {objectCount, plural, =1 {{objectName}} other {# {useUpdatedUX, select, true {assets} other {objects}}}} to another workspace?"
values={{
objectName: allSelectedObjects[0].meta.title,
objectCount: allSelectedObjects.length,
useUpdatedUX: this.props.useUpdatedUX,
}}
/>
</EuiModalHeaderTitle>
Expand All @@ -142,21 +143,10 @@ export class SavedObjectsDuplicateModal extends React.Component<ShowDuplicateMod
fullWidth
label={i18n.translate(
'savedObjectsManagement.objectsTable.duplicateModal.targetWorkspaceLabel',
{ defaultMessage: 'Workspace' }
{ defaultMessage: 'Target workspace' }
)}
>
<>
<EuiText size="s" color="subdued">
{i18n.translate(
'savedObjectsManagement.objectsTable.duplicateModal.targetWorkspaceNotice',
{
defaultMessage: `Move copied saved object${
allSelectedObjects.length > 1 ? `s` : ``
} to the selected workspace.`,
}
)}
</EuiText>
<EuiSpacer size="s" />
<EuiComboBox
options={workspaceOptions}
onChange={this.onTargetWorkspaceChange}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,13 @@ describe('DuplicateResultFlyout', () => {
);
expect(document.children).toMatchSnapshot();
});

it('calls onClose after footer close button clicked', () => {
render(<DuplicateResultFlyout {...duplicateResultFlyoutProps} />);

const closeButton = screen.getByText('Close');
fireEvent.click(closeButton);

expect(onCloseMock).toHaveBeenCalledTimes(1);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import {
EuiFlexItem,
EuiFlyout,
EuiFlyoutBody,
EuiFlyoutFooter,
EuiFlyoutHeader,
EuiHorizontalRule,
EuiIcon,
EuiIconTip,
EuiSmallButton,
EuiSpacer,
EuiText,
EuiTitle,
Expand Down Expand Up @@ -226,6 +228,14 @@ export class DuplicateResultFlyout extends React.Component<DuplicateResultFlyout
</EuiTitle>
</EuiFlyoutHeader>
<EuiFlyoutBody>{this.copyResult({ failedCopies, successfulCopies })}</EuiFlyoutBody>
<EuiFlyoutFooter>
<EuiSmallButton onClick={onClose}>
<FormattedMessage
id="savedObjectsManagement.copyResult.closeButton"
defaultMessage="Close"
/>
</EuiSmallButton>
</EuiFlyoutFooter>
</EuiFlyout>
);
}
Expand Down
Loading
Loading