Skip to content

Commit

Permalink
feat: update management related path
Browse files Browse the repository at this point in the history
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
  • Loading branch information
SuZhou-Joe committed Sep 8, 2023
1 parent 49b5cfa commit 9ef5867
Show file tree
Hide file tree
Showing 23 changed files with 68 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const loginPage = new LoginPage(cy);

describe('verify the advanced settings are saved', () => {
beforeEach(() => {
miscUtils.visitPage('app/management/opensearch-dashboards/settings');
miscUtils.visitPage('app/settings');
loginPage.enterUserName('admin');
loginPage.enterPassword('admin');
loginPage.submit();
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/with-security/helpers/generate_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const loginPage = new LoginPage(cy);

describe('Generating BWC test data with security', () => {
beforeEach(() => {
miscUtils.visitPage('app/management/opensearch-dashboards/settings');
miscUtils.visitPage('app/settings');
loginPage.enterUserName('admin');
loginPage.enterPassword('admin');
loginPage.submit();
Expand All @@ -29,7 +29,7 @@ describe('Generating BWC test data with security', () => {
});

it('adds advanced settings', () => {
miscUtils.visitPage('app/management/opensearch-dashboards/settings');
miscUtils.visitPage('app/settings');
cy.get('[data-test-subj="advancedSetting-editField-theme:darkMode"]').click();
cy.get('[data-test-subj="advancedSetting-editField-timeline:max_buckets"]').type(
'{selectAll}4'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Generating BWC test data without security', () => {
miscUtils.visitPage('app');
});
it('adds advanced settings', () => {
miscUtils.visitPage('app/management/opensearch-dashboards/settings');
miscUtils.visitPage('app/settings');
cy.get('[data-test-subj="advancedSetting-editField-theme:darkMode"]').click();
cy.get('[data-test-subj="advancedSetting-editField-timeline:max_buckets"]').type(
'{selectAll}4'
Expand Down
4 changes: 1 addition & 3 deletions src/plugins/dashboard/server/saved_objects/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ export const dashboardSavedObjectType: SavedObjectsType = {
return obj.attributes.title;
},
getEditUrl(obj) {
return `/management/opensearch-dashboards/objects/savedDashboards/${encodeURIComponent(
obj.id
)}`;
return `/objects/savedDashboards/${encodeURIComponent(obj.id)}`;
},
getInAppUrl(obj) {
return {
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data_source/server/saved_objects/data_source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export const dataSource: SavedObjectsType = {
return obj.attributes.title;
},
getEditUrl(obj) {
return `/management/opensearch-dashboards/dataSources/${encodeURIComponent(obj.id)}`;
return `/dataSources/${encodeURIComponent(obj.id)}`;
},
getInAppUrl(obj) {
return {
path: `/app/management/opensearch-dashboards/dataSources/${encodeURIComponent(obj.id)}`,
path: `/app/dataSources/${encodeURIComponent(obj.id)}`,
uiCapabilitiesPath: 'management.opensearchDashboards.dataSources',
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ export class DataSourceColumn implements IndexPatternTableColumn<DataSourceMap>
?.map((dataSource) => {
return {
...dataSource,
relativeUrl: basePath.prepend(
`/app/management/opensearch-dashboards/dataSources/${encodeURIComponent(
dataSource.id
)}`
),
relativeUrl: basePath.prepend(`/app/dataSources/${encodeURIComponent(dataSource.id)}`),
};
})
?.reduce(
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 @@ -99,7 +99,7 @@ export function OpenSearchPanel(props) {
fill
onClick={props.onClose}
href={addBasePath(
`/app/management/opensearch-dashboards/objects?_a=${rison.encode({
`/app/objects?_a=${rison.encode({
tab: SEARCH_OBJECT_TYPE,
})}`
)}
Expand Down
4 changes: 1 addition & 3 deletions src/plugins/discover/server/saved_objects/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ export const searchSavedObjectType: SavedObjectsType = {
return obj.attributes.title;
},
getEditUrl(obj) {
return `/management/opensearch-dashboards/objects/savedSearches/${encodeURIComponent(
obj.id
)}`;
return `/objects/savedSearches/${encodeURIComponent(obj.id)}`;
},
getInAppUrl(obj) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ class TableListView extends React.Component<TableListViewProps, TableListViewSta
listingLimitValue: this.props.listingLimit,
listingLimitText: <strong>listingLimit</strong>,
advancedSettingsLink: (
<EuiLink href="#/management/opensearch-dashboards/settings">
<EuiLink href="#/settings">
<FormattedMessage
id="opensearch-dashboards-react.tableListView.listing.listingLimitExceeded.advancedSettingsLinkText"
defaultMessage="Advanced Settings"
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/saved_objects_management/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Saved objects management

Provides a UI (via the `management` plugin) to find and manage all saved objects in one place (you can see the primary page by navigating to `/app/management/opensearch-dashboards/objects`). Not to be confused with the `savedObjects` plugin, which provides all the core capabilities of saved objects.
Provides a UI (via the `management` plugin) to find and manage all saved objects in one place (you can see the primary page by navigating to `/app/objects`). Not to be confused with the `savedObjects` plugin, which provides all the core capabilities of saved objects.

From the primary UI page, this plugin allows you to:
1. Search/view/delete saved objects and their relationships
2. Import/export saved objects
3. Inspect/edit raw saved object values without validation

For 3., this plugin can also be used to provide a route/page for editing, such as `/app/management/opensearch-dashboards/objects/savedVisualizations/{visualizationId}`, although plugins are also free to provide or host alternate routes for this purpose (see index patterns, for instance, which provide their own integration and UI via the `management` plugin directly).
For 3., this plugin can also be used to provide a route/page for editing, such as `/app/objects/savedVisualizations/{visualizationId}`, although plugins are also free to provide or host alternate routes for this purpose (see index patterns, for instance, which provide their own integration and UI via the `management` plugin directly).

## Making a new saved object type manageable

1. Create a new `SavedObjectsType` or add the `management` property to an existing one. (See [`SavedObjectsTypeManagementDefinition`](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/e1380f14deb98cc7cce55c3b82c2d501826a78c3/src/core/server/saved_objects/types.ts#L247-L285) for explanation of its properties)
2. Register saved object type via `core.savedObjects.registerType(...)` as part of plugin server setup method
3. Implement a way to save the object (e.g. via `savedObjectsClient.create(...)` or a `savedObjectLoader`)
4. After these steps, you should be able to save objects and view/search for them in Saved Objects management (`/app/management/opensearch-dashboards/objects`)
4. After these steps, you should be able to save objects and view/search for them in Saved Objects management (`/app/objects`)

## Enabling edit links from saved objects management

Expand All @@ -25,7 +25,7 @@ For 3., this plugin can also be used to provide a route/page for editing, such a

## Using saved objects management to inspect/edit new plugin objects

You'll notice that when clicking on the "Inspect" button from the saved objects management table, you'll usually be routed to something like `/app/management/opensearch-dashboards/objects/savedVisualizations/` (where the route itself is determined by the `management.getEditUrl` method of the `SavedObjectsType`). But to register a similar route for a new saved object type, you'll need to create a new `savedObjectLoader` and register it with the management plugin.
You'll notice that when clicking on the "Inspect" button from the saved objects management table, you'll usually be routed to something like `/app/objects/savedVisualizations/` (where the route itself is determined by the `management.getEditUrl` method of the `SavedObjectsType`). But to register a similar route for a new saved object type, you'll need to create a new `savedObjectLoader` and register it with the management plugin.

### Creating `savedObjectLoader`

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 @@ -53,7 +53,7 @@ describe('Relationships', () => {
id: '1',
relationship: 'parent',
meta: {
editUrl: '/management/opensearch-dashboards/objects/savedSearches/1',
editUrl: '/objects/savedSearches/1',
icon: 'search',
inAppUrl: {
path: '/app/discover#//1',
Expand All @@ -67,7 +67,7 @@ describe('Relationships', () => {
id: '2',
relationship: 'parent',
meta: {
editUrl: '/management/opensearch-dashboards/objects/savedVisualizations/2',
editUrl: '/objects/savedVisualizations/2',
icon: 'visualizeApp',
inAppUrl: {
path: '/app/visualize#/edit/2',
Expand Down Expand Up @@ -134,7 +134,7 @@ describe('Relationships', () => {
id: '2',
relationship: 'parent',
meta: {
editUrl: '/management/opensearch-dashboards/objects/savedVisualizations/2',
editUrl: '/objects/savedVisualizations/2',
icon: 'visualizeApp',
inAppUrl: {
path: '/app/visualize#/edit/2',
Expand All @@ -152,7 +152,7 @@ describe('Relationships', () => {
meta: {
title: 'MySearch',
icon: 'search',
editUrl: '/management/opensearch-dashboards/objects/savedSearches/1',
editUrl: '/objects/savedSearches/1',
inAppUrl: {
path: '/discover/1',
uiCapabilitiesPath: 'discover.show',
Expand Down Expand Up @@ -187,7 +187,7 @@ describe('Relationships', () => {
id: '1',
relationship: 'parent',
meta: {
editUrl: '/management/opensearch-dashboards/objects/savedDashboards/1',
editUrl: '/objects/savedDashboards/1',
icon: 'dashboardApp',
inAppUrl: {
path: '/app/opensearch-dashboards#/dashboard/1',
Expand All @@ -201,7 +201,7 @@ describe('Relationships', () => {
id: '2',
relationship: 'parent',
meta: {
editUrl: '/management/opensearch-dashboards/objects/savedDashboards/2',
editUrl: '/objects/savedDashboards/2',
icon: 'dashboardApp',
inAppUrl: {
path: '/app/opensearch-dashboards#/dashboard/2',
Expand All @@ -219,7 +219,7 @@ describe('Relationships', () => {
meta: {
title: 'MyViz',
icon: 'visualizeApp',
editUrl: '/management/opensearch-dashboards/objects/savedVisualizations/1',
editUrl: '/objects/savedVisualizations/1',
inAppUrl: {
path: '/edit/1',
uiCapabilitiesPath: 'visualize.show',
Expand Down Expand Up @@ -256,7 +256,7 @@ describe('Relationships', () => {
meta: {
title: 'MyViz',
icon: 'visualizeApp',
editUrl: '/management/opensearch-dashboards/objects/savedVisualizations/1',
editUrl: '/objects/savedVisualizations/1',
inAppUrl: {
path: '/edit/1',
uiCapabilitiesPath: 'visualize.show',
Expand All @@ -272,7 +272,7 @@ describe('Relationships', () => {
meta: {
title: 'MyAugmentVisObject',
icon: 'savedObject',
editUrl: '/management/opensearch-dashboards/objects/savedAugmentVis/1',
editUrl: '/objects/savedAugmentVis/1',
},
},
close: jest.fn(),
Expand Down Expand Up @@ -303,7 +303,7 @@ describe('Relationships', () => {
id: '1',
relationship: 'child',
meta: {
editUrl: '/management/opensearch-dashboards/objects/savedVisualizations/1',
editUrl: '/objects/savedVisualizations/1',
icon: 'visualizeApp',
inAppUrl: {
path: '/app/visualize#/edit/1',
Expand All @@ -317,7 +317,7 @@ describe('Relationships', () => {
id: '2',
relationship: 'child',
meta: {
editUrl: '/management/opensearch-dashboards/objects/savedVisualizations/2',
editUrl: '/objects/savedVisualizations/2',
icon: 'visualizeApp',
inAppUrl: {
path: '/app/visualize#/edit/2',
Expand All @@ -335,7 +335,7 @@ describe('Relationships', () => {
meta: {
title: 'MyDashboard',
icon: 'dashboardApp',
editUrl: '/management/opensearch-dashboards/objects/savedDashboards/1',
editUrl: '/objects/savedDashboards/1',
inAppUrl: {
path: '/dashboard/1',
uiCapabilitiesPath: 'dashboard.show',
Expand Down Expand Up @@ -375,7 +375,7 @@ describe('Relationships', () => {
meta: {
title: 'MyDashboard',
icon: 'dashboardApp',
editUrl: '/management/opensearch-dashboards/objects/savedDashboards/1',
editUrl: '/objects/savedDashboards/1',
inAppUrl: {
path: '/dashboard/1',
uiCapabilitiesPath: 'dashboard.show',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe('Table', () => {
meta: {
title: `My-Dashboard-test`,
icon: 'indexPatternApp',
editUrl: '/management/opensearch-dashboards/objects/savedDashboards/dashboard-1',
editUrl: '/objects/savedDashboards/dashboard-1',
inAppUrl: {
path: '/app/dashboards#/view/dashboard-1',
uiCapabilitiesPath: 'dashboard.show',
Expand Down
Loading

0 comments on commit 9ef5867

Please sign in to comment.