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

Replace gridster with react-grid-layout #13853

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
aafbe72
Initial check-in to replace gridster with react-grid-layout and react…
stacey-gammon Sep 5, 2017
bee007f
# This is a combination of 3 commits.
stacey-gammon Sep 14, 2017
75075c2
Add margin of error to test determining panel widths
stacey-gammon Sep 14, 2017
e0321be
Remove unnecessary _.once when creating react directives in dashboard.js
stacey-gammon Sep 20, 2017
e58ac8d
Remove unnecessary constructors
stacey-gammon Sep 20, 2017
1f70da2
Use componentDidMount instead of componentWillMount bc of async calls…
stacey-gammon Sep 20, 2017
7003150
Remove unnecessary null in classNames
stacey-gammon Sep 20, 2017
4114236
Use loads defaultsDeep instead of Object.assign
stacey-gammon Sep 20, 2017
5064127
use render* instead of get* for functions returning an element
stacey-gammon Sep 20, 2017
0e85f7c
use relative css paths
stacey-gammon Sep 20, 2017
6d10b5a
Use local import path
stacey-gammon Sep 20, 2017
f61e268
Switch to local imports and remove need for plugins path in jest tests
stacey-gammon Sep 20, 2017
f7347dd
Improve accessibility of max/min panel toggle icon
stacey-gammon Sep 20, 2017
fca9d0d
remove unused css
stacey-gammon Sep 20, 2017
6290a44
disable eslint rule for setState in componentDidMount
stacey-gammon Sep 20, 2017
efa50d7
Use native map instead of lodash
stacey-gammon Sep 21, 2017
bc73ef8
Have the grid handle setting the z-indexes of the right reactgriditem
stacey-gammon Sep 21, 2017
c81a918
Make the draggable handle the title, not the whole heading
stacey-gammon Sep 21, 2017
f71a249
Change from click to mouse down detector in KuiOutsideClickDector so …
stacey-gammon Sep 21, 2017
4cd1a9e
Fix mistaken commit
stacey-gammon Sep 22, 2017
5df16d3
Run getEditPath and getTitle async calls in parallel - no need to wai…
stacey-gammon Sep 22, 2017
46f89a0
Fix tests: update snapshots, add promise returns.
stacey-gammon Sep 22, 2017
dff702b
Merge branch 'master' of https://github.com/elastic/kibana into react…
stacey-gammon Sep 22, 2017
794aa02
version being added to panelData in the wrong spot caused isDirty fla…
stacey-gammon Sep 22, 2017
58aed06
Fix unmounting/mounting problem with panels due to view/edit mode switch
stacey-gammon Sep 23, 2017
4cb254d
Fix bug where panels get squashed to one side when view mode is chang…
stacey-gammon Sep 23, 2017
5553c04
Update snapshots to match wrong view mode comparison
stacey-gammon Sep 23, 2017
5a93c30
Improve naming of a variable
stacey-gammon Sep 23, 2017
3fc09aa
Fix issue with pop over hiding behind tile maps
stacey-gammon Sep 23, 2017
7f0d72f
Previous panel.js included ui/doc_table and ui/visualize - needed to …
stacey-gammon Sep 26, 2017
5481807
Merge with master
stacey-gammon Sep 26, 2017
bb15fb2
Fix bad merge: remove baseline screenshots
stacey-gammon Sep 26, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -127,7 +127,6 @@
"glob": "5.0.13",
"glob-all": "3.0.1",
"good-squeeze": "2.1.0",
"gridster": "0.5.6",
"h2o2": "5.1.1",
"handlebars": "4.0.5",
"hapi": "14.2.0",
Expand Down Expand Up @@ -171,13 +170,15 @@
"react-anything-sortable": "1.6.1",
"react-color": "2.11.7",
"react-dom": "15.6.1",
"react-grid-layout": "0.14.7",
"react-input-autosize": "1.1.0",
"react-input-range": "1.2.1",
"react-markdown": "2.4.2",
"react-redux": "4.4.5",
"react-router": "2.0.0",
"react-router-redux": "4.0.4",
"react-select": "1.0.0-rc.5",
"react-sizeme": "2.3.4",
"react-sortable": "1.1.0",
"react-test-renderer": "15.6.1",
"react-toggle": "3.0.1",
Expand Down
126 changes: 0 additions & 126 deletions src/core_plugins/kibana/public/dashboard/__tests__/dashboard_panels.js

This file was deleted.

79 changes: 0 additions & 79 deletions src/core_plugins/kibana/public/dashboard/__tests__/panel.js

This file was deleted.

17 changes: 9 additions & 8 deletions src/core_plugins/kibana/public/dashboard/dashboard.html
Expand Up @@ -79,13 +79,14 @@ <h2 class="kuiTitle kuiVerticalRhythm">

<dashboard-grid
ng-show="!hasExpandedPanel()"
on-panel-removed="onPanelRemoved"
dashboard-view-mode="dashboardViewMode"
panels="panels"
save-state="saveState"
toggle-expand="toggleExpandPanel"
is-full-screen-mode="!chrome.getVisible()"
dashboard-view-mode="dashboardViewMode"
get-embeddable-handler="getEmbeddableHandler"
get-container-api="getContainerApi"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switched to getContainerApi instead of passing containerApi in directly to avoid circular references.

expand-panel="expandPanel"
data-shared-items-count="{{panels.length}}"
container-api="containerApi"
on-panel-removed="onPanelRemoved"
></dashboard-grid>

<dashboard-panel
Expand All @@ -94,8 +95,8 @@ <h2 class="kuiTitle kuiVerticalRhythm">
is-full-screen-mode="!chrome.getVisible()"
is-expanded="true"
dashboard-view-mode="dashboardViewMode"
container-api="containerApi"
toggle-expand="toggleExpandPanel(expandedPanel.panelIndex)"
get-embeddable-handler="getEmbeddableHandler"
get-container-api="getContainerApi"
on-toggle-expanded="minimizeExpandedPanel"
></dashboard-panel>

</dashboard-app>
35 changes: 27 additions & 8 deletions src/core_plugins/kibana/public/dashboard/dashboard.js
Expand Up @@ -4,8 +4,6 @@ import { uiModules } from 'ui/modules';
import uiRoutes from 'ui/routes';
import chrome from 'ui/chrome';

import 'plugins/kibana/dashboard/grid';
import 'plugins/kibana/dashboard/panel/panel';
import 'ui/query_bar';

import { SavedObjectNotFound } from 'ui/errors';
Expand All @@ -28,16 +26,34 @@ import { keyCodes } from 'ui_framework/services';
import { DashboardContainerAPI } from './dashboard_container_api';
import * as filterActions from 'ui/doc_table/actions/filter';
import { FilterManagerProvider } from 'ui/filter_manager';
import { EmbeddableHandlersRegistryProvider } from 'ui/embeddable/embeddable_handlers_registry';

import {
DashboardGrid
} from './grid/dashboard_grid';

import {
DashboardPanel
} from './panel';

const app = uiModules.get('app/dashboard', [
'elasticsearch',
'ngRoute',
'react',
'kibana/courier',
'kibana/config',
'kibana/notify',
'kibana/typeahead',
]);

app.directive('dashboardGrid', function (reactDirective) {
return reactDirective(DashboardGrid);
});

app.directive('dashboardPanel', function (reactDirective) {
return reactDirective(DashboardPanel);
});

uiRoutes
.when(DashboardConstants.CREATE_NEW_DASHBOARD_URL, {
template: dashboardTemplate,
Expand Down Expand Up @@ -95,6 +111,8 @@ app.directive('dashboardApp', function ($injector) {
const docTitle = Private(DocTitleProvider);
const notify = new Notifier({ location: 'Dashboard' });
$scope.queryDocLinks = documentationLinks.query;
const embeddableHandlers = Private(EmbeddableHandlersRegistryProvider);
$scope.getEmbeddableHandler = panelType => embeddableHandlers.byName[panelType];

const dash = $scope.dash = $route.current.locals.dash;
if (dash.id) {
Expand All @@ -110,6 +128,7 @@ app.directive('dashboardApp', function ($injector) {
dashboardState.saveState();
}
);
$scope.getContainerApi = () => $scope.containerApi;

// The 'previouslyStored' check is so we only update the time filter on dashboard open, not during
// normal cross app navigation.
Expand Down Expand Up @@ -181,13 +200,13 @@ app.directive('dashboardApp', function ($injector) {
!dashboardConfig.getHideWriteControls()
);

$scope.toggleExpandPanel = (panelIndex) => {
if ($scope.expandedPanel && $scope.expandedPanel.panelIndex === panelIndex) {
$scope.expandedPanel = null;
} else {
$scope.expandedPanel =
$scope.minimizeExpandedPanel = () => {
$scope.expandedPanel = null;
};

$scope.expandPanel = (panelIndex) => {
$scope.expandedPanel =
dashboardState.getPanels().find((panel) => panel.panelIndex === panelIndex);
}
};

$scope.updateQueryAndFetch = function (query) {
Expand Down
Expand Up @@ -4,6 +4,9 @@ export const DashboardConstants = {
LANDING_PAGE_PATH: '/dashboards',
CREATE_NEW_DASHBOARD_URL: '/dashboard',
};
export const DEFAULT_PANEL_WIDTH = 6;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved these in here because now panel_state is including ui/chrome and I don't want to force anyone who wants these two conts to also include that behemoth.

export const DEFAULT_PANEL_HEIGHT = 3;
export const DASHBOARD_GRID_COLUMN_COUNT = 12;

export function createDashboardEditUrl(id) {
return `/dashboard/${id}`;
Expand Down
4 changes: 2 additions & 2 deletions src/core_plugins/kibana/public/dashboard/dashboard_state.js
Expand Up @@ -6,7 +6,7 @@ import { PanelUtils } from './panel/panel_utils';
import moment from 'moment';

import { stateMonitorFactory } from 'ui/state_management/state_monitor_factory';
import { createPanelState, getPersistedStateId } from 'plugins/kibana/dashboard/panel/panel_state';
import { createPanelState, getPersistedStateId } from './panel';

function getStateDefaults(dashboard, hideWriteControls) {
return {
Expand Down Expand Up @@ -298,7 +298,7 @@ export class DashboardState {
*/
addNewPanel(id, type) {
const maxPanelIndex = PanelUtils.getMaxPanelIndex(this.getPanels());
this.getPanels().push(createPanelState(id, type, maxPanelIndex));
this.getPanels().push(createPanelState(id, type, maxPanelIndex, this.getPanels()));
}

removePanel(panelIndex) {
Expand Down