Skip to content

Commit 5b6fb3b

Browse files
committed
feat(alerting): level handle progress
1 parent ec640bd commit 5b6fb3b

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

public/app/plugins/panel/graph/jquery.flot.alerts.ts

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,24 @@ import _ from 'lodash';
66

77
var options = {};
88

9-
function getHandleTemplate(type, op, value) {
9+
function getHandleInnerHtml(type, op, value) {
1010
if (op === '>') { op = '>'; }
1111
if (op === '<') { op = '&lt;'; }
1212

13-
return `
13+
return `
14+
<div class="alert-handle-line">
15+
</div>
16+
<div class="alert-handle">
17+
<i class="icon-gf icon-gf-${type} alert-icon-${type}"></i>
18+
${op} ${value}
19+
</div>`;
20+
}
21+
22+
function getFullHandleHtml(type, op, value) {
23+
var innerTemplate = getHandleInnerHtml(type, op, value);
24+
return `
1425
<div class="alert-handle-wrapper alert-handle-wrapper--${type}">
15-
<div class="alert-handle-line">
16-
</div>
17-
<div class="alert-handle">
18-
<i class="icon-gf icon-gf-${type} alert-icon-${type}"></i>
19-
${op} ${value}
20-
</div>
26+
${innerTemplate}
2127
</div>
2228
`;
2329
}
@@ -32,14 +38,12 @@ function dragEndHandler() {
3238
console.log('drag end');
3339
}
3440

35-
var past;
36-
3741
function drawAlertHandles(plot) {
3842
var options = plot.getOptions();
3943
var $placeholder = plot.getPlaceholder();
4044

4145
if (!options.alerting.editing) {
42-
$placeholder.find(".alert-handle").remove();
46+
$placeholder.find(".alert-handle-wrapper").remove();
4347
return;
4448
}
4549

@@ -55,16 +59,15 @@ function drawAlertHandles(plot) {
5559
}
5660

5761
if ($handle.length === 0) {
58-
console.log('not found');
59-
$handle = $(getHandleTemplate(type, model.op, model.level));
62+
console.log('creating handle');
63+
$handle = $(getFullHandleHtml(type, model.op, model.level));
6064
$handle.attr('draggable', true);
6165
$handle.bind('dragend', dragEndHandler);
6266
$handle.bind('dragstart', dragStartHandler);
6367
$placeholder.append($handle);
64-
console.log('registering drag events');
6568
} else {
66-
console.log('reusing!');
67-
$handle.html(getHandleTemplate(type, model.op, model.level));
69+
console.log('reusing handle!');
70+
$handle.html(getHandleInnerHtml(type, model.op, model.level));
6871
}
6972

7073
var levelCanvasPos = plot.p2c({x: 0, y: model.level});

public/sass/components/_panel_graph.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@
320320
user-select: none;
321321

322322
&--warn {
323-
right: -111px;
323+
right: -222px;
324324
width: 238px;
325325

326326
.alert-handle-line {
@@ -335,7 +335,7 @@
335335
}
336336

337337
&--critical {
338-
right: -54px;
338+
right: -105px;
339339
width: 123px;
340340

341341
.alert-handle-line {

0 commit comments

Comments
 (0)