Agent - stop job (#4410)

* stop job behavior similar to ssms

* removed agent from sqlops

* fix couple UX issues

* let sqlops remain unchanged
This commit is contained in:
Aditya Bist
2019-03-29 13:42:34 -07:00
committed by GitHub
parent b04ca0fdbd
commit e70d5838a8
6 changed files with 15 additions and 16 deletions

View File

@@ -1503,9 +1503,9 @@ declare module 'azdata' {
export interface AgentJobHistoryResult extends ResultStatus { export interface AgentJobHistoryResult extends ResultStatus {
histories: AgentJobHistoryInfo[]; histories: AgentJobHistoryInfo[];
steps: AgentJobStepInfo[];
schedules: AgentJobScheduleInfo[]; schedules: AgentJobScheduleInfo[];
alerts: AgentAlertInfo[]; alerts: AgentAlertInfo[];
steps: AgentJobStepInfo[];
} }
export interface CreateAgentJobResult extends ResultStatus { export interface CreateAgentJobResult extends ResultStatus {

View File

@@ -184,10 +184,16 @@ export class JobHistoryComponent extends JobManagementView implements OnInit {
}); });
} }
private setStepsTree(element: any) { private setStepsTree(element: JobHistoryRow) {
const self = this; const self = this;
self.agentJobHistoryInfo = self._treeController.jobHistories.find( let cachedHistory = self._jobCacheObject.getJobHistory(element.jobID);
if (cachedHistory) {
self.agentJobHistoryInfo = cachedHistory.find(
history => self.formatTime(history.runDate) === self.formatTime(element.runDate)); history => self.formatTime(history.runDate) === self.formatTime(element.runDate));
} else {
self.agentJobHistoryInfo = self._treeController.jobHistories.find(
history => self.formatTime(history.runDate) === self.formatTime(element.runDate));
}
if (self.agentJobHistoryInfo) { if (self.agentJobHistoryInfo) {
self.agentJobHistoryInfo.runDate = self.formatTime(self.agentJobHistoryInfo.runDate); self.agentJobHistoryInfo.runDate = self.formatTime(self.agentJobHistoryInfo.runDate);
if (self.agentJobHistoryInfo.steps) { if (self.agentJobHistoryInfo.steps) {
@@ -264,6 +270,7 @@ export class JobHistoryComponent extends JobManagementView implements OnInit {
jobHistoryRow.runDate = this.formatTime(historyInfo.runDate); jobHistoryRow.runDate = this.formatTime(historyInfo.runDate);
jobHistoryRow.runStatus = JobManagementUtilities.convertToStatusString(historyInfo.runStatus); jobHistoryRow.runStatus = JobManagementUtilities.convertToStatusString(historyInfo.runStatus);
jobHistoryRow.instanceID = historyInfo.instanceId; jobHistoryRow.instanceID = historyInfo.instanceId;
jobHistoryRow.jobID = historyInfo.jobId;
return jobHistoryRow; return jobHistoryRow;
} }
@@ -334,15 +341,6 @@ export class JobHistoryComponent extends JobManagementView implements OnInit {
protected initActionBar() { protected initActionBar() {
let runJobAction = this.instantiationService.createInstance(RunJobAction); let runJobAction = this.instantiationService.createInstance(RunJobAction);
let stopJobAction = this.instantiationService.createInstance(StopJobAction); let stopJobAction = this.instantiationService.createInstance(StopJobAction);
switch(this._agentJobInfo.currentExecutionStatus) {
case(1):
case(2):
case(3):
stopJobAction.enabled = true;
break;
default:
stopJobAction.enabled = false;
}
let editJobAction = this.instantiationService.createInstance(EditJobAction); let editJobAction = this.instantiationService.createInstance(EditJobAction);
let refreshAction = this.instantiationService.createInstance(JobsRefreshAction); let refreshAction = this.instantiationService.createInstance(JobsRefreshAction);
let taskbar = <HTMLElement>this.actionBarContainer.nativeElement; let taskbar = <HTMLElement>this.actionBarContainer.nativeElement;

View File

@@ -20,6 +20,7 @@ export class JobHistoryRow {
runStatus: string; runStatus: string;
instanceID: number; instanceID: number;
rowID: string = generateUuid(); rowID: string = generateUuid();
jobID: string;
} }
// Empty class just for tree input // Empty class just for tree input

View File

@@ -61,7 +61,6 @@ export class JobStepsViewComponent extends JobManagementView implements OnInit,
ngAfterContentChecked() { ngAfterContentChecked() {
$('.steps-tree .step-column-heading').closest('.monaco-tree-row').addClass('step-column-row'); $('.steps-tree .step-column-heading').closest('.monaco-tree-row').addClass('step-column-row');
this.layout(); this.layout();
this._tree.setInput(new JobStepsViewModel());
this._tree.onDidScroll(() => { this._tree.onDidScroll(() => {
$('.steps-tree .step-column-heading').closest('.monaco-tree-row').addClass('step-column-row'); $('.steps-tree .step-column-heading').closest('.monaco-tree-row').addClass('step-column-row');
}); });
@@ -94,6 +93,7 @@ export class JobStepsViewComponent extends JobManagementView implements OnInit,
let element = this._tree.getFocus(); let element = this._tree.getFocus();
this._tree.select(element); this._tree.select(element);
}); });
this._tree.setInput(new JobStepsViewModel());
} }
ngOnInit() { ngOnInit() {

View File

@@ -622,7 +622,7 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
let chartHeights = this.getChartHeights(jobHistories); let chartHeights = this.getChartHeights(jobHistories);
let runCharts = []; let runCharts = [];
for (let i = 0; i < chartHeights.length; i++) { for (let i = 0; i < chartHeights.length; i++) {
let runGraph = $(`table#${jobId}.jobprevruns > tbody > tr > td > div.bar${i}`); let runGraph = $(`table.jobprevruns#${jobId} > tbody > tr > td > div.bar${i}`);
if (runGraph.length > 0) { if (runGraph.length > 0) {
runGraph.css('height', chartHeights[i]); runGraph.css('height', chartHeights[i]);
let bgColor = jobHistories[i].runStatus === 0 ? 'red' : 'green'; let bgColor = jobHistories[i].runStatus === 0 ? 'red' : 'green';
@@ -666,7 +666,7 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
// if the durations are all 0 secs, show minimal chart // if the durations are all 0 secs, show minimal chart
// instead of nothing // instead of nothing
if (zeroDurationJobCount === jobHistories.length) { if (zeroDurationJobCount === jobHistories.length) {
return ['5px', '5px', '5px', '5px', '5px']; return Array(jobHistories.length).fill('5px');
} else { } else {
return chartHeights; return chartHeights;
} }

View File

@@ -165,7 +165,7 @@ export class EditJobAction extends Action {
this._commandService.executeCommand( this._commandService.executeCommand(
'agent.openJobDialog', 'agent.openJobDialog',
actionInfo.ownerUri, actionInfo.ownerUri,
actionInfo.targetObject); actionInfo.targetObject.job);
return Promise.resolve(true); return Promise.resolve(true);
} }
} }