mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Agent/history update (#2756)
* refresh history when job is run * refresh history and jobs when stopped
This commit is contained in:
@@ -16,6 +16,7 @@ import { JobsViewComponent } from '../views/jobsView.component';
|
|||||||
import { AlertsViewComponent } from 'sql/parts/jobManagement/views/alertsView.component';
|
import { AlertsViewComponent } from 'sql/parts/jobManagement/views/alertsView.component';
|
||||||
import { OperatorsViewComponent } from 'sql/parts/jobManagement/views/operatorsView.component';
|
import { OperatorsViewComponent } from 'sql/parts/jobManagement/views/operatorsView.component';
|
||||||
import { ProxiesViewComponent } from 'sql/parts/jobManagement/views/proxiesView.component';
|
import { ProxiesViewComponent } from 'sql/parts/jobManagement/views/proxiesView.component';
|
||||||
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
|
|
||||||
export enum JobActions {
|
export enum JobActions {
|
||||||
Run = 'run',
|
Run = 'run',
|
||||||
@@ -38,7 +39,7 @@ export class JobsRefreshAction extends Action {
|
|||||||
super(JobsRefreshAction.ID, JobsRefreshAction.LABEL, 'refreshIcon');
|
super(JobsRefreshAction.ID, JobsRefreshAction.LABEL, 'refreshIcon');
|
||||||
}
|
}
|
||||||
|
|
||||||
public run(context: JobsViewComponent): TPromise<boolean> {
|
public run(context: JobsViewComponent | JobHistoryComponent): TPromise<boolean> {
|
||||||
return new TPromise<boolean>((resolve, reject) => {
|
return new TPromise<boolean>((resolve, reject) => {
|
||||||
if (context) {
|
if (context) {
|
||||||
context.refreshJobs();
|
context.refreshJobs();
|
||||||
@@ -77,7 +78,8 @@ export class RunJobAction extends Action {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@INotificationService private notificationService: INotificationService,
|
@INotificationService private notificationService: INotificationService,
|
||||||
@IJobManagementService private jobManagementService: IJobManagementService
|
@IJobManagementService private jobManagementService: IJobManagementService,
|
||||||
|
@IInstantiationService private instantationService: IInstantiationService
|
||||||
) {
|
) {
|
||||||
super(RunJobAction.ID, RunJobAction.LABEL, 'runJobIcon');
|
super(RunJobAction.ID, RunJobAction.LABEL, 'runJobIcon');
|
||||||
}
|
}
|
||||||
@@ -85,9 +87,11 @@ export class RunJobAction extends Action {
|
|||||||
public run(context: JobHistoryComponent): TPromise<boolean> {
|
public run(context: JobHistoryComponent): TPromise<boolean> {
|
||||||
let jobName = context.agentJobInfo.name;
|
let jobName = context.agentJobInfo.name;
|
||||||
let ownerUri = context.ownerUri;
|
let ownerUri = context.ownerUri;
|
||||||
|
let refreshAction = this.instantationService.createInstance(JobsRefreshAction);
|
||||||
return new TPromise<boolean>((resolve, reject) => {
|
return new TPromise<boolean>((resolve, reject) => {
|
||||||
this.jobManagementService.jobAction(ownerUri, jobName, JobActions.Run).then(result => {
|
this.jobManagementService.jobAction(ownerUri, jobName, JobActions.Run).then(result => {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
|
refreshAction.run(context);
|
||||||
var startMsg = nls.localize('jobSuccessfullyStarted', ': The job was successfully started.');
|
var startMsg = nls.localize('jobSuccessfullyStarted', ': The job was successfully started.');
|
||||||
this.notificationService.notify({
|
this.notificationService.notify({
|
||||||
severity: Severity.Info,
|
severity: Severity.Info,
|
||||||
@@ -112,7 +116,8 @@ export class StopJobAction extends Action {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@INotificationService private notificationService: INotificationService,
|
@INotificationService private notificationService: INotificationService,
|
||||||
@IJobManagementService private jobManagementService: IJobManagementService
|
@IJobManagementService private jobManagementService: IJobManagementService,
|
||||||
|
@IInstantiationService private instantationService: IInstantiationService
|
||||||
) {
|
) {
|
||||||
super(StopJobAction.ID, StopJobAction.LABEL, 'stopJobIcon');
|
super(StopJobAction.ID, StopJobAction.LABEL, 'stopJobIcon');
|
||||||
}
|
}
|
||||||
@@ -120,14 +125,16 @@ export class StopJobAction extends Action {
|
|||||||
public run(context: JobHistoryComponent): TPromise<boolean> {
|
public run(context: JobHistoryComponent): TPromise<boolean> {
|
||||||
let jobName = context.agentJobInfo.name;
|
let jobName = context.agentJobInfo.name;
|
||||||
let ownerUri = context.ownerUri;
|
let ownerUri = context.ownerUri;
|
||||||
|
let refreshAction = this.instantationService.createInstance(JobsRefreshAction);
|
||||||
return new TPromise<boolean>((resolve, reject) => {
|
return new TPromise<boolean>((resolve, reject) => {
|
||||||
this.jobManagementService.jobAction(ownerUri, jobName, JobActions.Stop).then(result => {
|
this.jobManagementService.jobAction(ownerUri, jobName, JobActions.Stop).then(result => {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
var stopMsg = nls.localize('jobSuccessfullyStopped', ': The job was successfully stopped.');
|
refreshAction.run(context);
|
||||||
this.notificationService.notify({
|
var stopMsg = nls.localize('jobSuccessfullyStopped', ': The job was successfully stopped.');
|
||||||
severity: Severity.Info,
|
this.notificationService.notify({
|
||||||
message: jobName+ stopMsg
|
severity: Severity.Info,
|
||||||
});
|
message: jobName+ stopMsg
|
||||||
|
});
|
||||||
resolve(true);
|
resolve(true);
|
||||||
} else {
|
} else {
|
||||||
this.notificationService.notify({
|
this.notificationService.notify({
|
||||||
|
|||||||
@@ -315,6 +315,10 @@ export class JobHistoryComponent extends JobManagementView implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public refreshJobs() {
|
||||||
|
this._agentViewComponent.refresh = true;
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
@@ -353,4 +357,5 @@ export class JobHistoryComponent extends JobManagementView implements OnInit {
|
|||||||
this._showSteps = value;
|
this._showSteps = value;
|
||||||
this._cd.detectChanges();
|
this._cd.detectChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user