Skip to content

Commit

Permalink
Merge branch 'opensearch-project:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Maosaic authored Jan 10, 2025
2 parents 376b0c2 + e401613 commit 5312e30
Show file tree
Hide file tree
Showing 11 changed files with 605 additions and 27 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/9145.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- Add a "Learn More" flyout providing additional information to the collaborators page. ([#9145](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9145))
2 changes: 2 additions & 0 deletions changelogs/fragments/9159.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Fix Unhandled Error Response of dev tool with MDS ([#9159](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9159))
7 changes: 5 additions & 2 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,10 @@ export class DocLinksService {
advancedSettings: `${OPENSEARCH_DASHBOARDS_VERSIONED_DOCS}management/advanced-settings/`,
},
workspace: {
// https://opensearch.org/docs/latest/dashboards/workspace/workspace-acl/
acl: `${OPENSEARCH_DASHBOARDS_VERSIONED_DOCS}workspace/workspace-acl/`,
// https://opensearch.org/docs/latest/dashboards/workspace/workspace-acl/#defining-workspace-collaborators
collaborators: `${OPENSEARCH_DASHBOARDS_VERSIONED_DOCS}workspace/workspace-acl/#defining-workspace-collaborators`,
// https://opensearch.org/docs/latest/dashboards/workspace/workspace-acl/#workspace-privacy
privacy: `${OPENSEARCH_DASHBOARDS_VERSIONED_DOCS}workspace/workspace-acl/#workspace-privacy`,
},
},
noDocumentation: {
Expand Down Expand Up @@ -854,6 +856,7 @@ export interface DocLinksStart {
readonly visualize: Record<string, string>;
readonly dashboards: Record<string, string>;
readonly management: Record<string, string>;
readonly workspace: Record<string, string>;
};
readonly noDocumentation: {
readonly auditbeat: string;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { OpenSearchDashboardsRequest, RequestHandler } from 'opensearch-dashboar
import { trimStart } from 'lodash';
import { Readable } from 'stream';
import { stringify } from '@osd/std';
import { ApiResponse } from '@opensearch-project/opensearch';

// eslint-disable-next-line @osd/eslint/no-restricted-paths
import { ensureRawRequest } from '../../../../../../../core/server/http/router';
Expand Down Expand Up @@ -88,10 +87,6 @@ export const createHandler = ({
}: RouteDependencies): RequestHandler<unknown, Query, Body> => async (ctx, request, response) => {
const { body, query } = request;
const { path, method, dataSourceId } = query;
const client = dataSourceId
? await ctx.dataSource.opensearch.getClient(dataSourceId)
: ctx.core.opensearch.client.asCurrentUserWithLongNumeralsSupport;
let opensearchResponse: ApiResponse;

if (!pathFilters.some((re) => re.test(path))) {
return response.forbidden({
Expand All @@ -103,6 +98,10 @@ export const createHandler = ({
}

try {
const client = dataSourceId
? await ctx.dataSource.opensearch.getClient(dataSourceId)
: ctx.core.opensearch.client.asCurrentUserWithLongNumeralsSupport;

// TODO: proxy header will fail sigv4 auth type in data source, need create issue in opensearch-js repo to track
const requestHeaders = dataSourceId
? {}
Expand All @@ -111,7 +110,7 @@ export const createHandler = ({
};

const bufferedBody = await buildBufferedBody(body);
opensearchResponse = await client.transport.request(
const opensearchResponse = await client.transport.request(
{ path: toUrlPath(path), method, body: bufferedBody },
{ headers: requestHeaders }
);
Expand Down Expand Up @@ -148,7 +147,7 @@ export const createHandler = ({
});
} catch (e: any) {
const isResponseErrorFlag = isResponseError(e);
if (!isResponseError) log.error(e);
if (!isResponseErrorFlag) log.error(e);
const errorMessage = isResponseErrorFlag ? stringify(e.meta.body) : e.message;
// core http route handler has special logic that asks for stream readable input to pass error opaquely
const errorResponseBody = new Readable({
Expand All @@ -158,7 +157,7 @@ export const createHandler = ({
},
});
return response.customError({
statusCode: isResponseErrorFlag ? e.statusCode : 502,
statusCode: e.statusCode || 502,
body: errorResponseBody,
headers: {
'Content-Type': 'application/json',
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import React from 'react';
import React, { useState } from 'react';
import { EuiPage, EuiPanel, EuiSpacer } from '@elastic/eui';
import { i18n } from '@osd/i18n';

Expand All @@ -14,6 +14,7 @@ import { CoreStart } from '../../../../../core/public';
import {
NavigationPublicPluginStart,
TopNavControlDescriptionData,
TopNavControlLinkData,
} from '../../../../navigation/public';
import { WorkspacePermissionSetting } from '../workspace_form/types';
import { WorkspaceCollaboratorTable } from '../workspace_form/workspace_collaborator_table';
Expand All @@ -25,6 +26,7 @@ import {
} from '../workspace_form';
import { WorkspaceAttributeWithPermission } from '../../../../../core/types';
import { WorkspaceClient } from '../../workspace_client';
import { WorkspacePrivacyFlyout } from '../workspace_form/workspace_privacy_flyout';
import { WorkspaceCollaboratorPrivacySettingPanel } from '../workspace_form/workspace_collaborator_privacy_setting_panel';

export const WorkspaceCollaborators = () => {
Expand All @@ -43,6 +45,8 @@ export const WorkspaceCollaborators = () => {
collaboratorTypes: WorkspaceCollaboratorTypesService;
workspaceClient: WorkspaceClient;
}>();

const [isPrivacyFlyoutVisible, setIsPrivacyFlyoutVisible] = useState(false);
const displayedCollaboratorTypes = useObservable(collaboratorTypes.getTypes$()) ?? [];

const currentWorkspace = useObservable(
Expand Down Expand Up @@ -90,6 +94,10 @@ export const WorkspaceCollaborators = () => {
if (!currentWorkspace || !isPermissionEnabled) {
return null;
}

const handleLearnMoreClick = (targetElement: HTMLElement) => {
setIsPrivacyFlyoutVisible((value) => !value);
};
return (
<EuiPage data-test-subj="workspace-collaborators-panel">
<HeaderControl
Expand All @@ -98,6 +106,13 @@ export const WorkspaceCollaborators = () => {
description: i18n.translate('workspace.collaborators.description', {
defaultMessage: 'Manage workspace access and permissions.',
}),
links: {
label: i18n.translate('workspace.form.panels.collaborator.learnMore', {
defaultMessage: 'Learn more',
}),
controlType: 'link',
run: handleLearnMoreClick,
} as TopNavControlLinkData,
} as TopNavControlDescriptionData,
]}
setMountPoint={application.setAppDescriptionControls}
Expand Down Expand Up @@ -130,6 +145,9 @@ export const WorkspaceCollaborators = () => {
/>
</EuiPanel>
</div>
{isPrivacyFlyoutVisible && (
<WorkspacePrivacyFlyout onClose={() => setIsPrivacyFlyoutVisible(false)} />
)}
</EuiPage>
);
};
Loading

0 comments on commit 5312e30

Please sign in to comment.