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

revert Register Advance Settings, Data Source management,Index Pattern management and SavedObject management as standalone app, retire dashboard management #283

Merged
merged 4 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions .github/workflows/cypress_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Run cypress tests
# trigger on every PR for all branches
on:
pull_request:
branches: ['**']
branches: [ '**' ]
paths-ignore:
- '**/*.md'
workflow_dispatch:
Expand All @@ -28,7 +28,7 @@ on:

env:
TEST_REPO: ${{ inputs.test_repo != '' && inputs.test_repo || 'opensearch-project/opensearch-dashboards-functional-test' }}
TEST_BRANCH: "${{ inputs.test_branch != '' && inputs.test_branch || 'workspace' }}"
TEST_BRANCH: "${{ inputs.test_branch != '' && inputs.test_branch || 'main' }}"
FTR_PATH: 'ftr'
START_CMD: 'node ../scripts/opensearch_dashboards --dev --no-base-path --no-watch --savedObjects.maxImportPayloadBytes=10485760 --server.maxPayloadBytes=1759977 --logging.json=false --data.search.aggs.shardDelay.enabled=true'
OPENSEARCH_SNAPSHOT_CMD: 'node ../scripts/opensearch snapshot -E cluster.routing.allocation.disk.threshold_enabled=false'
Expand All @@ -47,7 +47,7 @@ jobs:
strategy:
fail-fast: false
matrix:
group: [1, 2, 3, 4, 5, 6, 7, 8, 9]
group: [1, 2, 3, 4, 5, 6, 7, 8, 9]
container:
image: docker://opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2
options: --user 1001
Expand Down Expand Up @@ -184,7 +184,7 @@ jobs:
with:
issue-number: ${{ inputs.pr_number }}
comment-author: 'github-actions[bot]'
body-includes: '${{ env.COMMENT_TAG }}'
body-includes: "${{ env.COMMENT_TAG }}"

- name: Add comment on the PR
uses: peter-evans/create-or-update-comment@v3
Expand Down
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/settings');
miscUtils.visitPage('app/management/opensearch-dashboards/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/settings');
miscUtils.visitPage('app/management/opensearch-dashboards/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/settings');
miscUtils.visitPage('app/management/opensearch-dashboards/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 @@ -9,7 +9,7 @@ const miscUtils = new MiscUtils(cy);

describe('verify the advanced settings are saved', () => {
beforeEach(() => {
miscUtils.visitPage('app/settings');
miscUtils.visitPage('app/management/opensearch-dashboards/settings');
});

it('the dark mode is on', () => {
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/settings');
miscUtils.visitPage('app/management/opensearch-dashboards/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
2 changes: 1 addition & 1 deletion src/core/public/core_app/errors/url_overflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('url overflow detection', () => {
</code>
option in
<a
href="/test-123/app/settings"
href="/test-123/app/management/opensearch-dashboards/settings"
>
advanced settings
</a>
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/core_app/errors/url_overflow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const setupUrlOverflowDetection = ({ basePath, history, toasts, uiSetting
values={{
storeInSessionStorageParam: <code>state:storeInSessionStorage</code>,
advancedSettingsLink: (
<a href={basePath.prepend('/app/settings')}>
<a href={basePath.prepend('/app/management/opensearch-dashboards/settings')}>
<FormattedMessage
id="core.ui.errorUrlOverflow.bigUrlWarningNotificationMessage.advancedSettingsLinkText"
defaultMessage="advanced settings"
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/core_app/errors/url_overflow_ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const UrlOverflowUi: React.FC<{ basePath: IBasePath }> = ({ basePath }) =
values={{
storeInSessionStorageConfig: <code>state:storeInSessionStorage</code>,
opensearchDashboardsSettingsLink: (
<a href={basePath.prepend('/app/settings')}>
<a href={basePath.prepend('/app/management/opensearch-dashboards/settings')}>
<FormattedMessage
id="core.ui.errorUrlOverflow.optionsToFixError.enableOptionText.advancedSettingsLinkText"
defaultMessage="Advanced Settings"
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/ui_settings/saved_objects/ui_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const uiSettingsType: SavedObjectsType = {
importableAndExportable: true,
getInAppUrl() {
return {
path: `/app/settings`,
path: `/app/management/opensearch-dashboards/settings`,
uiCapabilitiesPath: 'advancedSettings.show',
};
},
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,18 @@ import { Router, Switch, Route } from 'react-router-dom';

import { i18n } from '@osd/i18n';
import { I18nProvider } from '@osd/i18n/react';
import {
AppMountParameters,
ChromeBreadcrumb,
ScopedHistory,
StartServicesAccessor,
} from 'src/core/public';
import { StartServicesAccessor } from 'src/core/public';

import { AdvancedSettings } from './advanced_settings';
import { ManagementAppMountParams } from '../../../management/public';
import { ComponentRegistry } from '../types';
import { reactRouterNavigate } from '../../../opensearch_dashboards_react/public';
import { PageWrapper } from './components/page_wrapper';

import './index.scss';

const title = i18n.translate('advancedSettings.advancedSettingsLabel', {
defaultMessage: 'Advanced settings',
});
const crumb: ChromeBreadcrumb[] = [{ text: title }];
const crumb = [{ text: title }];

const readOnlyBadge = {
text: i18n.translate('advancedSettings.badge.readOnly.text', {
Expand All @@ -63,18 +57,13 @@ const readOnlyBadge = {
iconType: 'glasses',
};

export async function mountAdvancedSettingsManagementSection(
export async function mountManagementSection(
getStartServices: StartServicesAccessor,
params: AppMountParameters,
params: ManagementAppMountParams,
componentRegistry: ComponentRegistry['start']
) {
params.setBreadcrumbs(crumb);
const [{ uiSettings, notifications, docLinks, application, chrome }] = await getStartServices();
chrome.setBreadcrumbs([
...crumb.map((item) => ({
...item,
...(item.href ? reactRouterNavigate(params.history, item.href) : {}),
})),
]);

const canSave = application.capabilities.advancedSettings.save as boolean;

Expand All @@ -83,23 +72,21 @@ export async function mountAdvancedSettingsManagementSection(
}

ReactDOM.render(
<PageWrapper>
<I18nProvider>
<Router history={params.history}>
<Switch>
<Route path={['/:query', '/']}>
<AdvancedSettings
enableSaving={canSave}
toasts={notifications.toasts}
dockLinks={docLinks.links}
uiSettings={uiSettings}
componentRegistry={componentRegistry}
/>
</Route>
</Switch>
</Router>
</I18nProvider>
</PageWrapper>,
<I18nProvider>
<Router history={params.history}>
<Switch>
<Route path={['/:query', '/']}>
<AdvancedSettings
enableSaving={canSave}
toasts={notifications.toasts}
dockLinks={docLinks.links}
uiSettings={uiSettings}
componentRegistry={componentRegistry}
/>
</Route>
</Switch>
</Router>
</I18nProvider>,
params.element
);
return () => {
Expand Down
24 changes: 10 additions & 14 deletions src/plugins/advanced_settings/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@
*/

import { i18n } from '@osd/i18n';
import { AppMountParameters, CoreSetup, Plugin } from 'opensearch-dashboards/public';
import { CoreSetup, Plugin } from 'opensearch-dashboards/public';
import { FeatureCatalogueCategory } from '../../home/public';
import { ComponentRegistry } from './component_registry';
import { AdvancedSettingsSetup, AdvancedSettingsStart, AdvancedSettingsPluginSetup } from './types';
import { DEFAULT_APP_CATEGORIES } from '../../../core/public';

const component = new ComponentRegistry();

Expand All @@ -43,21 +42,18 @@ const title = i18n.translate('advancedSettings.advancedSettingsLabel', {

export class AdvancedSettingsPlugin
implements Plugin<AdvancedSettingsSetup, AdvancedSettingsStart, AdvancedSettingsPluginSetup> {
public setup(core: CoreSetup, { home }: AdvancedSettingsPluginSetup) {
core.application.register({
public setup(core: CoreSetup, { management, home }: AdvancedSettingsPluginSetup) {
const opensearchDashboardsSection = management.sections.section.opensearchDashboards;

opensearchDashboardsSection.registerApp({
id: 'settings',
title,
order: 99,
category: DEFAULT_APP_CATEGORIES.management,
async mount(params: AppMountParameters) {
const { mountAdvancedSettingsManagementSection } = await import(
order: 3,
async mount(params) {
const { mountManagementSection } = await import(
'./management_app/mount_management_section'
);
return mountAdvancedSettingsManagementSection(
core.getStartServices,
params,
component.start
);
return mountManagementSection(core.getStartServices, params, component.start);
},
});

Expand All @@ -70,7 +66,7 @@ export class AdvancedSettingsPlugin
'Customize your OpenSearch Dashboards experience — change the date format, turn on dark mode, and more.',
}),
icon: 'gear',
path: '/app/settings',
path: '/app/management/opensearch-dashboards/settings',
showOnHomePage: false,
category: FeatureCatalogueCategory.ADMIN,
});
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/dashboard/server/saved_objects/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ export const dashboardSavedObjectType: SavedObjectsType = {
return obj.attributes.title;
},
getEditUrl(obj) {
return `/objects/savedDashboards/${encodeURIComponent(obj.id)}`;
return `/management/opensearch-dashboards/objects/savedDashboards/${encodeURIComponent(
obj.id
)}`;
},
getInAppUrl(obj) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,11 @@ export class IndexPatternsService {
);

if (!savedObject.version) {
throw new SavedObjectNotFound(savedObjectType, id, 'indexPatterns');
throw new SavedObjectNotFound(
savedObjectType,
id,
'management/opensearch-dashboards/indexPatterns'
);
}

const spec = this.savedObjectToSpec(savedObject);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export const onRedirectNoIndexPattern = (
overlays: CoreStart['overlays']
) => () => {
const canManageIndexPatterns = capabilities.management.opensearchDashboards.indexPatterns;
const redirectTarget = canManageIndexPatterns ? '/indexPatterns' : '/home';
const redirectTarget = canManageIndexPatterns
? '/management/opensearch-dashboards/indexPatterns'
: '/home';
let timeoutId: NodeJS.Timeout | undefined;

if (timeoutId) {
Expand Down Expand Up @@ -70,8 +72,8 @@ export const onRedirectNoIndexPattern = (
if (redirectTarget === '/home') {
navigateToApp('home');
} else {
navigateToApp('indexPatterns', {
path: `?bannerMessage=${bannerMessage}`,
navigateToApp('management', {
path: `/opensearch-dashboards/indexPatterns?bannerMessage=${bannerMessage}`,
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/plugins/data/public/search/errors/painless_error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ export class PainlessError extends OsdError {

public getErrorMessage(application: ApplicationStart) {
function onClick() {
application.navigateToApp('indexPatterns');
application.navigateToApp('management', {
path: `/opensearch-dashboards/indexPatterns`,
});
}

return (
Expand Down
8 changes: 6 additions & 2 deletions src/plugins/data/server/saved_objects/index_patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ export const indexPatternSavedObjectType: SavedObjectsType = {
return obj.attributes.title;
},
getEditUrl(obj) {
return `/indexPatterns/patterns/${encodeURIComponent(obj.id)}`;
return `/management/opensearch-dashboards/indexPatterns/patterns/${encodeURIComponent(
obj.id
)}`;
},
getInAppUrl(obj) {
return {
path: `/app/indexPatterns/patterns/${encodeURIComponent(obj.id)}`,
path: `/app/management/opensearch-dashboards/indexPatterns/patterns/${encodeURIComponent(
obj.id
)}`,
uiCapabilitiesPath: 'management.opensearchDashboards.indexPatterns',
};
},
Expand Down
Loading
Loading