Skip to content

Commit 216f10a

Browse files
authored
Merge branch 'workspace-pr-integr' into feature/setup-workspace-server-api-main
2 parents e58ab3f + f630277 commit 216f10a

File tree

19 files changed

+1452
-15
lines changed

19 files changed

+1452
-15
lines changed

.github/workflows/build_and_test_workflow.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,11 @@ jobs:
3333
strategy:
3434
fail-fast: false
3535
matrix:
36-
os: [ubuntu-latest, windows-latest]
36+
os: [arc-runner-set]
3737
group: [1, 2, 3, 4]
3838
include:
3939
- os: ubuntu-latest
4040
name: Linux
41-
- os: windows-latest
42-
name: Windows
4341
runs-on: ${{ matrix.os }}
4442
steps:
4543
- name: Configure git's autocrlf (Windows only)
@@ -130,13 +128,11 @@ jobs:
130128
strategy:
131129
fail-fast: false
132130
matrix:
133-
os: [ubuntu-latest, windows-latest]
131+
os: [arc-runner-set]
134132
group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
135133
include:
136134
- os: ubuntu-latest
137135
name: Linux
138-
- os: windows-latest
139-
name: Windows
140136
runs-on: ${{ matrix.os }}
141137
steps:
142138
- run: echo Running functional tests for ciGroup${{ matrix.group }}
@@ -227,11 +223,6 @@ jobs:
227223
ext: tar.gz
228224
suffix: linux-arm64
229225
script: build-platform --linux-arm --skip-os-packages
230-
- os: windows-latest
231-
name: Windows x64
232-
ext: zip
233-
suffix: windows-x64
234-
script: build-platform --windows --skip-os-packages
235226
runs-on: ${{ matrix.os }}
236227
defaults:
237228
run:

.github/workflows/cypress_workflow.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env:
1919

2020
jobs:
2121
cypress-tests:
22-
runs-on: ubuntu-latest
22+
runs-on: arc-runner-set
2323
container:
2424
image: docker://opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2
2525
options: --user 1001
@@ -54,7 +54,7 @@ jobs:
5454
uses: actions/checkout@v2
5555
with:
5656
path: ${{ env.FTR_PATH }}
57-
repository: opensearch-project/opensearch-dashboards-functional-test
57+
repository: ruanyl/opensearch-dashboards-functional-test
5858
ref: '${{ github.base_ref }}'
5959

6060
- name: Get Cypress version
@@ -88,7 +88,7 @@ jobs:
8888
name: ftr-cypress-screenshots
8989
path: ${{ env.FTR_PATH }}/cypress/screenshots
9090
retention-days: 1
91-
91+
9292
- uses: actions/upload-artifact@v3
9393
if: always()
9494
with:
@@ -101,4 +101,4 @@ jobs:
101101
with:
102102
name: ftr-cypress-results
103103
path: ${{ env.FTR_PATH }}/cypress/results
104-
retention-days: 1
104+
retention-days: 1

src/core/public/application/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import { IUiSettingsClient } from '../ui_settings';
4747
import { SavedObjectsStart } from '../saved_objects';
4848
import { AppCategory } from '../../types';
4949
import { ScopedHistory } from './scoped_history';
50+
import { WorkspacesStart } from '../workspace';
5051

5152
/**
5253
* Accessibility status of an application.
@@ -334,6 +335,8 @@ export interface AppMountContext {
334335
injectedMetadata: {
335336
getInjectedVar: (name: string, defaultValue?: any) => unknown;
336337
};
338+
/** {@link WorkspacesService} */
339+
workspaces: WorkspacesStart;
337340
};
338341
}
339342

src/core/public/core_system.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import { ContextService } from './context';
5454
import { IntegrationsService } from './integrations';
5555
import { CoreApp } from './core_app';
5656
import type { InternalApplicationSetup, InternalApplicationStart } from './application/types';
57+
import { WorkspacesService } from './workspace';
5758

5859
interface Params {
5960
rootDomElement: HTMLElement;
@@ -110,6 +111,7 @@ export class CoreSystem {
110111

111112
private readonly rootDomElement: HTMLElement;
112113
private readonly coreContext: CoreContext;
114+
private readonly workspaces: WorkspacesService;
113115
private fatalErrorsSetup: FatalErrorsSetup | null = null;
114116

115117
constructor(params: Params) {
@@ -138,6 +140,7 @@ export class CoreSystem {
138140
this.rendering = new RenderingService();
139141
this.application = new ApplicationService();
140142
this.integrations = new IntegrationsService();
143+
this.workspaces = new WorkspacesService();
141144

142145
this.coreContext = { coreId: Symbol('core'), env: injectedMetadata.env };
143146

@@ -160,6 +163,7 @@ export class CoreSystem {
160163
const http = this.http.setup({ injectedMetadata, fatalErrors: this.fatalErrorsSetup });
161164
const uiSettings = this.uiSettings.setup({ http, injectedMetadata });
162165
const notifications = this.notifications.setup({ uiSettings });
166+
const workspaces = this.workspaces.setup();
163167

164168
const pluginDependencies = this.plugins.getOpaqueIds();
165169
const context = this.context.setup({
@@ -176,6 +180,7 @@ export class CoreSystem {
176180
injectedMetadata,
177181
notifications,
178182
uiSettings,
183+
workspaces,
179184
};
180185

181186
// Services that do not expose contracts at setup
@@ -220,6 +225,7 @@ export class CoreSystem {
220225
targetDomElement: notificationsTargetDomElement,
221226
});
222227
const application = await this.application.start({ http, overlays });
228+
const workspaces = this.workspaces.start({ application, http });
223229
const chrome = await this.chrome.start({
224230
application,
225231
docLinks,
@@ -242,6 +248,7 @@ export class CoreSystem {
242248
overlays,
243249
savedObjects,
244250
uiSettings,
251+
workspaces,
245252
}));
246253

247254
const core: InternalCoreStart = {
@@ -256,6 +263,7 @@ export class CoreSystem {
256263
overlays,
257264
uiSettings,
258265
fatalErrors,
266+
workspaces,
259267
};
260268

261269
await this.plugins.start(core);

src/core/public/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ import {
8787
HandlerParameters,
8888
} from './context';
8989
import { Branding } from '../types';
90+
import { WorkspacesStart, WorkspacesSetup } from './workspace';
9091

9192
export type { Logos } from '../common';
9293
export { PackageInfo, EnvironmentMode } from '../server/types';
@@ -102,6 +103,7 @@ export {
102103
StringValidation,
103104
StringValidationRegex,
104105
StringValidationRegexString,
106+
WorkspaceAttribute,
105107
} from '../types';
106108

107109
export {
@@ -239,6 +241,8 @@ export interface CoreSetup<TPluginsStart extends object = object, TStart = unkno
239241
};
240242
/** {@link StartServicesAccessor} */
241243
getStartServices: StartServicesAccessor<TPluginsStart, TStart>;
244+
/** {@link WorkspacesSetup} */
245+
workspaces: WorkspacesSetup;
242246
}
243247

244248
/**
@@ -293,6 +297,8 @@ export interface CoreStart {
293297
getInjectedVar: (name: string, defaultValue?: any) => unknown;
294298
getBranding: () => Branding;
295299
};
300+
/** {@link WorkspacesStart} */
301+
workspaces: WorkspacesStart;
296302
}
297303

298304
export {
@@ -341,3 +347,10 @@ export {
341347
};
342348

343349
export { __osdBootstrap__ } from './osd_bootstrap';
350+
351+
export {
352+
WorkspacesStart,
353+
WorkspacesSetup,
354+
WorkspacesService,
355+
WorkspaceObservables,
356+
} from './workspace';

src/core/public/mocks.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import { uiSettingsServiceMock } from './ui_settings/ui_settings_service.mock';
4747
import { savedObjectsServiceMock } from './saved_objects/saved_objects_service.mock';
4848
import { contextServiceMock } from './context/context_service.mock';
4949
import { injectedMetadataServiceMock } from './injected_metadata/injected_metadata_service.mock';
50+
import { workspacesServiceMock } from './workspace/workspaces_service.mock';
5051

5152
export { chromeServiceMock } from './chrome/chrome_service.mock';
5253
export { docLinksServiceMock } from './doc_links/doc_links_service.mock';
@@ -60,6 +61,7 @@ export { uiSettingsServiceMock } from './ui_settings/ui_settings_service.mock';
6061
export { savedObjectsServiceMock } from './saved_objects/saved_objects_service.mock';
6162
export { scopedHistoryMock } from './application/scoped_history.mock';
6263
export { applicationServiceMock } from './application/application_service.mock';
64+
export { workspacesServiceMock } from './workspace/workspaces_service.mock';
6365

6466
function createCoreSetupMock({
6567
basePath = '',
@@ -85,6 +87,7 @@ function createCoreSetupMock({
8587
getInjectedVar: injectedMetadataServiceMock.createSetupContract().getInjectedVar,
8688
getBranding: injectedMetadataServiceMock.createSetupContract().getBranding,
8789
},
90+
workspaces: workspacesServiceMock.createSetupContractMock(),
8891
};
8992

9093
return mock;
@@ -106,6 +109,7 @@ function createCoreStartMock({ basePath = '' } = {}) {
106109
getBranding: injectedMetadataServiceMock.createStartContract().getBranding,
107110
},
108111
fatalErrors: fatalErrorsServiceMock.createStartContract(),
112+
workspaces: workspacesServiceMock.createStartContract(),
109113
};
110114

111115
return mock;

src/core/public/plugins/plugin_context.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export function createPluginSetupContext<
121121
getBranding: deps.injectedMetadata.getBranding,
122122
},
123123
getStartServices: () => plugin.startDependencies,
124+
workspaces: deps.workspaces,
124125
};
125126
}
126127

@@ -168,5 +169,6 @@ export function createPluginStartContext<
168169
getBranding: deps.injectedMetadata.getBranding,
169170
},
170171
fatalErrors: deps.fatalErrors,
172+
workspaces: deps.workspaces,
171173
};
172174
}

src/core/public/plugins/plugins_service.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import { CoreSetup, CoreStart, PluginInitializerContext } from '..';
5858
import { docLinksServiceMock } from '../doc_links/doc_links_service.mock';
5959
import { savedObjectsServiceMock } from '../saved_objects/saved_objects_service.mock';
6060
import { contextServiceMock } from '../context/context_service.mock';
61+
import { workspacesServiceMock } from '../workspace/workspaces_service.mock';
6162

6263
export let mockPluginInitializers: Map<PluginName, MockedPluginInitializer>;
6364

@@ -108,6 +109,7 @@ describe('PluginsService', () => {
108109
injectedMetadata: injectedMetadataServiceMock.createStartContract(),
109110
notifications: notificationServiceMock.createSetupContract(),
110111
uiSettings: uiSettingsServiceMock.createSetupContract(),
112+
workspaces: workspacesServiceMock.createSetupContractMock(),
111113
};
112114
mockSetupContext = {
113115
...mockSetupDeps,
@@ -127,6 +129,7 @@ describe('PluginsService', () => {
127129
uiSettings: uiSettingsServiceMock.createStartContract(),
128130
savedObjects: savedObjectsServiceMock.createStartContract(),
129131
fatalErrors: fatalErrorsServiceMock.createStartContract(),
132+
workspaces: workspacesServiceMock.createStartContract(),
130133
};
131134
mockStartContext = {
132135
...mockStartDeps,

src/core/public/workspace/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
export {
6+
WorkspacesStart,
7+
WorkspacesService,
8+
WorkspacesSetup,
9+
WorkspaceObservables,
10+
} from './workspaces_service';
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import { BehaviorSubject } from 'rxjs';
7+
import { WorkspaceAttribute } from '..';
8+
9+
const currentWorkspaceId$ = new BehaviorSubject<string>('');
10+
const workspaceList$ = new BehaviorSubject<WorkspaceAttribute[]>([]);
11+
const currentWorkspace$ = new BehaviorSubject<WorkspaceAttribute | null>(null);
12+
const initialized$ = new BehaviorSubject<boolean>(false);
13+
const workspaceEnabled$ = new BehaviorSubject<boolean>(false);
14+
15+
const createWorkspacesSetupContractMock = () => ({
16+
currentWorkspaceId$,
17+
workspaceList$,
18+
currentWorkspace$,
19+
initialized$,
20+
workspaceEnabled$,
21+
registerWorkspaceMenuRender: jest.fn(),
22+
});
23+
24+
const createWorkspacesStartContractMock = () => ({
25+
currentWorkspaceId$,
26+
workspaceList$,
27+
currentWorkspace$,
28+
initialized$,
29+
workspaceEnabled$,
30+
renderWorkspaceMenu: jest.fn(),
31+
});
32+
33+
export const workspacesServiceMock = {
34+
createSetupContractMock: createWorkspacesSetupContractMock,
35+
createStartContract: createWorkspacesStartContractMock,
36+
};

0 commit comments

Comments
 (0)