// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Contexts;
using System.Web;
using System.Web.Mvc;
namespace Tools.CrashReporter.CrashReportWebSite.Models
{
///
/// The view model for the crashes index page.
///
public class CrashesViewModel
{
/// Dates are in milliseconds relative to this base (for ease of Javascript usage)
public static readonly DateTime Epoch = new DateTime( 1970, 1, 1 );
/// A container for all the crashes that pass the current filters.
public IEnumerable Results { get; set; }
/// Information to properly paginate a large number of crashes.
public PagingInfo PagingInfo { get; set; }
/// Whether to sort ascending or descending.
public string SortOrder { get; set; }
/// The term to sort by.
public string SortTerm { get; set; }
/// The user group to filter by.
public string UserGroup { get; set; }
/// The type of report to filter by. e.g. Asserts.
public string CrashType { get; set; }
/// Callstack line as query for filtering.
public string SearchQuery { get; set; }
/// User name as query for filtering.
public string UsernameQuery { get; set; }
/// Epic ID or Machine ID as query for filtering.
public string EpicIdOrMachineQuery { get; set; }
/// Jira as query for crash filtering.
public string JiraQuery { get; set; }
/// Message/Summary or Description as query for filtering.
public string MessageQuery { get; set; }
/// The date of the earliest crash to display.
public long DateFrom { get; set; }
/// The date of the most recent crash to display.
public long DateTo { get; set; }
/// The name of the branch to filter by.
public string BranchName { get; set; }
/// The version to filter by.
public string VersionName { get; set; }
/// The name of the game to filter by.
public string GameName { get; set; }
/// A dictionary of group names vs. crash counts.
public Dictionary GroupCounts { get; set; }
/// The user supplied parameters.
public FormCollection FormCollection { get; set; }
/// A collection of Branch names used in the drop down on the main search form
public List BranchNames { get; set; }
/// A collection of Version names used in the drop down on the main search form
public List VersionNames { get; set; }
/// The set of statuses a crash could have its status set to.
public IEnumerable SetStatus { get { return new List( new string[] { "Unset", "Reviewed", "New", "Coder", "EngineQA", "GameQA" } ); } }
/// The real user name, displayed only for searches.
public string RealUserName { get; set; }
/// Time spent in generating this site, formatted as a string.
public string GenerationTime { get; set; }
///
/// Default constructor, used by HomeController
///
public CrashesViewModel()
{
DateTime FromDate = DateTime.Today.AddDays( -7 ).ToUniversalTime();
DateTime ToDate = DateTime.Today.ToUniversalTime();
BranchNames = CrashRepository.GetBranches();
VersionNames = CrashRepository.GetVersions();
DateFrom = (long)( FromDate - Epoch ).TotalMilliseconds;
DateTo = (long)( ToDate - Epoch ).TotalMilliseconds;
CrashType = "CrashesAsserts";
}
}
}