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

Query View redesign #4536

Merged
merged 26 commits into from
Feb 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
099d58f
Render placeholder as link in EditInPlace
gabrieldutra Jan 11, 2020
b4338bf
Add card style to QueryVisualizationTabs
gabrieldutra Jan 11, 2020
981fd87
Add headerExtra for Refresh button in Query header
gabrieldutra Jan 11, 2020
2f10646
Quick preview of new query view design (Desktop)
gabrieldutra Jan 11, 2020
710def1
Add Parameters container
gabrieldutra Jan 12, 2020
475bebf
Small details
gabrieldutra Jan 12, 2020
7132727
Use updated style in QuerySource as well
gabrieldutra Jan 15, 2020
d7074f8
Adjust Tabs details
gabrieldutra Jan 17, 2020
b12727e
Rename 'Updated' and move datasource to the right
gabrieldutra Jan 17, 2020
6d37058
Add fullscreen data toggle
gabrieldutra Jan 18, 2020
1424bad
Keep elements in DOM and just hide them
gabrieldutra Jan 18, 2020
afa4159
Non-fixed layout for mobiles
gabrieldutra Jan 18, 2020
a86ceda
Move add description button to TagsControl
gabrieldutra Jan 18, 2020
872719f
Always show scroll and pagination in tables
gabrieldutra Jan 18, 2020
a0b1a64
Copy 100% height css to query pages (for tests)
gabrieldutra Jan 18, 2020
e3a55bd
Remove margin from Query Header
gabrieldutra Jan 18, 2020
a4f0d29
Reuse existing styles instead of copying
gabrieldutra Jan 18, 2020
6bc17ce
Use width 100% instead of 100vw
gabrieldutra Jan 18, 2020
dc59a0e
Add Visualization Button
gabrieldutra Jan 19, 2020
88eb1d3
Add EmptyState
gabrieldutra Jan 19, 2020
ef677c2
Use EmptyState when queryResult isEmpty too
gabrieldutra Jan 20, 2020
d64b802
Sync with master.
arikfr Jan 22, 2020
3ff8ec8
Merge branch 'master' into query-view
gabrieldutra Feb 4, 2020
9f923af
Merge branch 'master' into query-view
gabrieldutra Feb 9, 2020
c6936a1
Refactor useQueryExecution & add inline query execution status (#4584)
arikfr Feb 19, 2020
7fd1819
Table spec: Remove unnecessary .should
gabrieldutra Feb 19, 2020
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
13 changes: 13 additions & 0 deletions client/app/assets/images/illustrations/no-query-results.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 0 additions & 37 deletions client/app/assets/less/redash/query.less
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,6 @@ body.fixed-layout {
}
}

.bottom-controller {
padding: 10px 15px;
background: #fff;
display: flex;
align-items: center;

button,
div,
span {
position: relative;
}

div:last-child {
flex-grow: 1;
text-align: right;
}

&:before {
content: "";
height: 50px;
position: fixed;
bottom: 0;
width: 100%;
pointer-events: none;
left: 0;
}
}

.p-b-60 {
padding-bottom: 60px !important;
}
Expand Down Expand Up @@ -153,8 +125,6 @@ body.fixed-layout {
.page-header--query {
.page-title {
display: block;
margin-left: 15px;
margin-right: 15px;
}

.tags-control a {
Expand Down Expand Up @@ -479,13 +449,6 @@ nav .rg-bottom {
// Smaller screens

@media (max-width: 880px) {
.page-header--query {
.page-title {
margin-left: 0;
margin-right: 0;
}
}

.query-tags:not(.query-tags__empty) {
display: none;
}
Expand Down
36 changes: 22 additions & 14 deletions client/app/components/EditInPlace.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,33 @@ export default class EditInPlace extends React.Component {
placeholder: PropTypes.string,
value: PropTypes.string,
onDone: PropTypes.func.isRequired,
onStopEditing: PropTypes.func,
multiline: PropTypes.bool,
editorProps: PropTypes.object,
defaultEditing: PropTypes.bool,
};

static defaultProps = {
ignoreBlanks: false,
isEditable: true,
placeholder: "",
value: "",
onStopEditing: () => {},
multiline: false,
editorProps: {},
defaultEditing: false,
};

constructor(props) {
super(props);
this.state = {
editing: false,
editing: props.defaultEditing,
};
this.inputRef = React.createRef();
}

componentDidUpdate(_, prevState) {
if (this.state.editing && !prevState.editing) {
this.inputRef.current.focus();
if (!this.state.editing && prevState.editing) {
this.props.onStopEditing();
}
}

Expand Down Expand Up @@ -62,25 +65,30 @@ export default class EditInPlace extends React.Component {
}
};

renderNormal = () => (
<span
role="presentation"
onFocus={this.startEditing}
onClick={this.startEditing}
className={this.props.isEditable ? "editable" : ""}>
{this.props.value || this.props.placeholder}
</span>
);
renderNormal = () =>
this.props.value ? (
<span
role="presentation"
onFocus={this.startEditing}
onClick={this.startEditing}
className={this.props.isEditable ? "editable" : ""}>
{this.props.value}
</span>
) : (
<a className="clickable" onClick={this.startEditing}>
{this.props.placeholder}
</a>
);

renderEdit = () => {
const { multiline, value, editorProps } = this.props;
const InputComponent = multiline ? Input.TextArea : Input;
return (
<InputComponent
ref={this.inputRef}
defaultValue={value}
onBlur={e => this.stopEditing(e.target.value)}
onKeyDown={this.handleKeyDown}
autoFocus
{...editorProps}
/>
);
Expand Down
11 changes: 7 additions & 4 deletions client/app/components/Parameters.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../assets/less/ant';
@import "../assets/less/ant";

.parameter-block {
display: inline-block;
Expand All @@ -20,7 +20,8 @@
}

&.parameter-dragged {
box-shadow: 0 4px 9px -3px rgba(102, 136, 153, 0.15);
z-index: 2;
box-shadow: 0 4px 9px -3px rgba(102, 136, 153, 0.15);
}
}

Expand Down Expand Up @@ -60,7 +61,7 @@
bottom: -36px;
left: -15px;
border-radius: 2px;
z-index: 1;
z-index: 2;
transition: opacity 150ms ease-out;
box-shadow: 0 4px 9px -3px rgba(102, 136, 153, 0.15);
background-color: #ffffff;
Expand Down Expand Up @@ -88,7 +89,9 @@
height: 27px;
}

&:hover, &:focus, &:active {
&:hover,
&:focus,
&:active {
background-color: #eef7fe;
}

Expand Down
97 changes: 49 additions & 48 deletions client/app/components/dashboards/dashboard-grid.less
Original file line number Diff line number Diff line change
Expand Up @@ -56,54 +56,6 @@
}
}

.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;
Expand All @@ -123,6 +75,55 @@
}
}

.dashboard-grid .dashboard-widget-wrapper:not(.widget-auto-height-enabled),
.query-fixed-layout {
.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;
}
}

// react-grid-layout overrides
.react-grid-item {
// placeholder color
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import KeyboardShortcuts, { humanReadableShortcut } from "@/services/KeyboardSho
import AutocompleteToggle from "./AutocompleteToggle";
import "./QueryEditorControls.less";

function ButtonTooltip({ title, shortcut, ...props }) {
export function ButtonTooltip({ title, shortcut, ...props }) {
shortcut = humanReadableShortcut(shortcut, 1); // show only primary shortcut
title =
title && shortcut ? (
Expand Down
8 changes: 7 additions & 1 deletion client/app/components/tags-control/TagsControl.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export class TagsControl extends React.Component {
getAvailableTags: PropTypes.func,
onEdit: PropTypes.func,
className: PropTypes.string,
tagsExtra: PropTypes.node,
children: PropTypes.node,
};

Expand All @@ -20,6 +21,7 @@ export class TagsControl extends React.Component {
getAvailableTags: () => Promise.resolve([]),
onEdit: () => {},
className: "",
tagsExtra: null,
children: null,
};

Expand All @@ -32,7 +34,10 @@ export class TagsControl extends React.Component {
renderEditButton() {
const tags = map(this.props.tags, trim);
return (
<a className="label label-tag" role="none" onClick={() => this.editTags(tags, this.props.getAvailableTags)}>
<a
className="label label-tag hidden-xs"
role="none"
onClick={() => this.editTags(tags, this.props.getAvailableTags)}>
{tags.length === 0 && (
<React.Fragment>
<i className="zmdi zmdi-plus m-r-5" />
Expand All @@ -54,6 +59,7 @@ export class TagsControl extends React.Component {
</span>
))}
{this.props.canEdit && this.renderEditButton()}
{this.props.tagsExtra}
</div>
);
}
Expand Down
16 changes: 16 additions & 0 deletions client/app/lib/getQueryResultData.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { get, invoke } from "lodash";

export default function getQueryResultData(queryResult) {
return {
status: invoke(queryResult, "getStatus") || null,
columns: invoke(queryResult, "getColumns") || [],
rows: invoke(queryResult, "getData") || [],
filters: invoke(queryResult, "getFilters") || [],
updatedAt: invoke(queryResult, "getUpdatedAt") || null,
retrievedAt: get(queryResult, "query_result.retrieved_at", null),
log: invoke(queryResult, "getLog") || [],
error: invoke(queryResult, "getError") || null,
runtime: invoke(queryResult, "getRuntime") || null,
metadata: get(queryResult, "query_result.data.metadata", {}),
};
}
Loading