Skip to content

Commit

Permalink
[Workspace]feat: align essentials use case id (#7873)
Browse files Browse the repository at this point in the history
* feat: align essentials use case id

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>

* Changeset file for PR #7873 created/updated

---------

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 4b17e01)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 22799ca commit ed6af68
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 13 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/7873.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- Align essentials use case id ([#7873](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7873))
2 changes: 1 addition & 1 deletion src/core/utils/default_nav_groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ChromeNavGroup, NavGroupType } from '../types';
export const ALL_USE_CASE_ID = 'all';
export const OBSERVABILITY_USE_CASE_ID = 'observability';
export const SECURITY_ANALYTICS_USE_CASE_ID = 'security-analytics';
export const ESSENTIAL_USE_CASE_ID = 'analytics';
export const ESSENTIAL_USE_CASE_ID = 'essentials';
export const SEARCH_USE_CASE_ID = 'search';

const defaultNavGroups = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('Register HomeListCardToPages', () => {
expect(contentManagementStartMock.registerContentProvider).toHaveBeenCalledTimes(4);

let whatsNewCall = registerContentProviderFn.mock.calls[0];
expect(whatsNewCall[0].getTargetArea()).toEqual('analytics_overview/service_cards');
expect(whatsNewCall[0].getTargetArea()).toEqual('essentials_overview/service_cards');
expect(whatsNewCall[0].getContent()).toMatchInlineSnapshot(`
Object {
"id": "whats_new",
Expand All @@ -86,7 +86,7 @@ describe('Register HomeListCardToPages', () => {
`);

let learnOpenSearchCall = registerContentProviderFn.mock.calls[1];
expect(learnOpenSearchCall[0].getTargetArea()).toEqual('analytics_overview/service_cards');
expect(learnOpenSearchCall[0].getTargetArea()).toEqual('essentials_overview/service_cards');
expect(learnOpenSearchCall[0].getContent()).toMatchInlineSnapshot(`
Object {
"id": "learn_opensearch_new",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Sample data card', () => {
it('should call the getTargetArea function with the correct arguments', () => {
registerSampleDataCard(contentManagement, coreStart);
const call = registerContentProviderMock.mock.calls[0];
expect(call[0].getTargetArea()).toEqual(['analytics_overview/get_started']);
expect(call[0].getTargetArea()).toEqual(['essentials_overview/get_started']);
expect(call[0].getContent()).toMatchInlineSnapshot(`
Object {
"cardProps": Object {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/workspace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The above object defines a workspace with name `Observability team` that's creat
1. `use-case-observability`
2. `use-case-security-analytics`
3. `use-case-search`
4. `use-case-analytics`
4. `use-case-essentials`
5. `use-case-all`

## Associate saved objects with workspaces
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/workspace/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const WORKSPACE_USE_CASES = Object.freeze({
] as string[],
},
essentials: {
id: 'analytics',
id: 'essentials',
title: i18n.translate('workspace.usecase.essentials.title', {
defaultMessage: 'Essentials',
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('UseCaseFooter', () => {
it('renders create workspace button for admin when no workspaces within use case exist', () => {
const { getByTestId } = render(
<UseCaseFooter
useCaseId="analytics"
useCaseId="essentials"
useCaseTitle="Analytics"
core={getMockCore()}
registeredUseCases$={registeredUseCases$}
Expand All @@ -67,7 +67,7 @@ describe('UseCaseFooter', () => {
it('renders create workspace button for non-admin when no workspaces within use case exist', () => {
const { getByTestId } = render(
<UseCaseFooter
useCaseId="analytics"
useCaseId="essentials"
useCaseTitle="Analytics"
core={getMockCore(false)}
registeredUseCases$={registeredUseCases$}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('Setup use case overview', () => {
const call = registerPageMock.mock.calls[0];
expect(call[0]).toMatchInlineSnapshot(`
Object {
"id": "analytics_overview",
"id": "essentials_overview",
"sections": Array [
Object {
"id": "service_cards",
Expand Down Expand Up @@ -71,7 +71,7 @@ describe('Setup use case overview', () => {
expect(calls.length).toBe(3);

const firstCall = calls[0];
expect(firstCall[0].getTargetArea()).toMatchInlineSnapshot(`"analytics_overview/get_started"`);
expect(firstCall[0].getTargetArea()).toMatchInlineSnapshot(`"essentials_overview/get_started"`);
expect(firstCall[0].getContent()).toMatchInlineSnapshot(`
Object {
"cardProps": Object {
Expand Down Expand Up @@ -99,7 +99,7 @@ describe('Setup use case overview', () => {
const call = registerPageMock.mock.calls[0];
expect(call[0]).toMatchInlineSnapshot(`
Object {
"id": "analytics_overview",
"id": "essentials_overview",
"sections": Array [
Object {
"id": "service_cards",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ export const WorkspaceDetailFormDetails = ({
// Essential can be changed to other use cases;
// Analytics (all) cannot be changed back to a single use case;
// Other use cases can only be changed to Analytics (all) use case.
return currentUseCase === 'analytics' || id === 'all' || id === currentUseCase;
return (
currentUseCase === DEFAULT_NAV_GROUPS.essentials.id ||
id === DEFAULT_NAV_GROUPS.all.id ||
id === currentUseCase
);
})
.map((useCase) => ({
value: useCase.id,
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/workspace/public/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ describe('Workspace plugin', () => {

expect(setupMock.application.register).toHaveBeenCalledWith(
expect.objectContaining({
id: 'analytics_overview',
id: 'essentials_overview',
})
);
});
Expand Down

0 comments on commit ed6af68

Please sign in to comment.