Skip to content

Commit

Permalink
Modify popover logic in the timeline, move to 1.0.2 and fix layout of…
Browse files Browse the repository at this point in the history
… the filterbar
  • Loading branch information
dgutride committed Oct 7, 2016
1 parent ad54db0 commit a8f23c3
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
22 changes: 18 additions & 4 deletions app/assets/javascripts/miq_timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@

function eventClick(el) {
var table = '<table class="table table-striped table-bordered">';
console.log(el);
$(d3.event.target).popover('toggle');
$(d3.event.target).on('shown.bs.popover', function () {
$(document).on('click', hidePopover);
});

if (el.hasOwnProperty("events")) {
table = table + '<thead>This is a group of ' + el.events.length + ' events starting on ' + el.date.toLocaleString() + '</thead><tbody>';
table = table + '<tr><th>Date</th><th>Event</th></tr>'
Expand All @@ -33,7 +37,12 @@
table = table + el.details[i] + '<br>';
}
}
$('#chart_placeholder').append(table);
$('#legend').html(table);
}

function hidePopover() {
$('[data-toggle="popover"]').popover('hide');
$(document).off('click', hidePopover);
}

function createTooltip() {
Expand All @@ -42,6 +51,7 @@
}
$('[data-toggle="popover"]').popover({
'container': '#tl_div',
'trigger': 'manual',
'placement': 'top',
'html': true
});
Expand Down Expand Up @@ -73,9 +83,10 @@
data[x].display = true;
}
}
var timeSpanMilliseconds = end.getTime() - start.getTime();
timeline = d3.chart.timeline().end(end).start(start)
.minScale(one_week / one_month)
.maxScale(one_week / one_hour)
.minScale(1)
.maxScale(timeSpanMilliseconds / one_hour)
.eventGrouping(360000).labelWidth(170)
.eventPopover(handlePopover).eventClick(eventClick);

Expand All @@ -90,10 +101,13 @@

$('[data-toggle="popover"]').popover({
'container': '#tl_div',
'trigger': 'manual',
'placement': 'top',
'html': true
});

$('#chart_placeholder').append('<div id="legend"></div>');

$(window).on('resize', createTooltip);
}
};
Expand Down
14 changes: 12 additions & 2 deletions app/assets/stylesheets/timeline.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
.timeline-option {
display: inline-block;
margin-left: 30px;
margin-top: 10px;
margin-bottom: 15px;
}

.timeline-option .radio {
display: inline-block;
width: 150px;
margin-top: 0;
margin-bottom: 0;
margin-top: 0px;
margin-bottom: 0px;
}

.timeline-container {
Expand Down Expand Up @@ -65,4 +67,12 @@

.timeline-info {
padding-bottom: 10px;
}

.timeline-filterbar {
width: 740px;
}

.timeline-apply {
margin-left: 20px;
}
7 changes: 4 additions & 3 deletions app/views/layouts/_tl_options.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
.row
.col-sm-12.toolbar-pf-actions.timeline-toolbar
.form-group
%div
%div{'class' => 'timeline-filterbar'}
= select_tag("tl_show",
options_for_select(ApplicationController::Timelines::SELECT_EVENT_TYPE, nil),
'ng-model' => 'reportModel.tl_show',
Expand Down Expand Up @@ -83,9 +83,10 @@
'options' => 'dateOptions',
'date' => 'reportModel.tl_date',
'class' => 'pull-righto timeline-date-input'}
%div{'class' => 'pull-right'}
%div
.btn.btn-default{'ng-click' => 'applyButtonClicked()',
'ng-disabled' => 'reportModel.tl_categories.length === 0'}
'ng-disabled' => 'reportModel.tl_categories.length === 0',
'class' => 'timeline-apply'}
= _("Apply")
:javascript
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"rxjs": "^4.1.0",
"rx-angular": "rx.angular#^1.1.3",
"manageiq-ui-components": "~0.0.7",
"patternfly-timeline": "~1.0.1",
"patternfly-timeline": "~1.0.2",
"patternfly-bootstrap-treeview": "~2.1.0",
"jquery": "~2.1.4"
},
Expand Down

0 comments on commit a8f23c3

Please sign in to comment.