Skip to content

Commit

Permalink
[Dashboard listing] update edit url and view url
Browse files Browse the repository at this point in the history
Update to include BASE_URL if basePath is defined. Since create url is just
a direct nav and needs the basePath when passing props to the provider, the source
code no longer appends the basePath to keep these URLs consistent.

A feature should consolidate the basePaths in the dashboard listing service so that
createUrl also adds the base path. At which point we no longer need the base path.

Also removed some rogue URLs.

Core PR:
opensearch-project/OpenSearch-Dashboards#3922

Signed-off-by: Kawika Avilla <[email protected]>
  • Loading branch information
kavilla authored and rupal-bq committed Apr 24, 2023
1 parent 1749156 commit 1932f54
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
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 @@ -296,7 +296,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 @@ -84,7 +84,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 @@ -108,16 +107,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 @@ -131,7 +130,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

0 comments on commit 1932f54

Please sign in to comment.