Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into workspace-use-registe…
Browse files Browse the repository at this point in the history
…red-nav-groups

Signed-off-by: Lin Wang <wonglam@amazon.com>
  • Loading branch information
wanglam committed Jul 18, 2024
2 parents 199f21e + 38ae65b commit 6aafb87
Show file tree
Hide file tree
Showing 121 changed files with 4,607 additions and 1,952 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/7214.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- [DataSource] Restrict to edit data source on the DSM UI. ([#7214](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7214))
2 changes: 2 additions & 0 deletions changelogs/fragments/7230.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- [navigation-next] Add new left navigation ([#7230](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7230))
2 changes: 2 additions & 0 deletions changelogs/fragments/7241.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- [Workspace] Support workspace detail page ([#7241](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7241))
2 changes: 2 additions & 0 deletions changelogs/fragments/7279.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Unassign data source before deleteByWorkspace ([#7279](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7279))
2 changes: 2 additions & 0 deletions changelogs/fragments/7291.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deprecate:
- Remove data enhancements config and readonly flag. Removes dead url link, ([#7291](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7291))
9 changes: 6 additions & 3 deletions config/opensearch_dashboards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,12 @@
# AWSSigV4:
# enabled: true

# Optional setting that controls the permissions of data source to create, update and delete.
# "none": The data source is readonly for all users.
# "dashboard_admin": The data source can only be managed by dashboard admin.
# "all": The data source can be managed by all users. Default to "all".
# data_source.manageableBy: "all"

# Set the value of this setting to false to hide the help menu link to the OpenSearch Dashboards user survey
# opensearchDashboards.survey.url: "https://survey.opensearch.org"

Expand Down Expand Up @@ -353,9 +359,6 @@
# This publishes the Application Usage and UI Metrics into the saved object, which can be accessed by /api/stats?extended=true&legacy=true&exclude_usage=false
# usageCollection.uiMetric.enabled: false

# Set the value to true to enable enhancements for the data plugin
# data.enhancements.enabled: false

# Set the backend roles in groups or users, whoever has the backend roles or exactly match the user ids defined in this config will be regard as dashboard admin.
# Dashboard admin will have the access to all the workspaces(workspace.enabled: true) and objects inside OpenSearch Dashboards.
# opensearchDashboards.dashboardAdmin.groups: ["dashboard_admin"]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"start": "scripts/use_node scripts/opensearch_dashboards --dev",
"start:docker": "scripts/use_node scripts/opensearch_dashboards --dev --opensearch.hosts=$OPENSEARCH_HOSTS --opensearch.ignoreVersionMismatch=true --server.host=$SERVER_HOST",
"start:security": "scripts/use_node scripts/opensearch_dashboards --dev --security",
"start:enhancements": "scripts/use_node scripts/opensearch_dashboards --dev --data.enhancements.enabled=true --data_source.enabled=true --uiSettings.overrides['query:enhancements:enabled']=true --uiSettings.overrides['query:dataSource:readOnly']=false",
"start:enhancements": "scripts/use_node scripts/opensearch_dashboards --dev --data_source.enabled=true --uiSettings.overrides['query:enhancements:enabled']=true",
"debug": "scripts/use_node --nolazy --inspect scripts/opensearch_dashboards --dev",
"debug-break": "scripts/use_node --nolazy --inspect-brk scripts/opensearch_dashboards --dev",
"lint": "yarn run lint:es && yarn run lint:style",
Expand Down
2 changes: 2 additions & 0 deletions src/core/public/chrome/chrome_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ const createStartContractMock = () => {
registerLeft: jest.fn(),
registerCenter: jest.fn(),
registerRight: jest.fn(),
registerLeftBottom: jest.fn(),
getLeft$: jest.fn(),
getCenter$: jest.fn(),
getRight$: jest.fn(),
getLeftBottom$: jest.fn(),
},
navGroup: {
getNavGroupsMap$: jest.fn(() => new BehaviorSubject({})),
Expand Down
5 changes: 4 additions & 1 deletion src/core/public/chrome/chrome_service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ export class ChromeService {
navControlsRight$={navControls.getRight$()}
navControlsExpandedCenter$={navControls.getExpandedCenter$()}
navControlsExpandedRight$={navControls.getExpandedRight$()}
navControlsLeftBottom$={navControls.getLeftBottom$()}
onIsLockedUpdate={setIsNavDrawerLocked}
isLocked$={getIsNavDrawerLocked$}
branding={injectedMetadata.getBranding()}
Expand All @@ -302,7 +303,9 @@ export class ChromeService {
collapsibleNavHeaderRender={this.collapsibleNavHeaderRender}
sidecarConfig$={sidecarConfig$}
navGroupEnabled={navGroup.getNavGroupEnabled()}
currentNavgroup$={navGroup.getCurrentNavGroup$()}
currentNavGroup$={navGroup.getCurrentNavGroup$()}
navGroupsMap$={navGroup.getNavGroupsMap$()}
setCurrentNavGroup={navGroup.setCurrentNavGroup}
/>
),

Expand Down
20 changes: 20 additions & 0 deletions src/core/public/chrome/nav_controls/nav_controls_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,24 @@ describe('RecentlyAccessed#start()', () => {
]);
});
});

describe('expanded left bottom controls', () => {
it('allows registration', async () => {
const navControls = getStart();
const nc = { mount: jest.fn() };
navControls.registerLeftBottom(nc);
expect(await navControls.getLeftBottom$().pipe(take(1)).toPromise()).toEqual([nc]);
});

it('sorts controls by order property', async () => {
const navControls = getStart();
const nc1 = { mount: jest.fn(), order: 10 };
const nc2 = { mount: jest.fn(), order: 0 };
const nc3 = { mount: jest.fn(), order: 20 };
navControls.registerLeftBottom(nc1);
navControls.registerLeftBottom(nc2);
navControls.registerLeftBottom(nc3);
expect(await navControls.getLeftBottom$().pipe(take(1)).toPromise()).toEqual([nc2, nc1, nc3]);
});
});
});
15 changes: 15 additions & 0 deletions src/core/public/chrome/nav_controls/nav_controls_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,16 @@ export interface ChromeNavControls {
registerRight(navControl: ChromeNavControl): void;
/** Register a nav control to be presented on the top-center side of the chrome header. */
registerCenter(navControl: ChromeNavControl): void;
/** Register a nav control to be presented on the left-bottom side of the left navigation. */
registerLeftBottom(navControl: ChromeNavControl): void;
/** @internal */
getLeft$(): Observable<ChromeNavControl[]>;
/** @internal */
getRight$(): Observable<ChromeNavControl[]>;
/** @internal */
getCenter$(): Observable<ChromeNavControl[]>;
/** @internal */
getLeftBottom$(): Observable<ChromeNavControl[]>;
}

/** @internal */
Expand All @@ -82,6 +86,7 @@ export class NavControlsService {
const navControlsExpandedCenter$ = new BehaviorSubject<ReadonlySet<ChromeNavControl>>(
new Set()
);
const navControlsLeftBottom$ = new BehaviorSubject<ReadonlySet<ChromeNavControl>>(new Set());

return {
// In the future, registration should be moved to the setup phase. This
Expand All @@ -105,6 +110,11 @@ export class NavControlsService {
new Set([...navControlsExpandedCenter$.value.values(), navControl])
),

registerLeftBottom: (navControl: ChromeNavControl) =>
navControlsLeftBottom$.next(
new Set([...navControlsLeftBottom$.value.values(), navControl])
),

getLeft$: () =>
navControlsLeft$.pipe(
map((controls) => sortBy([...controls.values()], 'order')),
Expand All @@ -130,6 +140,11 @@ export class NavControlsService {
map((controls) => sortBy([...controls.values()], 'order')),
takeUntil(this.stop$)
),
getLeftBottom$: () =>
navControlsLeftBottom$.pipe(
map((controls) => sortBy([...controls.values()], 'order')),
takeUntil(this.stop$)
),
};
}

Expand Down
Loading

0 comments on commit 6aafb87

Please sign in to comment.