forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Workspace] Feature/workspace service core module (opensearch-project…
…#5092) * feat: add core workspace module (#145) The core workspace module(WorkspaceService) is a foundational component that enables the implementation of workspace features within OSD plugins. The purpose of the core workspace module is to provide a framework for workspace implementations. This module does not implement specific workspace functionality but provides the essential infrastructure for plugins to extend and customize workspace features, it maintains a shared workspace state(observables) across the entire application to ensure a consistent and up-to-date view of workspace-related information to all parts of the application. Signed-off-by: Yulong Ruan <[email protected]> Signed-off-by: Yulong Ruan <[email protected]> Co-authored-by: Miki <[email protected]>
- Loading branch information
Showing
25 changed files
with
748 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export { WorkspacesStart, WorkspacesService, WorkspacesSetup } from './workspaces_service'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { BehaviorSubject } from 'rxjs'; | ||
import type { PublicMethodsOf } from '@osd/utility-types'; | ||
|
||
import { WorkspacesService } from './workspaces_service'; | ||
import { WorkspaceAttribute } from '..'; | ||
|
||
const currentWorkspaceId$ = new BehaviorSubject<string>(''); | ||
const workspaceList$ = new BehaviorSubject<WorkspaceAttribute[]>([]); | ||
const currentWorkspace$ = new BehaviorSubject<WorkspaceAttribute | null>(null); | ||
const initialized$ = new BehaviorSubject<boolean>(false); | ||
|
||
const createWorkspacesSetupContractMock = () => ({ | ||
currentWorkspaceId$, | ||
workspaceList$, | ||
currentWorkspace$, | ||
initialized$, | ||
}); | ||
|
||
const createWorkspacesStartContractMock = () => ({ | ||
currentWorkspaceId$, | ||
workspaceList$, | ||
currentWorkspace$, | ||
initialized$, | ||
}); | ||
|
||
export type WorkspacesServiceContract = PublicMethodsOf<WorkspacesService>; | ||
const createMock = (): jest.Mocked<WorkspacesServiceContract> => ({ | ||
setup: jest.fn().mockReturnValue(createWorkspacesSetupContractMock()), | ||
start: jest.fn().mockReturnValue(createWorkspacesStartContractMock()), | ||
stop: jest.fn(), | ||
}); | ||
|
||
export const workspacesServiceMock = { | ||
create: createMock, | ||
createSetupContract: createWorkspacesSetupContractMock, | ||
createStartContract: createWorkspacesStartContractMock, | ||
}; |
Oops, something went wrong.