From 9e9862c6f04a37e5d6e5673328b9d4a12b9a2de1 Mon Sep 17 00:00:00 2001 From: Aditya Bist Date: Wed, 25 Apr 2018 12:20:46 -0700 Subject: [PATCH] Agent action icons fix (#1255) * change icon opacity based on job status * rid of magic numbers --- .../jobManagement/common/agentJobUtilities.ts | 40 +++++++++++++++++++ .../views/jobHistory.component.ts | 7 ++++ .../parts/jobManagement/views/jobHistory.css | 13 +++++- 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/src/sql/parts/jobManagement/common/agentJobUtilities.ts b/src/sql/parts/jobManagement/common/agentJobUtilities.ts index 6991ec6c48..70a564fbcc 100644 --- a/src/sql/parts/jobManagement/common/agentJobUtilities.ts +++ b/src/sql/parts/jobManagement/common/agentJobUtilities.ts @@ -9,6 +9,9 @@ import * as nls from 'vs/nls'; export class AgentJobUtilities { + public static startIconClass: string = 'icon-start'; + public static stopIconClass: string = 'icon-stop'; + public static convertToStatusString(status: number): string { switch(status) { case(0): return nls.localize('agentUtilities.failed','Failed'); @@ -51,4 +54,41 @@ export class AgentJobUtilities { return date; } } + + public static setRunnable(icon: HTMLElement, index: number) { + if (icon.className.includes('non-runnable')) { + icon.className = icon.className.slice(0, index); + } + } + + public static getActionIconClassName(startIcon: HTMLElement, stopIcon: HTMLElement, executionStatus: number) { + this.setRunnable(startIcon, AgentJobUtilities.startIconClass.length); + this.setRunnable(stopIcon, AgentJobUtilities.stopIconClass.length); + switch (executionStatus) { + case(1): // executing + startIcon.className += ' non-runnable'; + return; + case(2): // Waiting for thread + startIcon.className += ' non-runnable'; + return; + case(3): // Between retries + startIcon.className += ' non-runnable'; + return; + case(4): //Idle + stopIcon.className += ' non-runnable'; + return; + case(5): // Suspended + stopIcon.className += ' non-runnable'; + return; + case(6): //obsolete + startIcon.className += ' non-runnable'; + stopIcon.className += ' non-runnable'; + return; + case(7): //Performing Completion Actions + startIcon.className += ' non-runnable'; + return; + default: + return; + } + } } \ No newline at end of file diff --git a/src/sql/parts/jobManagement/views/jobHistory.component.ts b/src/sql/parts/jobManagement/views/jobHistory.component.ts index 7a581f1764..929bba2dc7 100644 --- a/src/sql/parts/jobManagement/views/jobHistory.component.ts +++ b/src/sql/parts/jobManagement/views/jobHistory.component.ts @@ -131,6 +131,7 @@ export class JobHistoryComponent extends Disposable implements OnInit { this._agentJobInfo = this._agentViewComponent.agentJobInfo; if (!this.agentJobInfo) { this.agentJobInfo = this._agentJobInfo; + this.setActions(); } if (this._isVisible === false && this._tableContainer.nativeElement.offsetParent !== null) { this._isVisible = true; @@ -273,6 +274,12 @@ export class JobHistoryComponent extends Disposable implements OnInit { return time.replace('T', ' '); } + private setActions(): void { + let startIcon: HTMLElement = $('.icon-start').get(0); + let stopIcon: HTMLElement = $('.icon-stop').get(0); + AgentJobUtilities.getActionIconClassName(startIcon, stopIcon, this.agentJobInfo.currentExecutionStatus); + } + public get showSteps(): boolean { return this._showSteps; } diff --git a/src/sql/parts/jobManagement/views/jobHistory.css b/src/sql/parts/jobManagement/views/jobHistory.css index 8e3aaf26a5..7b1eb61e11 100644 --- a/src/sql/parts/jobManagement/views/jobHistory.css +++ b/src/sql/parts/jobManagement/views/jobHistory.css @@ -29,7 +29,6 @@ ul.action-buttons li { padding-right: 25px; display: inline-block; width: 50px; - cursor: pointer; } .overview-container .overview-tab .resultsViewCollapsible { @@ -134,6 +133,7 @@ input#accordion:checked ~ .accordion-content { width: 20px; background-image: url('../common/media/start.svg'); background-repeat: no-repeat; + cursor: pointer; } .vs ul.action-buttons .icon-stop, @@ -144,6 +144,17 @@ input#accordion:checked ~ .accordion-content { background-repeat: no-repeat; height: 20px; width: 20px; + cursor: pointer; +} + +ul.action-buttons div.icon-start.non-runnable { + opacity: 0.4; + cursor: default; +} + +ul.action-buttons div.icon-stop.non-runnable { + opacity: 0.4; + cursor: default; } .accordion-content #col1,