private IResponse GenerateAuditHistory(ICruiseRequest request) { var velocityContext = new Hashtable(); var links = new List<IAbsoluteLink>(); links.Add(new ServerLink(request.UrlBuilder, request.ServerSpecifier, "Server", ActionName)); ProjectStatusListAndExceptions projects = farmService.GetProjectStatusListAndCaptureExceptions(request.ServerSpecifier, request.RetrieveSessionToken()); foreach (ProjectStatusOnServer projectStatusOnServer in projects.StatusAndServerList) { DefaultProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(projectStatusOnServer.ServerSpecifier, projectStatusOnServer.ProjectStatus.Name); links.Add(new ProjectLink(request.UrlBuilder, projectSpecifier, projectSpecifier.ProjectName, ServerAuditHistoryServerPlugin.ActionName)); } velocityContext["projectLinks"] = links; string sessionToken = request.RetrieveSessionToken(sessionRetriever); if (!string.IsNullOrEmpty(request.ProjectName)) { velocityContext["currentProject"] = request.ProjectName; AuditFilterBase filter = AuditFilters.ByProject(request.ProjectName); velocityContext["auditHistory"] = farmService.ReadAuditRecords(request.ServerSpecifier, sessionToken, 0, 100, filter); } else { velocityContext["auditHistory"] = new ServerLink(request.UrlBuilder, request.ServerSpecifier, string.Empty, DiagnosticsActionName); velocityContext["auditHistory"] = farmService.ReadAuditRecords(request.ServerSpecifier, sessionToken, 0, 100); } return viewGenerator.GenerateView(@"AuditHistory.vm", velocityContext); }
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)); }
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); }
private IResponse GenerateUserList(ICruiseRequest request, string message, string error) { Hashtable velocityContext = new Hashtable(); velocityContext["message"] = message; velocityContext["error"] = error; var links = new List<IAbsoluteLink>(); links.Add(new ServerLink(request.UrlBuilder, request.ServerSpecifier, "User List", ActionName)); ProjectStatusListAndExceptions projects = farmService.GetProjectStatusListAndCaptureExceptions(request.ServerSpecifier, request.RetrieveSessionToken()); foreach (ProjectStatusOnServer projectStatusOnServer in projects.StatusAndServerList) { DefaultProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(projectStatusOnServer.ServerSpecifier, projectStatusOnServer.ProjectStatus.Name); links.Add(new ProjectLink(request.UrlBuilder, projectSpecifier, projectSpecifier.ProjectName, ServerUserListServerPlugin.ActionName)); } velocityContext["projectLinks"] = links; string sessionToken = request.RetrieveSessionToken(sessionRetriever); List<UserDetails> allUsers = farmService.ListAllUsers(request.ServerSpecifier, sessionToken); foreach (UserDetails user in allUsers) { if (user.DisplayName == null) user.DisplayName = string.Empty; } velocityContext["users"] = allUsers; if (!string.IsNullOrEmpty(request.ProjectName)) { velocityContext["currentProject"] = request.ProjectName; velocityContext["diagnosticsCall"] = new ProjectLink(request.UrlBuilder, request.ProjectSpecifier, string.Empty, DiagnosticsActionName); } else { velocityContext["diagnosticsCall"] = new ServerLink(request.UrlBuilder, request.ServerSpecifier, string.Empty, DiagnosticsActionName); } return viewGenerator.GenerateView(@"UserList.vm", velocityContext); }
public void Setup() { serverSpecifier = new DefaultServerSpecifier(serverName); urlBuilderMock = new DynamicMock(typeof(ICruiseUrlBuilder)); serverLink = new ServerLink((ICruiseUrlBuilder) urlBuilderMock.MockInstance, serverSpecifier, description, this.action); }