Merge pull request from influxdata/fix-template-variables-responsive

Make Template Variables Manager More Responsive
pull/10616/head
Alex Paxton 2017-11-28 16:25:17 -08:00 committed by GitHub
commit 362831e67c
4 changed files with 35 additions and 24 deletions
ui/src
dashboards/components/template_variables
shared/components

View File

@ -14,6 +14,7 @@
1. [#2386](https://github.com/influxdata/chronograf/pull/2386): Fix queries that include regex, numbers and wildcard 1. [#2386](https://github.com/influxdata/chronograf/pull/2386): Fix queries that include regex, numbers and wildcard
1. [#2398](https://github.com/influxdata/chronograf/pull/2398): Fix apps on hosts page from parsing tags with null values 1. [#2398](https://github.com/influxdata/chronograf/pull/2398): Fix apps on hosts page from parsing tags with null values
1. [#2408](https://github.com/influxdata/chronograf/pull/2408): Fix updated Dashboard names not updating dashboard list 1. [#2408](https://github.com/influxdata/chronograf/pull/2408): Fix updated Dashboard names not updating dashboard list
1. [#2423](https://github.com/influxdata/chronograf/pull/2423): Gracefully scale Template Variables Manager overlay on smaller displays
### Features ### Features
1. [#2384](https://github.com/influxdata/chronograf/pull/2384): Add filtering by name to Dashboard index page 1. [#2384](https://github.com/influxdata/chronograf/pull/2384): Add filtering by name to Dashboard index page

View File

@ -1,33 +1,30 @@
import React, {PropTypes} from 'react' import React, {PropTypes} from 'react'
import DeleteConfirmButtons from 'shared/components/DeleteConfirmButtons' import DeleteConfirmButtons from 'shared/components/DeleteConfirmButtons'
const RowButtons = ({ const RowButtons = ({onStartEdit, isEditing, onCancelEdit, onDelete, id}) => {
onStartEdit,
isEditing,
onCancelEdit,
onDelete,
id,
selectedType,
}) => {
if (isEditing) { if (isEditing) {
return ( return (
<div className="tvm-actions"> <div className="tvm-actions">
<button <button
className="btn btn-sm btn-info" className="btn btn-sm btn-info btn-square"
type="button" type="button"
onClick={onCancelEdit} onClick={onCancelEdit}
> >
Cancel <span className="icon remove" />
</button> </button>
<button className="btn btn-sm btn-success" type="submit"> <button className="btn btn-sm btn-success btn-square" type="submit">
{selectedType === 'csv' ? 'Save Values' : 'Get Values'} <span className="icon checkmark" />
</button> </button>
</div> </div>
) )
} }
return ( return (
<div className="tvm-actions"> <div className="tvm-actions">
<DeleteConfirmButtons onDelete={onDelete(id)} /> <DeleteConfirmButtons
onDelete={onDelete(id)}
icon="remove"
square={true}
/>
<button <button
className="btn btn-sm btn-info btn-edit btn-square" className="btn btn-sm btn-info btn-edit btn-square"
type="button" type="button"

View File

@ -4,14 +4,15 @@ import classnames from 'classnames'
import OnClickOutside from 'shared/components/OnClickOutside' import OnClickOutside from 'shared/components/OnClickOutside'
import ConfirmButtons from 'shared/components/ConfirmButtons' import ConfirmButtons from 'shared/components/ConfirmButtons'
const DeleteButton = ({onClickDelete, buttonSize}) => const DeleteButton = ({onClickDelete, buttonSize, icon, square}) =>
<button <button
className={classnames('btn btn-danger table--show-on-row-hover', { className={classnames('btn btn-danger table--show-on-row-hover', {
[buttonSize]: buttonSize, [buttonSize]: buttonSize,
'btn-square': square,
})} })}
onClick={onClickDelete} onClick={onClickDelete}
> >
Delete {icon ? <span className={`icon ${icon}`} /> : 'Delete'}
</button> </button>
class DeleteConfirmButtons extends Component { class DeleteConfirmButtons extends Component {
@ -37,7 +38,7 @@ class DeleteConfirmButtons extends Component {
} }
render() { render() {
const {onDelete, item, buttonSize} = this.props const {onDelete, item, buttonSize, icon, square} = this.props
const {isConfirming} = this.state const {isConfirming} = this.state
return isConfirming return isConfirming
@ -50,21 +51,27 @@ class DeleteConfirmButtons extends Component {
: <DeleteButton : <DeleteButton
onClickDelete={this.handleClickDelete} onClickDelete={this.handleClickDelete}
buttonSize={buttonSize} buttonSize={buttonSize}
icon={icon}
square={square}
/> />
} }
} }
const {func, oneOfType, shape, string} = PropTypes const {bool, func, oneOfType, shape, string} = PropTypes
DeleteButton.propTypes = { DeleteButton.propTypes = {
onClickDelete: func.isRequired, onClickDelete: func.isRequired,
buttonSize: string, buttonSize: string,
icon: string,
square: bool,
} }
DeleteConfirmButtons.propTypes = { DeleteConfirmButtons.propTypes = {
item: oneOfType([(string, shape())]), item: oneOfType([(string, shape())]),
onDelete: func.isRequired, onDelete: func.isRequired,
buttonSize: string, buttonSize: string,
square: bool,
icon: string,
} }
DeleteConfirmButtons.defaultProps = { DeleteConfirmButtons.defaultProps = {

View File

@ -42,19 +42,20 @@ $tvmp-table-gutter: 8px;
/* Column Widths */ /* Column Widths */
.tvm--col-1 {flex: 0 0 140px;} .tvm--col-1 {flex: 0 0 140px;}
.tvm--col-2 {flex: 0 0 140px;} .tvm--col-2 {flex: 0 0 140px;}
.tvm--col-3 {flex: 1 0 500px;} .tvm--col-3 {flex: 1 0 0;}
.tvm--col-4 {flex: 0 0 160px;} .tvm--col-4 {flex: 0 0 68px;}
/* Table Column Labels */ /* Table Column Labels */
.template-variable-manager--table-heading { .template-variable-manager--table-heading {
padding: 0 $tvmp-table-gutter; padding: 0 $tvmp-table-gutter;
height: 18px; height: 18px;
display: flex; display: flex;
align-items: center; align-items: stretch;
flex-wrap: nowrap; flex-wrap: nowrap;
font-weight: 600; font-weight: 600;
font-size: 12px; font-size: 12px;
color: $g11-sidewalk; color: $g11-sidewalk;
white-space: nowrap;
> * { > * {
@include no-user-select(); @include no-user-select();
@ -132,7 +133,6 @@ $tvmp-table-gutter: 8px;
line-height: 30px; line-height: 30px;
border-radius: $radius; border-radius: $radius;
background-color: $g5-pepper; background-color: $g5-pepper;
margin-top: 2px;
@include custom-scrollbar-round($g5-pepper, $g7-graphite); @include custom-scrollbar-round($g5-pepper, $g7-graphite);
} }
.tvm-values-empty { .tvm-values-empty {
@ -160,9 +160,13 @@ $tvmp-table-gutter: 8px;
.tvm-query-builder { .tvm-query-builder {
display: flex; display: flex;
align-items: center; align-items: center;
height: 30px; min-height: 30px;
flex-wrap: wrap;
> * {margin-right: 2px;} > * {
margin-bottom: 2px;
margin-right: 2px;
}
> *:last-child {margin-right: 0;} > *:last-child {margin-right: 0;}
.dropdown { .dropdown {
@ -193,7 +197,9 @@ $tvmp-table-gutter: 8px;
order: 1; order: 1;
} }
> .btn {margin-left: $tvmp-table-gutter;} > .btn:first-child {
margin-left: $tvmp-table-gutter;
}
/* Override confirm buttons styles */ /* Override confirm buttons styles */
/* Janky, but doing this quick & dirty for now */ /* Janky, but doing this quick & dirty for now */