forked from Inedo/inedox-teamcity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TriggerBuildActionEditor.cs
80 lines (71 loc) · 3.47 KB
/
TriggerBuildActionEditor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System.Web;
using System.Web.UI.WebControls;
using Inedo.BuildMaster.Extensibility.Actions;
using Inedo.BuildMaster.Web.Controls;
using Inedo.BuildMaster.Web.Controls.Extensions;
using Inedo.Web.Controls;
namespace Inedo.BuildMasterExtensions.TeamCity
{
internal sealed class TriggerBuildActionEditor : ActionEditorBase
{
private ValidatingTextBox txtBuildConfigurationId;
private ValidatingTextBox txtAdditionalParameters;
private ValidatingTextBox txtBranchName;
private CheckBox chkWaitForCompletion;
/// <summary>
/// Binds to form.
/// </summary>
/// <param name="extension">The extension.</param>
public override void BindToForm(ActionBase extension)
{
var action = (TriggerBuildAction)extension;
this.txtBuildConfigurationId.Text = action.BuildConfigurationId;
this.txtAdditionalParameters.Text = action.AdditionalParameters;
this.chkWaitForCompletion.Checked = action.WaitForCompletion;
this.txtBranchName.Text = action.BranchName;
}
/// <summary>
/// Creates from form.
/// </summary>
/// <returns></returns>
public override ActionBase CreateFromForm()
{
return new TriggerBuildAction()
{
BuildConfigurationId = this.txtBuildConfigurationId.Text,
AdditionalParameters = this.txtAdditionalParameters.Text,
WaitForCompletion = this.chkWaitForCompletion.Checked,
BranchName = this.txtBranchName.Text
};
}
protected override void CreateChildControls()
{
this.txtBuildConfigurationId = new ValidatingTextBox() { Required = true };
this.txtBranchName = new ValidatingTextBox { DefaultText = "Default" };
this.txtAdditionalParameters = new ValidatingTextBox();
this.chkWaitForCompletion = new CheckBox()
{
Text = "Wait for build to complete",
Checked = true
};
this.Controls.Add(
new SlimFormField("Build configuration ID:", this.txtBuildConfigurationId)
{
HelpText = HelpText.FromHtml("This value can be found in a browser address bar when corresponding configuration is browsed within TeamCity. <br /><br />As an example, teamcity.jetbrains.com/viewLog.html?buildId=64797&buildTypeId=<strong>bt343</strong>&tab=...")
},
new SlimFormField("Branch:", this.txtBranchName)
{
HelpText = "The branch used to get the artifact, typically used in conjunction with predefined constant build numbers."
},
new SlimFormField("Additional parameters:", this.txtAdditionalParameters)
{
HelpText = HelpText.FromHtml("Optionally enter any additional parameters accepted by the TeamCity API in query string format, for example:<br/> " + HttpUtility.HtmlEncode("&name=agent&value=<agentnamevalue>&name=system.name&value=<systemnamevalue>.."))
},
new SlimFormField("Wait for completion:", this.chkWaitForCompletion)
{
HelpText = "Specify whether BuildMaster should pause the action until the TeamCity build has completed."
}
);
}
}
}