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

[Dashboard listing] update edit url and view url #416

Merged
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
63 changes: 47 additions & 16 deletions .cypress/integration/3_panels.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@

/// <reference types="cypress" />

import { suppressResizeObserverIssue } from '../utils/constants';
import {
delay,
TEST_PANEL,
PPL_VISUALIZATIONS,
PPL_VISUALIZATIONS_NAMES,
NEW_VISUALIZATION_NAME,
PPL_FILTER,
SAMPLE_PANEL,
SAMPLE_VISUALIZATIONS_NAMES,
PPL_VISUALIZATIONS,
PPL_VISUALIZATIONS_NAMES,
TEST_PANEL,
} from '../utils/panel_constants';

import { suppressResizeObserverIssue } from '../utils/constants';

describe('Adding sample data and visualization', () => {
it('Adds sample flights data for visualization paragraph', () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/home#/tutorial_directory/sampleData`);
Expand Down Expand Up @@ -195,6 +192,34 @@ describe('Testing panels table', () => {
cy.get('button[data-test-subj="popoverModal__deleteButton"]').click();
cy.get('h2[data-test-subj="customPanels__noPanelsHome"]').should('exist');
});

it('Redirects to observability dashboard from OSD dashboards', () => {
moveToOsdDashboards();
cy.location('pathname').should('eq', '/app/dashboards');
cy.get('[data-test-subj="dashboardListingTitleLink-Test-Panel"]').click();
cy.location('pathname').should('eq', '/app/observability-dashboards');
});

it('Redirects to observability dashboard from OSD dashboards with edit', () => {
moveToOsdDashboards();
cy.location('pathname').should('eq', '/app/dashboards');
cy.get('[data-test-subj="dashboardListingTitleLink-Test-Panel"]')
.closest('tr')
.get('span.euiToolTipAnchor > button.euiButtonIcon')
.eq(0)
.click();
cy.location('pathname').should('eq', '/app/observability-dashboards');
cy.location('hash').should('include', '/edit');
});

it('Redirects to observability dashboard from OSD dashboards with create', () => {
moveToOsdDashboards();
cy.location('pathname').should('eq', '/app/dashboards');
cy.get('div#createMenuPopover').click();
cy.get('[data-test-subj="contextMenuItem-observability-panel"]').click();
cy.location('pathname').should('eq', '/app/observability-dashboards');
cy.location('hash').should('include', '/create');
});
});

it('Searches existing panel', () => {
Expand Down Expand Up @@ -274,7 +299,7 @@ describe('Testing a panel', () => {

cy.get(`input.euiFieldText[value="${TEST_PANEL} (copy)"]`)
.focus()
.clear({force: true})
.clear({ force: true })
.focus()
.type('Renamed Panel', {
delay: 200,
Expand Down Expand Up @@ -347,9 +372,9 @@ describe('Testing a panel', () => {

cy.get('h5[data-test-subj="visualizationHeader"]')
.contains(PPL_VISUALIZATIONS_NAMES[1])
.trigger('mousedown', {which: 1})
.trigger('mousemove', {clientX: 1100, clientY: 0})
.trigger('mouseup', {force: true});
.trigger('mousedown', { which: 1 })
.trigger('mousemove', { clientX: 1100, clientY: 0 })
.trigger('mouseup', { force: true });

cy.get('button[data-test-subj="savePanelButton"]').click();
cy.wait(delay * 3);
Expand All @@ -364,9 +389,9 @@ describe('Testing a panel', () => {

cy.get('.react-resizable-handle')
.eq(1)
.trigger('mousedown', {which: 1})
.trigger('mousemove', {clientX: 2000, clientY: 800})
.trigger('mouseup', {force: true});
.trigger('mousedown', { which: 1 })
.trigger('mousemove', { clientX: 2000, clientY: 800 })
.trigger('mouseup', { force: true });

cy.get('button[data-test-subj="savePanelButton"]').click();
cy.wait(delay * 3);
Expand Down Expand Up @@ -481,7 +506,7 @@ describe('Testing a panel', () => {
cy.get('[data-test-subj="eventExplorer__saveManagementPopover"]').trigger('mouseover').click();
cy.wait(1000);
cy.get('[data-test-subj="eventExplorer__querySaveName"]')
.clear({force: true})
.clear({ force: true })
.type(NEW_VISUALIZATION_NAME, {
delay: 200,
});
Expand Down Expand Up @@ -535,6 +560,11 @@ describe('Clean up all test data', () => {
});
});

const moveToOsdDashboards = () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/dashboards#/`);
cy.wait(delay * 3);
};

const moveToEventsHome = () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-logs#/`);
cy.wait(delay * 3);
Expand Down Expand Up @@ -615,7 +645,8 @@ const eraseTestPanels = () => {
eraseLegacyPanels();
eraseSavedObjectPaenls();
};
const uuidRx = /[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}/;
const uuidRx =
/[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}/;

const clickCreatePanelButton = () =>
cy.get('a[data-test-subj="customPanels__createNewPanels"]').click();
Expand Down
1 change: 0 additions & 1 deletion public/components/custom_panels/custom_panel_view_so.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ export const CustomPanelViewSO = (props: CustomPanelViewProps) => {
}, [panel]);

const cancelEdit = () => {
console.log('cancelEdits');
dispatch(fetchPanel(panelId));
setIsEditing(false);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,7 @@ export const handleJaegerDashboardRequest = async (
return map;
})
.catch((error) => {
console.log("error here")
console.error(error)

setToast('hello')
console.error(error);
});

await handleDslRequest(http, DSL, getJaegerDashboardQuery(), mode, true, setShowTimeoutToast)
Expand Down
10 changes: 4 additions & 6 deletions public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export class ObservabilityPlugin
core: CoreSetup<AppPluginStartDependencies>,
setupDeps: SetupDependencies
): ObservabilitySetup {
console.log('core: ', core, ', setupDeps: ', setupDeps);
uiSettingsService.init(core.uiSettings, core.notifications);
const pplService = new PPLService(core.http);
const qm = new QueryManager();
Expand All @@ -107,16 +106,16 @@ export class ObservabilityPlugin
// if (window.location.pathname.includes('application_analytics')) {
// window.location.assign(convertLegacyAppAnalyticsUrl(window.location));
// }

const BASE_URL = core.http.basePath.prepend('/app/observability-dashboards#');
setupDeps.dashboard.registerDashboardProvider({
appId: 'observability-panel',
savedObjectsType: 'observability-panel',
savedObjectsName: 'Observability',
editUrlPathFn: (obj: SavedObject) => `/app/observability-dashboards#/${obj.id}/edit`,
viewUrlPathFn: (obj: SavedObject) => `/app/observability-dashboards#/${obj.id}`,
editUrlPathFn: (obj: SavedObject) => `${BASE_URL}/${obj.id}/edit`,
viewUrlPathFn: (obj: SavedObject) => `${BASE_URL}/${obj.id}`,
createLinkText: 'Observability Dashboard',
createSortText: 'Observability Dashboard',
createUrl: '/app/observability-dashboards#/create',
createUrl: `${BASE_URL}/create`,
});

const OBSERVABILITY_APP_CATEGORIES: Record<string, AppCategory> = Object.freeze({
Expand All @@ -130,7 +129,6 @@ export class ObservabilityPlugin
});

const appMountWithStartPage = (startPage: string) => async (params: AppMountParameters) => {
console.log('start page: ', startPage);
const { Observability } = await import('./components/index');
const [coreStart, depsStart] = await core.getStartServices();
const dslService = new DSLService(coreStart.http);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export class SaveAsNewQuery extends SavedQuerySaver {
const { batch, dispatch, changeQuery, updateTabName } = this.dispatchers;
const { tabId, history, notifications, showPermissionErrorToast } = this.saveContext;
const { name } = this.saveParams;
console.log('this.saveParams: ', this.saveParams);
this.saveClient
.create({ ...this.saveParams })
.then((res: any) => {
Expand Down