public ProjectGridRow[] GenerateProjectGridRows(ProjectStatusOnServer[] statusList, string forceBuildActionName, ProjectGridSortColumn sortColumn, bool sortIsAscending) { ArrayList rows = new ArrayList(); foreach (ProjectStatusOnServer statusOnServer in statusList) { ProjectStatus status = statusOnServer.ProjectStatus; IServerSpecifier serverSpecifier = statusOnServer.ServerSpecifier; string projectName = status.Name; rows.Add( new ProjectGridRow( projectName, statusOnServer.ServerSpecifier.ServerName, status.BuildStatus.ToString(), CalculateHtmlColor(status.BuildStatus), status.LastBuildDate, (status.LastBuildLabel != null ? status.LastBuildLabel : "no build available"), status.Status.ToString(), status.Activity.ToString(), urlBuilder.BuildFormName(forceBuildActionName), linkFactory.CreateProjectLink(new DefaultProjectSpecifier(serverSpecifier, projectName), ProjectReportProjectPlugin.ACTION_NAME).Url )); } rows.Sort(GetComparer(sortColumn, sortIsAscending)); return((ProjectGridRow[])rows.ToArray(typeof(ProjectGridRow))); }
public ProjectGridRow[] GenerateProjectGridRows(ProjectStatusOnServer[] statusList, string forceBuildActionName, ProjectGridSortColumn sortColumn, bool sortIsAscending, string categoryFilter, ICruiseUrlBuilder urlBuilder, Translations translations) { var rows = new List <ProjectGridRow>(); foreach (ProjectStatusOnServer statusOnServer in statusList) { ProjectStatus status = statusOnServer.ProjectStatus; IServerSpecifier serverSpecifier = statusOnServer.ServerSpecifier; DefaultProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(serverSpecifier, status.Name); if ((categoryFilter != string.Empty) && (categoryFilter != status.Category)) { continue; } rows.Add( new ProjectGridRow(status, serverSpecifier, urlBuilder.BuildProjectUrl(ProjectReportProjectPlugin.ACTION_NAME, projectSpecifier), urlBuilder.BuildProjectUrl(ProjectParametersAction.ActionName, projectSpecifier), translations)); } return(rows.OrderBy(a => a, GetComparer(sortColumn, sortIsAscending)).ToArray()); }
public ProjectGridRow[] GenerateProjectGridRows(ProjectStatusOnServer[] statusList, string forceBuildActionName, ProjectGridSortColumn sortColumn, bool sortIsAscending, string categoryFilter, ICruiseUrlBuilder urlBuilder, Translations translations) { ArrayList rows = new ArrayList(); foreach (ProjectStatusOnServer statusOnServer in statusList) { ProjectStatus status = statusOnServer.ProjectStatus; IServerSpecifier serverSpecifier = statusOnServer.ServerSpecifier; DefaultProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(serverSpecifier, status.Name); if ((categoryFilter != string.Empty) && (categoryFilter != status.Category)) continue; rows.Add( new ProjectGridRow(status, serverSpecifier, urlBuilder.BuildProjectUrl(ProjectReportProjectPlugin.ACTION_NAME, projectSpecifier), urlBuilder.BuildProjectUrl(ProjectParametersAction.ActionName, projectSpecifier), translations)); } rows.Sort(GetComparer(sortColumn, sortIsAscending)); return (ProjectGridRow[]) rows.ToArray(typeof (ProjectGridRow)); }
public ProjectGridRow[] GenerateProjectGridRows(IFarmService farmService, ProjectStatusOnServer[] statusList, string forceBuildActionName, ProjectGridSortColumn sortColumn, bool sortIsAscending) { ArrayList rows = new ArrayList(); foreach (ProjectStatusOnServer statusOnServer in statusList) { ProjectStatus status = statusOnServer.ProjectStatus; IServerSpecifier serverSpecifier = statusOnServer.ServerSpecifier; string projectName = status.Name; IProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(serverSpecifier, projectName); string baseUrl = Regex.Replace(statusOnServer.ProjectStatus.WebURL, @"default\.aspx\?.*", ""); string projectLink = baseUrl + linkFactory.CreateProjectLink(projectSpecifier, ProjectReportProjectPlugin.ACTION_NAME).Url; IBuildSpecifier[] buildSpecifiers = farmService.GetMostRecentBuildSpecifiers(projectSpecifier, 1); string mostRecentBuildUrl; if (buildSpecifiers.Length == 1) { mostRecentBuildUrl = baseUrl + linkFactory.CreateProjectLink(projectSpecifier, LatestBuildReportProjectPlugin.ACTION_NAME).Url; } else { mostRecentBuildUrl = projectLink; } String[] logMessages = farmService.GetLogMessages(projectSpecifier); String lastLogMessage = String.Empty; if (logMessages.Length > 0) { lastLogMessage = logMessages[logMessages.Length - 1]; } rows.Add( new ProjectGridRow( projectName, statusOnServer.ServerSpecifier.ServerName, status.BuildStatus.ToString(), CalculateHtmlColor(status.BuildStatus), status.LastBuildDate, status.LastBuildDuration, (status.LastBuildLabel != null ? status.LastBuildLabel : "no build available"), status.Status.ToString(), status.Activity.ToString(), urlBuilder.BuildFormName(forceBuildActionName), projectLink, mostRecentBuildUrl, ChangeSet.Convert(status.Modifications), status.Forcee, status.CurrentBuildStartTime, status.BuildCondition.ToString(), lastLogMessage, logMessages )); } rows.Sort(GetComparer(sortColumn, sortIsAscending)); return((ProjectGridRow[])rows.ToArray(typeof(ProjectGridRow))); }
public ProjectGridRow[] GenerateProjectGridRows(IFarmService farmService, ProjectStatusOnServer[] statusList, string forceBuildActionName, ProjectGridSortColumn sortColumn, bool sortIsAscending) { ArrayList rows = new ArrayList(); foreach (ProjectStatusOnServer statusOnServer in statusList) { ProjectStatus status = statusOnServer.ProjectStatus; IServerSpecifier serverSpecifier = statusOnServer.ServerSpecifier; string projectName = status.Name; IProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(serverSpecifier, projectName); string baseUrl = Regex.Replace(statusOnServer.ProjectStatus.WebURL, @"default\.aspx\?.*", ""); string projectLink = baseUrl + linkFactory.CreateProjectLink(projectSpecifier, ProjectReportProjectPlugin.ACTION_NAME).Url; IBuildSpecifier[] buildSpecifiers = farmService.GetMostRecentBuildSpecifiers(projectSpecifier, 1); string mostRecentBuildUrl; if (buildSpecifiers.Length == 1) { mostRecentBuildUrl = baseUrl + linkFactory.CreateProjectLink(projectSpecifier, LatestBuildReportProjectPlugin.ACTION_NAME).Url; } else { mostRecentBuildUrl = projectLink; } rows.Add( new ProjectGridRow( projectName, statusOnServer.ServerSpecifier.ServerName, status.BuildStatus.ToString(), CalculateHtmlColor(status.BuildStatus), status.LastBuildDate, status.LastBuildDuration, (status.LastBuildLabel != null ? status.LastBuildLabel : "no build available"), status.Status.ToString(), status.Activity.ToString(), urlBuilder.BuildFormName(forceBuildActionName), projectLink, mostRecentBuildUrl, ChangeSet.Convert(status.Modifications), status.Forcee, status.CurrentBuildStartTime, status.BuildCondition.ToString() )); } rows.Sort(GetComparer(sortColumn, sortIsAscending)); return (ProjectGridRow[])rows.ToArray(typeof(ProjectGridRow)); }
private HtmlFragmentResponse GenerateView(ProjectStatusListAndExceptions projectStatusListAndExceptions, Hashtable velocityContext, string actionName, IRequest request, IServerSpecifier serverSpecifier) { ProjectGridSortColumn sortColumn = GetSortColumn(request); bool sortReverse = SortAscending(request); velocityContext["projectNameSortLink"] = GenerateSortLink(serverSpecifier, actionName, ProjectGridSortColumn.Name, sortColumn, sortReverse); velocityContext["buildStatusSortLink"] = GenerateSortLink(serverSpecifier, actionName, ProjectGridSortColumn.BuildStatus, sortColumn, sortReverse); velocityContext["lastBuildDateSortLink"] = GenerateSortLink(serverSpecifier, actionName, ProjectGridSortColumn.LastBuildDate, sortColumn, sortReverse); velocityContext["projectGrid"] = projectGrid.GenerateProjectGridRows( farmService, projectStatusListAndExceptions.StatusAndServerList, actionName, sortColumn, sortReverse); velocityContext["exceptions"] = projectStatusListAndExceptions.Exceptions; velocityContext["refreshButtonName"] = urlBuilder.BuildFormName(actionName); return viewGenerator.GenerateView(@"ProjectGrid.vm", velocityContext); }
private object GenerateSortLink(IServerSpecifier serverSpecifier, string action, ProjectGridSortColumn column, ProjectGridSortColumn currentColumn, bool currentReverse) { string queryString = "SortColumn=" + column.ToString(); if (column == currentColumn && !currentReverse) { queryString += "&ReverseSort=ReverseSort"; } if (serverSpecifier == null) { return urlBuilder.BuildUrl(action, queryString); } else { return cruiseUrlBuilder.BuildServerUrl(action, serverSpecifier, queryString); } }
public ProjectGridRow[] GenerateProjectGridRows(IFarmService farmService, ProjectStatusOnServer[] statusList, string forceBuildActionName, ProjectGridSortColumn sortColumn, bool sortIsAscending) { ArrayList rows = new ArrayList(); foreach (ProjectStatusOnServer statusOnServer in statusList) { ProjectStatus status = statusOnServer.ProjectStatus; IServerSpecifier serverSpecifier = statusOnServer.ServerSpecifier; string projectName = status.Name; IProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(serverSpecifier, projectName); string projectLink = linkFactory.CreateProjectLink(projectSpecifier, ProjectReportProjectPlugin.ACTION_NAME).Url; IBuildSpecifier[] buildSpecifiers = farmService.GetMostRecentBuildSpecifiers(projectSpecifier, 1); string mostRecentBuildUrl; if (buildSpecifiers.Length == 1) { mostRecentBuildUrl = linkFactory.CreateProjectLink(projectSpecifier, LatestBuildReportProjectPlugin.ACTION_NAME).Url; } else { mostRecentBuildUrl = projectLink; } rows.Add( new ProjectGridRow( projectName, statusOnServer.ServerSpecifier.ServerName, status.BuildStatus.ToString(), CalculateHtmlColor(status.BuildStatus), status.LastBuildDate, (status.LastBuildLabel != null ? status.LastBuildLabel : "no build available"), status.Status.ToString(), status.Activity.ToString(), urlBuilder.BuildFormName(forceBuildActionName), projectLink, mostRecentBuildUrl )); } rows.Sort(GetComparer(sortColumn, sortIsAscending)); return((ProjectGridRow[])rows.ToArray(typeof(ProjectGridRow))); }
private HtmlFragmentResponse GenerateView(ProjectStatusListAndExceptions projectStatusListAndExceptions, string actionName, ICruiseRequest request, IServerSpecifier serverSpecifier) { this.translations = Translations.RetrieveCurrent(); cruiseUrlBuilder = request.UrlBuilder; urlBuilder = request.UrlBuilder.InnerBuilder; Hashtable velocityContext = new Hashtable(); velocityContext["forceBuildMessage"] = ForceBuildIfNecessary(request.Request); velocityContext["parametersCall"] = new ServerLink(cruiseUrlBuilder, new DefaultServerSpecifier("null"), string.Empty, ProjectParametersAction.ActionName).Url; velocityContext["wholeFarm"] = serverSpecifier == null ? true : false; string category = request.Request.GetText("Category"); velocityContext["showCategoryColumn"] = string.IsNullOrEmpty(category) ? true : false; ProjectGridSortColumn sortColumn = GetSortColumn(request.Request); bool sortReverse = SortAscending(request.Request); velocityContext["projectNameSortLink"] = GenerateSortLink(serverSpecifier, actionName, ProjectGridSortColumn.Name, sortColumn, sortReverse); velocityContext["buildStatusSortLink"] = GenerateSortLink(serverSpecifier, actionName, ProjectGridSortColumn.BuildStatus, sortColumn, sortReverse); velocityContext["lastBuildDateSortLink"] = GenerateSortLink(serverSpecifier, actionName, ProjectGridSortColumn.LastBuildDate, sortColumn, sortReverse); velocityContext["serverNameSortLink"] = GenerateSortLink(serverSpecifier, actionName, ProjectGridSortColumn.ServerName, sortColumn, sortReverse); velocityContext["projectCategorySortLink"] = GenerateSortLink(serverSpecifier, actionName, ProjectGridSortColumn.Category, sortColumn, sortReverse); ProjectGridRow[] projectGridRows = projectGrid.GenerateProjectGridRows(projectStatusListAndExceptions.StatusAndServerList, actionName, sortColumn, sortReverse, category, cruiseUrlBuilder, this.translations); velocityContext["projectGrid"] = projectGridRows; velocityContext["exceptions"] = projectStatusListAndExceptions.Exceptions; Array categoryList = this.GenerateCategoryList(projectGridRows); velocityContext["categoryList"] = categoryList; velocityContext["barAtTop"] = (this.SuccessIndicatorBarLocation == IndicatorBarLocation.Top) || (this.SuccessIndicatorBarLocation == IndicatorBarLocation.TopAndBottom); velocityContext["barAtBottom"] = (this.SuccessIndicatorBarLocation == IndicatorBarLocation.Bottom) || (this.SuccessIndicatorBarLocation == IndicatorBarLocation.TopAndBottom); return(viewGenerator.GenerateView(@"ProjectGrid.vm", velocityContext)); }
public ProjectGridRowComparer(ProjectGridSortColumn column, bool ascending) { this.column = column; this.ascending = ascending; }
private IComparer GetComparer(ProjectGridSortColumn column, bool ascending) { return(new ProjectGridRowComparer(column, ascending)); }
private IComparer GetComparer(ProjectGridSortColumn column, bool ascending) { return new ProjectGridRowComparer(column, ascending); }