mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-17 02:51:45 -05:00
chagned strings to enums and can edit step completion actions (#827)
This commit is contained in:
@@ -72,10 +72,10 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
|||||||
stepInfo.JobId = jobId;
|
stepInfo.JobId = jobId;
|
||||||
stepInfo.JobName = logEntry.JobName;
|
stepInfo.JobName = logEntry.JobName;
|
||||||
stepInfo.StepName = step.Name;
|
stepInfo.StepName = step.Name;
|
||||||
stepInfo.SubSystem = step.SubSystem.ToString();
|
stepInfo.SubSystem = step.SubSystem;
|
||||||
stepInfo.Id = step.ID;
|
stepInfo.Id = step.ID;
|
||||||
stepInfo.FailureAction = step.OnFailAction.ToString();
|
stepInfo.FailureAction = step.OnFailAction;
|
||||||
stepInfo.SuccessAction = step.OnSuccessAction.ToString();
|
stepInfo.SuccessAction = step.OnSuccessAction;
|
||||||
stepInfo.FailStepId = step.OnFailStep;
|
stepInfo.FailStepId = step.OnFailStep;
|
||||||
stepInfo.SuccessStepId = step.OnSuccessStep;
|
stepInfo.SuccessStepId = step.OnSuccessStep;
|
||||||
stepInfo.Command = step.Command;
|
stepInfo.Command = step.Command;
|
||||||
@@ -103,10 +103,10 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
|||||||
stepInfo.JobId = jobId;
|
stepInfo.JobId = jobId;
|
||||||
stepInfo.JobName = jobName;
|
stepInfo.JobName = jobName;
|
||||||
stepInfo.StepName = step.Name;
|
stepInfo.StepName = step.Name;
|
||||||
stepInfo.SubSystem = step.SubSystem.ToString();
|
stepInfo.SubSystem = step.SubSystem;
|
||||||
stepInfo.Id = step.ID;
|
stepInfo.Id = step.ID;
|
||||||
stepInfo.FailureAction = step.OnFailAction.ToString();
|
stepInfo.FailureAction = step.OnFailAction;
|
||||||
stepInfo.SuccessAction = step.OnSuccessAction.ToString();
|
stepInfo.SuccessAction = step.OnSuccessAction;
|
||||||
stepInfo.FailStepId = step.OnFailStep;
|
stepInfo.FailStepId = step.OnFailStep;
|
||||||
stepInfo.SuccessStepId = step.OnSuccessStep;
|
stepInfo.SuccessStepId = step.OnSuccessStep;
|
||||||
stepInfo.Command = step.Command;
|
stepInfo.Command = step.Command;
|
||||||
@@ -221,20 +221,5 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
|||||||
}
|
}
|
||||||
return jobs;
|
return jobs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AgentSubSystem ConvertToAgentSubSytem(string subSystem)
|
|
||||||
{
|
|
||||||
switch(subSystem)
|
|
||||||
{
|
|
||||||
case ("Transact-SQL script (T-SQL"):
|
|
||||||
return AgentSubSystem.TransactSql;
|
|
||||||
case ("Operating system (CmdExec)"):
|
|
||||||
return AgentSubSystem.CmdExec;
|
|
||||||
case ("PowerShell"):
|
|
||||||
return AgentSubSystem.PowerShell;
|
|
||||||
default:
|
|
||||||
return AgentSubSystem.TransactSql;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||||
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
||||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||||
using Microsoft.SqlTools.Utility;
|
using Microsoft.SqlTools.Utility;
|
||||||
@@ -21,7 +22,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent.Contracts
|
|||||||
|
|
||||||
public string StepName { get; set; }
|
public string StepName { get; set; }
|
||||||
|
|
||||||
public string SubSystem { get; set; }
|
public AgentSubSystem SubSystem { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Current step id
|
/// Current step id
|
||||||
@@ -30,12 +31,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent.Contracts
|
|||||||
|
|
||||||
/// action to take if the step fails
|
/// action to take if the step fails
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string FailureAction { get; set; }
|
public StepCompletionAction FailureAction { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Action to take if the step succeeds
|
/// Action to take if the step succeeds
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SuccessAction { get; set; }
|
public StepCompletionAction SuccessAction { get; set; }
|
||||||
|
|
||||||
// note we will have either the id or step
|
// note we will have either the id or step
|
||||||
// for the steps to go to on failure
|
// for the steps to go to on failure
|
||||||
|
|||||||
@@ -365,6 +365,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
|||||||
}
|
}
|
||||||
return this.failureAction;
|
return this.failureAction;
|
||||||
}
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (this.failureAction != value) {
|
||||||
|
this.failureAction = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public JobStepData FailStep
|
public JobStepData FailStep
|
||||||
@@ -390,6 +396,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
|||||||
}
|
}
|
||||||
return this.successAction;
|
return this.successAction;
|
||||||
}
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (this.successAction != value) {
|
||||||
|
this.successAction = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public JobStepData SuccessStep
|
public JobStepData SuccessStep
|
||||||
|
|||||||
@@ -44,7 +44,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
|||||||
this.data.ID = stepInfo.Id;
|
this.data.ID = stepInfo.Id;
|
||||||
this.data.Name = stepInfo.StepName;
|
this.data.Name = stepInfo.StepName;
|
||||||
this.data.Command = stepInfo.Command;
|
this.data.Command = stepInfo.Command;
|
||||||
this.data.Subsystem = AgentUtilities.ConvertToAgentSubSytem(stepInfo.SubSystem);
|
this.data.Subsystem = stepInfo.SubSystem;
|
||||||
|
this.data.FailureAction = stepInfo.FailureAction;
|
||||||
|
this.data.SuccessAction = stepInfo.SuccessAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool DoPreProcessExecution(RunType runType, out ExecutionMode executionResult)
|
protected override bool DoPreProcessExecution(RunType runType, out ExecutionMode executionResult)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
|||||||
Id = 1,
|
Id = 1,
|
||||||
JobName = job.Name,
|
JobName = job.Name,
|
||||||
StepName = stepName,
|
StepName = stepName,
|
||||||
SubSystem = "T-SQL",
|
SubSystem = SqlServer.Management.Smo.Agent.AgentSubSystem.TransactSql,
|
||||||
Script = "SELECT @@VERSION",
|
Script = "SELECT @@VERSION",
|
||||||
DatabaseName = connectionResult.ConnectionInfo.ConnectionDetails.DatabaseName,
|
DatabaseName = connectionResult.ConnectionInfo.ConnectionDetails.DatabaseName,
|
||||||
DatabaseUserName = connectionResult.ConnectionInfo.ConnectionDetails.UserName,
|
DatabaseUserName = connectionResult.ConnectionInfo.ConnectionDetails.UserName,
|
||||||
|
|||||||
Reference in New Issue
Block a user