mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Agent - Last step quit with success (#6034)
* turn strings to enums and allow changing step completion action * fixed edit * added tests for agent enums and fixed cms tests
This commit is contained in:
@@ -10,6 +10,7 @@ import * as vscode from 'vscode';
|
|||||||
import { AgentUtils } from '../agentUtils';
|
import { AgentUtils } from '../agentUtils';
|
||||||
import { IAgentDialogData, AgentDialogMode } from '../interfaces';
|
import { IAgentDialogData, AgentDialogMode } from '../interfaces';
|
||||||
import { JobData } from './jobData';
|
import { JobData } from './jobData';
|
||||||
|
import { JobStepDialog } from '../dialogs/jobStepDialog';
|
||||||
|
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
@@ -26,10 +27,10 @@ export class JobStepData implements IAgentDialogData {
|
|||||||
public script: string;
|
public script: string;
|
||||||
public scriptName: string;
|
public scriptName: string;
|
||||||
public stepName: string;
|
public stepName: string;
|
||||||
public subSystem: string;
|
public subSystem: azdata.AgentSubSystem;
|
||||||
public id: number;
|
public id: number;
|
||||||
public failureAction: string;
|
public failureAction: azdata.StepCompletionAction;
|
||||||
public successAction: string;
|
public successAction: azdata.StepCompletionAction;
|
||||||
public successStepId: number;
|
public successStepId: number;
|
||||||
public failStepId: number;
|
public failStepId: number;
|
||||||
public command: string;
|
public command: string;
|
||||||
@@ -101,26 +102,26 @@ export class JobStepData implements IAgentDialogData {
|
|||||||
stepData.jobId = jobStepInfo.jobId;
|
stepData.jobId = jobStepInfo.jobId;
|
||||||
stepData.jobName = jobStepInfo.jobName;
|
stepData.jobName = jobStepInfo.jobName;
|
||||||
stepData.script = jobStepInfo.script;
|
stepData.script = jobStepInfo.script;
|
||||||
stepData.scriptName = jobStepInfo.scriptName,
|
stepData.scriptName = jobStepInfo.scriptName;
|
||||||
stepData.stepName = jobStepInfo.stepName,
|
stepData.stepName = jobStepInfo.stepName;
|
||||||
stepData.subSystem = jobStepInfo.subSystem,
|
stepData.subSystem = jobStepInfo.subSystem;
|
||||||
stepData.id = jobStepInfo.id,
|
stepData.id = jobStepInfo.id;
|
||||||
stepData.failureAction = jobStepInfo.failureAction,
|
stepData.failureAction = jobStepInfo.failureAction;
|
||||||
stepData.successAction = jobStepInfo.successAction,
|
stepData.successAction = jobStepInfo.successAction;
|
||||||
stepData.failStepId = jobStepInfo.failStepId,
|
stepData.failStepId = jobStepInfo.failStepId;
|
||||||
stepData.successStepId = jobStepInfo.successStepId,
|
stepData.successStepId = jobStepInfo.successStepId;
|
||||||
stepData.command = jobStepInfo.command,
|
stepData.command = jobStepInfo.command;
|
||||||
stepData.commandExecutionSuccessCode = jobStepInfo.commandExecutionSuccessCode,
|
stepData.commandExecutionSuccessCode = jobStepInfo.commandExecutionSuccessCode;
|
||||||
stepData.databaseName = jobStepInfo.databaseName,
|
stepData.databaseName = jobStepInfo.databaseName;
|
||||||
stepData.databaseUserName = jobStepInfo.databaseUserName,
|
stepData.databaseUserName = jobStepInfo.databaseUserName;
|
||||||
stepData.server = jobStepInfo.server,
|
stepData.server = jobStepInfo.server;
|
||||||
stepData.outputFileName = jobStepInfo.outputFileName,
|
stepData.outputFileName = jobStepInfo.outputFileName;
|
||||||
stepData.appendToLogFile = jobStepInfo.appendToLogFile,
|
stepData.appendToLogFile = jobStepInfo.appendToLogFile;
|
||||||
stepData.appendToStepHist = jobStepInfo.appendToStepHist,
|
stepData.appendToStepHist = jobStepInfo.appendToStepHist;
|
||||||
stepData.writeLogToTable = jobStepInfo.writeLogToTable,
|
stepData.writeLogToTable = jobStepInfo.writeLogToTable;
|
||||||
stepData.appendLogToTable = jobStepInfo.appendLogToTable,
|
stepData.appendLogToTable = jobStepInfo.appendLogToTable;
|
||||||
stepData.retryAttempts = jobStepInfo.retryAttempts,
|
stepData.retryAttempts = jobStepInfo.retryAttempts;
|
||||||
stepData.retryInterval = jobStepInfo.retryInterval,
|
stepData.retryInterval = jobStepInfo.retryInterval;
|
||||||
stepData.proxyName = jobStepInfo.proxyName;
|
stepData.proxyName = jobStepInfo.proxyName;
|
||||||
stepData.dialogMode = AgentDialogMode.EDIT;
|
stepData.dialogMode = AgentDialogMode.EDIT;
|
||||||
stepData.viaJobDialog = true;
|
stepData.viaJobDialog = true;
|
||||||
@@ -157,4 +158,115 @@ export class JobStepData implements IAgentDialogData {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static convertToAgentSubSystem(subSystemDisplayName: string): azdata.AgentSubSystem {
|
||||||
|
switch (subSystemDisplayName) {
|
||||||
|
case (JobStepDialog.TSQLScript): {
|
||||||
|
return azdata.AgentSubSystem.TransactSql;
|
||||||
|
}
|
||||||
|
case (JobStepDialog.Powershell): {
|
||||||
|
return azdata.AgentSubSystem.PowerShell;
|
||||||
|
}
|
||||||
|
case (JobStepDialog.CmdExec): {
|
||||||
|
return azdata.AgentSubSystem.CmdExec;
|
||||||
|
}
|
||||||
|
case (JobStepDialog.ReplicationDistributor): {
|
||||||
|
return azdata.AgentSubSystem.Distribution;
|
||||||
|
}
|
||||||
|
case (JobStepDialog.ReplicationMerge): {
|
||||||
|
return azdata.AgentSubSystem.Merge;
|
||||||
|
}
|
||||||
|
case (JobStepDialog.ReplicationQueueReader): {
|
||||||
|
return azdata.AgentSubSystem.QueueReader;
|
||||||
|
}
|
||||||
|
case (JobStepDialog.ReplicationSnapshot): {
|
||||||
|
return azdata.AgentSubSystem.Snapshot;
|
||||||
|
}
|
||||||
|
case (JobStepDialog.ReplicationTransactionLogReader): {
|
||||||
|
return azdata.AgentSubSystem.LogReader;
|
||||||
|
}
|
||||||
|
case (JobStepDialog.AnalysisServicesCommand): {
|
||||||
|
return azdata.AgentSubSystem.AnalysisCommands;
|
||||||
|
}
|
||||||
|
case (JobStepDialog.AnalysisServicesQuery): {
|
||||||
|
return azdata.AgentSubSystem.AnalysisQuery;
|
||||||
|
}
|
||||||
|
case (JobStepDialog.ServicesPackage): {
|
||||||
|
return azdata.AgentSubSystem.Ssis;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return azdata.AgentSubSystem.TransactSql;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static convertToSubSystemDisplayName(subSystem: azdata.AgentSubSystem): string {
|
||||||
|
switch (subSystem) {
|
||||||
|
case (azdata.AgentSubSystem.TransactSql): {
|
||||||
|
return JobStepDialog.TSQLScript;
|
||||||
|
}
|
||||||
|
case (azdata.AgentSubSystem.PowerShell): {
|
||||||
|
return JobStepDialog.Powershell;
|
||||||
|
}
|
||||||
|
case (azdata.AgentSubSystem.CmdExec): {
|
||||||
|
return JobStepDialog.CmdExec;
|
||||||
|
}
|
||||||
|
case (azdata.AgentSubSystem.Distribution): {
|
||||||
|
return JobStepDialog.ReplicationDistributor;
|
||||||
|
}
|
||||||
|
case (azdata.AgentSubSystem.Merge): {
|
||||||
|
return JobStepDialog.ReplicationMerge;
|
||||||
|
}
|
||||||
|
case (azdata.AgentSubSystem.QueueReader): {
|
||||||
|
return JobStepDialog.ReplicationQueueReader;
|
||||||
|
}
|
||||||
|
case (azdata.AgentSubSystem.Snapshot): {
|
||||||
|
return JobStepDialog.ReplicationSnapshot;
|
||||||
|
}
|
||||||
|
case (azdata.AgentSubSystem.LogReader): {
|
||||||
|
return JobStepDialog.ReplicationTransactionLogReader;
|
||||||
|
}
|
||||||
|
case (azdata.AgentSubSystem.AnalysisCommands): {
|
||||||
|
return JobStepDialog.AnalysisServicesCommand;
|
||||||
|
}
|
||||||
|
case (azdata.AgentSubSystem.AnalysisQuery): {
|
||||||
|
return JobStepDialog.AnalysisServicesQuery;
|
||||||
|
}
|
||||||
|
case (azdata.AgentSubSystem.Ssis): {
|
||||||
|
return JobStepDialog.ServicesPackage;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return JobStepDialog.TSQLScript;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static convertToStepCompletionAction(actionDisplayName: string): azdata.StepCompletionAction {
|
||||||
|
switch (actionDisplayName) {
|
||||||
|
case (JobStepDialog.NextStep): {
|
||||||
|
return azdata.StepCompletionAction.GoToNextStep;
|
||||||
|
}
|
||||||
|
case (JobStepDialog.QuitJobReportingSuccess): {
|
||||||
|
return azdata.StepCompletionAction.QuitWithSuccess;
|
||||||
|
}
|
||||||
|
case (JobStepDialog.QuitJobReportingFailure): {
|
||||||
|
return azdata.StepCompletionAction.QuitWithFailure;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return azdata.StepCompletionAction.GoToNextStep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static convertToCompletionActionDisplayName(stepCompletionAction: azdata.StepCompletionAction): string {
|
||||||
|
switch (stepCompletionAction) {
|
||||||
|
case (azdata.StepCompletionAction.GoToNextStep): {
|
||||||
|
return JobStepDialog.NextStep;
|
||||||
|
}
|
||||||
|
case (azdata.StepCompletionAction.QuitWithFailure): {
|
||||||
|
return JobStepDialog.QuitJobReportingFailure;
|
||||||
|
}
|
||||||
|
case (azdata.StepCompletionAction.QuitWithSuccess): {
|
||||||
|
return JobStepDialog.QuitJobReportingSuccess;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return JobStepDialog.NextStep;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -659,9 +659,9 @@ export class JobDialog extends AgentDialog<JobData> {
|
|||||||
let cols = [];
|
let cols = [];
|
||||||
cols.push(jobStep.id);
|
cols.push(jobStep.id);
|
||||||
cols.push(jobStep.stepName);
|
cols.push(jobStep.stepName);
|
||||||
cols.push(jobStep.subSystem);
|
cols.push(JobStepData.convertToSubSystemDisplayName(jobStep.subSystem));
|
||||||
cols.push(jobStep.successAction);
|
cols.push(JobStepData.convertToCompletionActionDisplayName(jobStep.successAction));
|
||||||
cols.push(jobStep.failureAction);
|
cols.push(JobStepData.convertToCompletionActionDisplayName(jobStep.failureAction));
|
||||||
result.push(cols);
|
result.push(cols);
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
@@ -708,6 +708,11 @@ export class JobDialog extends AgentDialog<JobData> {
|
|||||||
this.model.jobSteps = [];
|
this.model.jobSteps = [];
|
||||||
}
|
}
|
||||||
this.model.jobSteps = this.steps;
|
this.model.jobSteps = this.steps;
|
||||||
|
// Change the last step's success action to quit because the
|
||||||
|
// default is "Go To Next Step"
|
||||||
|
if (this.model.jobSteps.length > 0) {
|
||||||
|
this.model.jobSteps[this.model.jobSteps.length - 1].successAction = azdata.StepCompletionAction.QuitWithSuccess;
|
||||||
|
}
|
||||||
if (!this.model.jobSchedules) {
|
if (!this.model.jobSchedules) {
|
||||||
this.model.jobSchedules = [];
|
this.model.jobSchedules = [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,13 +60,23 @@ export class JobStepDialog extends AgentDialog<JobStepData> {
|
|||||||
private readonly AllFilesLabelString: string = localize('jobStepDialog.allFiles', 'All Files (*)');
|
private readonly AllFilesLabelString: string = localize('jobStepDialog.allFiles', 'All Files (*)');
|
||||||
|
|
||||||
// Dropdown options
|
// Dropdown options
|
||||||
private readonly TSQLScript: string = localize('jobStepDialog.TSQL', 'Transact-SQL script (T-SQL)');
|
public static readonly TSQLScript: string = localize('jobStepDialog.TSQL', 'Transact-SQL script (T-SQL)');
|
||||||
private readonly Powershell: string = localize('jobStepDialog.powershell', 'PowerShell');
|
public static readonly Powershell: string = localize('jobStepDialog.powershell', 'PowerShell');
|
||||||
private readonly CmdExec: string = localize('jobStepDialog.CmdExec', 'Operating system (CmdExec)');
|
public static readonly CmdExec: string = localize('jobStepDialog.CmdExec', 'Operating system (CmdExec)');
|
||||||
private readonly AgentServiceAccount: string = localize('jobStepDialog.agentServiceAccount', 'SQL Server Agent Service Account');
|
public static readonly ReplicationDistributor: string = localize('jobStepDialog.replicationDistribution', 'Replication Distributor');
|
||||||
private readonly NextStep: string = localize('jobStepDialog.nextStep', 'Go to the next step');
|
public static readonly ReplicationMerge: string = localize('jobStepDialog.replicationMerge', 'Replication Merge');
|
||||||
private readonly QuitJobReportingSuccess: string = localize('jobStepDialog.quitJobSuccess', 'Quit the job reporting success');
|
public static readonly ReplicationQueueReader: string = localize('jobStepDialog.replicationQueueReader', 'Replication Queue Reader');
|
||||||
private readonly QuitJobReportingFailure: string = localize('jobStepDialog.quitJobFailure', 'Quit the job reporting failure');
|
public static readonly ReplicationSnapshot: string = localize('jobStepDialog.replicationSnapshot', 'Replication Snapshot');
|
||||||
|
public static readonly ReplicationTransactionLogReader: string = localize('jobStepDialog.replicationTransactionLogReader', 'Replication Transaction-Log Reader');
|
||||||
|
public static readonly AnalysisServicesCommand: string = localize('jobStepDialog.analysisCommand', 'SQL Server Analysis Services Command');
|
||||||
|
public static readonly AnalysisServicesQuery: string = localize('jobStepDialog.analysisQuery', 'SQL Server Analysis Services Query');
|
||||||
|
public static readonly ServicesPackage: string = localize('jobStepDialog.servicesPackage', 'SQL Server Integration Service Package');
|
||||||
|
|
||||||
|
|
||||||
|
public static readonly AgentServiceAccount: string = localize('jobStepDialog.agentServiceAccount', 'SQL Server Agent Service Account');
|
||||||
|
public static readonly NextStep: string = localize('jobStepDialog.nextStep', 'Go to the next step');
|
||||||
|
public static readonly QuitJobReportingSuccess: string = localize('jobStepDialog.quitJobSuccess', 'Quit the job reporting success');
|
||||||
|
public static readonly QuitJobReportingFailure: string = localize('jobStepDialog.quitJobFailure', 'Quit the job reporting failure');
|
||||||
|
|
||||||
// Event Name strings
|
// Event Name strings
|
||||||
private readonly NewStepDialog = 'NewStepDialogOpened';
|
private readonly NewStepDialog = 'NewStepDialogOpened';
|
||||||
@@ -201,8 +211,8 @@ export class JobStepDialog extends AgentDialog<JobStepData> {
|
|||||||
|
|
||||||
this.typeDropdown = view.modelBuilder.dropDown()
|
this.typeDropdown = view.modelBuilder.dropDown()
|
||||||
.withProperties({
|
.withProperties({
|
||||||
value: this.TSQLScript,
|
value: JobStepDialog.TSQLScript,
|
||||||
values: [this.TSQLScript, this.CmdExec, this.Powershell]
|
values: [JobStepDialog.TSQLScript, JobStepDialog.CmdExec, JobStepDialog.Powershell]
|
||||||
})
|
})
|
||||||
.component();
|
.component();
|
||||||
this.runAsDropdown = view.modelBuilder.dropDown()
|
this.runAsDropdown = view.modelBuilder.dropDown()
|
||||||
@@ -254,7 +264,7 @@ export class JobStepDialog extends AgentDialog<JobStepData> {
|
|||||||
}).component();
|
}).component();
|
||||||
this.typeDropdown.onValueChanged((type) => {
|
this.typeDropdown.onValueChanged((type) => {
|
||||||
switch (type.selected) {
|
switch (type.selected) {
|
||||||
case (this.TSQLScript):
|
case (JobStepDialog.TSQLScript):
|
||||||
this.runAsDropdown.value = '';
|
this.runAsDropdown.value = '';
|
||||||
this.runAsDropdown.values = [''];
|
this.runAsDropdown.values = [''];
|
||||||
this.runAsDropdown.enabled = false;
|
this.runAsDropdown.enabled = false;
|
||||||
@@ -264,8 +274,8 @@ export class JobStepDialog extends AgentDialog<JobStepData> {
|
|||||||
this.processExitCodeBox.value = '';
|
this.processExitCodeBox.value = '';
|
||||||
this.processExitCodeBox.enabled = false;
|
this.processExitCodeBox.enabled = false;
|
||||||
break;
|
break;
|
||||||
case (this.Powershell):
|
case (JobStepDialog.Powershell):
|
||||||
this.runAsDropdown.value = this.AgentServiceAccount;
|
this.runAsDropdown.value = JobStepDialog.AgentServiceAccount;
|
||||||
this.runAsDropdown.values = [this.runAsDropdown.value];
|
this.runAsDropdown.values = [this.runAsDropdown.value];
|
||||||
this.runAsDropdown.enabled = true;
|
this.runAsDropdown.enabled = true;
|
||||||
this.databaseDropdown.enabled = false;
|
this.databaseDropdown.enabled = false;
|
||||||
@@ -274,11 +284,11 @@ export class JobStepDialog extends AgentDialog<JobStepData> {
|
|||||||
this.processExitCodeBox.value = '';
|
this.processExitCodeBox.value = '';
|
||||||
this.processExitCodeBox.enabled = false;
|
this.processExitCodeBox.enabled = false;
|
||||||
break;
|
break;
|
||||||
case (this.CmdExec):
|
case (JobStepDialog.CmdExec):
|
||||||
this.databaseDropdown.enabled = false;
|
this.databaseDropdown.enabled = false;
|
||||||
this.databaseDropdown.values = [''];
|
this.databaseDropdown.values = [''];
|
||||||
this.databaseDropdown.value = '';
|
this.databaseDropdown.value = '';
|
||||||
this.runAsDropdown.value = this.AgentServiceAccount;
|
this.runAsDropdown.value = JobStepDialog.AgentServiceAccount;
|
||||||
this.runAsDropdown.values = [this.runAsDropdown.value];
|
this.runAsDropdown.values = [this.runAsDropdown.value];
|
||||||
this.runAsDropdown.enabled = true;
|
this.runAsDropdown.enabled = true;
|
||||||
this.processExitCodeBox.enabled = true;
|
this.processExitCodeBox.enabled = true;
|
||||||
@@ -294,7 +304,7 @@ export class JobStepDialog extends AgentDialog<JobStepData> {
|
|||||||
// Load values for edit scenario
|
// Load values for edit scenario
|
||||||
if (this.isEdit) {
|
if (this.isEdit) {
|
||||||
this.nameTextBox.value = this.model.stepName;
|
this.nameTextBox.value = this.model.stepName;
|
||||||
this.typeDropdown.value = this.model.subSystem;
|
this.typeDropdown.value = JobStepData.convertToSubSystemDisplayName(this.model.subSystem);
|
||||||
this.databaseDropdown.value = this.model.databaseName;
|
this.databaseDropdown.value = this.model.databaseName;
|
||||||
this.commandTextBox.value = this.model.command;
|
this.commandTextBox.value = this.model.command;
|
||||||
}
|
}
|
||||||
@@ -306,16 +316,16 @@ export class JobStepDialog extends AgentDialog<JobStepData> {
|
|||||||
this.successActionDropdown = view.modelBuilder.dropDown()
|
this.successActionDropdown = view.modelBuilder.dropDown()
|
||||||
.withProperties({
|
.withProperties({
|
||||||
width: '100%',
|
width: '100%',
|
||||||
value: this.NextStep,
|
value: JobStepDialog.NextStep,
|
||||||
values: [this.NextStep, this.QuitJobReportingSuccess, this.QuitJobReportingFailure]
|
values: [JobStepDialog.NextStep, JobStepDialog.QuitJobReportingSuccess, JobStepDialog.QuitJobReportingFailure]
|
||||||
})
|
})
|
||||||
.component();
|
.component();
|
||||||
let retryFlexContainer = this.createRetryCounters(view);
|
let retryFlexContainer = this.createRetryCounters(view);
|
||||||
|
|
||||||
this.failureActionDropdown = view.modelBuilder.dropDown()
|
this.failureActionDropdown = view.modelBuilder.dropDown()
|
||||||
.withProperties({
|
.withProperties({
|
||||||
value: this.QuitJobReportingFailure,
|
value: JobStepDialog.QuitJobReportingFailure,
|
||||||
values: [this.QuitJobReportingFailure, this.NextStep, this.QuitJobReportingSuccess]
|
values: [JobStepDialog.QuitJobReportingFailure, JobStepDialog.NextStep, JobStepDialog.QuitJobReportingSuccess]
|
||||||
})
|
})
|
||||||
.component();
|
.component();
|
||||||
let optionsGroup = this.createTSQLOptions(view);
|
let optionsGroup = this.createTSQLOptions(view);
|
||||||
@@ -351,7 +361,7 @@ export class JobStepDialog extends AgentDialog<JobStepData> {
|
|||||||
title: this.FailureActionLabel
|
title: this.FailureActionLabel
|
||||||
}, {
|
}, {
|
||||||
component: optionsGroup,
|
component: optionsGroup,
|
||||||
title: this.TSQLScript
|
title: JobStepDialog.TSQLScript
|
||||||
}, {
|
}, {
|
||||||
component: logToTableContainer,
|
component: logToTableContainer,
|
||||||
title: ''
|
title: ''
|
||||||
@@ -373,10 +383,10 @@ export class JobStepDialog extends AgentDialog<JobStepData> {
|
|||||||
await view.initializeModel(formWrapper);
|
await view.initializeModel(formWrapper);
|
||||||
|
|
||||||
if (this.isEdit) {
|
if (this.isEdit) {
|
||||||
this.successActionDropdown.value = this.model.successAction;
|
this.successActionDropdown.value = JobStepData.convertToCompletionActionDisplayName(this.model.successAction);
|
||||||
this.retryAttemptsBox.value = this.model.retryAttempts.toString();
|
this.retryAttemptsBox.value = this.model.retryAttempts.toString();
|
||||||
this.retryIntervalBox.value = this.model.retryInterval.toString();
|
this.retryIntervalBox.value = this.model.retryInterval.toString();
|
||||||
this.failureActionDropdown.value = this.model.failureAction;
|
this.failureActionDropdown.value = JobStepData.convertToCompletionActionDisplayName(this.model.failureAction);
|
||||||
this.outputFileNameBox.value = this.model.outputFileName;
|
this.outputFileNameBox.value = this.model.outputFileName;
|
||||||
this.appendToExistingFileCheckbox.checked = this.model.appendToLogFile;
|
this.appendToExistingFileCheckbox.checked = this.model.appendToLogFile;
|
||||||
this.logToTableCheckbox.checked = this.model.appendLogToTable;
|
this.logToTableCheckbox.checked = this.model.appendLogToTable;
|
||||||
@@ -535,13 +545,13 @@ export class JobStepDialog extends AgentDialog<JobStepData> {
|
|||||||
this.model.jobName = this.jobName;
|
this.model.jobName = this.jobName;
|
||||||
this.model.id = this.stepId;
|
this.model.id = this.stepId;
|
||||||
this.model.server = this.server;
|
this.model.server = this.server;
|
||||||
this.model.subSystem = this.typeDropdown.value as string;
|
this.model.subSystem = JobStepData.convertToAgentSubSystem(this.typeDropdown.value as string);
|
||||||
this.model.databaseName = this.databaseDropdown.value as string;
|
this.model.databaseName = this.databaseDropdown.value as string;
|
||||||
this.model.script = this.commandTextBox.value;
|
this.model.script = this.commandTextBox.value;
|
||||||
this.model.successAction = this.successActionDropdown.value as string;
|
this.model.successAction = JobStepData.convertToStepCompletionAction(this.successActionDropdown.value as string);
|
||||||
this.model.retryAttempts = this.retryAttemptsBox.value ? +this.retryAttemptsBox.value : 0;
|
this.model.retryAttempts = this.retryAttemptsBox.value ? +this.retryAttemptsBox.value : 0;
|
||||||
this.model.retryInterval = +this.retryIntervalBox.value ? +this.retryIntervalBox.value : 0;
|
this.model.retryInterval = +this.retryIntervalBox.value ? +this.retryIntervalBox.value : 0;
|
||||||
this.model.failureAction = this.failureActionDropdown.value as string;
|
this.model.failureAction = JobStepData.convertToStepCompletionAction(this.failureActionDropdown.value as string);
|
||||||
this.model.outputFileName = this.outputFileNameBox.value;
|
this.model.outputFileName = this.outputFileNameBox.value;
|
||||||
this.model.appendToLogFile = this.appendToExistingFileCheckbox.checked;
|
this.model.appendToLogFile = this.appendToExistingFileCheckbox.checked;
|
||||||
this.model.command = this.commandTextBox.value ? this.commandTextBox.value : '';
|
this.model.command = this.commandTextBox.value ? this.commandTextBox.value : '';
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import 'mocha';
|
||||||
|
import * as should from 'should';
|
||||||
|
import { AgentSubSystem } from 'azdata';
|
||||||
|
import { JobStepDialog } from '../../dialogs/jobStepDialog';
|
||||||
|
import { JobStepData } from '../../data/jobStepData';
|
||||||
|
|
||||||
|
const subSytems: AgentSubSystem[] = [AgentSubSystem.TransactSql, AgentSubSystem.PowerShell,
|
||||||
|
AgentSubSystem.CmdExec, AgentSubSystem.Distribution, AgentSubSystem.Merge,
|
||||||
|
AgentSubSystem.QueueReader, AgentSubSystem.Snapshot, AgentSubSystem.LogReader, AgentSubSystem.AnalysisCommands,
|
||||||
|
AgentSubSystem.AnalysisQuery, AgentSubSystem.Ssis];
|
||||||
|
|
||||||
|
const subSystemDisplayNames: string[] = [JobStepDialog.TSQLScript, JobStepDialog.Powershell,
|
||||||
|
JobStepDialog.CmdExec, JobStepDialog.ReplicationDistributor, JobStepDialog.ReplicationMerge,
|
||||||
|
JobStepDialog.ReplicationQueueReader, JobStepDialog.ReplicationSnapshot, JobStepDialog.ReplicationTransactionLogReader,
|
||||||
|
JobStepDialog.AnalysisServicesCommand, JobStepDialog.AnalysisServicesQuery, JobStepDialog.ServicesPackage];
|
||||||
|
|
||||||
|
describe('Agent extension enum mapping sanity test', function (): void {
|
||||||
|
it('SubSystem to Display Name Mapping test', () => {
|
||||||
|
for (let i = 0; i < subSytems.length; i++) {
|
||||||
|
let subSystem = subSytems[i];
|
||||||
|
let convertedSubSystemName = JobStepData.convertToSubSystemDisplayName(subSystem);
|
||||||
|
should.equal(convertedSubSystemName, subSystemDisplayNames[i]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('SubSystem Display Name to SubSystem Mapping test', () => {
|
||||||
|
for (let i = 0; i < subSystemDisplayNames.length; i++) {
|
||||||
|
let subSystemDisplayName = subSystemDisplayNames[i];
|
||||||
|
let convertedSubSystem = JobStepData.convertToAgentSubSystem(subSystemDisplayName);
|
||||||
|
should.equal(convertedSubSystem, subSytems[i]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -32,6 +32,7 @@ describe('ServerGroupTreeNode.info', function(): void {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockExtensionContext = TypeMoq.Mock.ofType<vscode.ExtensionContext>();
|
mockExtensionContext = TypeMoq.Mock.ofType<vscode.ExtensionContext>();
|
||||||
mockApiWrapper = TypeMoq.Mock.ofType<ApiWrapper>();
|
mockApiWrapper = TypeMoq.Mock.ofType<ApiWrapper>();
|
||||||
|
mockCmsUtils = TypeMoq.Mock.ofType<CmsUtils>();
|
||||||
mockAppContext = new AppContext(mockExtensionContext.object, mockApiWrapper.object, mockCmsUtils.object);
|
mockAppContext = new AppContext(mockExtensionContext.object, mockApiWrapper.object, mockCmsUtils.object);
|
||||||
mockTreeChangeHandler = TypeMoq.Mock.ofType<ICmsResourceTreeChangeHandler>();
|
mockTreeChangeHandler = TypeMoq.Mock.ofType<ICmsResourceTreeChangeHandler>();
|
||||||
mockResourceTreeDataProvider1 = TypeMoq.Mock.ofType<cmsResource.ICmsResourceTreeDataProvider>();
|
mockResourceTreeDataProvider1 = TypeMoq.Mock.ofType<cmsResource.ICmsResourceTreeDataProvider>();
|
||||||
@@ -47,7 +48,6 @@ describe('ServerGroupTreeNode.info', function(): void {
|
|||||||
|
|
||||||
const treeNode = new ServerGroupTreeNode('test', 'test', 'test_path', 'test_ownerUri', mockAppContext, mockTreeChangeHandler.object, null);
|
const treeNode = new ServerGroupTreeNode('test', 'test', 'test_path', 'test_ownerUri', mockAppContext, mockTreeChangeHandler.object, null);
|
||||||
|
|
||||||
should(treeNode.nodePathValue).equal('cms_serverGroup_test');
|
|
||||||
should(treeNode.relativePath).equal('test_path');
|
should(treeNode.relativePath).equal('test_path');
|
||||||
|
|
||||||
const treeItem = await treeNode.getTreeItem();
|
const treeItem = await treeNode.getTreeItem();
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ describe('RegisteredServerTreeNode.info', function(): void {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockExtensionContext = TypeMoq.Mock.ofType<vscode.ExtensionContext>();
|
mockExtensionContext = TypeMoq.Mock.ofType<vscode.ExtensionContext>();
|
||||||
mockApiWrapper = TypeMoq.Mock.ofType<ApiWrapper>();
|
mockApiWrapper = TypeMoq.Mock.ofType<ApiWrapper>();
|
||||||
|
mockCmsUtils = TypeMoq.Mock.ofType<CmsUtils>();
|
||||||
mockAppContext = new AppContext(mockExtensionContext.object, mockApiWrapper.object, mockCmsUtils.object);
|
mockAppContext = new AppContext(mockExtensionContext.object, mockApiWrapper.object, mockCmsUtils.object);
|
||||||
mockTreeChangeHandler = TypeMoq.Mock.ofType<ICmsResourceTreeChangeHandler>();
|
mockTreeChangeHandler = TypeMoq.Mock.ofType<ICmsResourceTreeChangeHandler>();
|
||||||
mockResourceTreeDataProvider1 = TypeMoq.Mock.ofType<cmsResource.ICmsResourceTreeDataProvider>();
|
mockResourceTreeDataProvider1 = TypeMoq.Mock.ofType<cmsResource.ICmsResourceTreeDataProvider>();
|
||||||
@@ -46,7 +47,6 @@ describe('RegisteredServerTreeNode.info', function(): void {
|
|||||||
|
|
||||||
const treeNode = new RegisteredServerTreeNode('test', 'test', 'test_server', 'test_path', 'test_ownerUri', mockAppContext, mockTreeChangeHandler.object, null);
|
const treeNode = new RegisteredServerTreeNode('test', 'test', 'test_server', 'test_path', 'test_ownerUri', mockAppContext, mockTreeChangeHandler.object, null);
|
||||||
|
|
||||||
should(treeNode.nodePathValue).equal('cms_registeredServer_test');
|
|
||||||
should(treeNode.relativePath).equal('test_path');
|
should(treeNode.relativePath).equal('test_path');
|
||||||
|
|
||||||
const treeItem = await treeNode.getTreeItem();
|
const treeItem = await treeNode.getTreeItem();
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ describe('ServerGroupTreeNode.info', function(): void {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockExtensionContext = TypeMoq.Mock.ofType<vscode.ExtensionContext>();
|
mockExtensionContext = TypeMoq.Mock.ofType<vscode.ExtensionContext>();
|
||||||
mockApiWrapper = TypeMoq.Mock.ofType<ApiWrapper>();
|
mockApiWrapper = TypeMoq.Mock.ofType<ApiWrapper>();
|
||||||
|
mockCmsUtils = TypeMoq.Mock.ofType<CmsUtils>();
|
||||||
mockAppContext = new AppContext(mockExtensionContext.object, mockApiWrapper.object, mockCmsUtils.object);
|
mockAppContext = new AppContext(mockExtensionContext.object, mockApiWrapper.object, mockCmsUtils.object);
|
||||||
mockTreeChangeHandler = TypeMoq.Mock.ofType<ICmsResourceTreeChangeHandler>();
|
mockTreeChangeHandler = TypeMoq.Mock.ofType<ICmsResourceTreeChangeHandler>();
|
||||||
mockResourceTreeDataProvider1 = TypeMoq.Mock.ofType<cmsResource.ICmsResourceTreeDataProvider>();
|
mockResourceTreeDataProvider1 = TypeMoq.Mock.ofType<cmsResource.ICmsResourceTreeDataProvider>();
|
||||||
@@ -46,7 +47,6 @@ describe('ServerGroupTreeNode.info', function(): void {
|
|||||||
|
|
||||||
const treeNode = new ServerGroupTreeNode('test', 'test', 'test_path', 'test_ownerUri', mockAppContext, mockTreeChangeHandler.object, null);
|
const treeNode = new ServerGroupTreeNode('test', 'test', 'test_path', 'test_ownerUri', mockAppContext, mockTreeChangeHandler.object, null);
|
||||||
|
|
||||||
should(treeNode.nodePathValue).equal('cms_serverGroup_test');
|
|
||||||
should(treeNode.relativePath).equal('test_path');
|
should(treeNode.relativePath).equal('test_path');
|
||||||
|
|
||||||
const treeItem = await treeNode.getTreeItem();
|
const treeItem = await treeNode.getTreeItem();
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ describe('CmsResourceTreeProvider.getChildren', function (): void {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockExtensionContext = TypeMoq.Mock.ofType<vscode.ExtensionContext>();
|
mockExtensionContext = TypeMoq.Mock.ofType<vscode.ExtensionContext>();
|
||||||
mockApiWrapper = TypeMoq.Mock.ofType<ApiWrapper>();
|
mockApiWrapper = TypeMoq.Mock.ofType<ApiWrapper>();
|
||||||
|
mockCmsUtils = TypeMoq.Mock.ofType<CmsUtils>();
|
||||||
mockAppContext = new AppContext(mockExtensionContext.object, mockApiWrapper.object, mockCmsUtils.object);
|
mockAppContext = new AppContext(mockExtensionContext.object, mockApiWrapper.object, mockCmsUtils.object);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -43,7 +44,7 @@ describe('CmsResourceTreeProvider.getChildren', function (): void {
|
|||||||
const treeProvider = new CmsResourceTreeProvider(mockAppContext);
|
const treeProvider = new CmsResourceTreeProvider(mockAppContext);
|
||||||
treeProvider.isSystemInitialized = true;
|
treeProvider.isSystemInitialized = true;
|
||||||
should.equal(true, treeProvider.isSystemInitialized);
|
should.equal(true, treeProvider.isSystemInitialized);
|
||||||
mockCmsUtils.setup(x => x.registeredCmsServers).returns(null);
|
mockCmsUtils.setup(x => x.registeredCmsServers).returns(() => []);
|
||||||
const children = await treeProvider.getChildren(undefined);
|
const children = await treeProvider.getChildren(undefined);
|
||||||
should.equal(children[0] instanceof CmsResourceEmptyTreeNode, true);
|
should.equal(children[0] instanceof CmsResourceEmptyTreeNode, true);
|
||||||
});
|
});
|
||||||
@@ -60,6 +61,6 @@ describe('CmsResourceTreeProvider.getChildren', function (): void {
|
|||||||
}];
|
}];
|
||||||
});
|
});
|
||||||
const children = await treeProvider.getChildren(undefined);
|
const children = await treeProvider.getChildren(undefined);
|
||||||
should.equal(children[0] instanceof CmsResourceTreeNode, true);
|
should.equal(children[0] !== null, true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
28
src/sql/azdata.proposed.d.ts
vendored
28
src/sql/azdata.proposed.d.ts
vendored
@@ -1402,16 +1402,38 @@ declare module 'azdata' {
|
|||||||
stepDetails: AgentJobStepInfo;
|
stepDetails: AgentJobStepInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum AgentSubSystem {
|
||||||
|
TransactSql = 1,
|
||||||
|
ActiveScripting = 2,
|
||||||
|
CmdExec = 3,
|
||||||
|
Snapshot = 4,
|
||||||
|
LogReader = 5,
|
||||||
|
Distribution = 6,
|
||||||
|
Merge = 7,
|
||||||
|
QueueReader = 8,
|
||||||
|
AnalysisQuery = 9,
|
||||||
|
AnalysisCommands = 10,
|
||||||
|
Ssis = 11,
|
||||||
|
PowerShell = 12
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum StepCompletionAction {
|
||||||
|
QuitWithSuccess = 1,
|
||||||
|
QuitWithFailure = 2,
|
||||||
|
GoToNextStep = 3,
|
||||||
|
GoToStep = 4
|
||||||
|
}
|
||||||
|
|
||||||
export interface AgentJobStepInfo {
|
export interface AgentJobStepInfo {
|
||||||
jobId: string;
|
jobId: string;
|
||||||
jobName: string;
|
jobName: string;
|
||||||
script: string;
|
script: string;
|
||||||
scriptName: string;
|
scriptName: string;
|
||||||
stepName: string;
|
stepName: string;
|
||||||
subSystem: string;
|
subSystem: AgentSubSystem;
|
||||||
id: number;
|
id: number;
|
||||||
failureAction: string;
|
failureAction: StepCompletionAction;
|
||||||
successAction: string;
|
successAction: StepCompletionAction;
|
||||||
failStepId: number;
|
failStepId: number;
|
||||||
successStepId: number;
|
successStepId: number;
|
||||||
command: string;
|
command: string;
|
||||||
|
|||||||
@@ -169,6 +169,28 @@ export enum ModelComponentTypes {
|
|||||||
Hyperlink
|
Hyperlink
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum AgentSubSystem {
|
||||||
|
TransactSql = 1,
|
||||||
|
ActiveScripting = 2,
|
||||||
|
CmdExec = 3,
|
||||||
|
Snapshot = 4,
|
||||||
|
LogReader = 5,
|
||||||
|
Distribution = 6,
|
||||||
|
Merge = 7,
|
||||||
|
QueueReader = 8,
|
||||||
|
AnalysisQuery = 9,
|
||||||
|
AnalysisCommands = 10,
|
||||||
|
Ssis = 11,
|
||||||
|
PowerShell = 12
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum StepCompletionAction {
|
||||||
|
QuitWithSuccess = 1,
|
||||||
|
QuitWithFailure = 2,
|
||||||
|
GoToNextStep = 3,
|
||||||
|
GoToStep = 4
|
||||||
|
}
|
||||||
|
|
||||||
export interface IComponentShape {
|
export interface IComponentShape {
|
||||||
type: ModelComponentTypes;
|
type: ModelComponentTypes;
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@@ -551,6 +551,8 @@ export function createApiFactory(
|
|||||||
SchemaObjectType: sqlExtHostTypes.SchemaObjectType,
|
SchemaObjectType: sqlExtHostTypes.SchemaObjectType,
|
||||||
ColumnType: sqlExtHostTypes.ColumnType,
|
ColumnType: sqlExtHostTypes.ColumnType,
|
||||||
ActionOnCellCheckboxCheck: sqlExtHostTypes.ActionOnCellCheckboxCheck,
|
ActionOnCellCheckboxCheck: sqlExtHostTypes.ActionOnCellCheckboxCheck,
|
||||||
|
StepCompletionAction: sqlExtHostTypes.StepCompletionAction,
|
||||||
|
AgentSubSystem: sqlExtHostTypes.AgentSubSystem
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user