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:
Aditya Bist
2018-11-29 10:47:57 -08:00
committed by GitHub
parent 87e8eb9ef6
commit 2f1097028f
2 changed files with 24 additions and 2 deletions

View File

@@ -893,11 +893,33 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
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
if (jobInfo.JobSteps != null && jobInfo.JobSteps.Length > 0)
{
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);
}
}

View File

@@ -42,7 +42,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
// load properties from AgentJobStepInfo
this.data.ID = stepInfo.Id;
this.data.Name = stepInfo.StepName;
this.data.Command = stepInfo.Script;
this.data.Command = stepInfo.Command;
}
protected override bool DoPreProcessExecution(RunType runType, out ExecutionMode executionResult)