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

[Saved Objects Tagging] Visually hide tags in Saved Objects Management #197423

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

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 @@ -51,7 +51,9 @@ const convertType = (type: string): SavedObjectManagementTypeInfo => ({
namespaceType: 'single',
});

const allowedTypes = ['index-pattern', 'visualization', 'dashboard', 'search'].map(convertType);
const allowedTypes = ['index-pattern', 'visualization', 'dashboard', 'search', 'tag'].map(
convertType
);

const allSavedObjects = [
{
Expand Down Expand Up @@ -82,6 +84,13 @@ const allSavedObjects = [
title: `MyViz`,
},
},
{
id: '5',
type: 'tag',
attributes: {
title: `HelloWorldTag`,
},
},
];

describe('SavedObjectsTable', () => {
Expand Down Expand Up @@ -129,6 +138,7 @@ describe('SavedObjectsTable', () => {
visualization: 0,
dashboard: 0,
search: 0,
tag: 0,
});

defaultProps = {
Expand All @@ -148,7 +158,7 @@ describe('SavedObjectsTable', () => {
};

findObjectsMock.mockImplementation(() => ({
total: 4,
total: 5,
saved_objects: [
{
id: '1',
Expand Down Expand Up @@ -199,6 +209,14 @@ describe('SavedObjectsTable', () => {
},
},
},
{
id: '5',
type: 'tag',
meta: {
title: `HelloWorldTag`,
icon: 'tag',
},
},
],
}));
});
Expand Down Expand Up @@ -451,7 +469,7 @@ describe('SavedObjectsTable', () => {
component.update();

await component.instance().getRelationships('search', '1');
const savedObjectTypes = ['index-pattern', 'visualization', 'dashboard', 'search'];
const savedObjectTypes = ['index-pattern', 'visualization', 'dashboard', 'search', 'tag'];
expect(getRelationshipsMock).toHaveBeenCalledWith(http, 'search', '1', savedObjectTypes);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,10 @@ export class SavedObjectsTable extends Component<SavedObjectsTableProps, SavedOb
onSelectionChange: this.onSelectionChanged,
};

const filterOptions = allowedTypes.map((type) => ({
const filtersWithoutTags = allowedTypes.filter((t) => t.name !== 'tag');
const itemsWithoutTags = savedObjects.filter((t) => t.type !== 'tag');

const filterOptions = filtersWithoutTags.map((type) => ({
value: type.displayName,
name: type.displayName,
view: `${type.displayName} (${savedObjectCounts[type.name] || 0})`,
Expand Down Expand Up @@ -733,7 +736,7 @@ export class SavedObjectsTable extends Component<SavedObjectsTableProps, SavedOb
pageIndex={page}
pageSize={perPage}
sort={sort}
items={savedObjects}
items={itemsWithoutTags}
totalItemCount={filteredItemCount}
isSearching={isSearching}
onShowRelationships={this.onShowRelationships}
Expand Down