-
Notifications
You must be signed in to change notification settings - Fork 919
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introducing workspace level ui settings and hide non-global ui …
…settings from advance settings page (#8500) * feat: introducing workspace level ui settings and hide non-global ui settings from advance settings page + make defaultIndex pattern a workspace ui setting when workspace is on and make it a global setting when workspace is off Signed-off-by: Yulong Ruan <[email protected]> * Changeset file for PR #8500 created/updated * fix: failed tests Signed-off-by: Yulong Ruan <[email protected]> * fix: lint Signed-off-by: Yulong Ruan <[email protected]> --------- Signed-off-by: Yulong Ruan <[email protected]> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> (cherry picked from commit 91fd6d3) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
fb38d67
commit 577bb93
Showing
15 changed files
with
171 additions
and
4 deletions.
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