mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Agent - committer work (#4758)
* fix delete job * added the ability to change and retrieve jobowner * fixed UX for delete step * improved operator actions * fixed operators and proxies * added errors for failures
This commit is contained in:
@@ -108,6 +108,7 @@ export class JobData implements IAgentDialogData {
|
|||||||
this._defaultOwner = jobDefaults.owner;
|
this._defaultOwner = jobDefaults.owner;
|
||||||
|
|
||||||
this._operators = ['', this._defaultOwner];
|
this._operators = ['', this._defaultOwner];
|
||||||
|
this.owner = this.owner ? this.owner : this._defaultOwner;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._jobCompletionActionConditions = [{
|
this._jobCompletionActionConditions = [{
|
||||||
@@ -128,8 +129,22 @@ export class JobData implements IAgentDialogData {
|
|||||||
? await this._agentService.createJob(this.ownerUri, jobInfo)
|
? await this._agentService.createJob(this.ownerUri, jobInfo)
|
||||||
: await this._agentService.updateJob(this.ownerUri, this.originalName, jobInfo);
|
: await this._agentService.updateJob(this.ownerUri, this.originalName, jobInfo);
|
||||||
if (!result || !result.success) {
|
if (!result || !result.success) {
|
||||||
|
if (this.dialogMode === AgentDialogMode.EDIT) {
|
||||||
vscode.window.showErrorMessage(
|
vscode.window.showErrorMessage(
|
||||||
localize('jobData.saveErrorMessage', "Job update failed '{0}'", result.errorMessage ? result.errorMessage : 'Unknown'));
|
localize('jobData.saveErrorMessage', "Job update failed '{0}'", result.errorMessage ? result.errorMessage : 'Unknown'));
|
||||||
|
} else {
|
||||||
|
vscode.window.showErrorMessage(
|
||||||
|
localize('jobData.newJobErrorMessage', "Job creation failed '{0}'", result.errorMessage ? result.errorMessage : 'Unknown'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (this.dialogMode === AgentDialogMode.EDIT) {
|
||||||
|
vscode.window.showInformationMessage(
|
||||||
|
localize('jobData.saveSucessMessage', "Job '{0}' updated successfully", jobInfo.name));
|
||||||
|
} else {
|
||||||
|
vscode.window.showInformationMessage(
|
||||||
|
localize('jobData.newJobSuccessMessage',"Job '{0}' created successfully", jobInfo.name));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +164,7 @@ export class JobData implements IAgentDialogData {
|
|||||||
public toAgentJobInfo(): azdata.AgentJobInfo {
|
public toAgentJobInfo(): azdata.AgentJobInfo {
|
||||||
return {
|
return {
|
||||||
name: this.name,
|
name: this.name,
|
||||||
owner: this.owner,
|
owner: this.owner ? this.owner : this.defaultOwner,
|
||||||
description: this.description,
|
description: this.description,
|
||||||
emailLevel: this.emailLevel,
|
emailLevel: this.emailLevel,
|
||||||
pageLevel: this.pageLevel,
|
pageLevel: this.pageLevel,
|
||||||
|
|||||||
@@ -31,11 +31,25 @@ export class OperatorData implements IAgentDialogData {
|
|||||||
|
|
||||||
constructor(ownerUri:string, operatorInfo: azdata.AgentOperatorInfo) {
|
constructor(ownerUri:string, operatorInfo: azdata.AgentOperatorInfo) {
|
||||||
this.ownerUri = ownerUri;
|
this.ownerUri = ownerUri;
|
||||||
|
|
||||||
if (operatorInfo) {
|
if (operatorInfo) {
|
||||||
this.dialogMode = AgentDialogMode.EDIT;
|
this.dialogMode = AgentDialogMode.EDIT;
|
||||||
this.name = operatorInfo.name;
|
this.name = operatorInfo.name;
|
||||||
|
this.id = operatorInfo.id;
|
||||||
|
this.emailAddress = operatorInfo.emailAddress;
|
||||||
this.enabled = operatorInfo.enabled;
|
this.enabled = operatorInfo.enabled;
|
||||||
|
this.lastEmailDate = operatorInfo.lastEmailDate;
|
||||||
|
this.lastNetSendDate = operatorInfo.lastNetSendDate;
|
||||||
|
this.lastPagerDate = operatorInfo.lastPagerDate;
|
||||||
|
this.pagerAddress = operatorInfo.pagerAddress;
|
||||||
|
this.categoryName = operatorInfo.categoryName;
|
||||||
|
this.pagerDays = operatorInfo.pagerDays.toString();
|
||||||
|
this.saturdayPagerEndTime = operatorInfo.saturdayPagerEndTime;
|
||||||
|
this.saturdayPagerStartTime = operatorInfo.saturdayPagerStartTime;
|
||||||
|
this.sundayPagerEndTime = operatorInfo.sundayPagerEndTime;
|
||||||
|
this.sundayPagerStartTime = operatorInfo.sundayPagerStartTime;
|
||||||
|
this.netSendAddress = operatorInfo.netSendAddress;
|
||||||
|
this.weekdayPagerStartTime = operatorInfo.weekdayPagerStartTime;
|
||||||
|
this.weekdayPagerEndTime = operatorInfo.weekdayPagerEndTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,12 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
import * as nls from 'vscode-nls';
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
|
import * as vscode from 'vscode';
|
||||||
import { AgentUtils } from '../agentUtils';
|
import { AgentUtils } from '../agentUtils';
|
||||||
import { IAgentDialogData, AgentDialogMode } from '../interfaces';
|
import { IAgentDialogData, AgentDialogMode } from '../interfaces';
|
||||||
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
export class ProxyData implements IAgentDialogData {
|
export class ProxyData implements IAgentDialogData {
|
||||||
public dialogMode: AgentDialogMode = AgentDialogMode.CREATE;
|
public dialogMode: AgentDialogMode = AgentDialogMode.CREATE;
|
||||||
@@ -34,9 +37,20 @@ export class ProxyData implements IAgentDialogData {
|
|||||||
|
|
||||||
public async save() {
|
public async save() {
|
||||||
let agentService = await AgentUtils.getAgentService();
|
let agentService = await AgentUtils.getAgentService();
|
||||||
let result = await agentService.createProxy(this.ownerUri, this.toAgentProxyInfo());
|
let proxyInfo = this.toAgentProxyInfo();
|
||||||
|
let result = await agentService.createProxy(this.ownerUri, proxyInfo);
|
||||||
if (!result || !result.success) {
|
if (!result || !result.success) {
|
||||||
// TODO handle error here
|
vscode.window.showErrorMessage(
|
||||||
|
localize('proxyData.saveErrorMessage', "Proxy update failed '{0}'", result.errorMessage ? result.errorMessage : 'Unknown'));
|
||||||
|
} else {
|
||||||
|
if (this.dialogMode === AgentDialogMode.EDIT) {
|
||||||
|
vscode.window.showInformationMessage(
|
||||||
|
localize('proxyData.saveSucessMessage', "Proxy '{0}' updated successfully", proxyInfo.accountName));
|
||||||
|
} else {
|
||||||
|
vscode.window.showInformationMessage(
|
||||||
|
localize('proxyData.newJobSuccessMessage',"Proxy '{0}' created successfully", proxyInfo.accountName));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ export class JobDialog extends AgentDialog<JobData> {
|
|||||||
await view.initializeModel(formModel);
|
await view.initializeModel(formModel);
|
||||||
|
|
||||||
this.nameTextBox.value = this.model.name;
|
this.nameTextBox.value = this.model.name;
|
||||||
this.ownerTextBox.value = this.model.defaultOwner;
|
this.ownerTextBox.value = this.model.owner;
|
||||||
this.categoryDropdown.values = this.model.jobCategories;
|
this.categoryDropdown.values = this.model.jobCategories;
|
||||||
|
|
||||||
let idx: number = undefined;
|
let idx: number = undefined;
|
||||||
@@ -349,13 +349,13 @@ export class JobDialog extends AgentDialog<JobData> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.deleteStepButton.onDidClick(() => {
|
this.deleteStepButton.onDidClick(async() => {
|
||||||
if (this.stepsTable.selectedRows.length === 1) {
|
if (this.stepsTable.selectedRows.length === 1) {
|
||||||
let rowNumber = this.stepsTable.selectedRows[0];
|
let rowNumber = this.stepsTable.selectedRows[0];
|
||||||
AgentUtils.getAgentService().then((agentService) => {
|
AgentUtils.getAgentService().then(async (agentService) => {
|
||||||
let stepData = this.steps[rowNumber];
|
let stepData = this.steps[rowNumber];
|
||||||
if (stepData.jobId) {
|
if (stepData.jobId) {
|
||||||
agentService.deleteJobStep(this.ownerUri, stepData).then((result) => {
|
await agentService.deleteJobStep(this.ownerUri, stepData).then((result) => {
|
||||||
if (result && result.success) {
|
if (result && result.success) {
|
||||||
this.steps.splice(rowNumber, 1);
|
this.steps.splice(rowNumber, 1);
|
||||||
let data = this.convertStepsToData(this.steps);
|
let data = this.convertStepsToData(this.steps);
|
||||||
|
|||||||
@@ -97,20 +97,18 @@ export class OperatorDialog extends AgentDialog<OperatorData> {
|
|||||||
this.generalTab.registerContent(async view => {
|
this.generalTab.registerContent(async view => {
|
||||||
|
|
||||||
this.nameTextBox = view.modelBuilder.inputBox().component();
|
this.nameTextBox = view.modelBuilder.inputBox().component();
|
||||||
|
this.nameTextBox.value = this.model.name;
|
||||||
this.enabledCheckBox = view.modelBuilder.checkBox()
|
|
||||||
.withProperties({
|
|
||||||
label: OperatorDialog.EnabledCheckboxLabel
|
|
||||||
}).component();
|
|
||||||
this.enabledCheckBox.checked = true;
|
|
||||||
this.emailNameTextBox = view.modelBuilder.inputBox().component();
|
this.emailNameTextBox = view.modelBuilder.inputBox().component();
|
||||||
|
this.emailNameTextBox.value = this.model.emailAddress;
|
||||||
|
|
||||||
this.pagerEmailNameTextBox = view.modelBuilder.inputBox().component();
|
this.pagerEmailNameTextBox = view.modelBuilder.inputBox().component();
|
||||||
|
this.pagerEmailNameTextBox.value = this.model.pagerAddress;
|
||||||
|
|
||||||
this.enabledCheckBox = view.modelBuilder.checkBox()
|
this.enabledCheckBox = view.modelBuilder.checkBox()
|
||||||
.withProperties({
|
.withProperties({
|
||||||
label: OperatorDialog.EnabledCheckboxLabel
|
label: OperatorDialog.EnabledCheckboxLabel
|
||||||
}).component();
|
}).component();
|
||||||
|
this.enabledCheckBox.checked = this.model.enabled;
|
||||||
|
|
||||||
this.pagerMondayCheckBox = view.modelBuilder.checkBox()
|
this.pagerMondayCheckBox = view.modelBuilder.checkBox()
|
||||||
.withProperties({
|
.withProperties({
|
||||||
@@ -367,7 +365,6 @@ export class OperatorDialog extends AgentDialog<OperatorData> {
|
|||||||
}] ,
|
}] ,
|
||||||
title: OperatorDialog.PagerDutyScheduleLabel
|
title: OperatorDialog.PagerDutyScheduleLabel
|
||||||
}]).withLayout({ width: '100%' }).component();
|
}]).withLayout({ width: '100%' }).component();
|
||||||
|
|
||||||
await view.initializeModel(formModel);
|
await view.initializeModel(formModel);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,35 +38,35 @@ export class MainController {
|
|||||||
* Activates the extension
|
* Activates the extension
|
||||||
*/
|
*/
|
||||||
public activate(): void {
|
public activate(): void {
|
||||||
vscode.commands.registerCommand('agent.openJobDialog', (ownerUri: string, jobInfo: azdata.AgentJobInfo) => {
|
vscode.commands.registerCommand('agent.openJobDialog', async (ownerUri: string, jobInfo: azdata.AgentJobInfo) => {
|
||||||
let dialog = new JobDialog(ownerUri, jobInfo);
|
let dialog = new JobDialog(ownerUri, jobInfo);
|
||||||
dialog.dialogName ? dialog.openDialog(dialog.dialogName) : dialog.openDialog();
|
dialog.dialogName ? await dialog.openDialog(dialog.dialogName) : await dialog.openDialog();
|
||||||
});
|
});
|
||||||
vscode.commands.registerCommand('agent.openNewStepDialog', (ownerUri: string, server: string, jobInfo: azdata.AgentJobInfo, jobStepInfo: azdata.AgentJobStepInfo) => {
|
vscode.commands.registerCommand('agent.openNewStepDialog', (ownerUri: string, server: string, jobInfo: azdata.AgentJobInfo, jobStepInfo: azdata.AgentJobStepInfo) => {
|
||||||
AgentUtils.getAgentService().then((agentService) => {
|
AgentUtils.getAgentService().then(async(agentService) => {
|
||||||
let jobData: JobData = new JobData(ownerUri, jobInfo, agentService);
|
let jobData: JobData = new JobData(ownerUri, jobInfo, agentService);
|
||||||
let dialog = new JobStepDialog(ownerUri, server, jobData, jobStepInfo, false);
|
let dialog = new JobStepDialog(ownerUri, server, jobData, jobStepInfo, false);
|
||||||
dialog.dialogName ? dialog.openDialog(dialog.dialogName) : dialog.openDialog();
|
dialog.dialogName ? await dialog.openDialog(dialog.dialogName) : await dialog.openDialog();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
vscode.commands.registerCommand('agent.openPickScheduleDialog', (ownerUri: string, jobName: string) => {
|
vscode.commands.registerCommand('agent.openPickScheduleDialog', async (ownerUri: string, jobName: string) => {
|
||||||
let dialog = new PickScheduleDialog(ownerUri, jobName);
|
let dialog = new PickScheduleDialog(ownerUri, jobName);
|
||||||
dialog.showDialog();
|
await dialog.showDialog();
|
||||||
});
|
});
|
||||||
vscode.commands.registerCommand('agent.openAlertDialog', (ownerUri: string, jobInfo: azdata.AgentJobInfo, alertInfo: azdata.AgentAlertInfo) => {
|
vscode.commands.registerCommand('agent.openAlertDialog', (ownerUri: string, jobInfo: azdata.AgentJobInfo, alertInfo: azdata.AgentAlertInfo) => {
|
||||||
AgentUtils.getAgentService().then((agentService) => {
|
AgentUtils.getAgentService().then(async (agentService) => {
|
||||||
let jobData: JobData = new JobData(ownerUri, jobInfo, agentService);
|
let jobData: JobData = new JobData(ownerUri, jobInfo, agentService);
|
||||||
let dialog = new AlertDialog(ownerUri, jobData, alertInfo, false);
|
let dialog = new AlertDialog(ownerUri, jobData, alertInfo, false);
|
||||||
dialog.dialogName ? dialog.openDialog(dialog.dialogName) : dialog.openDialog();
|
dialog.dialogName ? await dialog.openDialog(dialog.dialogName) : await dialog.openDialog();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
vscode.commands.registerCommand('agent.openOperatorDialog', (ownerUri: string, operatorInfo: azdata.AgentOperatorInfo) => {
|
vscode.commands.registerCommand('agent.openOperatorDialog', async (ownerUri: string, operatorInfo: azdata.AgentOperatorInfo) => {
|
||||||
let dialog = new OperatorDialog(ownerUri, operatorInfo);
|
let dialog = new OperatorDialog(ownerUri, operatorInfo);
|
||||||
dialog.dialogName ? dialog.openDialog(dialog.dialogName) : dialog.openDialog();
|
dialog.dialogName ? await dialog.openDialog(dialog.dialogName) : await dialog.openDialog();
|
||||||
});
|
});
|
||||||
vscode.commands.registerCommand('agent.openProxyDialog', (ownerUri: string, proxyInfo: azdata.AgentProxyInfo, credentials: azdata.CredentialInfo[]) => {
|
vscode.commands.registerCommand('agent.openProxyDialog', async (ownerUri: string, proxyInfo: azdata.AgentProxyInfo, credentials: azdata.CredentialInfo[]) => {
|
||||||
let dialog = new ProxyDialog(ownerUri, proxyInfo, credentials);
|
let dialog = new ProxyDialog(ownerUri, proxyInfo, credentials);
|
||||||
dialog.dialogName ? dialog.openDialog(dialog.dialogName) : dialog.openDialog();
|
dialog.dialogName ? await dialog.openDialog(dialog.dialogName) : await dialog.openDialog();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ export class AlertsViewComponent extends JobManagementView implements OnInit, On
|
|||||||
this._table.resizeCanvas();
|
this._table.resizeCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getTableActions(): IAction[] {
|
protected getTableActions(targetObject: any): IAction[] {
|
||||||
let actions: IAction[] = [];
|
let actions: IAction[] = [];
|
||||||
actions.push(this._instantiationService.createInstance(EditAlertAction));
|
actions.push(this._instantiationService.createInstance(EditAlertAction));
|
||||||
actions.push(this._instantiationService.createInstance(DeleteAlertAction));
|
actions.push(this._instantiationService.createInstance(DeleteAlertAction));
|
||||||
@@ -209,9 +209,10 @@ export class AlertsViewComponent extends JobManagementView implements OnInit, On
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected getCurrentTableObject(rowIndex: number): any {
|
protected getCurrentTableObject(rowIndex: number): any {
|
||||||
return (this.alerts && this.alerts.length >= rowIndex)
|
let targetObject = {
|
||||||
? this.alerts[rowIndex]
|
alertInfo: this.alerts && this.alerts.length >= rowIndex ? this.alerts[rowIndex] : undefined
|
||||||
: undefined;
|
};
|
||||||
|
return targetObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -227,16 +228,6 @@ export class AlertsViewComponent extends JobManagementView implements OnInit, On
|
|||||||
|
|
||||||
public openCreateAlertDialog() {
|
public openCreateAlertDialog() {
|
||||||
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
||||||
this._jobManagementService.getJobs(ownerUri).then((result) => {
|
|
||||||
if (result && result.jobs.length > 0) {
|
|
||||||
let jobs = [];
|
|
||||||
result.jobs.forEach(job => {
|
|
||||||
jobs.push(job.name);
|
|
||||||
});
|
|
||||||
this._commandService.executeCommand('agent.openAlertDialog', ownerUri, null, jobs);
|
|
||||||
} else {
|
|
||||||
this._commandService.executeCommand('agent.openAlertDialog', ownerUri, null, null);
|
this._commandService.executeCommand('agent.openAlertDialog', ownerUri, null, null);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -948,8 +948,8 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
public openCreateJobDialog() {
|
public async openCreateJobDialog() {
|
||||||
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
||||||
this._commandService.executeCommand('agent.openJobDialog', ownerUri);
|
await this._commandService.executeCommand('agent.openJobDialog', ownerUri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,9 +70,9 @@ export class NewJobAction extends Action {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public run(context: JobsViewComponent): Promise<boolean> {
|
public run(context: JobsViewComponent): Promise<boolean> {
|
||||||
return new Promise<boolean>((resolve, reject) => {
|
return new Promise<boolean>(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
context.openCreateJobDialog();
|
await context.openCreateJobDialog();
|
||||||
resolve(true);
|
resolve(true);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
reject(e);
|
reject(e);
|
||||||
@@ -185,7 +185,7 @@ export class DeleteJobAction extends Action {
|
|||||||
|
|
||||||
public run(actionInfo: IJobActionInfo): Promise<boolean> {
|
public run(actionInfo: IJobActionInfo): Promise<boolean> {
|
||||||
let self = this;
|
let self = this;
|
||||||
let job = actionInfo.targetObject as azdata.AgentJobInfo;
|
let job = actionInfo.targetObject.job as azdata.AgentJobInfo;
|
||||||
self._notificationService.prompt(
|
self._notificationService.prompt(
|
||||||
Severity.Info,
|
Severity.Info,
|
||||||
nls.localize('jobaction.deleteJobConfirm', "Are you sure you'd like to delete the job '{0}'?", job.name),
|
nls.localize('jobaction.deleteJobConfirm', "Are you sure you'd like to delete the job '{0}'?", job.name),
|
||||||
@@ -193,7 +193,7 @@ export class DeleteJobAction extends Action {
|
|||||||
label: DeleteJobAction.LABEL,
|
label: DeleteJobAction.LABEL,
|
||||||
run: () => {
|
run: () => {
|
||||||
this._telemetryService.publicLog(TelemetryKeys.DeleteAgentJob);
|
this._telemetryService.publicLog(TelemetryKeys.DeleteAgentJob);
|
||||||
self._jobService.deleteJob(actionInfo.ownerUri, actionInfo.targetObject).then(result => {
|
self._jobService.deleteJob(actionInfo.ownerUri, actionInfo.targetObject.job).then(result => {
|
||||||
if (!result || !result.success) {
|
if (!result || !result.success) {
|
||||||
let errorMessage = nls.localize("jobaction.failedToDeleteJob", "Could not delete job '{0}'.\nError: {1}",
|
let errorMessage = nls.localize("jobaction.failedToDeleteJob", "Could not delete job '{0}'.\nError: {1}",
|
||||||
job.name, result.errorMessage ? result.errorMessage : 'Unknown error');
|
job.name, result.errorMessage ? result.errorMessage : 'Unknown error');
|
||||||
@@ -319,7 +319,8 @@ export class EditAlertAction extends Action {
|
|||||||
this._commandService.executeCommand(
|
this._commandService.executeCommand(
|
||||||
'agent.openAlertDialog',
|
'agent.openAlertDialog',
|
||||||
actionInfo.ownerUri,
|
actionInfo.ownerUri,
|
||||||
actionInfo.targetObject);
|
actionInfo.targetObject.jobInfo,
|
||||||
|
actionInfo.targetObject.alertInfo);
|
||||||
return Promise.resolve(true);
|
return Promise.resolve(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -340,7 +341,7 @@ export class DeleteAlertAction extends Action {
|
|||||||
|
|
||||||
public run(actionInfo: IJobActionInfo): Promise<boolean> {
|
public run(actionInfo: IJobActionInfo): Promise<boolean> {
|
||||||
let self = this;
|
let self = this;
|
||||||
let alert = actionInfo.targetObject as azdata.AgentAlertInfo;
|
let alert = actionInfo.targetObject.alertInfo as azdata.AgentAlertInfo;
|
||||||
self._notificationService.prompt(
|
self._notificationService.prompt(
|
||||||
Severity.Info,
|
Severity.Info,
|
||||||
nls.localize('jobaction.deleteAlertConfirm', "Are you sure you'd like to delete the alert '{0}'?", alert.name),
|
nls.localize('jobaction.deleteAlertConfirm', "Are you sure you'd like to delete the alert '{0}'?", alert.name),
|
||||||
@@ -348,7 +349,7 @@ export class DeleteAlertAction extends Action {
|
|||||||
label: DeleteAlertAction.LABEL,
|
label: DeleteAlertAction.LABEL,
|
||||||
run: () => {
|
run: () => {
|
||||||
this._telemetryService.publicLog(TelemetryKeys.DeleteAgentAlert);
|
this._telemetryService.publicLog(TelemetryKeys.DeleteAgentAlert);
|
||||||
self._jobService.deleteAlert(actionInfo.ownerUri, actionInfo.targetObject).then(result => {
|
self._jobService.deleteAlert(actionInfo.ownerUri, alert).then(result => {
|
||||||
if (!result || !result.success) {
|
if (!result || !result.success) {
|
||||||
let errorMessage = nls.localize("jobaction.failedToDeleteAlert", "Could not delete alert '{0}'.\nError: {1}",
|
let errorMessage = nls.localize("jobaction.failedToDeleteAlert", "Could not delete alert '{0}'.\nError: {1}",
|
||||||
alert.name, result.errorMessage ? result.errorMessage : 'Unknown error');
|
alert.name, result.errorMessage ? result.errorMessage : 'Unknown error');
|
||||||
@@ -482,17 +483,25 @@ export class EditProxyAction extends Action {
|
|||||||
public static LABEL = nls.localize('jobaction.editProxy', "Edit Proxy");
|
public static LABEL = nls.localize('jobaction.editProxy', "Edit Proxy");
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ICommandService private _commandService: ICommandService
|
@ICommandService private _commandService: ICommandService,
|
||||||
|
@IJobManagementService private _jobManagementService: IJobManagementService
|
||||||
) {
|
) {
|
||||||
super(EditProxyAction.ID, EditProxyAction.LABEL);
|
super(EditProxyAction.ID, EditProxyAction.LABEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public run(actionInfo: IJobActionInfo): Promise<boolean> {
|
public run(actionInfo: IJobActionInfo): Promise<boolean> {
|
||||||
|
return Promise.resolve(this._jobManagementService.getCredentials(actionInfo.ownerUri).then((result) => {
|
||||||
|
if (result && result.credentials) {
|
||||||
this._commandService.executeCommand(
|
this._commandService.executeCommand(
|
||||||
'agent.openProxyDialog',
|
'agent.openProxyDialog',
|
||||||
actionInfo.ownerUri,
|
actionInfo.ownerUri,
|
||||||
actionInfo.targetObject);
|
actionInfo.targetObject,
|
||||||
return Promise.resolve(true);
|
result.credentials);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user