problems: fix alert list styles

This commit is contained in:
Alexander Zobnin
2019-01-15 17:31:05 +03:00
parent 466b328ad7
commit 195373953c
4 changed files with 71 additions and 30 deletions

View File

@@ -53,6 +53,7 @@ export default class AlertCard extends PureComponent<AlertCardProps, AlertCardSt
render() { render() {
const { problem, panelOptions } = this.props; const { problem, panelOptions } = this.props;
const cardClass = classNames('alert-rule-item', 'zbx-trigger-card', { 'zbx-trigger-highlighted': panelOptions.highlightBackground }); const cardClass = classNames('alert-rule-item', 'zbx-trigger-card', { 'zbx-trigger-highlighted': panelOptions.highlightBackground });
const descriptionClass = classNames('alert-rule-item__text', { 'zbx-description--newline': panelOptions.descriptionAtNewLine });
const severityDesc = _.find(panelOptions.triggerSeverity, s => s.priority === Number(problem.priority)); const severityDesc = _.find(panelOptions.triggerSeverity, s => s.priority === Number(problem.priority));
const lastchange = formatLastChange(problem.lastchangeUnix, panelOptions.customLastChangeFormat && panelOptions.lastChangeFormat); const lastchange = formatLastChange(problem.lastchangeUnix, panelOptions.customLastChangeFormat && panelOptions.lastChangeFormat);
const age = moment.unix(problem.lastchangeUnix).fromNow(true); const age = moment.unix(problem.lastchangeUnix).fromNow(true);
@@ -95,7 +96,7 @@ export default class AlertCard extends PureComponent<AlertCardProps, AlertCardSt
)} )}
</p> </p>
<div className="alert-rule-item__text"> <div className={descriptionClass}>
{panelOptions.statusField && <AlertStatus problem={problem} blink={blink} />} {panelOptions.statusField && <AlertStatus problem={problem} blink={blink} />}
{panelOptions.severityField && ( {panelOptions.severityField && (
<AlertSeverity severityDesc={severityDesc} blink={blink} highlightBackground={panelOptions.highlightBackground} /> <AlertSeverity severityDesc={severityDesc} blink={blink} highlightBackground={panelOptions.highlightBackground} />

View File

@@ -59,9 +59,8 @@ export default class AlertList extends PureComponent<AlertListProps, AlertListSt
const { problems, panelOptions } = this.props; const { problems, panelOptions } = this.props;
const currentProblems = this.getCurrentProblems(this.state.page); const currentProblems = this.getCurrentProblems(this.state.page);
return [ return (
<div className="triggers-panel-container" key="alertListContainer"> <div className="triggers-panel-container" key="alertListContainer">
<div className="triggers-panel-scroll">
<section className="card-section card-list-layout-list"> <section className="card-section card-list-layout-list">
<ol className="alert-rule-list"> <ol className="alert-rule-list">
{currentProblems.map(problem => {currentProblems.map(problem =>
@@ -75,8 +74,7 @@ export default class AlertList extends PureComponent<AlertListProps, AlertListSt
)} )}
</ol> </ol>
</section> </section>
</div>
</div>,
<div className="triggers-panel-footer" key="alertListFooter"> <div className="triggers-panel-footer" key="alertListFooter">
<PaginationControl <PaginationControl
itemsLength={problems.length} itemsLength={problems.length}
@@ -85,7 +83,8 @@ export default class AlertList extends PureComponent<AlertListProps, AlertListSt
onPageChange={this.handlePageChange} onPageChange={this.handlePageChange}
/> />
</div> </div>
]; </div>
);
} }
} }

View File

@@ -645,6 +645,7 @@ export class TriggerPanelCtrl extends PanelCtrl {
} }
TriggerPanelCtrl.templateUrl = 'public/plugins/alexanderzobnin-zabbix-app/panel-triggers/partials/module.html'; TriggerPanelCtrl.templateUrl = 'public/plugins/alexanderzobnin-zabbix-app/panel-triggers/partials/module.html';
// TriggerPanelCtrl.scrollable = true;
function filterTriggers(triggers, triggerFilter) { function filterTriggers(triggers, triggerFilter) {
if (utils.isRegex(triggerFilter)) { if (utils.isRegex(triggerFilter)) {

View File

@@ -4,6 +4,41 @@
.triggers-panel-container { .triggers-panel-container {
position: relative; position: relative;
display: flex;
flex-direction: column;
height: 100%;
.card-section {
padding: 2px;
margin-bottom: 0.4rem;
overflow: auto;
.alert-rule-list {
.alert-rule-item {
.alert-rule-item__text {
display: flex;
max-height: 1.6em;
overflow: hidden;
padding-right: 1em;
&.zbx-description--newline {
max-height: unset;
}
.zbx-description {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
span {
padding-right: 0.4em;
}
}
}
}
}
.zabbix-trigger-name { .zabbix-trigger-name {
font-weight: bold; font-weight: bold;
@@ -11,14 +46,18 @@
.zabbix-hostname { .zabbix-hostname {
color: $gray-2; color: $gray-2;
margin-left: 1rem; margin-left: 1em;
font-weight: 500; font-weight: 500;
i {
padding-right: 0.2em;
}
} }
.zbx-description { .zbx-description {
color: $gray-3; color: $gray-3;
font-weight: normal; font-weight: normal;
margin-left: 0.6rem; margin-left: 0.6em;
&--newline { &--newline {
margin-left: 0rem; margin-left: 0rem;
@@ -51,8 +90,9 @@
margin-right: 1.5rem; margin-right: 1.5rem;
margin-left: 1rem; margin-left: 1rem;
font-weight: 500; font-weight: 500;
.gicon-datasources {
opacity: 0.4; i {
padding-right: 0.4em;
} }
} }
@@ -109,10 +149,10 @@
} }
.triggers-panel-footer { .triggers-panel-footer {
margin-top: auto;
text-align: center; text-align: center;
font-size: 90%; font-size: 90%;
line-height: 2px; line-height: 2px;
padding-top: 4px;
ul { ul {
position: relative; position: relative;