Skip to content

Commit

Permalink
[Workspace] Remove whats new in workspace overview page (#8435) (#8439)
Browse files Browse the repository at this point in the history
* remove whats new



* Changeset file for PR #8435 created/updated

---------



(cherry picked from commit 26dca19)

Signed-off-by: Hailong Cui <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 2, 2024
1 parent dd3c75d commit 2037aa4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 69 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/8435.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- [Workspace]Remove what's new card in workspace overview page ([#8435](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8435))
Original file line number Diff line number Diff line change
Expand Up @@ -75,53 +75,29 @@ describe('Register HomeListCardToPages', () => {

it('register to use case overview page', () => {
registerHomeListCardToPage(contentManagementStartMock, docLinkMock);
expect(contentManagementStartMock.registerContentProvider).toHaveBeenCalledTimes(4);
expect(contentManagementStartMock.registerContentProvider).toHaveBeenCalledTimes(2);

let whatsNewCall = registerContentProviderFn.mock.calls[0];
expect(whatsNewCall[0].getTargetArea()).toEqual('essentials_overview/service_cards');
expect(whatsNewCall[0].getContent()).toMatchInlineSnapshot(`
Object {
"id": "whats_new",
"kind": "custom",
"order": 10,
"render": [Function],
"width": 24,
}
`);

let learnOpenSearchCall = registerContentProviderFn.mock.calls[1];
let learnOpenSearchCall = registerContentProviderFn.mock.calls[0];
expect(learnOpenSearchCall[0].getTargetArea()).toEqual('essentials_overview/service_cards');
expect(learnOpenSearchCall[0].getContent()).toMatchInlineSnapshot(`
Object {
"id": "learn_opensearch_new",
"kind": "custom",
"order": 20,
"render": [Function],
"width": 24,
}
`);

whatsNewCall = registerContentProviderFn.mock.calls[2];
expect(whatsNewCall[0].getTargetArea()).toEqual('all_overview/service_cards');
expect(whatsNewCall[0].getContent()).toMatchInlineSnapshot(`
Object {
"id": "whats_new",
"kind": "custom",
"order": 30,
"render": [Function],
"width": undefined,
"width": 48,
}
`);

learnOpenSearchCall = registerContentProviderFn.mock.calls[3];
learnOpenSearchCall = registerContentProviderFn.mock.calls[1];
expect(learnOpenSearchCall[0].getTargetArea()).toEqual('all_overview/service_cards');
expect(learnOpenSearchCall[0].getContent()).toMatchInlineSnapshot(`
Object {
"id": "learn_opensearch_new",
"kind": "custom",
"order": 40,
"render": [Function],
"width": undefined,
"width": 16,
}
`);
});
Expand Down
18 changes: 2 additions & 16 deletions src/plugins/home/public/application/components/home_list_card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,33 +165,19 @@ export const registerHomeListCardToPage = (
contentManagement: ContentManagementPluginStart,
docLinks: DocLinksStart
) => {
registerHomeListCard(contentManagement, {
id: 'whats_new',
order: 10,
config: getWhatsNewConfig(docLinks),
target: ESSENTIAL_OVERVIEW_CONTENT_AREAS.SERVICE_CARDS,
width: 24,
});

registerHomeListCard(contentManagement, {
id: 'learn_opensearch_new',
order: 20,
config: getLearnOpenSearchConfig(docLinks),
target: ESSENTIAL_OVERVIEW_CONTENT_AREAS.SERVICE_CARDS,
width: 24,
});

registerHomeListCard(contentManagement, {
id: 'whats_new',
order: 30,
config: getWhatsNewConfig(docLinks),
target: ANALYTICS_ALL_OVERVIEW_CONTENT_AREAS.SERVICE_CARDS,
width: 48,
});

registerHomeListCard(contentManagement, {
id: 'learn_opensearch_new',
order: 40,
config: getLearnOpenSearchConfig(docLinks),
target: ANALYTICS_ALL_OVERVIEW_CONTENT_AREAS.SERVICE_CARDS,
width: 16,
});
};
12 changes: 2 additions & 10 deletions src/plugins/home/public/application/home_render.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,22 +130,14 @@ describe('initHome', () => {
};
initHome(contentManagementStartMock, core);

expect(registerHomeListCard).toHaveBeenCalledTimes(2);

expect(registerHomeListCard).toHaveBeenCalledWith(contentManagementStartMock, {
id: 'whats_new',
order: 10,
config: getWhatsNewConfig(core.docLinks),
target: HOME_CONTENT_AREAS.SERVICE_CARDS,
width: 16,
});
expect(registerHomeListCard).toHaveBeenCalledTimes(1);

expect(registerHomeListCard).toHaveBeenCalledWith(contentManagementStartMock, {
id: 'learn_opensearch_new',
order: 11,
config: getLearnOpenSearchConfig(core.docLinks),
target: HOME_CONTENT_AREAS.SERVICE_CARDS,
width: 16,
width: 48,
});
});
});
16 changes: 2 additions & 14 deletions src/plugins/home/public/application/home_render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ import {
OBSERVABILITY_OVERVIEW_PAGE_ID,
SECURITY_ANALYTICS_OVERVIEW_PAGE_ID,
} from '../../../../plugins/content_management/public';
import {
getWhatsNewConfig,
getLearnOpenSearchConfig,
registerHomeListCard,
} from './components/home_list_card';
import { getLearnOpenSearchConfig, registerHomeListCard } from './components/home_list_card';

import { registerUseCaseCard } from './components/use_case_card';

Expand Down Expand Up @@ -90,19 +86,11 @@ export const initHome = (contentManagement: ContentManagementPluginStart, core:
});
}

registerHomeListCard(contentManagement, {
id: 'whats_new',
order: 10,
config: getWhatsNewConfig(core.docLinks),
target: HOME_CONTENT_AREAS.SERVICE_CARDS,
width: 16,
});

registerHomeListCard(contentManagement, {
id: 'learn_opensearch_new',
order: 11,
config: getLearnOpenSearchConfig(core.docLinks),
target: HOME_CONTENT_AREAS.SERVICE_CARDS,
width: 16,
width: workspaceEnabled ? 32 : 48,
});
};

0 comments on commit 2037aa4

Please sign in to comment.