forked from Inedo/inedox-teamcity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TeamCityBuildImporterEditor.cs
63 lines (59 loc) · 2.66 KB
/
TeamCityBuildImporterEditor.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
using Inedo.BuildMaster;
using Inedo.BuildMaster.Extensibility.BuildImporters;
using Inedo.BuildMaster.Web.Controls.Extensions.BuildImporters;
using Inedo.Web.Controls;
using Inedo.Web.Controls.SimpleHtml;
namespace Inedo.BuildMasterExtensions.TeamCity
{
internal sealed class TeamCityBuildImporterEditor : BuildImporterEditorBase<TeamCityBuildImporterTemplate>
{
private ValidatingTextBox txtArtifactName;
private ValidatingTextBox txtBranchName;
private BuildNumberPicker ctlBuildNumber;
public override BuildImporterBase CreateFromForm()
{
return new TeamCityBuildImporter
{
ArtifactName = this.txtArtifactName.Text,
BuildConfigurationId = this.Template.BuildConfigurationId,
BuildConfigurationDisplayName = this.Template.BuildConfigurationDisplayName,
BuildNumber = this.ctlBuildNumber.Value,
BranchName = this.txtBranchName.Text
};
}
protected override void CreateChildControls()
{
this.txtArtifactName = new ValidatingTextBox
{
Required = true,
Enabled = !this.Template.ArtifactNameLocked,
Text = this.Template.ArtifactName
};
this.txtBranchName = new ValidatingTextBox
{
Text = this.Template.BranchName,
Enabled = !this.Template.BranchNameLocked,
DefaultText = "Default"
};
this.ctlBuildNumber = new BuildNumberPicker
{
Value = Util.CoalesceStr(this.Template.BuildNumber, "lastSuccessful"),
Enabled = string.IsNullOrEmpty(this.Template.BuildNumber),
BuildConfigurationId = this.Template.BuildConfigurationId,
ConfigurerId = this.Template.ExtensionConfigurerId ?? 0
};
this.Controls.Add(
new SlimFormField("Build configuration:", new Div(this.Template.BuildConfigurationDisplayName)),
new SlimFormField("TeamCity build number:", new Div(this.ctlBuildNumber)),
new SlimFormField("Artifact name:", this.txtArtifactName)
{
HelpText = "The name of artifact, for example: \"ideaIC-118.SNAPSHOT.win.zip\"."
},
new SlimFormField("Branch:", this.txtBranchName)
{
HelpText = "The branch used to get the artifact, typically used in conjunction with predefined constant build numbers."
}
);
}
}
}