/// <summary> /// Adds the bugg as a new JIRA ticket /// </summary> public void CopyToJira() { var jc = JiraConnection.Get(); Dictionary <string, object> issueFields; if (BranchesFoundIn.Any(data => data.ToLower().Contains("//fort"))) { issueFields = CreateFortniteIssue(jc); } //else if (BranchesFoundIn.Any(data => data.ToLower().Contains("//orion"))) //{ // issueFields = CreateOrionIssue(); //} else { issueFields = CreateGeneralIssue(jc); } if (jc.CanBeUsed() && string.IsNullOrEmpty(this.Jira)) { // Additional Info URL / Link to Crash/Bugg string Key = jc.AddJiraTicket(issueFields); if (!string.IsNullOrEmpty(Key)) { Jira = Key; var buggs = new BuggRepository(); buggs.SetJIRAForBuggAndCrashes(Key, Id); } } }
/// <summary> /// Adds the bugg as a new JIRA ticket /// </summary> public void CopyToJira() { var JC = JiraConnection.Get(); if (JC.CanBeUsed() && string.IsNullOrEmpty(this.TTPID)) { Dictionary <string, object> Fields = new Dictionary <string, object>(); Fields.Add("project", new Dictionary <string, object> { { "id", 11205 } }); // UE Fields.Add("summary", "[CrashReport] " + ToJiraSummary); // Call Stack, Line 1 Fields.Add("description", "____________"); // Description Fields.Add("issuetype", new Dictionary <string, object> { { "id", "1" } }); // Bug Fields.Add("labels", new string[] { "crash" }); // <label>crash</label> Fields.Add("customfield_11500", ToJiraFirstCLAffected); // Changelist # / Found Changelist Fields.Add("environment", LatestOSAffected); // Platform // Components var SupportComponent = JC.GetNameToComponents()["Support"]; Fields.Add("components", new object[] { SupportComponent }); // ToJiraVersions Fields.Add("versions", ToJiraVersions); // ToJiraBranches Fields.Add("customfield_11201", ToJiraBranches); // ToJiraPlatforms Fields.Add("customfield_11203", ToJiraPlatforms); // Callstack customfield_11807 var Callstack = GetFunctionCalls(); string JiraCallstack = string.Join("\r\n", Callstack); Fields.Add("customfield_11807", JiraCallstack); // Callstack string Key = JC.AddJiraTicket(Fields); if (!string.IsNullOrEmpty(Key)) { TTPID = Key; BuggRepository.SetJIRAForBuggAndCrashes(Key, Id); // Update the JIRA in the bugg. Dictionary <string, object> FieldsToUpdate = new Dictionary <string, object>(); string BuggLink = "http://crashreporter/Buggs/Show/" + Id; FieldsToUpdate.Add("customfield_11205", BuggLink); // Additional Info URL / Link to Crash/Bugg JC.UpdateJiraTicket(Key, FieldsToUpdate); } } }
/// <summary> /// Adds the bugg as a new JIRA ticket /// </summary> public void CopyToJira() { var JC = JiraConnection.Get(); if (JC.CanBeUsed() && string.IsNullOrEmpty(this.Jira)) { Dictionary <string, object> Fields = new Dictionary <string, object>(); Fields.Add("project", new Dictionary <string, object> { { "id", 11205 } }); // UE Fields.Add("summary", "[CrashReport] " + ToJiraSummary); // Call Stack, Line 1 Fields.Add("description", string.Join("\r\n", ToJiraDescriptions)); // Description Fields.Add("issuetype", new Dictionary <string, object> { { "id", "1" } }); // Bug Fields.Add("labels", new string[] { "crash", "liveissue" }); // <label>crash, live issue</label> Fields.Add("customfield_11500", ToJiraFirstCLAffected); // Changelist # / Found Changelist Fields.Add("environment", LatestOSAffected); // Platform // Components var SupportComponent = JC.GetNameToComponents()["Support"]; Fields.Add("components", new object[] { SupportComponent }); // ToJiraVersions Fields.Add("versions", ToJiraVersions); // ToJiraBranches Fields.Add("customfield_12402", ToJiraBranches.ToList()); // NewBranchFoundIn // ToJiraPlatforms Fields.Add("customfield_11203", ToJiraPlatforms); // Callstack customfield_11807 string JiraCallstack = "{noformat}" + string.Join("\r\n", ToJiraFunctionCalls) + "{noformat}"; Fields.Add("customfield_11807", JiraCallstack); // Callstack string BuggLink = "http://crashreporter/Buggs/Show/" + Id; Fields.Add("customfield_11205", BuggLink); // Additional Info URL / Link to Crash/Bugg string Key = JC.AddJiraTicket(Fields); if (!string.IsNullOrEmpty(Key)) { Jira = Key; BuggRepository Buggs = new BuggRepository(); Buggs.SetJIRAForBuggAndCrashes(Key, Id); } } }
/// <summary> /// Adds the bugg as a new JIRA ticket /// </summary> public void CopyToJira() { var jc = JiraConnection.Get(); Dictionary<string, object> issueFields; if (BranchesFoundIn.Any(data => data.ToLower().Contains("//fort"))) { issueFields = CreateFortniteIssue(jc); } //else if (BranchesFoundIn.Any(data => data.ToLower().Contains("//orion"))) //{ // issueFields = CreateOrionIssue(); //} else { issueFields = CreateGeneralIssue(jc); } if(jc.CanBeUsed() && string.IsNullOrEmpty( this.Jira )) { // Additional Info URL / Link to Crash/Bugg string Key = jc.AddJiraTicket(issueFields); if( !string.IsNullOrEmpty( Key ) ) { Jira = Key; var buggs = new BuggRepository(); buggs.SetJIRAForBuggAndCrashes( Key, Id ); } } }
/// <summary> /// Adds the bugg as a new JIRA ticket /// </summary> public void CopyToJira() { var JC = JiraConnection.Get(); if( JC.CanBeUsed() && string.IsNullOrEmpty( this.Jira ) ) { Dictionary<string, object> Fields = new Dictionary<string, object>(); Fields.Add( "project", new Dictionary<string, object> { { "id", 11205 } } ); // UE Fields.Add( "summary", "[CrashReport] " + ToJiraSummary ); // Call Stack, Line 1 Fields.Add( "description", string.Join( "\r\n", ToJiraDescriptions ) ); // Description Fields.Add( "issuetype", new Dictionary<string, object> { { "id", "1" } } ); // Bug Fields.Add( "labels", new string[] { "crash", "liveissue" } ); // <label>crash, live issue</label> Fields.Add( "customfield_11500", ToJiraFirstCLAffected ); // Changelist # / Found Changelist Fields.Add( "environment", LatestOSAffected ); // Platform // Components var SupportComponent = JC.GetNameToComponents()["Support"]; Fields.Add( "components", new object[] { SupportComponent } ); // ToJiraVersions Fields.Add( "versions", ToJiraVersions ); // ToJiraBranches Fields.Add( "customfield_11201", ToJiraBranches ); // ToJiraPlatforms Fields.Add( "customfield_11203", ToJiraPlatforms ); // Callstack customfield_11807 string JiraCallstack = string.Join( "\r\n", ToJiraFunctionCalls ); Fields.Add( "customfield_11807", JiraCallstack ); // Callstack string BuggLink = "http://crashreporter/Buggs/Show/" + Id; Fields.Add( "customfield_11205", BuggLink ); // Additional Info URL / Link to Crash/Bugg string Key = JC.AddJiraTicket( Fields ); if( !string.IsNullOrEmpty( Key ) ) { Jira = Key; BuggRepository Buggs = new BuggRepository(); Buggs.SetJIRAForBuggAndCrashes( Key, Id ); } } }
/// <summary> /// The Show action. /// </summary> /// <param name="BuggsForm">The form of user data passed up from the client.</param> /// <param name="id">The unique id of the Bugg.</param> /// <returns>The view to display a Bugg on the client.</returns> public ActionResult Show( FormCollection BuggsForm, int id ) { using( FAutoScopedLogTimer LogTimer = new FAutoScopedLogTimer( this.GetType().ToString() + "(BuggId=" + id + ")", bCreateNewLog: true ) ) { // Handle 'CopyToJira' button int BuggIDToBeAddedToJira = 0; foreach( var Entry in BuggsForm ) { if( Entry.ToString().Contains( Bugg.JiraSubmitName ) ) { int.TryParse( Entry.ToString().Substring( Bugg.JiraSubmitName.Length ), out BuggIDToBeAddedToJira ); break; } } BuggRepository Buggs = new BuggRepository(); // Set the display properties based on the radio buttons bool DisplayModuleNames = false; if( BuggsForm["DisplayModuleNames"] == "true" ) { DisplayModuleNames = true; } bool DisplayFunctionNames = false; if( BuggsForm["DisplayFunctionNames"] == "true" ) { DisplayFunctionNames = true; } bool DisplayFileNames = false; if( BuggsForm["DisplayFileNames"] == "true" ) { DisplayFileNames = true; } bool DisplayFilePathNames = false; if( BuggsForm["DisplayFilePathNames"] == "true" ) { DisplayFilePathNames = true; DisplayFileNames = false; } bool DisplayUnformattedCallStack = false; if( BuggsForm["DisplayUnformattedCallStack"] == "true" ) { DisplayUnformattedCallStack = true; } // Create a new view and populate with crashes List<Crash> Crashes = null; BuggViewModel Model = new BuggViewModel(); Bugg NewBugg = Buggs.GetBugg( id ); if( NewBugg == null ) { return RedirectToAction( "" ); } Crashes = NewBugg.GetCrashes(); using (FAutoScopedLogTimer GetCrashesTimer = new FAutoScopedLogTimer( "Bugg.PrepareBuggForJira" )) { if (Crashes.Count > 0) { NewBugg.PrepareBuggForJira( Crashes ); if (BuggIDToBeAddedToJira != 0) { NewBugg.CopyToJira(); } } } using( FAutoScopedLogTimer JiraResultsTimer = new FAutoScopedLogTimer( "Bugg.GrabJira" ) ) { var JC = JiraConnection.Get(); bool bValidJira = false; // Verify valid JiraID, this may be still a TTP if( !string.IsNullOrEmpty( NewBugg.Jira ) ) { int TTPID = 0; int.TryParse( NewBugg.Jira, out TTPID ); if( TTPID == 0 ) { //AddBuggJiraMapping( NewBugg, ref FoundJiras, ref JiraIDtoBugg ); bValidJira = true; } } if( JC.CanBeUsed() && bValidJira ) { // Grab the data form JIRA. string JiraSearchQuery = "key = " + NewBugg.Jira; var JiraResults = JC.SearchJiraTickets( JiraSearchQuery, new string[] { "key", // string "summary", // string "components", // System.Collections.ArrayList, Dictionary<string,object>, name "resolution", // System.Collections.Generic.Dictionary`2[System.String,System.Object], name "fixVersions", // System.Collections.ArrayList, Dictionary<string,object>, name "customfield_11200" // string } ); // Jira Key, Summary, Components, Resolution, Fix version, Fix changelist foreach( var Jira in JiraResults ) { string JiraID = Jira.Key; string Summary = (string)Jira.Value["summary"]; string ComponentsText = ""; System.Collections.ArrayList Components = (System.Collections.ArrayList)Jira.Value["components"]; foreach( Dictionary<string, object> Component in Components ) { ComponentsText += (string)Component["name"]; ComponentsText += " "; } Dictionary<string, object> ResolutionFields = (Dictionary<string, object>)Jira.Value["resolution"]; string Resolution = ResolutionFields != null ? (string)ResolutionFields["name"] : ""; string FixVersionsText = ""; System.Collections.ArrayList FixVersions = (System.Collections.ArrayList)Jira.Value["fixVersions"]; foreach( Dictionary<string, object> FixVersion in FixVersions ) { FixVersionsText += (string)FixVersion["name"]; FixVersionsText += " "; } int FixCL = Jira.Value["customfield_11200"] != null ? (int)(decimal)Jira.Value["customfield_11200"] : 0; NewBugg.JiraSummary = Summary; NewBugg.JiraComponentsText = ComponentsText; NewBugg.JiraResolution = Resolution; NewBugg.JiraFixVersionsText = FixVersionsText; if( FixCL != 0 ) { NewBugg.JiraFixCL = FixCL.ToString(); } break; } } } // Apply any user settings if( BuggsForm.Count > 0 ) { if( !string.IsNullOrEmpty( BuggsForm["SetStatus"] ) ) { NewBugg.Status = BuggsForm["SetStatus"]; Buggs.SetBuggStatus( NewBugg.Status, id ); } if( !string.IsNullOrEmpty( BuggsForm["SetFixedIn"] ) ) { NewBugg.FixedChangeList = BuggsForm["SetFixedIn"]; Buggs.SetBuggFixedChangeList( NewBugg.FixedChangeList, id ); } if( !string.IsNullOrEmpty( BuggsForm["SetTTP"] ) ) { NewBugg.Jira = BuggsForm["SetTTP"]; Buggs.SetJIRAForBuggAndCrashes( NewBugg.Jira, id ); } // <STATUS> } // Set up the view model with the crash data Model.Bugg = NewBugg; Model.Crashes = Crashes; Crash NewCrash = Model.Crashes.FirstOrDefault(); if( NewCrash != null ) { using( FScopedLogTimer LogTimer2 = new FScopedLogTimer( "CallstackTrimming" ) ) { CallStackContainer CallStack = new CallStackContainer( NewCrash ); // Set callstack properties CallStack.bDisplayModuleNames = DisplayModuleNames; CallStack.bDisplayFunctionNames = DisplayFunctionNames; CallStack.bDisplayFileNames = DisplayFileNames; CallStack.bDisplayFilePathNames = DisplayFilePathNames; CallStack.bDisplayUnformattedCallStack = DisplayUnformattedCallStack; Model.CallStack = CallStack; // Shorten very long function names. foreach( CallStackEntry Entry in Model.CallStack.CallStackEntries ) { Entry.FunctionName = Entry.GetTrimmedFunctionName( 128 ); } Model.SourceContext = NewCrash.SourceContext; } Model.Bugg.LatestCrashSummary = NewCrash.Summary; } Model.GenerationTime = LogTimer.GetElapsedSeconds().ToString( "F2" ); return View( "Show", Model ); } }