From 4f55ffe4a0b7f524059854d1335bdbbb87c38541 Mon Sep 17 00:00:00 2001 From: Alex Corey Date: Mon, 8 Apr 2019 14:46:59 -0400 Subject: [PATCH 1/2] Add tool tip to Host Event lines. --- .../client/features/output/output.strings.js | 5 ++- .../client/features/output/render.service.js | 32 +++++++++++++------ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/awx/ui/client/features/output/output.strings.js b/awx/ui/client/features/output/output.strings.js index 982070837e..822bb61dd1 100644 --- a/awx/ui/client/features/output/output.strings.js +++ b/awx/ui/client/features/output/output.strings.js @@ -17,12 +17,15 @@ function OutputStrings (BaseString) { ARTIFACTS: t.s('Read-only view of artifacts added to the job template'), CANCEL: t.s('Cancel'), COLLAPSE_OUTPUT: t.s('Collapse Output'), + CREDENTIAL: t.s('View the Credential'), + DETAILS: t.s('Click for details'), DELETE: t.s('Delete'), DOWNLOAD_OUTPUT: t.s('Download Output'), - CREDENTIAL: t.s('View the Credential'), + EVENT_ID: t.s('Event ID:'), EXPAND_OUTPUT: t.s('Expand Output'), EXTRA_VARS: t.s('Read-only view of extra variables added to the job template'), HOST_LIMIT: t.s('When this field is true, the job\'s inventory belongs to an organization that has exceeded it\'s limit of hosts as defined by the system administrator.'), + HOST_STATUS: t.s('Status:'), INVENTORY: t.s('View the Inventory'), INVENTORY_SCM: t.s('View the Project'), INVENTORY_SCM_JOB: t.s('View Project checkout results'), diff --git a/awx/ui/client/features/output/render.service.js b/awx/ui/client/features/output/render.service.js index 8598d6ba3e..315ad4c925 100644 --- a/awx/ui/client/features/output/render.service.js +++ b/awx/ui/client/features/output/render.service.js @@ -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 ` -
+
${tdToggle}
${ln}
-
${content}
+
+
Host Status
+
Next line
+
${content}
+
${timestamp}
`; }; + 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}
${eventID} ${event.id}
${clickForDetails}` + : `${status} ${event.event_display}
${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; From 75a1c69ea23b8ae353f6dd610042f67298e511cb Mon Sep 17 00:00:00 2001 From: Alex Corey Date: Tue, 9 Apr 2019 11:01:50 -0400 Subject: [PATCH 2/2] address concerns in PR --- awx/ui/client/features/output/render.service.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/awx/ui/client/features/output/render.service.js b/awx/ui/client/features/output/render.service.js index 315ad4c925..0655dd0c71 100644 --- a/awx/ui/client/features/output/render.service.js +++ b/awx/ui/client/features/output/render.service.js @@ -347,7 +347,7 @@ function JobRenderService ($q, $compile, $sce, $window, strings) { let tdToggle = ''; let tdEvent = ''; let classList = ''; - let directives = ''; + let directives = `aw-tool-tip="${this.createToolTip(event, record)}" aw-tip-placement="top"`; if (record.isMissing) { return `
@@ -403,20 +403,17 @@ function JobRenderService ($q, $compile, $sce, $window, strings) { if (record && record.isClickable) { classList += ' at-Stdout-row--clickable'; - directives = `ng-click="vm.showHostDetails('${record.id}', '${record.uuid}')"`; + directives += ` ng-click="vm.showHostDetails('${record.id}', '${record.uuid}')" + `; } - return ` -
+
${tdToggle}
${ln}
-
-
Host Status
-
Next line
-
${content}
-
+
${content}
${timestamp}
-
`; +
+ `; }; this.createToolTip = (event, record) => {