forked from Inedo/inedox-teamcity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GetArtifactActionEditor.cs
71 lines (64 loc) · 3.54 KB
/
GetArtifactActionEditor.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
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 GetArtifactActionEditor : ActionEditorBase
{
private ValidatingTextBox txtArtifactName;
private ValidatingTextBox txtBuildConfigurationId;
private ValidatingTextBox txtBuildNumber;
private ValidatingTextBox txtBranchName;
private CheckBox chkExtractFilesToTargetDirectory;
public override bool DisplayTargetDirectory { get { return true; } }
public override void BindToForm(ActionBase extension)
{
var action = (GetArtifactAction)extension;
this.txtArtifactName.Text = action.ArtifactName;
this.txtBuildConfigurationId.Text = action.BuildConfigurationId;
this.txtBuildNumber.Text = action.BuildNumber;
this.txtBranchName.Text = action.BranchName;
this.chkExtractFilesToTargetDirectory.Checked = action.ExtractFilesToTargetDirectory;
}
public override ActionBase CreateFromForm()
{
return new GetArtifactAction()
{
ArtifactName = this.txtArtifactName.Text,
BuildConfigurationId = this.txtBuildConfigurationId.Text,
BuildNumber = this.txtBuildNumber.Text,
BranchName = this.txtBranchName.Text,
ExtractFilesToTargetDirectory = this.chkExtractFilesToTargetDirectory.Checked
};
}
protected override void CreateChildControls()
{
this.txtArtifactName = new ValidatingTextBox() { Required = true };
this.txtBuildConfigurationId = new ValidatingTextBox() { Required = true };
this.txtBuildNumber = new ValidatingTextBox() { Required = true };
this.txtBranchName = new ValidatingTextBox() { DefaultText = "default" };
this.chkExtractFilesToTargetDirectory = new CheckBox() { Text = "Extract files in artifact to target directory" };
this.Controls.Add(
new SlimFormField("Artifact name:", this.txtArtifactName)
{
HelpText = HelpText.FromHtml("The name of artifact, for example: <br />\"ideaIC-118.SNAPSHOT.win.zip\". This value can also take a form of \"artifactName!archivePath\" for reading archive's content")
},
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("Build number:", this.txtBuildNumber)
{
HelpText = "The build number or one of predefined constants: \"lastSuccessful\", \"lastPinned\", or \"lastFinished\"."
},
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 options:", this.chkExtractFilesToTargetDirectory)
);
}
}
}