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 {
histories: AgentJobHistoryInfo[];
steps: AgentJobStepInfo[];
schedules: AgentJobScheduleInfo[];
alerts: AgentAlertInfo[];
steps: AgentJobStepInfo[];
}
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;
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));
} else {
self.agentJobHistoryInfo = self._treeController.jobHistories.find(
history => self.formatTime(history.runDate) === self.formatTime(element.runDate));
}
if (self.agentJobHistoryInfo) {
self.agentJobHistoryInfo.runDate = self.formatTime(self.agentJobHistoryInfo.runDate);
if (self.agentJobHistoryInfo.steps) {
@@ -264,6 +270,7 @@ export class JobHistoryComponent extends JobManagementView implements OnInit {
jobHistoryRow.runDate = this.formatTime(historyInfo.runDate);
jobHistoryRow.runStatus = JobManagementUtilities.convertToStatusString(historyInfo.runStatus);
jobHistoryRow.instanceID = historyInfo.instanceId;
jobHistoryRow.jobID = historyInfo.jobId;
return jobHistoryRow;
}
@@ -334,15 +341,6 @@ export class JobHistoryComponent extends JobManagementView implements OnInit {
protected initActionBar() {
let runJobAction = this.instantiationService.createInstance(RunJobAction);
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 refreshAction = this.instantiationService.createInstance(JobsRefreshAction);
let taskbar = <HTMLElement>this.actionBarContainer.nativeElement;

View File

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

View File

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

View File

@@ -622,7 +622,7 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
let chartHeights = this.getChartHeights(jobHistories);
let runCharts = [];
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) {
runGraph.css('height', chartHeights[i]);
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
// instead of nothing
if (zeroDurationJobCount === jobHistories.length) {
return ['5px', '5px', '5px', '5px', '5px'];
return Array(jobHistories.length).fill('5px');
} else {
return chartHeights;
}

View File

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