-
Notifications
You must be signed in to change notification settings - Fork 892
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 De-Angular] Initial clean up and linter fix #4511
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
import React, { useState } from 'react'; | ||
import { cloneDeep, isEqual, uniqBy } from 'lodash'; | ||
import { EMPTY, Observable, Subscription, merge, of, pipe } from 'rxjs'; | ||
import { EMPTY, Observable, Subscription, merge, pipe } from 'rxjs'; | ||
import { | ||
catchError, | ||
distinctUntilChanged, | ||
|
@@ -16,7 +16,6 @@ import { | |
switchMap, | ||
} from 'rxjs/operators'; | ||
import deepEqual from 'fast-deep-equal'; | ||
import { EventEmitter } from 'stream'; | ||
import { useEffect } from 'react'; | ||
import { i18n } from '@osd/i18n'; | ||
import _ from 'lodash'; | ||
|
@@ -55,8 +54,6 @@ import { Dashboard } from '../../../dashboard'; | |
|
||
export const useDashboardContainer = ( | ||
services: DashboardServices, | ||
isChromeVisible: boolean, | ||
eventEmitter: EventEmitter, | ||
dashboard?: Dashboard, | ||
savedDashboardInstance?: SavedObjectDashboard, | ||
appState?: DashboardAppStateContainer | ||
|
@@ -134,7 +131,6 @@ const createDashboardEmbeddable = ( | |
} = dashboardServices; | ||
const { query: queryService } = data; | ||
const filterManager = queryService.filterManager; | ||
const timefilter = queryService.timefilter.timefilter; | ||
const queryStringManager = queryService.queryString; | ||
const { visualizeCapabilities, mapsCapabilities } = embeddableCapabilities; | ||
const dashboardFactory = embeddable.getEmbeddableFactory< | ||
|
@@ -237,7 +233,7 @@ const createDashboardEmbeddable = ( | |
getShouldShowViewHelp(appStateData) || | ||
shouldShowUnauthorizedEmptyState(appStateData), | ||
useMargins: appStateData.options.useMargins, | ||
lastReloadRequestTime, // TODO | ||
lastReloadRequestTime, | ||
title: appStateData.title, | ||
description: appStateData.description, | ||
expandedPanelId: appStateData.expandedPanelId, | ||
|
@@ -339,8 +335,6 @@ const createDashboardEmbeddable = ( | |
return Object.values(differences).length === 0 ? undefined : cloneDeep(differences); | ||
}; | ||
|
||
// TODO: handle dashboard container input and output subsciptions | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. resolved |
||
// issue: | ||
outputSubscription = merge( | ||
// output of dashboard container itself | ||
dashboardContainer.getOutput$(), | ||
|
@@ -381,13 +375,6 @@ const createDashboardEmbeddable = ( | |
) { | ||
// Add filters modifies the object passed to it, hence the clone deep. | ||
filterManager.addFilters(cloneDeep(container.getInput().filters)); | ||
|
||
// TODO: investigate if this is needed | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. resolved, this is not needed here |
||
/* dashboardStateManager.applyFilters( | ||
$scope.model.query, | ||
container.getInput().filters | ||
);*/ | ||
|
||
appState.transitions.set('query', queryStringManager.getQuery()); | ||
} | ||
// triggered when dashboard embeddable container has changes, and update the appState | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,14 +15,9 @@ | |
|
||
import { cloneDeep } from 'lodash'; | ||
import { Filter, ISearchSource, Query, RefreshInterval } from '../../data/public'; | ||
import { DashboardPanelState } from './application'; | ||
import { EmbeddableInput } from './embeddable_plugin'; | ||
import { SavedDashboardPanel } from './types'; | ||
|
||
// export interface SerializedPanels { | ||
// [panelId: string]: DashboardPanelState<EmbeddableInput & { [k: string]: unknown }>; | ||
// } | ||
|
||
// TODO: This class can be revisited and clean up more | ||
export interface SerializedDashboard { | ||
id?: string; | ||
timeRestore: boolean; | ||
|
@@ -35,8 +30,8 @@ export interface SerializedDashboard { | |
useMargins: boolean; | ||
}; | ||
uiState?: string; | ||
lastSavedTitle: string; // TODO: DO WE STILL NEED THIS? | ||
refreshInterval?: RefreshInterval; // TODO: SHOULD THIS NOT BE OPTIONAL? | ||
lastSavedTitle: string; | ||
refreshInterval?: RefreshInterval; | ||
searchSource?: ISearchSource; | ||
query: Query; | ||
filters: Filter[]; | ||
|
@@ -63,7 +58,6 @@ export class Dashboard<TDashboardParams = DashboardParams> { | |
public query: Query; | ||
public filters: Filter[]; | ||
public title?: string; | ||
// TODO: dashboardNew - pass version to dashboard class | ||
public version = '3.0.0'; | ||
public isDirty = false; | ||
|
||
|
@@ -90,8 +84,6 @@ export class Dashboard<TDashboardParams = DashboardParams> { | |
this.description = state.description; | ||
} | ||
if (state.panels) { | ||
// this panels is only JSON.parse() panels, we should convert them into the same type as app state panels | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. resolve |
||
// app state store only JSON.parse() panels too | ||
this.panels = cloneDeep(state.panels); | ||
} | ||
if (state.options) { | ||
|
@@ -124,52 +116,4 @@ export class Dashboard<TDashboardParams = DashboardParams> { | |
private getRefreshInterval(refreshInterval: RefreshInterval) { | ||
return cloneDeep(refreshInterval ?? {}); | ||
} | ||
|
||
// private getQuery(query: Query): Query { | ||
// return cloneDeep(query ?? ({} as Query)); | ||
// } | ||
|
||
// private getFilters(filters: Filter[]) { | ||
// return cloneDeep(filters ?? ({} as Filter[])); | ||
// } | ||
|
||
// private getPanels(panels?: SerializedPanels) { | ||
// return cloneDeep(panels ?? ({} as SerializedPanels)); | ||
// } | ||
|
||
/* clone() { | ||
const serializedDashboard = this.serialize(); | ||
const dashboard = new Dashboard(serializedDashboard); | ||
dashboard.setState(serializedDashboard); | ||
return dashboard; | ||
}*/ | ||
|
||
/* serialize(): SerializedDashboard { | ||
return { | ||
id: this.id, | ||
timeRestore: this.timeRestore!, | ||
timeTo: this.timeTo, | ||
timeFrom: this.timeFrom, | ||
description: this.description, | ||
panels: this.serializePanels(), | ||
options: cloneDeep(this.options) as any, | ||
uiState: this.uiState, | ||
lastSavedTitle: this.lastSavedTitle, | ||
refreshInterval: this.refreshInterval, | ||
searchSource: this.searchSource, | ||
query: this.query, | ||
filters: this.filters, | ||
title: this.title!, | ||
}; | ||
}*/ | ||
|
||
/* serializePanels(): SerializedPanels { | ||
const embeddablesMap: { | ||
[key: string]: DashboardPanelState; | ||
} = {}; | ||
this.panels.forEach((panel: SavedDashboardPanel) => { | ||
embeddablesMap[panel.panelIndex] = convertSavedDashboardPanelToPanelState(panel); | ||
}); | ||
return embeddablesMap; | ||
}*/ | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added related logics to lastReloadRequestTime