problems panel: narrow layout for details

This commit is contained in:
Alexander Zobnin
2018-12-04 22:04:21 +03:00
parent 0b626898bb
commit 654f050365
2 changed files with 33 additions and 13 deletions

View File

@@ -12,6 +12,13 @@ export interface ProblemListProps {
} }
export class ProblemList extends PureComponent<ProblemListProps, any> { export class ProblemList extends PureComponent<ProblemListProps, any> {
rootWidth: number;
rootRef: any;
setRootRef = ref => {
this.rootRef = ref;
}
buildColumns() { buildColumns() {
const result = []; const result = [];
const options = this.props.panelOptions; const options = this.props.panelOptions;
@@ -41,17 +48,18 @@ export class ProblemList extends PureComponent<ProblemListProps, any> {
} }
render() { render() {
console.log(this.props.problems, this.props.panelOptions); // console.log(this.props.problems, this.props.panelOptions);
const columns = this.buildColumns(); const columns = this.buildColumns();
// const data = this.props.problems.map(p => [p.host, p.description]); this.rootWidth = this.rootRef && this.rootRef.clientWidth;
return ( return (
<div className="panel-problems"> <div className="panel-problems" ref={this.setRootRef}>
<ReactTable <ReactTable
data={this.props.problems} data={this.props.problems}
columns={columns} columns={columns}
defaultPageSize={10} defaultPageSize={10}
loading={this.props.loading} loading={this.props.loading}
SubComponent={props => <ProblemDetails {...props} />} SubComponent={props => <ProblemDetails rootWidth={this.rootWidth} {...props} />}
/> />
</div> </div>
); );
@@ -244,7 +252,7 @@ function ProblemStatusBar(props: ProblemStatusBarProps) {
<ProblemStatusBarItem icon="tag" fired={closeByTag} tooltip={`OK event closes problems matched to tag: ${problem.correlation_tag}`} /> <ProblemStatusBarItem icon="tag" fired={closeByTag} tooltip={`OK event closes problems matched to tag: ${problem.correlation_tag}`} />
<ProblemStatusBarItem icon="question-circle" fired={stateUnknown} tooltip="Current trigger state is unknown" /> <ProblemStatusBarItem icon="question-circle" fired={stateUnknown} tooltip="Current trigger state is unknown" />
<ProblemStatusBarItem icon="warning" fired={error} tooltip={problem.error} /> <ProblemStatusBarItem icon="warning" fired={error} tooltip={problem.error} />
<ProblemStatusBarItem icon="window-close-o" fired={manualClose} tooltip="Manual close event" /> <ProblemStatusBarItem icon="window-close-o" fired={manualClose} tooltip="Manual close problem" />
</div> </div>
); );
} }
@@ -289,11 +297,10 @@ class ProblemDetails extends PureComponent<any, any> {
render() { render() {
const problem = this.props.original as Trigger; const problem = this.props.original as Trigger;
const rootWidth = this.props.rootWidth;
const displayClass = this.state.show ? 'show' : ''; const displayClass = this.state.show ? 'show' : '';
let groups = ""; const wideLayout = rootWidth > 1000;
if (problem && problem.groups) {
groups = problem.groups.map(g => g.name).join(', ');
}
return ( return (
<div className={`problem-details-container ${displayClass}`}> <div className={`problem-details-container ${displayClass}`}>
<div className="problem-details"> <div className="problem-details">
@@ -317,8 +324,14 @@ class ProblemDetails extends PureComponent<any, any> {
<div className="problem-tags"> <div className="problem-tags">
{problem.tags && problem.tags.map(tag => <EventTag key={tag.tag + tag.value} tag={tag} />)} {problem.tags && problem.tags.map(tag => <EventTag key={tag.tag + tag.value} tag={tag} />)}
</div> </div>
{problem.acknowledges && !wideLayout &&
<div className="problem-ack-container">
<h6><FAIcon icon="reply-all" /> Acknowledges</h6>
<AcknowledgesList acknowledges={problem.acknowledges} />
</div>
}
</div> </div>
{problem.acknowledges && {problem.acknowledges && wideLayout &&
<div className="problem-details-middle"> <div className="problem-details-middle">
<h6><FAIcon icon="reply-all" /> Acknowledges</h6> <h6><FAIcon icon="reply-all" /> Acknowledges</h6>
<AcknowledgesList acknowledges={problem.acknowledges} /> <AcknowledgesList acknowledges={problem.acknowledges} />

View File

@@ -167,6 +167,7 @@
.problem-details-row { .problem-details-row {
display: flex; display: flex;
margin-bottom: 0.6rem; margin-bottom: 0.6rem;
min-height: 3rem;
.problem-value-container { .problem-value-container {
flex: 1 0 auto; flex: 1 0 auto;
@@ -176,7 +177,7 @@
.problem-details { .problem-details {
position: relative; position: relative;
flex: 10 0 auto; flex: 10 0 auto;
padding: 0.5rem 1rem; padding: 0.5rem 1rem 0.5rem 1.2rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
@@ -193,7 +194,7 @@
.problem-tags { .problem-tags {
padding-top: 0.6rem; padding-top: 0.6rem;
padding-bottom: 0.6rem; padding-bottom: 0.8rem;
margin-top: auto; margin-top: auto;
} }
@@ -243,7 +244,7 @@
.problem-details-middle { .problem-details-middle {
flex: 1 0 auto; flex: 1 0 auto;
padding: 0.5rem 1rem; padding: 0.6rem 1rem;
// border: 1px solid $dark-4; // border: 1px solid $dark-4;
border-width: 0 1px; border-width: 0 1px;
border-style: solid; border-style: solid;
@@ -251,6 +252,12 @@
overflow: auto; overflow: auto;
} }
.problem-ack-container {
padding: 0.8rem 0;
border-top: 2px solid $dark-4;
overflow: auto;
}
.problem-ack-list { .problem-ack-list {
display: flex; display: flex;
overflow: auto; overflow: auto;