Add tool tip to Host Event lines.

This commit is contained in:
Alex Corey
2019-04-08 14:46:59 -04:00
parent 4f8b197b55
commit 4f55ffe4a0
2 changed files with 27 additions and 10 deletions
@@ -35,7 +35,7 @@ const hasAnsi = input => re.test(input);
let $scope;
function JobRenderService ($q, $compile, $sce, $window) {
function JobRenderService ($q, $compile, $sce, $window, strings) {
this.init = (_$scope_, { toggles }) => {
$scope = _$scope_;
this.setScope();
@@ -132,7 +132,7 @@ function JobRenderService ($q, $compile, $sce, $window) {
return { html: '', count: 0 };
}
const html = this.buildRowHTML(this.records[uuid]);
const html = this.buildRowHTML(this.records[uuid], null, null, event);
const count = 1;
return { html, count };
@@ -193,7 +193,7 @@ function JobRenderService ($q, $compile, $sce, $window) {
return { html: '', count: 0 };
}
const html = this.buildRowHTML(this.records[uuid]);
const html = this.buildRowHTML(this.records[uuid], null, null, event);
const count = 1;
return { html, count };
@@ -226,10 +226,10 @@ function JobRenderService ($q, $compile, $sce, $window) {
const line = lines[i];
const isLastLine = i === lines.length - 1;
let row = this.buildRowHTML(record, ln, line);
let row = this.buildRowHTML(record, ln, line, event);
if (record && record.isTruncated && isLastLine) {
row += this.buildRowHTML(record);
row += this.buildRowHTML(record, null, null, event);
count++;
}
@@ -340,7 +340,7 @@ function JobRenderService ($q, $compile, $sce, $window) {
return list;
};
this.buildRowHTML = (record, ln, content) => {
this.buildRowHTML = (record, ln, content, event) => {
let id = '';
let icon = '';
let timestamp = '';
@@ -407,14 +407,28 @@ function JobRenderService ($q, $compile, $sce, $window) {
}
return `
<div id="${id}" class="at-Stdout-row ${classList}" ${directives}>
<div id="${id}" class="at-Stdout-row ${classList}" ${directives} aw-tool-tip= '${this.createToolTip(event, record)}' aw-tip-placement="top">
${tdToggle}
<div class="at-Stdout-line">${ln}</div>
<div class="at-Stdout-event"><span ng-non-bindable>${content}</span></div>
<div class="at-Stdout-event">
<div>Host Status </div>
<div>Next line </div>
<div ng-non-bindable>${content}</div>
</div>
<div class="at-Stdout-time">${timestamp}</div>
</div>`;
};
this.createToolTip = (event, record) => {
const status = strings.get('tooltips.HOST_STATUS');
const eventID = strings.get('tooltips.EVENT_ID');
const clickForDetails = strings.get('tooltips.DETAILS');
return record.isClickable
? `${status} ${event.event_display}<br />${eventID} ${event.id}<br />${clickForDetails}`
: `${status} ${event.event_display}<br />${eventID} ${event.id}`;
};
this.getTimestamp = created => {
const date = new Date(created);
const hour = date.getHours() < 10 ? `0${date.getHours()}` : date.getHours();
@@ -608,6 +622,6 @@ function JobRenderService ($q, $compile, $sce, $window) {
this.getCapacity = () => OUTPUT_EVENT_LIMIT - (this.getTailCounter() - this.getHeadCounter());
}
JobRenderService.$inject = ['$q', '$compile', '$sce', '$window'];
JobRenderService.$inject = ['$q', '$compile', '$sce', '$window', 'OutputStrings'];
export default JobRenderService;