From 450e8dfc0982eeaebd56aa9506932a2ccb7395df Mon Sep 17 00:00:00 2001 From: Sylwekqaz Date: Thu, 31 Mar 2016 16:50:08 +0200 Subject: [PATCH] add assigning crash reports to crash groups --- client/frontend/core/crash_vm.js | 38 ++++++++++++++++++-- client/frontend/core/group_vm.js | 4 +-- client/frontend/index.htm | 59 ++++++++++++++++---------------- 3 files changed, 66 insertions(+), 35 deletions(-) diff --git a/client/frontend/core/crash_vm.js b/client/frontend/core/crash_vm.js index 43c2bba..345a025 100644 --- a/client/frontend/core/crash_vm.js +++ b/client/frontend/core/crash_vm.js @@ -13,18 +13,50 @@ function CrashVM(data, root) { Version: ko.observable((data.application && data.application.version) || "") }); self.SystemInfo = ko.observable({ + Name: ko.observable((data.application && data.system_info.name) || ""), Version: ko.observable((data.system_info && data.system_info.version) || "") }); //computed - self.Group = ko.computed(function () { - return ko.utils.arrayFirst(root.crashGroupsData(), function (group) { + self.Group = ko.computed(function() { + return ko.utils.arrayFirst(root.crashGroupsData(), function(group) { return group.GroupId() === self.GroupId(); }); }); //functions - self.Edit = function () { + self.Edit = function() { alert("edit1"); } + + //Assigning to CG + self.NewCrashGroup = ko.observable(self.GroupId()); + + self.assignReport = function() { + var sendObject = { + "crash_report_id": self.ReportId, + "crash_group_id": self.NewCrashGroup(), + "stderr_output": self.StderrOutput(), + "exit_code": self.ExitCode(), + "application": { + "name": self.Application().Name(), + "version": self.Application().Version() + }, + "systeminfo": { + "name": self.SystemInfo().Name(), + "version": self.SystemInfo().Version() + } + } + + $.ajax(Repository.CrashReports.put(self.ReportId(), sendObject)) + .then(function() { + self.GroupId(self.NewCrashGroup()); + }); + + } + + self.ConfirmButtonClass = ko.pureComputed(function() { + return self.GroupId() == self.NewCrashGroup() ? "btn-default" : "btn-success"; + }); + } \ No newline at end of file diff --git a/client/frontend/core/group_vm.js b/client/frontend/core/group_vm.js index 2e1dbc8..6d3dd97 100644 --- a/client/frontend/core/group_vm.js +++ b/client/frontend/core/group_vm.js @@ -22,8 +22,8 @@ function GroupVM(data, root) { }); }); - self.SolutionName = ko.pureComputed(function () { - return self.Solution() ? self.Solution().ShellScript() : "no solution"; + self.GroupName = ko.pureComputed(function () { + return "#" +self.GroupId() + " "+ (self.Solution() ? self.Solution().ShellScript() : "no solution"); }); self.Count = ko.pureComputed(function () { diff --git a/client/frontend/index.htm b/client/frontend/index.htm index 17213b8..92097e4 100644 --- a/client/frontend/index.htm +++ b/client/frontend/index.htm @@ -106,7 +106,7 @@

Crash groups

-
+
@@ -142,39 +142,38 @@ -