mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
Fixed update agent step (#748)
* fixed update step * fix new step from edit job * allowed to reorder steps in edit job
This commit is contained in:
@@ -893,11 +893,33 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
|||||||
ExecuteAction(actions, runType);
|
ExecuteAction(actions, runType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ConnectionInfo connInfo;
|
||||||
|
ConnectionServiceInstance.TryFindConnection(ownerUri, out connInfo);
|
||||||
|
if (connInfo != null)
|
||||||
|
{
|
||||||
|
dataContainer = CDataContainer.CreateDataContainer(connInfo, databaseExists: true);
|
||||||
|
}
|
||||||
|
|
||||||
// Execute step actions if they exist
|
// Execute step actions if they exist
|
||||||
if (jobInfo.JobSteps != null && jobInfo.JobSteps.Length > 0)
|
if (jobInfo.JobSteps != null && jobInfo.JobSteps.Length > 0)
|
||||||
{
|
{
|
||||||
foreach (AgentJobStepInfo step in jobInfo.JobSteps)
|
foreach (AgentJobStepInfo step in jobInfo.JobSteps)
|
||||||
{
|
{
|
||||||
|
configAction = ConfigAction.Create;
|
||||||
|
foreach(JobStep jobStep in dataContainer.Server.JobServer.Jobs[originalJobName].JobSteps)
|
||||||
|
{
|
||||||
|
// any changes made to step other than name or ordering
|
||||||
|
if ((step.StepName == jobStep.Name && step.Id == jobStep.ID) ||
|
||||||
|
// if the step name was changed
|
||||||
|
(step.StepName != jobStep.Name && step.Id == jobStep.ID) ||
|
||||||
|
// if the step ordering was changed
|
||||||
|
(step.StepName == jobStep.Name && step.Id != jobStep.ID))
|
||||||
|
{
|
||||||
|
configAction = ConfigAction.Update;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
await ConfigureAgentJobStep(ownerUri, step, configAction, runType);
|
await ConfigureAgentJobStep(ownerUri, step, configAction, runType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
|||||||
// load properties from AgentJobStepInfo
|
// load properties from AgentJobStepInfo
|
||||||
this.data.ID = stepInfo.Id;
|
this.data.ID = stepInfo.Id;
|
||||||
this.data.Name = stepInfo.StepName;
|
this.data.Name = stepInfo.StepName;
|
||||||
this.data.Command = stepInfo.Script;
|
this.data.Command = stepInfo.Command;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool DoPreProcessExecution(RunType runType, out ExecutionMode executionResult)
|
protected override bool DoPreProcessExecution(RunType runType, out ExecutionMode executionResult)
|
||||||
|
|||||||
Reference in New Issue
Block a user