Skip to content

Commit

Permalink
remove hide import
Browse files Browse the repository at this point in the history
Signed-off-by: Hailong Cui <[email protected]>
  • Loading branch information
Hailong-am committed Mar 8, 2024
1 parent 740479d commit 448fdb2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 44 deletions.

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 @@ -40,29 +40,10 @@ describe('Header', () => {
onRefresh: () => {},
totalCount: 4,
filteredCount: 2,
title: '',
};

const component = shallow(<Header {...props} />);

expect(component).toMatchSnapshot();
});
});

describe('Header - workspace enabled', () => {
it('should hide `Import` button for application home state', () => {
const props = {
onExportAll: () => {},
onImport: () => {},
onRefresh: () => {},
totalCount: 4,
filteredCount: 2,
hideImport: true,
title: 'Saved Objectes',
};

const component = shallow(<Header {...props} />);

expect(component.find('EuiButtonEmpty[data-test-subj="importObjects"]').exists()).toBe(false);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,11 @@ export const Header = ({
onImport,
onRefresh,
filteredCount,
hideImport,
title,
}: {
onExportAll: () => void;
onImport: () => void;
onRefresh: () => void;
filteredCount: number;
hideImport?: boolean;
title: string;
}) => (
<Fragment>
<EuiFlexGroup justifyContent="spaceBetween" alignItems="baseline">
Expand Down Expand Up @@ -86,21 +82,19 @@ export const Header = ({
/>
</EuiButtonEmpty>
</EuiFlexItem>
{!hideImport && (
<EuiFlexItem grow={false}>
<EuiButtonEmpty
size="s"
iconType="importAction"
data-test-subj="importObjects"
onClick={onImport}
>
<FormattedMessage
id="savedObjectsManagement.objectsTable.header.importButtonLabel"
defaultMessage="Import"
/>
</EuiButtonEmpty>
</EuiFlexItem>
)}
<EuiFlexItem grow={false}>
<EuiButtonEmpty
size="s"
iconType="importAction"
data-test-subj="importObjects"
onClick={onImport}
>
<FormattedMessage
id="savedObjectsManagement.objectsTable.header.importButtonLabel"
defaultMessage="Import"
/>
</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonEmpty size="s" iconType="refresh" onClick={onRefresh}>
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -992,9 +992,6 @@ export class SavedObjectsTable extends Component<SavedObjectsTableProps, SavedOb
});
}

// workspace enable and no workspace is selected
const hideImport = workspaceEnabled && !currentWorkspaceId;

return (
<EuiPageContent horizontalPosition="center">
{this.renderFlyout()}
Expand All @@ -1006,8 +1003,6 @@ export class SavedObjectsTable extends Component<SavedObjectsTableProps, SavedOb
onImport={this.showImportFlyout}
onRefresh={this.refreshObjects}
filteredCount={filteredItemCount}
hideImport={hideImport}
title={this.props.title}
/>
<EuiSpacer size="xs" />
<RedirectAppLinks application={applications}>
Expand Down

0 comments on commit 448fdb2

Please sign in to comment.