Skip to content
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

Ci/temp #17

Draft
wants to merge 34 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
450ed0f
[Feature] Setup workspace skeleton and implement basic CRUD API (#130)
SuZhou-Joe Sep 11, 2023
93aa359
[Workspace] Add ACL related functions for workspace (#146)
gaobinlong Sep 14, 2023
bc555d2
feat: add core workspace module (#145)
ruanyl Sep 19, 2023
5876656
use self hosted runner and disable windows workflow (#182)
ruanyl Sep 20, 2023
fa68b39
fix backport workflow
ruanyl Sep 22, 2023
1d8088e
[Workspace] Add optional workspaces parameter to all saved objects A…
gaobinlong Sep 28, 2023
d89987d
Register Advance Settings, Data Source management,Index Pattern manag…
raintygao Oct 10, 2023
d046d52
feat: add unit test for mountWrapper (#223)
SuZhou-Joe Oct 12, 2023
b26aef0
[Workspace]Add workspace id in basePath (#212)
SuZhou-Joe Oct 12, 2023
722fc28
[API] Delete saved objects by workspace (#216)
Hailong-am Oct 13, 2023
132447b
[Workspace][Feature] Import sample data to workspace (#210)
wanglam Oct 13, 2023
63e8e9d
Patch/acl (#231)
SuZhou-Joe Oct 16, 2023
7e8c2e3
[Workspace][Feature] Left navigation menu adjustment (#192)
yuye-aws Oct 18, 2023
7185d73
Add copy saved objects API (#217)
gaobinlong Oct 19, 2023
0d079d7
Feature: create management / public workspaces when calling list api …
SuZhou-Joe Oct 23, 2023
b78cea6
fix: remove duplicated reserved field avoid type error (#250)
wanglam Feb 26, 2024
f7b057b
fix: cypress tests checkout workspace branch (#252)
wanglam Feb 27, 2024
b7a4a28
fix: workspace routes integration failed (#251)
wanglam Feb 27, 2024
a6f2f3f
feat: consume current workspace in saved objects management and saved…
SuZhou-Joe Mar 1, 2024
0644dcb
feat: backport pr 5949 to workspace-pr-inte (#275)
SuZhou-Joe Mar 4, 2024
856d014
feat: remove useless code (#280)
SuZhou-Joe Mar 6, 2024
e0c9e87
add permission control service for saved objects and workspace saved …
raintygao Mar 6, 2024
fbe1039
revert Register Advance Settings, Data Source management,Index Patter…
ruanyl Mar 7, 2024
035dc4c
Add a workspace dropdown menu in left navigation bar (#282)
ruanyl Mar 7, 2024
c726157
remove management workspace (#278) (#281)
yubonluo Mar 7, 2024
3cf8b8e
[Workspace][Feature] Add ACL related functions (#5084) (#287)
gaobinlong Mar 8, 2024
822ef54
Workspace left nav bar (#286)
ruanyl Mar 8, 2024
6f12320
Add workspace filter/column into saved objects page (#211)
Hailong-am Mar 11, 2024
d287778
Workspace list pr (#285)
raintygao Mar 11, 2024
93a6585
fix: authInfo destructure (#7) (#296)
SuZhou-Joe Mar 15, 2024
529fc01
Add workspace create page (#284)
wanglam Mar 15, 2024
f95cf18
fix test for delete workspace modal (#299)
raintygao Mar 15, 2024
1b542b6
feat: rebase 20240518
SuZhou-Joe Mar 18, 2024
22638da
feat: update to run ci
SuZhou-Joe Mar 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
# opensearch-trigger-bot installation ID
installation_id: 22958780
installation_id: 41494816

- name: Backport
uses: VachaShah/[email protected]
Expand Down
23 changes: 2 additions & 21 deletions .github/workflows/build_and_test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
os: [arc-runner-set]
group: [1, 2, 3, 4]
include:
- os: ubuntu-latest
name: Linux
- os: windows-latest
name: Windows
runs-on: ${{ matrix.os }}
steps:
- name: Configure git's autocrlf (Windows only)
Expand Down Expand Up @@ -138,13 +136,11 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
os: [arc-runner-set]
group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
include:
- os: ubuntu-latest
name: Linux
- os: windows-latest
name: Windows
runs-on: ${{ matrix.os }}
steps:
- run: echo Running functional tests for ciGroup${{ matrix.group }}
Expand Down Expand Up @@ -332,21 +328,6 @@ jobs:
ext: tar.gz
suffix: linux-arm64
script: build-platform --linux-arm --skip-os-packages
- os: macos-latest
name: macOS x64
ext: tar.gz
suffix: darwin-x64
script: build-platform --darwin --skip-os-packages
- os: macos-latest
name: macOS ARM64
ext: tar.gz
suffix: darwin-arm64
script: build-platform --darwin-arm --skip-os-packages
- os: windows-latest
name: Windows x64
ext: zip
suffix: windows-x64
script: build-platform --windows --skip-os-packages
runs-on: ${{ matrix.os }}
defaults:
run:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/cypress_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ on:

env:
TEST_REPO: ${{ inputs.test_repo != '' && inputs.test_repo || 'opensearch-project/opensearch-dashboards-functional-test' }}
TEST_BRANCH: "${{ inputs.test_branch != '' && inputs.test_branch || github.base_ref }}"
TEST_BRANCH: "${{ inputs.test_branch != '' && inputs.test_branch || 'main' }}"
FTR_PATH: 'ftr'
START_CMD: 'node ../scripts/opensearch_dashboards --dev --no-base-path --no-watch --savedObjects.maxImportPayloadBytes=10485760 --server.maxPayloadBytes=1759977 --logging.json=false --data.search.aggs.shardDelay.enabled=true'
OPENSEARCH_SNAPSHOT_CMD: 'node ../scripts/opensearch snapshot -E cluster.routing.allocation.disk.threshold_enabled=false'
Expand All @@ -43,7 +43,7 @@ env:

jobs:
cypress-tests:
runs-on: ubuntu-latest
runs-on: arc-runner-set
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -264,6 +264,6 @@ jobs:
'${{ env.SPEC }}'
```

#### Link to results:
#### Link to results:
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
edit-mode: replace
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Discover] Enhanced the data source selector with added sorting functionality ([#5609](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/5609))
- [Multiple Datasource] Add datasource picker component and use it in devtools and tutorial page when multiple datasource is enabled ([#5756](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5756))
- [Multiple Datasource] Add datasource picker to import saved object flyout when multiple data source is enabled ([#5781](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5781))
- [Multiple Datasource] Add interfaces to register add-on authentication method from plug-in module ([#5851](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5851))
- [Multiple Datasource] Able to Hide "Local Cluster" option from datasource DropDown ([#5827](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5827))
- [Multiple Datasource] Add api registry and allow it to be added into client config in data source plugin ([#5895](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5895))
- [Multiple Datasource] Concatenate data source name with index pattern name and change delimiter to double colon ([#5907](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5907))
- [Multiple Datasource] Refactor client and legacy client to use authentication registry ([#5881](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5881))
- [Multiple Datasource] Improved error handling for the search API when a null value is passed for the dataSourceId ([#5882](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5882))
- [Multiple Datasource] Hide/Show authentication method in multi data source plugin based on configuration ([#5916](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5916))
- [[Dynamic Configurations] Add support for dynamic application configurations ([#5855](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5855))
- [Workspace] Optional workspaces params in repository ([#5949](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5949))

### 🐛 Bug Fixes

Expand Down
1 change: 1 addition & 0 deletions src/core/public/chrome/chrome_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const createStartContractMock = () => {
getHeaderComponent: jest.fn(),
navLinks: {
getNavLinks$: jest.fn(),
getLinkUpdaters$: jest.fn(),
has: jest.fn(),
get: jest.fn(),
getAll: jest.fn(),
Expand Down
7 changes: 6 additions & 1 deletion src/core/public/chrome/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ export {
ChromeHelpExtensionMenuGitHubLink,
} from './ui/header/header_help_menu';
export { NavType } from './ui';
export { ChromeNavLink, ChromeNavLinks, ChromeNavLinkUpdateableFields } from './nav_links';
export {
ChromeNavLink,
ChromeNavLinks,
ChromeNavLinkUpdateableFields,
LinksUpdater,
} from './nav_links';
export { ChromeRecentlyAccessed, ChromeRecentlyAccessedHistoryItem } from './recently_accessed';
export { ChromeNavControl, ChromeNavControls } from './nav_controls';
export { ChromeDocTitle } from './doc_title';
2 changes: 1 addition & 1 deletion src/core/public/chrome/nav_links/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
*/

export { ChromeNavLink, ChromeNavLinkUpdateableFields } from './nav_link';
export { ChromeNavLinks, NavLinksService } from './nav_links_service';
export { ChromeNavLinks, NavLinksService, LinksUpdater } from './nav_links_service';
17 changes: 14 additions & 3 deletions src/core/public/chrome/nav_links/nav_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ export interface ChromeNavLinks {
*/
getNavLinks$(): Observable<Array<Readonly<ChromeNavLink>>>;

/**
* Get an observable for the current link updaters. Link updater is used to modify the
* nav links, for example, filter the nav links or update a specific nav link's properties.
* {@link LinksUpdater}
*/
getLinkUpdaters$(): BehaviorSubject<LinksUpdater[]>;

/**
* Get the state of a navlink at this point in time.
* @param id
Expand Down Expand Up @@ -112,7 +119,7 @@ export interface ChromeNavLinks {
getForceAppSwitcherNavigation$(): Observable<boolean>;
}

type LinksUpdater = (navLinks: Map<string, NavLinkWrapper>) => Map<string, NavLinkWrapper>;
export type LinksUpdater = (navLinks: Map<string, NavLinkWrapper>) => Map<string, NavLinkWrapper>;

export class NavLinksService {
private readonly stop$ = new ReplaySubject(1);
Expand Down Expand Up @@ -140,8 +147,8 @@ export class NavLinksService {
return linkUpdaters.reduce((links, updater) => updater(links), appLinks);
})
)
.subscribe((navlinks) => {
navLinks$.next(navlinks);
.subscribe((navLinks) => {
navLinks$.next(navLinks);
});

const forceAppSwitcherNavigation$ = new BehaviorSubject(false);
Expand All @@ -151,6 +158,10 @@ export class NavLinksService {
return navLinks$.pipe(map(sortNavLinks), takeUntil(this.stop$));
},

getLinkUpdaters$: () => {
return linkUpdaters$;
},

get(id: string) {
const link = navLinks$.value.get(id);
return link && link.properties;
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/http/base_path.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@ describe('BasePath', () => {
).toEqual('/client_base_path/remove');
});
});
});
});
7 changes: 6 additions & 1 deletion src/core/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import {
ChromeStart,
ChromeRecentlyAccessed,
ChromeRecentlyAccessedHistoryItem,
LinksUpdater,
NavType,
} from './chrome';
import { FatalErrorsSetup, FatalErrorsStart, FatalErrorInfo } from './fatal_errors';
Expand Down Expand Up @@ -104,6 +105,7 @@ export {
StringValidation,
StringValidationRegex,
StringValidationRegexString,
WorkspaceObject,
WorkspaceAttribute,
} from '../types';

Expand Down Expand Up @@ -329,6 +331,7 @@ export {
ChromeRecentlyAccessed,
ChromeRecentlyAccessedHistoryItem,
ChromeStart,
LinksUpdater,
IContextContainer,
HandlerFunction,
HandlerContextType,
Expand Down Expand Up @@ -359,4 +362,6 @@ export { __osdBootstrap__ } from './osd_bootstrap';

export { WorkspacesStart, WorkspacesSetup, WorkspacesService } from './workspace';

export { WORKSPACE_TYPE } from '../utils';
export { WORKSPACE_TYPE, cleanWorkspaceId, DEFAULT_WORKSPACE_ID } from '../utils';

export { debounce } from './utils';
1 change: 1 addition & 0 deletions src/core/public/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ function createCoreSetupMock({
} = {}) {
const mock = {
application: applicationServiceMock.createSetupContract(),
chrome: chromeServiceMock.createSetupContract(),
context: contextServiceMock.createSetupContract(),
docLinks: docLinksServiceMock.createSetupContract(),
fatalErrors: fatalErrorsServiceMock.createSetupContract(),
Expand Down
8 changes: 6 additions & 2 deletions src/core/public/saved_objects/saved_objects_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ import { HttpFetchOptions, HttpSetup } from '../http';

type SavedObjectsFindOptions = Omit<
SavedObjectFindOptionsServer,
'sortOrder' | 'rootSearchFields' | 'typeToNamespacesMap'
| 'sortOrder'
| 'rootSearchFields'
| 'typeToNamespacesMap'
| 'ACLSearchParams'
| 'workspacesSearchOperator'
>;

type PromiseType<T extends Promise<any>> = T extends Promise<infer U> ? U : never;
Expand Down Expand Up @@ -307,7 +311,7 @@ export class SavedObjectsClient {
* @returns The result of the create operation containing created saved objects.
*/
public bulkCreate = (
objects: SavedObjectsBulkCreateObject[] = [],
objects: Array<Omit<SavedObjectsBulkCreateObject, 'workspaces'>> = [],
options: SavedObjectsBulkCreateOptions = { overwrite: false }
) => {
const path = this.getPath(['_bulk_create']);
Expand Down
55 changes: 55 additions & 0 deletions src/core/public/utils/debounce.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import { debounce } from './debounce';

describe('debounce', () => {
let fn: Function;
beforeEach(() => {
fn = jest.fn();
jest.useFakeTimers();
});
afterEach(() => {
jest.clearAllTimers();
});

test('it should call the debounced fn once at the end of the quiet time', () => {
const debounced = debounce(fn, 1000);

for (let i = 0; i < 100; i++) {
debounced(i);
}

jest.advanceTimersByTime(1001);
expect(fn).toBeCalledTimes(1);
expect(fn).toBeCalledWith(99);
});

test("with a leading invocation, it should call the debounced fn once, if the time doens't pass", () => {
const debounced = debounce(fn, 1000, true);

for (let i = 0; i < 100; i++) {
debounced(i);
}

jest.advanceTimersByTime(999);

expect(fn).toBeCalledTimes(1);
expect(fn).toBeCalledWith(0);
});

test('with a leading invocation, it should call the debounced fn twice (at the beginning and at the end)', () => {
const debounced = debounce(fn, 1000, true);

for (let i = 0; i < 100; i++) {
debounced(i);
}

jest.advanceTimersByTime(1500);

expect(fn).toBeCalledTimes(2);
expect(fn).toBeCalledWith(0);
expect(fn).toBeCalledWith(99);
});
});
23 changes: 23 additions & 0 deletions src/core/public/utils/debounce.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @param func The function to be debounced.
* @param delay The time in milliseconds to wait before invoking the function again after the last invocation.
* @param leading An optional parameter that, when true, allows the function to be invoked immediately upon the first call.

*/
export const debounce = (func: Function, delay: number, leading?: boolean) => {
let timerId: NodeJS.Timeout;

return (...args: any) => {
if (!timerId && leading) {
func(...args);
}
clearTimeout(timerId);

timerId = setTimeout(() => func(...args), delay);
};
};
2 changes: 2 additions & 0 deletions src/core/public/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ export {
WORKSPACE_TYPE,
formatUrlWithWorkspaceId,
getWorkspaceIdFromUrl,
cleanWorkspaceId,
} from '../../utils';
export { debounce } from './debounce';
43 changes: 25 additions & 18 deletions src/core/public/workspace/workspaces_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,33 @@ import { BehaviorSubject } from 'rxjs';
import type { PublicMethodsOf } from '@osd/utility-types';

import { WorkspacesService } from './workspaces_service';
import { WorkspaceAttribute } from '..';
import { WorkspaceObject } 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 createWorkspacesSetupContractMock = () => {
const currentWorkspaceId$ = new BehaviorSubject<string>('');
const workspaceList$ = new BehaviorSubject<WorkspaceObject[]>([]);
const currentWorkspace$ = new BehaviorSubject<WorkspaceObject | null>(null);
const initialized$ = new BehaviorSubject<boolean>(false);
return {
currentWorkspaceId$,
workspaceList$,
currentWorkspace$,
initialized$,
};
};

const createWorkspacesStartContractMock = () => ({
currentWorkspaceId$,
workspaceList$,
currentWorkspace$,
initialized$,
});
const createWorkspacesStartContractMock = () => {
const currentWorkspaceId$ = new BehaviorSubject<string>('');
const workspaceList$ = new BehaviorSubject<WorkspaceObject[]>([]);
const currentWorkspace$ = new BehaviorSubject<WorkspaceObject | null>(null);
const initialized$ = new BehaviorSubject<boolean>(false);
return {
currentWorkspaceId$,
workspaceList$,
currentWorkspace$,
initialized$,
};
};

export type WorkspacesServiceContract = PublicMethodsOf<WorkspacesService>;
const createMock = (): jest.Mocked<WorkspacesServiceContract> => ({
Expand Down
4 changes: 1 addition & 3 deletions src/core/public/workspace/workspaces_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
import { BehaviorSubject, combineLatest } from 'rxjs';
import { isEqual } from 'lodash';

import { CoreService, WorkspaceAttribute } from '../../types';

type WorkspaceObject = WorkspaceAttribute & { readonly?: boolean };
import { CoreService, WorkspaceObject } from '../../types';

interface WorkspaceObservables {
/**
Expand Down
Loading
Loading