Skip to content

Commit

Permalink
Add a learn more flyout to the collaborators page (#9145) (#9168)
Browse files Browse the repository at this point in the history
* Add a learn more flyout to the collaborators page



* Changeset file for PR #9145 created/updated

* Update the link



* Update snapshots



* Modify flyout size



* Update collaborators description



* Move learn_more link into the description



---------



(cherry picked from commit e401613)

Signed-off-by: Kapian1234 <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 17, 2025
1 parent 7ea8bd5 commit 5359da3
Show file tree
Hide file tree
Showing 9 changed files with 596 additions and 19 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))
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.

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 5359da3

Please sign in to comment.