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

[Feature] copy saved objects among workspaces #52

Closed
wants to merge 57 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
11a5ad4
setup workspace plugin project skeleton
ruanyl Jun 7, 2023
62b34eb
test: add unit tests
ruanyl Jun 9, 2023
146e6c9
workspace template init commit
Hailong-am Jun 9, 2023
b84a894
refacter workspace template into hooks
Hailong-am Jun 9, 2023
6192831
refacter workspace template hooks
Hailong-am Jun 9, 2023
65363da
update coverImage comments
Hailong-am Jun 9, 2023
d661cf3
feature: add public/workspaces service
SuZhou-Joe Jun 7, 2023
580343a
feat: add interfaces for workspaces client
SuZhou-Joe Jun 8, 2023
a276998
feat: add interfaces for workspaces client
SuZhou-Joe Jun 8, 2023
02f73fa
feat: add interfaces for workspaces client
SuZhou-Joe Jun 8, 2023
99fc9eb
Merge pull request #6 from Hailong-am/feature/workspace
Hailong-am Jun 12, 2023
3c5df9d
Merge pull request #4 from SuZhou-Joe/feature/workspace-service
SuZhou-Joe Jun 12, 2023
f5d01c3
feat: implement workspaces service
SuZhou-Joe Jun 12, 2023
e302b05
feat: changes to client type interface
SuZhou-Joe Jun 13, 2023
790de17
feat: changes to client implement
SuZhou-Joe Jun 13, 2023
5629189
feat: implement more for workspaces service
SuZhou-Joe Jun 13, 2023
1d5deb5
feat: implement more for workspaces service
SuZhou-Joe Jun 13, 2023
666bb2f
feat: implement more for workspaces service
SuZhou-Joe Jun 13, 2023
9c8b378
Merge pull request #7 from SuZhou-Joe/feature/workspace-service-imple…
SuZhou-Joe Jun 13, 2023
e3e278c
feat: add workspace creator page (#5)
wanglam Jun 14, 2023
9be35b0
Add validation when load page (#8)
SuZhou-Joe Jun 15, 2023
169ed8a
feat: use BehaviorObject and optimize code (#14)
SuZhou-Joe Jun 15, 2023
89ec965
feat: integrate with workspace create API (#13)
wanglam Jun 15, 2023
28da567
Add currentWorkspace$ (#15)
SuZhou-Joe Jun 16, 2023
edec3bd
register plugin with workspace template (#16)
Hailong-am Jun 16, 2023
aba31ba
workspace dropdown list (#9)
zhichao-aws Jun 16, 2023
1132fc7
init workspace menu stage 1 (#12)
raintygao Jun 16, 2023
057b808
Fix template registration import error (#21)
Hailong-am Jun 16, 2023
6047108
Add workspace overview page (#19)
wanglam Jun 19, 2023
724ba55
feat: navigate to workspace create page after button clicked (#23)
wanglam Jun 19, 2023
5fbbd09
fix failed test snapshots (#22)
ruanyl Jun 19, 2023
60b4278
change to currentWorkspace, wrap title using i18n (#20)
zhichao-aws Jun 20, 2023
be11d98
add workspace switch (#17)
raintygao Jun 20, 2023
7220321
Add update workspace page (#25)
gaobinlong Jun 21, 2023
4c3e1e0
Delete Workspace (#24)
yuye-aws Jun 21, 2023
5961e55
feat: redirect to overview page after workspace switch (#26)
wanglam Jun 25, 2023
c4a16bd
update menu filter logic (#28)
raintygao Jun 25, 2023
0b4836c
feat: redirect to workspace overview page after created success (#29)
wanglam Jun 25, 2023
557960b
[Feature] Complied saved_objects create/find (#18)
SuZhou-Joe Jun 25, 2023
545f5b3
feat: redirect to workspace update page after workspace switch (#30)
wanglam Jun 25, 2023
4c91979
Move delete button to update page (#27)
yuye-aws Jun 25, 2023
cfe506d
fix: linting error
ruanyl Jun 26, 2023
704818f
remove duplicate EuiPage (#34)
Hailong-am Jun 26, 2023
19909fe
remove clear button, add the width of create button (#33)
zhichao-aws Jun 26, 2023
62115d5
rename OpenSearch Plugins to OpenSearch Features
ruanyl Jun 27, 2023
40ac0a2
Add some logic check when overwrite a saved object (#32)
SuZhou-Joe Jun 29, 2023
49f0bdf
Add color, icon and defaultVISTheme for workspace (#36)
wanglam Jul 5, 2023
72afa20
feat: add workspace list (#39)
raintygao Jul 6, 2023
40856f1
Feature/menu change (#37)
SuZhou-Joe Jul 7, 2023
05ab4f7
feat: different left menu and exit workspace (#38)
yuye-aws Jul 7, 2023
dcc9869
feat: make url stateful (#35)
SuZhou-Joe Jul 10, 2023
e88f967
Fix build error and part of test error (#42)
raintygao Jul 11, 2023
def1e6a
feat: optimize code (#40)
SuZhou-Joe Jul 11, 2023
bfc5c8a
fix: bootstrap error (#43)
SuZhou-Joe Jul 12, 2023
eb200a7
feat: add workspace permission control interface (#41)
wanglam Jul 13, 2023
878d8a3
allow user to turn on/off workspace from advance settings (#46)
ruanyl Jul 14, 2023
0c83ccd
Add copy saved objects among workspaces functionality
gaobinlong Jul 13, 2023
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
7 changes: 4 additions & 3 deletions .github/workflows/cypress_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ jobs:
with:
path: ${{ env.FTR_PATH }}
repository: opensearch-project/opensearch-dashboards-functional-test
ref: '${{ github.base_ref }}'
# revert this to '${{ github.base_ref }}'
ref: 'main'

- name: Get Cypress version
id: cypress_version
Expand Down Expand Up @@ -88,7 +89,7 @@ jobs:
name: ftr-cypress-screenshots
path: ${{ env.FTR_PATH }}/cypress/screenshots
retention-days: 1

- uses: actions/upload-artifact@v3
if: always()
with:
Expand All @@ -101,4 +102,4 @@ jobs:
with:
name: ftr-cypress-results
path: ${{ env.FTR_PATH }}/cypress/results
retention-days: 1
retention-days: 1
11 changes: 10 additions & 1 deletion src/core/public/application/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ import { OverlayStart } from '../overlays';
import { PluginOpaqueId } from '../plugins';
import { IUiSettingsClient } from '../ui_settings';
import { SavedObjectsStart } from '../saved_objects';
import { AppCategory } from '../../types';
import { AppCategory, WorkspaceTemplate } from '../../types';
import { ScopedHistory } from './scoped_history';
import { WorkspacesStart } from '../workspace';

/**
* Accessibility status of an application.
Expand Down Expand Up @@ -123,6 +124,12 @@ export interface App<HistoryLocationState = unknown> {
*/
category?: AppCategory;

/**
* The template definition of features belongs to
* See {@link WorkspaceTemplate}
*/
workspaceTemplate?: WorkspaceTemplate[];

/**
* The initial status of the application.
* Defaulting to `accessible`
Expand Down Expand Up @@ -334,6 +341,8 @@ export interface AppMountContext {
injectedMetadata: {
getInjectedVar: (name: string, defaultValue?: any) => unknown;
};
/** {@link WorkspacesService} */
workspaces: WorkspacesStart;
};
}

Expand Down
2 changes: 2 additions & 0 deletions src/core/public/chrome/chrome_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { notificationServiceMock } from '../notifications/notifications_service.
import { uiSettingsServiceMock } from '../ui_settings/ui_settings_service.mock';
import { ChromeService } from './chrome_service';
import { getAppInfo } from '../application/utils';
import { workspacesServiceMock } from '../fatal_errors/fatal_errors_service.mock';

class FakeApp implements App {
public title = `${this.id} App`;
Expand All @@ -67,6 +68,7 @@ function defaultStartDeps(availableApps?: App[]) {
injectedMetadata: injectedMetadataServiceMock.createStartContract(),
notifications: notificationServiceMock.createStartContract(),
uiSettings: uiSettingsServiceMock.createStartContract(),
workspaces: workspacesServiceMock.createStartContract(),
};

if (availableApps) {
Expand Down
48 changes: 45 additions & 3 deletions src/core/public/chrome/chrome_service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,22 @@ import { FormattedMessage } from '@osd/i18n/react';
import { BehaviorSubject, combineLatest, merge, Observable, of, ReplaySubject } from 'rxjs';
import { flatMap, map, takeUntil } from 'rxjs/operators';
import { EuiLink } from '@elastic/eui';
import { i18n } from '@osd/i18n';
import { mountReactNode } from '../utils/mount';
import { InternalApplicationStart } from '../application';
import { DocLinksStart } from '../doc_links';
import { HttpStart } from '../http';
import { InjectedMetadataStart } from '../injected_metadata';
import { NotificationsStart } from '../notifications';
import { IUiSettingsClient } from '../ui_settings';
import { OPENSEARCH_DASHBOARDS_ASK_OPENSEARCH_LINK } from './constants';
import { OPENSEARCH_DASHBOARDS_ASK_OPENSEARCH_LINK, WORKSPACE_APP_ID } from './constants';
import { ChromeDocTitle, DocTitleService } from './doc_title';
import { ChromeNavControls, NavControlsService } from './nav_controls';
import { ChromeNavLinks, NavLinksService, ChromeNavLink } from './nav_links';
import { ChromeRecentlyAccessed, RecentlyAccessedService } from './recently_accessed';
import { Header } from './ui';
import { ChromeHelpExtensionMenuLink } from './ui/header/header_help_menu';
import { Branding } from '../';
import { Branding, WorkspacesStart } from '../';
export { ChromeNavControls, ChromeRecentlyAccessed, ChromeDocTitle };

const IS_LOCKED_KEY = 'core.chrome.isLocked';
Expand Down Expand Up @@ -99,6 +100,7 @@ interface StartDeps {
injectedMetadata: InjectedMetadataStart;
notifications: NotificationsStart;
uiSettings: IUiSettingsClient;
workspaces: WorkspacesStart;
}

/** @internal */
Expand Down Expand Up @@ -152,6 +154,7 @@ export class ChromeService {
injectedMetadata,
notifications,
uiSettings,
workspaces,
}: StartDeps): Promise<InternalChromeStart> {
this.initVisibility(application);

Expand All @@ -178,6 +181,41 @@ export class ChromeService {
docTitle.reset();
});

const getWorkspaceUrl = (id: string) => {
return workspaces.formatUrlWithWorkspaceId(
application.getUrlForApp(WORKSPACE_APP_ID, {
path: '/',
absolute: true,
}),
id
);
};

const exitWorkspace = async () => {
let result;
try {
result = await workspaces.client.exitWorkspace();
} catch (error) {
notifications?.toasts.addDanger({
title: i18n.translate('workspace.exit.failed', {
defaultMessage: 'Failed to exit workspace',
}),
text: error instanceof Error ? error.message : JSON.stringify(error),
});
return;
}
if (!result?.success) {
notifications?.toasts.addDanger({
title: i18n.translate('workspace.exit.failed', {
defaultMessage: 'Failed to exit workspace',
}),
text: result?.error,
});
return;
}
await application.navigateToApp('home');
};

const setIsNavDrawerLocked = (isLocked: boolean) => {
isNavDrawerLocked$.next(isLocked);
localStorage.setItem(IS_LOCKED_KEY, `${isLocked}`);
Expand Down Expand Up @@ -243,7 +281,6 @@ export class ChromeService {
badge$={badge$.pipe(takeUntil(this.stop$))}
basePath={http.basePath}
breadcrumbs$={breadcrumbs$.pipe(takeUntil(this.stop$))}
customNavLink$={customNavLink$.pipe(takeUntil(this.stop$))}
opensearchDashboardsDocLink={docLinks.links.opensearchDashboards.introduction}
forceAppSwitcherNavigation$={navLinks.getForceAppSwitcherNavigation$()}
helpExtension$={helpExtension$.pipe(takeUntil(this.stop$))}
Expand All @@ -252,16 +289,21 @@ export class ChromeService {
isVisible$={this.isVisible$}
opensearchDashboardsVersion={injectedMetadata.getOpenSearchDashboardsVersion()}
navLinks$={navLinks.getNavLinks$()}
customNavLink$={customNavLink$.pipe(takeUntil(this.stop$))}
recentlyAccessed$={recentlyAccessed.get$()}
navControlsLeft$={navControls.getLeft$()}
navControlsCenter$={navControls.getCenter$()}
navControlsRight$={navControls.getRight$()}
navControlsExpandedCenter$={navControls.getExpandedCenter$()}
navControlsExpandedRight$={navControls.getExpandedRight$()}
onIsLockedUpdate={setIsNavDrawerLocked}
exitWorkspace={exitWorkspace}
getWorkspaceUrl={getWorkspaceUrl}
isLocked$={getIsNavDrawerLocked$}
branding={injectedMetadata.getBranding()}
survey={injectedMetadata.getSurvey()}
currentWorkspace$={workspaces.client.currentWorkspace$}
workspaceList$={workspaces.client.workspaceList$}
/>
),

Expand Down
6 changes: 6 additions & 0 deletions src/core/public/chrome/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@
export const OPENSEARCH_DASHBOARDS_ASK_OPENSEARCH_LINK = 'https://forum.opensearch.org/';
export const GITHUB_CREATE_ISSUE_LINK =
'https://github.com/opensearch-project/OpenSearch-Dashboards/issues/new/choose';

export const WORKSPACE_APP_ID = 'workspace';

export const PATHS = {
list: '/list',
};
Loading
Loading