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

Add support for table based controls #1818

Merged
merged 1 commit into from
Sep 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion client/app/scripts/components/node-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export class NodeDetails extends React.Component {
<Warning text={getTruncationText(table.truncationCount)} />
</span>}
</div>
<NodeDetailsLabels rows={table.rows}
<NodeDetailsLabels rows={table.rows} controls={table.controls}
matches={nodeMatches.get('tables')} />
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React from 'react';
import { Map as makeMap } from 'immutable';
import sortBy from 'lodash/sortBy';

import MatchedText from '../matched-text';
import NodeDetailsControlButton from './node-details-control-button';
import ShowMore from '../show-more';

export default class NodeDetailsLabels extends React.Component {
Expand All @@ -13,15 +15,25 @@ export default class NodeDetailsLabels extends React.Component {
limit: this.DEFAULT_LIMIT,
};
this.handleLimitClick = this.handleLimitClick.bind(this);
this.renderControls = this.renderControls.bind(this);
}

handleLimitClick() {
const limit = this.state.limit ? 0 : this.DEFAULT_LIMIT;
this.setState({limit});
}

renderControls(controls) {
return (
<div className="node-details-labels-controls">
{sortBy(controls, 'rank').map(control => <NodeDetailsControlButton

This comment was marked as abuse.

This comment was marked as abuse.

nodeId={control.nodeId} control={control} key={control.id} />)}
</div>
);
}

render() {
const { matches = makeMap() } = this.props;
const { controls, matches = makeMap() } = this.props;
let rows = this.props.rows;
let notShown = 0;
const limited = rows && this.state.limit > 0 && rows.length > this.state.limit;
Expand All @@ -37,6 +49,7 @@ export default class NodeDetailsLabels extends React.Component {

return (
<div className="node-details-labels">
{controls && this.renderControls(controls)}
{rows.map(field => (<div className="node-details-labels-field" key={field.id}>
<div className="node-details-labels-field-label truncate" title={field.label}
key={field.id}>
Expand Down
38 changes: 23 additions & 15 deletions client/app/styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -696,22 +696,7 @@ h2 {
}

.node-control-button {
.btn-opacity;
padding: 6px;
margin-left: 2px;
font-size: 110%;
color: @white;
cursor: pointer;
border: 1px solid rgba(255, 255, 255, 0);
border-radius: 10%;
&:hover {
border-color: rgba(255, 255, 255, 0.6);
}
&-pending, &-pending:hover {
opacity: 0.2;
border-color: rgba(255, 255, 255, 0);
cursor: not-allowed;
}
}

&-spinner {
Expand Down Expand Up @@ -848,6 +833,10 @@ h2 {
}

&-labels {
&-controls {
margin-left: -4px;
}

&-field {
display: flex;
align-items: baseline;
Expand Down Expand Up @@ -958,6 +947,25 @@ h2 {
}
}

.node-control-button {
.btn-opacity;
padding: 6px;
margin-left: 2px;
font-size: 110%;

This comment was marked as abuse.

This comment was marked as abuse.

color: @text-secondary-color;
cursor: pointer;
border: 1px solid rgba(255, 255, 255, 0);
border-radius: 10%;
&:hover {
border-color: rgba(255, 255, 255, 0.6);
}
&-pending, &-pending:hover {
opacity: 0.2;
border-color: rgba(255, 255, 255, 0);
cursor: not-allowed;
}
}

.terminal {

&-app {
Expand Down