-
Notifications
You must be signed in to change notification settings - Fork 919
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
feat: introducing workspace level ui settings and hide non-global ui settings from advance settings page #8500
Merged
ruanyl
merged 5 commits into
opensearch-project:main
from
ruanyl:filter-out-workspace-settings-from-global-advance-setting-page
Oct 10, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
298968a
feat: introducing workspace level ui settings and hide non-global
ruanyl a10dc9c
Changeset file for PR #8500 created/updated
opensearch-changeset-bot[bot] 35d9731
Merge branch 'main' into filter-out-workspace-settings-from-global-ad…
ruanyl dd15fe6
fix: failed tests
ruanyl 5c0f79f
fix: lint
ruanyl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
feat: | ||
- Introducing workspace level ui settings and hide non-global ui settings from advance settings page ([#8500](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8500)) |
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,19 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { PublicMethodsOf } from '@osd/utility-types'; | ||
|
||
import { | ||
InternalWorkspaceServiceSetup, | ||
InternalWorkspaceServiceStart, | ||
WorkspaceService, | ||
} from './workspace_service'; | ||
|
||
export { InternalWorkspaceServiceSetup, InternalWorkspaceServiceStart } from './workspace_service'; | ||
|
||
export type WorkspaceSetup = InternalWorkspaceServiceSetup; | ||
export type WorkspaceStart = InternalWorkspaceServiceStart; | ||
|
||
export type IWorkspaceService = PublicMethodsOf<WorkspaceService>; |
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,43 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { IWorkspaceService } from '.'; | ||
import { InternalWorkspaceServiceSetup, InternalWorkspaceServiceStart } from './workspace_service'; | ||
|
||
const createWorkspaceServiceMock = () => { | ||
const mocked: jest.Mocked<IWorkspaceService> = { | ||
setup: jest.fn().mockReturnValue(createInternalSetupContractMock()), | ||
start: jest.fn().mockReturnValue({}), | ||
stop: jest.fn(), | ||
}; | ||
|
||
return mocked; | ||
}; | ||
|
||
const createInternalSetupContractMock = () => { | ||
const mocked: jest.Mocked<InternalWorkspaceServiceSetup> = { | ||
isWorkspaceEnabled: jest.fn(), | ||
}; | ||
|
||
return mocked; | ||
}; | ||
const createSetupContractMock = createInternalSetupContractMock; | ||
|
||
const createInternalStartContractMock = () => { | ||
const mocked: jest.Mocked<InternalWorkspaceServiceStart> = { | ||
isWorkspaceEnabled: jest.fn(), | ||
}; | ||
|
||
return mocked; | ||
}; | ||
const createStartContractMock = createInternalStartContractMock; | ||
|
||
export const workspaceServiceMock = { | ||
create: createWorkspaceServiceMock, | ||
createInternalSetupContract: createInternalSetupContractMock, | ||
createInternalStartContract: createInternalStartContractMock, | ||
createSetupContract: createSetupContractMock, | ||
createStartContract: createStartContractMock, | ||
}; |
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,53 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { Observable } from 'rxjs'; | ||
import { first } from 'rxjs/operators'; | ||
|
||
import { CoreService } from '../../types'; | ||
import { CoreContext } from '../core_context'; | ||
import { Logger } from '../logging'; | ||
|
||
export interface InternalWorkspaceServiceSetup { | ||
isWorkspaceEnabled: () => boolean; | ||
} | ||
|
||
export interface InternalWorkspaceServiceStart { | ||
isWorkspaceEnabled: () => boolean; | ||
} | ||
|
||
/** @internal */ | ||
export class WorkspaceService | ||
implements CoreService<InternalWorkspaceServiceSetup, InternalWorkspaceServiceStart> { | ||
private readonly log: Logger; | ||
private readonly config$: Observable<{ enabled: boolean }>; | ||
|
||
constructor(private readonly coreContext: CoreContext) { | ||
this.log = this.coreContext.logger.get('workspace-service'); | ||
this.config$ = this.coreContext.configService.atPath<{ enabled: boolean }>('workspace'); | ||
} | ||
|
||
public async setup(): Promise<InternalWorkspaceServiceSetup> { | ||
this.log.debug('Setting up workspace service'); | ||
|
||
const workspaceConfig = await this.config$.pipe(first()).toPromise(); | ||
|
||
return { | ||
isWorkspaceEnabled: () => workspaceConfig.enabled, | ||
}; | ||
} | ||
|
||
public async start(): Promise<InternalWorkspaceServiceStart> { | ||
this.log.debug('Starting workspace service'); | ||
|
||
const workspaceConfig = await this.config$.pipe(first()).toPromise(); | ||
|
||
return { | ||
isWorkspaceEnabled: () => workspaceConfig.enabled, | ||
}; | ||
} | ||
|
||
public async stop() {} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this impacts build?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Actually, if importing from
core/server
, it only affects the unit tests increate_or_upgrade_saved_config.test.ts