Skip to content

Commit

Permalink
Merge pull request #45 from newrelic/kav/statusWidgetUpdates
Browse files Browse the repository at this point in the history
feat: nrql status std colors + custom poll
  • Loading branch information
Kav91 authored Jun 30, 2023
2 parents 0e4b519 + 40ef8de commit a01e91f
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 10 deletions.
5 changes: 4 additions & 1 deletion visualizations/nrql-status-widget/bottomMetrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export default class BottomMetrics extends React.Component {
mainProps,
displayTimeline,
hideLabels,
fontSizeMultiplier
fontSizeMultiplier,
pollInterval
} = this.props;

const {
Expand Down Expand Up @@ -93,6 +94,7 @@ export default class BottomMetrics extends React.Component {
leftStatus={this.state.leftStatus}
metricLabelRight={metricLabelRight}
hideLabels={hideLabels}
pollInterval={pollInterval}
/>
)}
{queryRight && (
Expand All @@ -114,6 +116,7 @@ export default class BottomMetrics extends React.Component {
leftStatus={this.state.leftStatus}
metricLabelLeft={metricLabelLeft}
hideLabels={hideLabels}
pollInterval={pollInterval}
/>
)}
</div>
Expand Down
43 changes: 42 additions & 1 deletion visualizations/nrql-status-widget/nr1.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,53 @@
"description": "NRQL query eg. SELECT count(*) FROM TransactionError",
"type": "nrql"
},
{
"name": "pollInterval",
"title": "Optional Poll Interval (seconds)",
"description": "",
"type": "enum",
"items": [
{
"title": "Default - auto",
"value": null
},
{
"title": "5s",
"value": 5000
},
{
"title": "10s",
"value": 10000
},
{
"title": "15s",
"value": 15000
},
{
"title": "30s",
"value": 30000
},
{
"title": "45s",
"value": 45000
},
{
"title": "1m",
"value": 60000
},
{
"title": "5m",
"value": 300000
}
]
},
{
"name": "enableFlash",
"title": "Enable flash/pulse effect when not healthy",
"description": "",
"type": "boolean"
}, {
},
{
"name": "fontMultiplier",
"title": "Font multiplier - increase the font size (default: 1)",
"description": "",
Expand Down
8 changes: 6 additions & 2 deletions visualizations/nrql-status-widget/status-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ export default class StatusWidget extends React.Component {
sloBudget,
sloBar,
sloDaysToView,
fontMultiplier
fontMultiplier,
pollInterval
} = this.props;
let { displayTimeline, metricLabel, queryLeft, queryRight } = this.props;

Expand Down Expand Up @@ -244,7 +245,9 @@ export default class StatusWidget extends React.Component {
<NrqlQuery
query={finalQuery}
accountIds={[parseInt(accountId)]}
pollInterval={NrqlQuery.AUTO_POLL_INTERVAL}
pollInterval={
pollInterval ? parseInt(pollInterval) : NrqlQuery.AUTO_POLL_INTERVAL
}
>
{({ data, loading, error }) => {
if (loading) {
Expand Down Expand Up @@ -389,6 +392,7 @@ export default class StatusWidget extends React.Component {
height={height}
mainProps={this.props}
fontSizeMultiplier={fontSizeMultiplier}
pollInterval={pollInterval}
/>

{displayTimeline && (
Expand Down
16 changes: 10 additions & 6 deletions visualizations/nrql-status-widget/styles.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// crit #f5554b
// orange #f07a0e
// yell #ffd23d
// green #01a76a
.healthy-bg {
background-color: #3a845e;
background-color: #01a76a;
}

.critical-bg {
Expand All @@ -14,7 +18,7 @@
background-color: #222;
}
50% {
background-color: #a1251a;
background-color: #f5554b;
}
100% {
background-color: #222;
Expand All @@ -33,7 +37,7 @@
background-color: #222;
}
50% {
background-color: #f8d45c;
background-color: #ffd23d;
}
100% {
background-color: #222;
Expand All @@ -60,15 +64,15 @@
}

.healthy-solid-bg {
background-color: #3a845e;
background-color: #01a76a;
}

.critical-solid-bg {
background-color: #a1251a;
background-color: #f5554b;
}

.warning-solid-bg {
background-color: #f8d45c;
background-color: #ffd23d;
}

.unknown-solid-bg {
Expand Down

0 comments on commit a01e91f

Please sign in to comment.