protected override void CreateChildControls()
        {
            this.chkUseStandardGitClient = new CheckBox
            {
                Text = "Use Standard Git Client"
            };

            this.txtGitExecutablePath = new SourceControlFileFolderPicker
            {
                ServerId = this.EditorContext.ServerId,
                Required = false,
            };

            var ctlExePathField = new SlimFormField("Git executable path:", this.txtGitExecutablePath);

            this.Controls.Add(
                 new SlimFormField("Git client:", this.chkUseStandardGitClient)
                 {
                     HelpText = "This extension includes a lightweight Git client for Windows. To use an alternate Git client, check the box and provide the path of the other client."
                 },
                 ctlExePathField
            );

            this.Controls.BindVisibility(this.chkUseStandardGitClient, ctlExePathField);
        }
Ejemplo n.º 2
0
        protected override void CreateChildControls()
        {
            this.txtTargetAssembly = new ValidatingTextBox { Required = true };

            this.cbQueue = new CheckBox { Text = "Queue for background generation" };

            this.ddlMode = new DropDownList();
            this.ddlMode.AutoPostBack = true;
            this.ddlMode.Items.Add(new ListItem("Install", "Install"));
            this.ddlMode.Items.Add(new ListItem("Uninstall", "Uninstall"));
            this.ddlMode.Items.Add(new ListItem("Update", "Update"));
            this.ddlMode.SelectedValue = "Install";
            this.ddlMode.SelectedIndexChanged += ddlMode_SelectedIndexChanged;

            this.ffgTargetAssembly = new SlimFormField("Target assembly:", this.txtTargetAssembly)
            {
                HelpText = "The absolute path to the .NET assembly or its strong name if it is installed in the GAC."
            };

            this.ffgOptions = new SlimFormField("Options:", this.cbQueue);

            this.Controls.Add(
                new SlimFormField("Action:", this.ddlMode),
                this.ffgTargetAssembly,
                this.ffgOptions
            );
        }
Ejemplo n.º 3
0
        protected override void CreateChildControls()
        {
            this.txtTargetAssembly = new ValidatingTextBox {
                Required = true
            };

            this.cbQueue = new CheckBox {
                Text = "Queue for background generation"
            };

            this.ddlMode = new DropDownList();
            this.ddlMode.AutoPostBack = true;
            this.ddlMode.Items.Add(new ListItem("Install", "Install"));
            this.ddlMode.Items.Add(new ListItem("Uninstall", "Uninstall"));
            this.ddlMode.Items.Add(new ListItem("Update", "Update"));
            this.ddlMode.SelectedValue         = "Install";
            this.ddlMode.SelectedIndexChanged += ddlMode_SelectedIndexChanged;

            this.ffgTargetAssembly = new SlimFormField("Target assembly:", this.txtTargetAssembly)
            {
                HelpText = "The absolute path to the .NET assembly or its strong name if it is installed in the GAC."
            };

            this.ffgOptions = new SlimFormField("Options:", this.cbQueue);

            this.Controls.Add(
                new SlimFormField("Action:", this.ddlMode),
                this.ffgTargetAssembly,
                this.ffgOptions
                );
        }
Ejemplo n.º 4
0
        protected override void CreateChildControls()
        {
            this.txtBaseUrl = new ValidatingTextBox {
                DefaultText = "ex: http://tfsserver:80/tfs", Required = true
            };

            this.txtUserName = new ValidatingTextBox();

            this.txtDomain = new ValidatingTextBox();

            this.txtPassword = new PasswordTextBox();

            this.txtCustomWorkspacePath = new ValidatingTextBox {
                DefaultText = "BuildMaster managed"
            };
            this.txtCustomWorkspaceName = new ValidatingTextBox {
                DefaultText = "Default"
            };

            ddlAuthentication = new DropDownList {
                ID = "ddlAuthentication"
            };
            ddlAuthentication.Items.Add(new ListItem("System", "system"));
            ddlAuthentication.Items.Add(new ListItem("Specify account...", "specify"));

            var ffgAuthentication = new SlimFormField("Authentication:", ddlAuthentication);

            var ffgCredentials = new Div(
                new SlimFormField("User name:", this.txtUserName),
                new SlimFormField("Password:"******"Domain:", this.txtDomain)
                );

            this.Controls.Add(
                new SlimFormField("TFS URL:", this.txtBaseUrl),
                ffgAuthentication,
                ffgCredentials,
                new SlimFormField("Workspace path:", this.txtCustomWorkspacePath)
            {
                HelpText = "The directory on disk where the TFS workspace will be mapped. By default, BuildMaster will use "
                           + @"_SVCTEMP\SrcRepos\{workspace-name}"
            },
                new SlimFormField("Workspace name:", this.txtCustomWorkspaceName)
            {
                HelpText = "The name of the TFS workspace to use. This value should be unique per credentials and machine. "
                           + "By default, BuildMaster will use the deepest subdirectory of the workspace path to generate the name."
            },
                new RenderJQueryDocReadyDelegator(
                    w =>
            {
                w.Write("$('#{0}').change(function(){{", this.ddlAuthentication.ClientID);
                w.Write("if($(this).val() == 'system') $('#{0}').hide(); else $('#{0}').show();", ffgCredentials.ClientID);
                w.Write("});");
                w.Write("$('#{0}').change();", this.ddlAuthentication.ClientID);
            }
                    )
                );
        }
Ejemplo n.º 5
0
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            //ddlConfigurationFile
            this.ddlConfigurationFile = new DropDownList {
                ID = "ddlConfigurationFile", Width = 300, AutoPostBack = true
            };
            this.ddlConfigurationFile.Items.Add(string.Empty);
            this.ddlConfigurationFile.Items.AddRange(
                DB.ConfigurationFiles_GetConfigurationFiles(Application_Id: this.ApplicationId, Deployable_Id: AH.NullIf(this.DeployableId, 0))
                .ConfigurationFiles_Extended
                .Select(c => new ListItem {
                Text = c.FilePath_Text, Value = c.ConfigurationFile_Id.ToString()
            })
                );
            this.ddlConfigurationFile.Items.Add(new ListItem {
                Text = "Type name...", Value = "X", Enabled = false
            });
            this.ddlConfigurationFile.SelectedIndexChanged += this.ddlConfigurationFile_SelectedIndexChanged;

            //ddlInstance
            ddlInstance = new DropDownList {
                ID = "ddlInstance", Width = 300
            };
            this.txtConfigurationFileName = new ValidatingTextBox {
                Width = 300
            };
            this.txtInstanceName = new ValidatingTextBox {
                Width = 300
            };

            this.ctl_txtInstanceName = new SlimFormField("Instance Name:", this.txtInstanceName)
            {
                Visible = false
            };
            this.ctl_ddlInstance = new SlimFormField("Instance Name:", this.ddlInstance);
            this.ctl_txtConfigurationFileName = new SlimFormField("Configuration File Name:", this.txtConfigurationFileName)
            {
                Visible = false
            };

            this.Controls.Add(
                new Div(
                    new SlimFormField("Configuration Text:", this.txtConfigText),
                    new SlimFormField("Configuration File Location:", this.ffpConfigFilePath),
                    new SlimFormField("Configuration File:", this.ddlConfigurationFile),
                    ctl_txtConfigurationFileName,
                    ctl_ddlInstance
                    )
                );
        }
Ejemplo n.º 6
0
        public override ISimpleControl CreateView(ActionStatement action)
        {
            if (action.PositionalArguments?.Count != 1)
            {
                return(new LiteralHtml("Cannot edit this statement; the target script name is not present."));
            }

            var scriptName = LooselyQualifiedName.Parse(action.PositionalArguments[0]);
            var info       = PowerShellScriptInfo.TryLoadAsync(scriptName).GetAwaiter().GetResult();

            if (info == null)
            {
                return(new LiteralHtml("Cannot edit this statement; script metatdata could not be parsed."));
            }

            var argumentName = new KoElement(KoBind.text(nameof(Argument.Name)));
            var argumentDesc = new KoElement(
                KoBind.text(nameof(Argument.Description))
                );

            var field = new SlimFormField(new LiteralHtml(argumentName.ToString()));

            field.HelpText = new LiteralHtml(argumentDesc.ToString());
            field.Controls.Add(
                new Element("input",
                            new KoBindAttribute("planargvalue", nameof(Argument.Value)))
            {
                Attributes = { ["type"] = "text" }
            });

            return(new SimpleVirtualCompositeControl(
                       new SlimFormField("Script name:", info.Name ?? scriptName.ToString()),
                       new Div(
                           new KoElement(
                               KoBind.@foreach(nameof(PSCallOperationModel.Arguments)),
                               field
                               )
                           )
            {
                Class = "argument-container"
            },
                       new SlimFormField(
                           "Parameters:",
                           KoBind.visible($"{nameof(PSCallOperationModel.Arguments)}().length == 0"),
                           "This script does not have any input or output parameters."
                           )
                       ));
        }
Ejemplo n.º 7
0
        private void AddActionOptions()
        {
            var ff = new SlimFormField("Action options:");

            if (extensionInstance.UsesTreatWarningsAsError)
            {
                ff.Controls.Add(new Div(chkWarningsAsError));
            }
            if (extensionInstance.UsesWaitForCompletion)
            {
                ff.Controls.Add(new Div(chkWaitForCompletion));
            }
            if (extensionInstance.UsesTreatWarningsAsError || extensionInstance.UsesWaitForCompletion)
            {
                this.Controls.Add(ff);
            }
        }
Ejemplo n.º 8
0
        protected override void CreateChildControls()
        {
            this.ctlServerPicker = new ActionServerPicker { ServerId = 1, ID = "ctlServerPicker" };

            this.txtBaseUrl = new ValidatingTextBox();

            this.txtUserName = new ValidatingTextBox();

            this.txtDomain = new ValidatingTextBox();

            this.txtPassword = new PasswordTextBox();

            this.ddlAuthentication = new DropDownList { ID = "ddlAuthentication" };
            this.ddlAuthentication.Items.Add(new ListItem("System", "system"));
            this.ddlAuthentication.Items.Add(new ListItem("Specify account...", "specify"));

            var sffAuthentication = new SlimFormField("Authentication:", this.ddlAuthentication) { ID = "sffAuthentication" };

            var sffCredentials = new SlimFormField("Credentials:",
                new Div(new Div("Username:"******"Password:"******"Domain:"), new Div(this.txtDomain))
                ) { ID = "sffCredentials" };

            this.Controls.Add(
                new SlimFormField("TFS client:", this.ctlServerPicker){ HelpText = "The server where the TFS Client (Visual Studio or Team Explorer) is installed." },
                new SlimFormField("TFS collection url:", this.txtBaseUrl){ HelpText = "The is the api of the TFS Collection to use, e.g. http://tfsserver:8080/tfs" },
                sffAuthentication,
                sffCredentials,
                new RenderJQueryDocReadyDelegator(w =>
                        {
                            w.WriteLine(
@"  var onAuthorizationChange = function(){
        if($('#" + ddlAuthentication.ClientID + @" option:selected').val() == 'system') {
            $('#" + sffCredentials.ClientID + @"').hide();
        }
        else {
            $('#" + sffCredentials.ClientID + @"').show();
        }
    };
    onAuthorizationChange();
    $('#" + this.ddlAuthentication.ClientID + @"').change(onAuthorizationChange);
");
                        })
              );
        }
        protected override void CreateChildControls()
        {
            this.txtBaseUrl = new ValidatingTextBox {
                DefaultText = "ex: http://tfsserver:80/tfs", Required = true
            };

            this.txtUserName = new ValidatingTextBox();

            this.txtDomain = new ValidatingTextBox();

            this.txtPassword = new PasswordTextBox();

            ddlAuthentication = new DropDownList()
            {
                ID = "ddlAuthentication"
            };
            ddlAuthentication.Items.Add(new ListItem("System", "system"));
            ddlAuthentication.Items.Add(new ListItem("Specify account...", "specify"));

            var ffgAuthentication = new SlimFormField("Authentication:", ddlAuthentication);

            var ffgCredentials = new Div(
                new SlimFormField("User name:", this.txtUserName),
                new SlimFormField("Password:"******"Domain:", this.txtDomain)
                );

            this.Controls.Add(
                new SlimFormField("TFS URL:", this.txtBaseUrl),
                ffgAuthentication,
                ffgCredentials,
                new RenderJQueryDocReadyDelegator(
                    w =>
            {
                w.Write("$('#{0}').change(function(){{", this.ddlAuthentication.ClientID);
                w.Write("if($(this).val() == 'system') $('#{0}').hide(); else $('#{0}').show();", ffgCredentials.ClientID);
                w.Write("});");
                w.Write("$('#{0}').change();", this.ddlAuthentication.ClientID);
            }
                    )
                );
        }
        protected override void CreateChildControls()
        {
            this.txtApiUrl = new ValidatingTextBox() { DefaultText = GitHub.GitHubComUrl };

            this.chkUseStandardGitClient = new CheckBox
            {
                Text = "Use Standard Git Client"
            };

            this.txtGitExecutablePath = new SourceControlFileFolderPicker
            {
                ServerId = this.EditorContext.ServerId,
                Required = false
            };

            this.txtOrganizationName = new ValidatingTextBox { Required = false, DefaultText = "Optional" };
            this.txtUserName = new ValidatingTextBox { Required = true };
            this.txtPassword = new PasswordTextBox { Required = true };

            var ctlExePathField = new SlimFormField("Git executable path:", this.txtGitExecutablePath);

            this.Controls.Add(
                new SlimFormField("API base URL:", this.txtApiUrl)
                {
                    HelpText = "This provider connects to github.com by default. If connecting to GitHub Enterprise on a local network, specify the hostname of the API here."
                },
                new SlimFormField("Organization name:", this.txtOrganizationName),
                new SlimFormField("GitHub username:"******"GitHub password:"******"Git client:", this.chkUseStandardGitClient)
                {
                    HelpText = "This extension includes a lightweight Git client for Windows. To use an alternate Git client, check the box and provide the path of the other client."
                },
                ctlExePathField
            );

            this.Controls.BindVisibility(this.chkUseStandardGitClient, ctlExePathField);
        }
Ejemplo n.º 11
0
        protected override void CreateChildControls()
        {
            this.txtBaseUrl = new ValidatingTextBox { DefaultText = "ex: http://tfsserver:80/tfs", Required = true };

            this.txtUserName = new ValidatingTextBox();

            this.txtDomain = new ValidatingTextBox();

            this.txtPassword = new PasswordTextBox();

            ddlAuthentication = new DropDownList() { ID = "ddlAuthentication" };
            ddlAuthentication.Items.Add(new ListItem("System", "system"));
            ddlAuthentication.Items.Add(new ListItem("Specify account...", "specify"));

            var ffgAuthentication = new SlimFormField("Authentication:", ddlAuthentication);

            var ffgCredentials = new Div(
                new SlimFormField("User name:", this.txtUserName),
                new SlimFormField("Password:"******"Domain:", this.txtDomain)
            );

            this.Controls.Add(
                new SlimFormField("TFS URL:", this.txtBaseUrl),
                ffgAuthentication,
                ffgCredentials,
                new RenderJQueryDocReadyDelegator(
                    w =>
                    {
                        w.Write("$('#{0}').change(function(){{", this.ddlAuthentication.ClientID);
                        w.Write("if($(this).val() == 'system') $('#{0}').hide(); else $('#{0}').show();", ffgCredentials.ClientID);
                        w.Write("});");
                        w.Write("$('#{0}').change();", this.ddlAuthentication.ClientID);
                    }
                )
            );
        }
Ejemplo n.º 12
0
        protected override void CreateChildControls()
        {
            this.ddlSourceType = new DropDownList {
                ID = "ddlSourceType"
            };
            this.ddlSourceType.Items.Add(new ListItem(".nuspec file", "nuspec"));
            this.ddlSourceType.Items.Add(new ListItem("msbuild project", "msbuild"));

            this.txtNuspecPath = new Inedo.Web.FileBrowserTextBox
            {
                IncludeFiles = true,
                ServerId     = this.ServerId
            };

            this.txtProjectPath = new Inedo.Web.FileBrowserTextBox
            {
                IncludeFiles = true,
                ServerId     = this.ServerId
            };

            this.txtVersion = new ValidatingTextBox {
                DefaultText = "default (nuspec or project version)"
            };

            this.txtProperties = new ValidatingTextBox
            {
                Rows        = 5,
                TextMode    = TextBoxMode.MultiLine,
                DefaultText = "none"
            };

            this.chkSymbols = new CheckBox {
                Text = "Create symbol package"
            };
            this.chkIncludeReferencedProjects = new CheckBox {
                Text = "Include referenced projects"
            };

            var ctlNuspecFileField = new SlimFormField(".nuspec file:", this.txtNuspecPath)
            {
                ID = "ctlNuspecFileField"
            };
            var ctlProjectFileField = new SlimFormField("MSBuild project:", this.txtProjectPath)
            {
                ID = "ctlProjectFileField"
            };

            var ffgProperties = new SlimFormField("Properties:", this.txtProperties)
            {
                ID       = "ffgProperties",
                HelpText = "Provide additional properties to pass to NuGet. Use the format Property=Value (one per line). For example:<br/><i>Configuration=Release</i>"
            };

            this.Controls.Add(
                new SlimFormField("Source:", this.ddlSourceType),
                ctlNuspecFileField,
                ctlProjectFileField,
                new SlimFormField("Package version:", this.txtVersion),
                ffgProperties,
                new SlimFormField("Options:", new Div(this.chkSymbols), new Div(this.chkIncludeReferencedProjects)),
                new RenderJQueryDocReadyDelegator(
                    w =>
            {
                w.WriteLine("var updateFields = function() {");
                w.WriteLine("  if($('#{0}').val() == 'nuspec') {{", this.ddlSourceType.ClientID);
                w.WriteLine("    $('#{0}').show();", ctlNuspecFileField.ClientID);
                w.WriteLine("    $('#{0}').hide();", ctlProjectFileField.ClientID);
                w.WriteLine("    $('#{0}').hide();", ffgProperties.ClientID);
                w.WriteLine("  } else {");
                w.WriteLine("    $('#{0}').show();", ctlProjectFileField.ClientID);
                w.WriteLine("    $('#{0}').hide();", ctlNuspecFileField.ClientID);
                w.WriteLine("    $('#{0}').show();", ffgProperties.ClientID);
                w.WriteLine("  }");
                w.WriteLine("};");
                w.WriteLine("updateFields();");
                w.WriteLine("$('#{0}').change(updateFields);", this.ddlSourceType.ClientID);
            }
                    )
                );
        }
Ejemplo n.º 13
0
        protected override void CreateChildControls()
        {
            this.ddlCollection = new SelectList();
            this.ddlCollection.Items.AddRange(
                from c in this.collections.Value
                orderby c.Name
                select new SelectListItem(c.Name, c.Id.ToString())
                );

            if (this.HasProviderWiql())
            {
                this.Controls.Add(
                    new P("There is a custom WIQL query defined at the provider level. That query will override any project or area filtering here."),
                    new P("However, you may still specify a custom WIQL query here to override the provider's WIQL query.")
                    );
            }

            this.ddlUseWiql = new SelectList
            {
                Items =
                {
                    new SelectListItem("Not using a custom query", "False"),
                    new SelectListItem("Custom WIQL query",        "True")
                }
            };

            this.ctlProject = new HiddenField {
                ID = "ctlProject"
            };
            this.ctlAreaPath = new HiddenField {
                ID = "ctlAreaPath"
            };

            var ctlNoWiql = new Div(
                new SlimFormField("Project:", this.ctlProject),
                new SlimFormField("Area Path:", this.ctlAreaPath)
                );

            this.txtCustomWiql = new TextBox
            {
                TextMode = TextBoxMode.MultiLine,
                Rows     = 5
            };

            var ctlWiql = new SlimFormField("Custom query:", this.txtCustomWiql);

            this.Controls.Add(
                new SlimFormField("Collection:", this.ddlCollection),
                new SlimFormField("Query mode:", this.ddlUseWiql),
                ctlNoWiql,
                ctlWiql,
                new RenderJQueryDocReadyDelegator(
                    w =>
            {
                w.Write("TfsIssueTrackingApplicationFilterEditor_Init(");
                JsonSerializer.CreateDefault().Serialize(
                    w,
                    new
                {
                    ddlCollection  = ddlCollection.ClientID,
                    ddlUseWiql     = ddlUseWiql.ClientID,
                    ctlWiql        = ctlWiql.ClientID,
                    ctlNoWiql      = ctlNoWiql.ClientID,
                    ctlProject     = ctlProject.ClientID,
                    ctlArea        = ctlAreaPath.ClientID,
                    getProjectsUrl = Ajax.GetUrl(new Func <int, string, object>(GetProjects)),
                    getAreasUrl    = Ajax.GetUrl(new Func <int, string, string, object>(GetAreas)),
                    applicationId  = this.EditorContext.ApplicationId
                }
                    );
                w.Write(");");
            }
                    )
                );
        }
Ejemplo n.º 14
0
        protected override void CreateChildControls()
        {
            this.txtBaseUrl = new ValidatingTextBox
            {
                DefaultText = "ex: http://tfsserver:80/tfs",
                Required    = true
            };

            this.txtCustomReleaseNumberFieldName = new ValidatingTextBox {
                DefaultText = "iteration"
            };

            this.txtUserName = new ValidatingTextBox();

            this.txtDomain = new ValidatingTextBox();

            this.txtPassword = new PasswordTextBox();

            this.chkAllowHtml = new CheckBox {
                Text = "Allow HTML in issue descriptions"
            };

            this.txtCustomClosedStates = new ValidatingTextBox()
            {
                TextMode    = TextBoxMode.MultiLine,
                Rows        = 3,
                DefaultText = "Closed\r\nResolved"
            };

            ddlAuthentication = new DropDownList
            {
                ID    = "ddlAuthentication",
                Items =
                {
                    new ListItem("System",             "system"),
                    new ListItem("Specify account...", "specify")
                }
            };

            this.ddlUseWiql = new DropDownList
            {
                ID    = "ddlUseWiql",
                Items =
                {
                    new ListItem("Not using a custom query", "False"),
                    new ListItem("Custom WIQL query",        "True")
                }
            };

            var ffgAuthentication = new SlimFormField("Authentication:", ddlAuthentication);

            var ffgCredentials = new Div(
                new SlimFormField("User name:", this.txtUserName),
                new SlimFormField("Password:"******"Domain:", this.txtDomain)
                );

            this.txtWiql = new ValidatingTextBox
            {
                TextMode = TextBoxMode.MultiLine,
                Rows     = 5
            };

            var ctlWiql = new SlimFormField("WIQL query:", this.txtWiql)
            {
                HelpText = "This will be sent to TFS directly, after BuildMaster variables have been replaced. This WIQL query should return all issues "
                           + "for the current BuildMaster release. Any release-level or higher BuildMaster variables may be used in this query."
            };

            var ctlNoWiql = new SlimFormField("Release number field:", this.txtCustomReleaseNumberFieldName)
            {
                HelpText = HelpText.FromHtml("If you store your TFS work item release numbers in a custom field, enter the full field \"refname\" of the custom field here - otherwise leave this field blank and \"Iteration\" will be used to retrieve them.<br /><br />For more information on custom work item types, visit <a href=\"http://msdn.microsoft.com/en-us/library/ms400654.aspx\" target=\"_blank\">http://msdn.microsoft.com/en-us/library/ms400654.aspx</a>")
            };

            this.Controls.Add(
                new SlimFormField("TFS URL:", this.txtBaseUrl),
                ffgAuthentication,
                ffgCredentials,
                new SlimFormField("Query mode:", this.ddlUseWiql),
                ctlNoWiql,
                ctlWiql,
                new SlimFormField("Options:", this.chkAllowHtml),
                new RenderJQueryDocReadyDelegator(
                    w =>
            {
                w.Write("$('#{0}').change(function(){{", this.ddlAuthentication.ClientID);
                w.Write("if($(this).val() == 'system') $('#{0}').hide(); else $('#{0}').show();", ffgCredentials.ClientID);
                w.Write("});");
                w.Write("$('#{0}').change();", this.ddlAuthentication.ClientID);

                w.Write("$('#{0}').change(function(){{", this.ddlUseWiql.ClientID);
                w.Write("if($(this).val() == 'False') {{ $('#{0}').hide(); $('#{1}').show(); }} else {{ $('#{0}').show(); $('#{1}').hide(); }}", ctlWiql.ClientID, ctlNoWiql.ClientID);
                w.Write("});");
                w.Write("$('#{0}').change();", this.ddlUseWiql.ClientID);
            }
                    ),
                new SlimFormField("Closed statuses:", this.txtCustomClosedStates)
            {
                HelpText = "The newline-separated list of issue states in TFS that BuildMaster will use to determine if a synchronized issue is closed."
            }
                );
        }
        protected override void CreateChildControls()
        {
            this.ddlCollection = new ComboSelect();
            this.ddlCollection.Items.AddRange(
                from c in this.collections.Value
                orderby c.Name
                select new ListItem(c.Name, c.Id.ToString())
            );

            if (this.HasProviderWiql())
            {
                this.Controls.Add(
                    new InfoBox(
                        InfoBox.InfoBoxTypes.Info,
                        new P("There is a custom WIQL query defined at the provider level. That query will override any project or area filtering here."),
                        new P("However, you may still specify a custom WIQL query here to override the provider's WIQL query.")
                    )
                );
            }

            this.ddlUseWiql = new ComboSelect
            {
                Items =
                {
                    new ListItem("Not using a custom query", "False"),
                    new ListItem("Custom WIQL query", "True")
                }
            };

            this.ctlProject = new HiddenField { ID = "ctlProject" };
            this.ctlAreaPath = new HiddenField { ID = "ctlAreaPath" };

            var ctlNoWiql = new Div(
                new SlimFormField("Project:", this.ctlProject),
                new SlimFormField("Area Path:", this.ctlAreaPath)
            );

            this.txtCustomWiql = new TextBox
            {
                TextMode = TextBoxMode.MultiLine,
                Rows = 5
            };

            var ctlWiql = new SlimFormField("Custom query:", this.txtCustomWiql);

            this.Controls.Add(
                new SlimFormField("Collection:", this.ddlCollection),
                new SlimFormField("Query mode:", this.ddlUseWiql),
                ctlNoWiql,
                ctlWiql,
                new RenderJQueryDocReadyDelegator(
                    w =>
                    {
                        w.Write("TfsIssueTrackingApplicationFilterEditor_Init(");
                        InedoLib.Util.JavaScript.WriteJson(
                            w,
                            new
                            {
                                ddlCollection = ddlCollection.ClientID,
                                ddlUseWiql = ddlUseWiql.ClientID,
                                ctlWiql = ctlWiql.ClientID,
                                ctlNoWiql = ctlNoWiql.ClientID,
                                ctlProject = ctlProject.ClientID,
                                ctlArea = ctlAreaPath.ClientID,
                                getProjectsUrl = DynamicHttpHandling.GetJavascriptDataUrl<int, string, object>(GetProjects),
                                getAreasUrl = DynamicHttpHandling.GetJavascriptDataUrl<int, string, string, object>(GetAreas),
                                applicationId = this.EditorContext.ApplicationId
                            }
                        );
                        w.Write(");");
                    }
                )
            );
        }
Ejemplo n.º 16
0
        protected override void CreateChildControls()
        {
            this.ctlServerPicker = new ActionServerPicker {
                ServerId = 1, ID = "ctlServerPicker"
            };

            this.txtBaseUrl = new ValidatingTextBox();

            this.txtUserName = new ValidatingTextBox();

            this.txtDomain = new ValidatingTextBox();

            this.txtPassword = new PasswordTextBox();

            this.ddlAuthentication = new DropDownList {
                ID = "ddlAuthentication"
            };
            this.ddlAuthentication.Items.Add(new ListItem("System", "system"));
            this.ddlAuthentication.Items.Add(new ListItem("Specify account...", "specify"));

            var sffAuthentication = new SlimFormField("Authentication:", this.ddlAuthentication)
            {
                ID = "sffAuthentication"
            };

            var sffCredentials = new SlimFormField("Credentials:",
                                                   new Div(new Div("Username:"******"Password / access token:"), new Div(this.txtPassword)),
                                                   new Div(new Div("Domain:"), new Div(this.txtDomain))
                                                   )
            {
                ID       = "sffCredentials",
                HelpText = new LiteralHtml("For Visual Studio Online, either <a href=\"https://www.visualstudio.com/en-us/integrate/get-started/auth/overview\" target=\"_blank\">Alternate Credentials or Personal Access Tokens</a> must be used in the password field.", false)
            };

            this.Controls.Add(
                new SlimFormField("TFS client:", this.ctlServerPicker)
            {
                HelpText = "The server where the TFS Client (Visual Studio or Team Explorer) is installed."
            },
                new SlimFormField("TFS collection url:", this.txtBaseUrl)
            {
                HelpText = "The is the api of the TFS Collection to use, e.g. http://tfsserver:8080/tfs"
            },
                sffAuthentication,
                sffCredentials,
                new RenderJQueryDocReadyDelegator(w =>
            {
                w.WriteLine(
                    @"  var onAuthorizationChange = function(){
        if($('#" + ddlAuthentication.ClientID + @" option:selected').val() == 'system') {
            $('#" + sffCredentials.ClientID + @"').hide();
        }
        else {
            $('#" + sffCredentials.ClientID + @"').show();
        }
    };
    onAuthorizationChange();
    $('#" + this.ddlAuthentication.ClientID + @"').change(onAuthorizationChange);
");
            })
                );
        }
Ejemplo n.º 17
0
        protected override void CreateChildControls()
        {
            this.txtBaseUrl = new ValidatingTextBox
            {
                DefaultText = "ex: http://tfsserver:80/tfs",
                Required = true
            };

            this.txtCustomReleaseNumberFieldName = new ValidatingTextBox { DefaultText = "iteration" };

            this.txtUserName = new ValidatingTextBox();

            this.txtDomain = new ValidatingTextBox();

            this.txtPassword = new PasswordTextBox();

            this.chkAllowHtml = new CheckBox { Text = "Allow HTML in issue descriptions" };

            this.txtCustomClosedStates = new ValidatingTextBox()
            {
                TextMode = TextBoxMode.MultiLine,
                Rows = 3,
                DefaultText = "Closed\r\nResolved"
            };

            ddlAuthentication = new DropDownList
            {
                ID = "ddlAuthentication",
                Items =
                {
                    new ListItem("System", "system"),
                    new ListItem("Specify account...", "specify")
                }
            };

            this.ddlUseWiql = new DropDownList
            {
                ID = "ddlUseWiql",
                Items =
                {
                    new ListItem("Not using a custom query", "False"),
                    new ListItem("Custom WIQL query", "True")
                }
            };

            var ffgAuthentication = new SlimFormField("Authentication:", ddlAuthentication);

            var ffgCredentials = new Div(
                new SlimFormField("User name:", this.txtUserName),
                new SlimFormField("Password:"******"Domain:", this.txtDomain)
            );

            this.txtWiql = new ValidatingTextBox
            {
                TextMode = TextBoxMode.MultiLine,
                Rows = 5
            };

            var ctlWiql = new SlimFormField("WIQL query:", this.txtWiql)
            {
                HelpText = "This will be sent to TFS directly, after BuildMaster variables have been replaced. This WIQL query should return all issues "
                         + "for the current BuildMaster release. Any release-level or higher BuildMaster variables may be used in this query."
            };

            var ctlNoWiql = new SlimFormField("Release number field:", this.txtCustomReleaseNumberFieldName)
            {
                HelpText = HelpText.FromHtml("If you store your TFS work item release numbers in a custom field, enter the full field \"refname\" of the custom field here - otherwise leave this field blank and \"Iteration\" will be used to retrieve them.<br /><br />For more information on custom work item types, visit <a href=\"http://msdn.microsoft.com/en-us/library/ms400654.aspx\" target=\"_blank\">http://msdn.microsoft.com/en-us/library/ms400654.aspx</a>")
            };

            this.Controls.Add(
                new SlimFormField("TFS URL:", this.txtBaseUrl),
                ffgAuthentication,
                ffgCredentials,
                new SlimFormField("Query mode:", this.ddlUseWiql),
                ctlNoWiql,
                ctlWiql,
                new SlimFormField("Options:", this.chkAllowHtml),
                new RenderJQueryDocReadyDelegator(
                    w =>
                    {
                        w.Write("$('#{0}').change(function(){{", this.ddlAuthentication.ClientID);
                        w.Write("if($(this).val() == 'system') $('#{0}').hide(); else $('#{0}').show();", ffgCredentials.ClientID);
                        w.Write("});");
                        w.Write("$('#{0}').change();", this.ddlAuthentication.ClientID);

                        w.Write("$('#{0}').change(function(){{", this.ddlUseWiql.ClientID);
                        w.Write("if($(this).val() == 'False') {{ $('#{0}').hide(); $('#{1}').show(); }} else {{ $('#{0}').show(); $('#{1}').hide(); }}", ctlWiql.ClientID, ctlNoWiql.ClientID);
                        w.Write("});");
                        w.Write("$('#{0}').change();", this.ddlUseWiql.ClientID);
                    }
                ),
                new SlimFormField("Closed statuses:", this.txtCustomClosedStates)
                {
                    HelpText = "The newline-separated list of issue states in TFS that BuildMaster will use to determine if a synchronized issue is closed."
                }
            );
        }