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

Migrate Dashboard and Public Dashboard to React #4228

Merged
merged 50 commits into from
Dec 24, 2019
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
2771fbe
Initial React Rendering with useDashboard
gabrieldutra Oct 1, 2019
aa66aff
Make sure widgets refresh + useCallback
gabrieldutra Oct 1, 2019
49dffba
Rename collectFilters and add refreshRate
gabrieldutra Oct 2, 2019
2516635
Fix error updates not being rendered
gabrieldutra Oct 3, 2019
6cc5091
Only render widget bottom when queryResults exists
gabrieldutra Oct 3, 2019
7796161
Cleanup
gabrieldutra Oct 3, 2019
ecd55f4
Add useCallback to refreshDashboard
gabrieldutra Oct 3, 2019
bce0d97
Make sure Promise.all have all promises done
gabrieldutra Oct 3, 2019
8aee2ad
Merge branch 'master' into react-public-dashboard
gabrieldutra Oct 7, 2019
2c31510
Merge branch 'master' into react-public-dashboard
gabrieldutra Oct 8, 2019
d55cbff
Start migrating Dashoard to React
gabrieldutra Oct 8, 2019
e10998c
Fullscreen handler added
gabrieldutra Oct 9, 2019
e3c2401
Separate refreshRateHandler hook
gabrieldutra Oct 9, 2019
a1637c2
Add a few tooltips
gabrieldutra Oct 9, 2019
7b80a69
Separate DashboardControl and normalize btn width
gabrieldutra Oct 9, 2019
ab8794a
Share Button
gabrieldutra Oct 9, 2019
2ee69f7
Fix serach params not updating
gabrieldutra Oct 9, 2019
a95d866
Enumerate More Options
gabrieldutra Oct 9, 2019
a024b24
Toggle Publish options
gabrieldutra Oct 9, 2019
fed179d
Archive Dashboard
gabrieldutra Oct 10, 2019
50f99c6
Parameters + Filters
gabrieldutra Oct 10, 2019
77b5ccd
Merge branch 'master' into react-public-dashboard
gabrieldutra Oct 26, 2019
508bceb
Prepare Manage Permissions
gabrieldutra Oct 26, 2019
636f85f
Merge branch 'react-public-dashboard' into react-dashboard
gabrieldutra Oct 26, 2019
4540d77
Start to create edit mode
gabrieldutra Oct 26, 2019
20d5aec
Add Edit Mode functionalities
gabrieldutra Oct 28, 2019
d0191d4
Use previous state when updating dashboard
gabrieldutra Oct 29, 2019
7504b52
Mobile adjustments
gabrieldutra Oct 29, 2019
c45b2ea
Merge branch 'master' into react-public-dashboard
gabrieldutra Oct 29, 2019
817898d
Merge branch 'react-public-dashboard' into react-dashboard
gabrieldutra Oct 29, 2019
0daf14b
PermissionsEditorDialog + Dashboard page title
gabrieldutra Oct 29, 2019
c65448d
Update Dashboard spec
gabrieldutra Oct 29, 2019
3fb95da
Fix other specs
gabrieldutra Oct 29, 2019
a03a6aa
Break dashboard.less
gabrieldutra Oct 30, 2019
feb9a63
Hide publish button on mobile
gabrieldutra Oct 30, 2019
67c5eae
Angular Cleaning
gabrieldutra Oct 30, 2019
80114ef
Keep edit state when changing resolution
gabrieldutra Oct 30, 2019
05e8b24
Bug fix: Dashboard Level Filters not updating
gabrieldutra Oct 30, 2019
b434f03
Remove prepareWidgetsForDashboard
gabrieldutra Nov 14, 2019
b64ccd5
Merge branch 'master' into react-dashboard
gabrieldutra Nov 14, 2019
b5db0ee
Revert "Remove prepareWidgetsForDashboard"
gabrieldutra Nov 14, 2019
f5ee64a
Avoid saving layout changes out of editing mode
gabrieldutra Nov 14, 2019
b050252
Merge branch 'master' into react-dashboard
gabrieldutra Nov 19, 2019
821810b
Merge branch 'master' into react-dashboard
gabrieldutra Dec 4, 2019
42a9f3d
Apply policy for enabled refresh rates
gabrieldutra Dec 5, 2019
e14e8e8
Merge branch 'master' into react-dashboard
gabrieldutra Dec 17, 2019
93ed21a
Disable loadDashboard deps
gabrieldutra Dec 17, 2019
cc309ca
Restyled by prettier (#4459)
restyled-io[bot] Dec 17, 2019
2a2bfb8
Update title when dashboard name updates
gabrieldutra Dec 17, 2019
56bbdaf
Merge branch 'react-dashboard' of github.com:getredash/redash into re…
gabrieldutra Dec 17, 2019
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
21 changes: 2 additions & 19 deletions client/app/assets/less/inc/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,6 @@ text.slicetext {
}

// page
.page-header--new .btn-favourite, .page-header--new .btn-archive {
font-size: 19px;
}

.page-title {
display: flex;
align-items: center;
Expand All @@ -251,23 +247,10 @@ text.slicetext {
display: inline-block;
}

favorites-control {
.favorites-control {
font-size: 19px;
margin-right: 5px;
}

@media (max-width: 767px) {
display: block;

favorites-control {
float: left;
}

h3 {
width: 100%;
margin-bottom: 5px !important;
display: block !important;
}
}
}

.page-header-wrapper, .page-header--new {
Expand Down
11 changes: 11 additions & 0 deletions client/app/assets/less/redash/query.less
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,17 @@ edit-in-place p.editable:hover {
margin-left: 15px;
margin-right: 15px;
}

.tags-control a {
opacity: 0;
transition: opacity 0.2s ease-in-out;
}

&:hover {
.tags-control a {
opacity: 1;
}
}
}

a.label-tag {
Expand Down
9 changes: 2 additions & 7 deletions client/app/components/BigMessage.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { react2angular } from 'react2angular';

export function BigMessage({ message, icon, children, className }) {
function BigMessage({ message, icon, children, className }) {
return (
<div className={'p-15 text-center ' + className}>
<h3 className="m-t-0 m-b-0">
Expand All @@ -28,8 +27,4 @@ BigMessage.defaultProps = {
className: 'tiled bg-white',
};

export default function init(ngModule) {
ngModule.component('bigMessage', react2angular(BigMessage));
}

init.init = true;
export default BigMessage;
2 changes: 1 addition & 1 deletion client/app/components/FavoritesControl.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class FavoritesControl extends React.Component {
return (
<a
title={title}
className="btn-favourite"
className="favorites-control btn-favourite"
onClick={event => this.toggleItem(event, item, onChange)}
>
<i className={icon} aria-hidden="true" />
Expand Down
9 changes: 2 additions & 7 deletions client/app/components/Filters.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { isArray, indexOf, get, map, includes, every, some, toNumber } from 'lod
import moment from 'moment';
import React from 'react';
import PropTypes from 'prop-types';
import { react2angular } from 'react2angular';
import Select from 'antd/lib/select';
import { formatColumnValue } from '@/filters';

Expand Down Expand Up @@ -71,7 +70,7 @@ export function filterData(rows, filters = []) {
return result;
}

export function Filters({ filters, onChange }) {
function Filters({ filters, onChange }) {
if (filters.length === 0) {
return null;
}
Expand Down Expand Up @@ -133,8 +132,4 @@ Filters.defaultProps = {
onChange: () => {},
};

export default function init(ngModule) {
ngModule.component('filters', react2angular(Filters));
}

init.init = true;
export default Filters;
2 changes: 1 addition & 1 deletion client/app/components/HelpTrigger.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import cx from 'classnames';
import Tooltip from 'antd/lib/tooltip';
import Drawer from 'antd/lib/drawer';
import Icon from 'antd/lib/icon';
import { BigMessage } from '@/components/BigMessage';
import BigMessage from '@/components/BigMessage';
import DynamicComponent from '@/components/DynamicComponent';

import './HelpTrigger.less';
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/NoTaggedObjectsFound.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { react2angular } from 'react2angular';
import { BigMessage } from '@/components/BigMessage';
import BigMessage from '@/components/BigMessage';
import { TagsControl } from '@/components/tags-control/TagsControl';

export function NoTaggedObjectsFound({ objectType, tags }) {
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/SelectItemsDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Input from 'antd/lib/input';
import List from 'antd/lib/list';
import Button from 'antd/lib/button';
import { wrap as wrapDialog, DialogPropType } from '@/components/DialogWrapper';
import { BigMessage } from '@/components/BigMessage';
import BigMessage from '@/components/BigMessage';

import LoadingState from '@/components/items-list/components/LoadingState';
import notification from '@/services/notification';
Expand Down
7 changes: 1 addition & 6 deletions client/app/components/dashboards/DashboardGrid.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { chain, cloneDeep, find } from 'lodash';
import { react2angular } from 'react2angular';
import cx from 'classnames';
import { Responsive, WidthProvider } from 'react-grid-layout';
import { VisualizationWidget, TextboxWidget, RestrictedWidget } from '@/components/dashboards/dashboard-widget';
Expand Down Expand Up @@ -231,8 +230,4 @@ class DashboardGrid extends React.Component {
}
}

export default function init(ngModule) {
ngModule.component('dashboardGrid', react2angular(DashboardGrid));
}

init.init = true;
export default DashboardGrid;
115 changes: 115 additions & 0 deletions client/app/components/dashboards/dashboard-grid.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,118 @@
.dashboard-wrapper {
flex-grow: 1;
margin-bottom: 70px;

.layout {
margin: -15px -15px 0;
}

.tile {
display: flex;
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
width: auto;
height: auto;
overflow: hidden;
margin: 0;
padding: 0;
}

.pivot-table-visualization-container > table,
.visualization-renderer > .visualization-renderer-wrapper {
overflow: visible;
}

&.preview-mode {
.widget-menu-regular {
display: block;
}
.widget-menu-remove {
display: none;
}
}

&.editing-mode {
/* Y axis lines */
background: linear-gradient(to right, transparent, transparent 1px, #F6F8F9 1px, #F6F8F9), linear-gradient(to bottom, #B3BABF, #B3BABF 1px, transparent 1px, transparent);
background-size: 5px 50px;
background-position-y: -8px;

/* X axis lines */
&::before {
content: "";
position: absolute;
top: 0;
left: 0;
bottom: 85px;
right: 15px;
background: linear-gradient(to bottom, transparent, transparent 2px, #F6F8F9 2px, #F6F8F9 5px), linear-gradient(to left, #B3BABF, #B3BABF 1px, transparent 1px, transparent);
background-size: calc((100vw - 15px) / 6) 5px;
background-position: -7px 1px;
}
}

.dashboard-widget-wrapper:not(.widget-auto-height-enabled) {
.visualization-renderer {
display: flex;
flex-direction: column;
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;

> .visualization-renderer-wrapper {
flex-grow: 1;
position: relative;
}

> .filters-wrapper {
flex-grow: 0;
}
}

.sunburst-visualization-container,
.sankey-visualization-container,
.map-visualization-container,
.word-cloud-visualization-container,
.box-plot-deprecated-visualization-container,
.chart-visualization-container {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
width: auto;
height: auto;
overflow: hidden;
}

.counter-visualization-content {
position: absolute;
left: 10px;
top: 15px;
right: 10px;
bottom: 15px;
height: auto;
overflow: hidden;
padding: 0;
}
}

.widget-auto-height-enabled {
.spinner {
position: static;
}

.scrollbox {
overflow-y: hidden;
}
}
}

.react-grid-layout {
&.disable-animations {
& > .react-grid-item {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ function VisualizationWidgetFooter({ widget, isPublic, onRefresh, onExpand }) {
}
};

return (
return widgetQueryResult ? (
<>
<span>
{(!isPublic && !!widgetQueryResult) && (
{!isPublic && (
<a
className="refresh-button hidden-print btn btn-sm btn-default btn-transparent"
onClick={() => refreshWidget(1)}
Expand Down Expand Up @@ -162,7 +162,7 @@ function VisualizationWidgetFooter({ widget, isPublic, onRefresh, onExpand }) {
</a>
</span>
</>
);
) : null;
}

VisualizationWidgetFooter.propTypes = {
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/items-list/components/EmptyState.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { BigMessage } from '@/components/BigMessage';
import BigMessage from '@/components/BigMessage';

// Default "list empty" message for list pages
export default function EmptyState(props) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { BigMessage } from '@/components/BigMessage';
import BigMessage from '@/components/BigMessage';

// Default "loading" message for list pages
export default function LoadingState(props) {
Expand Down
1 change: 0 additions & 1 deletion client/app/components/tags-control/TagsControl.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export const DashboardTagsControl = modelTagsControl({

export default function init(ngModule) {
ngModule.component('queryTagsControl', react2angular(QueryTagsControl));
ngModule.component('dashboardTagsControl', react2angular(DashboardTagsControl));
}

init.init = true;
2 changes: 1 addition & 1 deletion client/app/pages/dashboards/DashboardListEmptyState.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { BigMessage } from '@/components/BigMessage';
import BigMessage from '@/components/BigMessage';
import { NoTaggedObjectsFound } from '@/components/NoTaggedObjectsFound';
import EmptyState from '@/components/empty-state/EmptyState';

Expand Down
Loading