// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Web.Mvc;
using Tools.CrashReporter.CrashReportWebSite.DataModels;
namespace Tools.CrashReporter.CrashReportWebSite.ViewModels
{
///
/// 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; }
/// Bugg Id as query for filtering.
public string BuggId { get; set; }
/// BuiltFromCL as query for filtering.
public string BuiltFromCL { 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 version to filter by.
public string EngineVersion { get; set; }
/// The platform to filter by.
public string PlatformName { get; set; }
/// The Engine Mode by which to filter.
public string EngineMode { 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; }
/// A collection of Platform names used in the drop down on the main search form
public List PlatformNames { get; set; }
/// A collection of Engine Modes used in the drop down on the main search form
public List EngineModes { get; set; }
/// A collection of Engine Modes used in the drop down on the main search form
public List EngineVersions { 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; }
/// Engine Version Ex field is vanilla build
public string IsVanilla { get; set; }
///
/// Default constructor, used by HomeController
///
public CrashesViewModel()
{
DateTime FromDate = DateTime.Today.AddDays( -7 ).ToUniversalTime();
DateTime ToDate = DateTime.Today.ToUniversalTime();
DateFrom = (long)( FromDate - Epoch ).TotalMilliseconds;
DateTo = (long)( ToDate - Epoch ).TotalMilliseconds;
CrashType = "CrashesAsserts";
}
}
}