Skip to content

Commit

Permalink
add assigning crash reports to crash groups
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylwekqaz committed Mar 31, 2016
1 parent 75378de commit 450e8df
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 35 deletions.
38 changes: 35 additions & 3 deletions client/frontend/core/crash_vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
});

}
4 changes: 2 additions & 2 deletions client/frontend/core/group_vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
59 changes: 29 additions & 30 deletions client/frontend/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h3 class="col-md-3 col-md-offset-2">Crash groups</h3>
<tr>
<td data-bind="text: GroupId"></td>
<td>
<div class="well-sm" data-bind="text:SolutionName"></div>
<div class="well-sm" data-bind="text:GroupName"></div>
</td>
<td data-bind="text: Count"></td>
<td>
Expand Down Expand Up @@ -142,39 +142,38 @@ <h4 class="modal-title">add new crash report</h4>
</div>
<!-- /.modal -->

<script type="text/html" id="crash-view-template">
<div class="row panel">
<div class="panel-body">
<div class='col-md-3'>
<div class="row">
Crash id: <strong data-bind="text: ReportId"></strong>
</div>
<script type="text/html" id="crash-view-template">
<div class="row panel">
<div class="panel-body">
<div class='col-md-3'>
<div class="row">
Crash id: <strong data-bind="text: ReportId"></strong>
</div>

<div class='row'>
exit code:
<strong data-bind="text: ExitCode"></strong>
</div>
<div class='row'>
exit code:
<strong data-bind="text: ExitCode"></strong>
</div>
<div class='col-md-5'>
<div class="row" data-bind="with: Application">
app: <strong data-bind="text: Name"></strong> <strong data-bind="text: Version"></strong>
</div>
<div class="row" data-bind="with: SystemInfo">
system: <strong data-bind="text: Version"></strong>
</div>
</div>
<div class='col-md-5'>
<div class="row" data-bind="with: Application">
app: <strong data-bind="text: Name"></strong> <strong data-bind="text: Version"></strong>
</div>
<div class='col-md-12 well' data-bind="text: StderrOutput">

<div class="row" data-bind="with: SystemInfo">
system: <strong data-bind="text: Version"></strong>
</div>
<div class='col-md-12'>
<div class="row">
<div class="form-inline">
<label class="control-label">Assign to</label>
<!-- <select class="form-control" data-bind="foreach: $root.crashGroupsData, value: $root.selectedCrashGroup">
CG
<option data-bind="text: GroupId"></option>
</select>
<button type="button" class="btn btn-default" data-bind="click:$root.assignReport.bind($index())"> Confirm </button>-->
</div>
<div class='col-md-12 well' data-bind="text: StderrOutput">

</div>
<div class='col-md-12'>
<div class="row">
<div class="form-inline">
<label class="control-label">Assign to</label>
<select data-bind="options: $root.crashGroupsData,optionsText: 'GroupName',optionsValue:'GroupId',value: NewCrashGroup,optionsCaption: 'Assign crash group...'"></select>

<button type="button" class="btn" data-bind="click:assignReport , css:ConfirmButtonClass"> Confirm </button>

</div>
</div>
</div>
Expand Down

0 comments on commit 450e8df

Please sign in to comment.