Fix: Javascript Bugs
jQuery v1.9 migrations; Isotope Update
This commit is contained in:
@@ -1,270 +1,271 @@
|
||||
@model Disco.Web.Areas.Config.Models.DeviceModel.DeviceComponentsModel
|
||||
@{
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Disco-jQueryExtensions");
|
||||
}
|
||||
<table id="deviceComponents" data-devicemodelid="@(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty)">
|
||||
<tr>
|
||||
<th>
|
||||
Description
|
||||
</th>
|
||||
<th>
|
||||
Cost
|
||||
</th>
|
||||
<th>
|
||||
Job Types
|
||||
</th>
|
||||
<th class="actions">
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
@foreach (var item in Model.DeviceComponents)
|
||||
{
|
||||
<tr data-devicecomponentid="@item.Id">
|
||||
<td>
|
||||
<input type="text" class="description" value="@item.Description" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="cost" value="@item.Cost.ToString("C")" />
|
||||
</td>
|
||||
<td>
|
||||
<span class="edit@(item.JobSubTypes.Count > 0 ? " editAlert" : string.Empty)"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="remove"></span>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<a href="#" id="addDeviceComponent">Add Component</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $deviceComponents = $('#deviceComponents');
|
||||
|
||||
$('#addDeviceComponent').click(function () {
|
||||
var dc = $('<tr><td><input type="text" class="description" /></td><td><input type="text" class="cost" /></td><td><span class="edit"></span></td><td><span class="remove"></span></td></tr>');
|
||||
dc.find('input').focus(function () { $(this).select() })
|
||||
dc.insertBefore($deviceComponents.find('tr').last());
|
||||
dc.find('input.description').focus();
|
||||
return false;
|
||||
});
|
||||
|
||||
var removeComponentConfirmed = function (id, row) {
|
||||
var data = { id: id };
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentRemove())',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
row.remove();
|
||||
} else {
|
||||
alert('Unable to remove component: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to remove component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
var removeComponent = function () {
|
||||
var componentRow = $(this).closest('tr');
|
||||
var id = componentRow.attr('data-devicecomponentid');
|
||||
if (id) {
|
||||
var dialog = $("#dialogConfirmRemove");
|
||||
var buttons = dialog.dialog("option", "buttons");
|
||||
buttons['Remove'] = function () { removeComponentConfirmed(id, componentRow); $(this).dialog("close"); };
|
||||
var buttons = dialog.dialog("option", "buttons", buttons);
|
||||
dialog.dialog('open');
|
||||
} else {
|
||||
// New - Remove
|
||||
componentRow.remove();
|
||||
}
|
||||
}
|
||||
var updateComponent = function () {
|
||||
var componentRow = $(this).closest('tr');
|
||||
componentRow.find('input').attr('disabled', true).addClass('updating');
|
||||
|
||||
var id = componentRow.attr('data-devicecomponentid');
|
||||
if (id) {
|
||||
// Update
|
||||
var data = {
|
||||
id: id,
|
||||
Description: componentRow.find('input.description').val(),
|
||||
Cost: componentRow.find('input.cost').val()
|
||||
};
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentUpdate())',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
componentRow.find('input.description').val(d.Component.Description);
|
||||
componentRow.find('input.cost').val(d.Component.Cost);
|
||||
} else {
|
||||
alert('Unable to update component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Add
|
||||
id = componentRow.closest('table').attr('data-devicemodelid');
|
||||
var data = {
|
||||
id: id,
|
||||
Description: componentRow.find('input.description').val(),
|
||||
Cost: componentRow.find('input.cost').val()
|
||||
};
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentAdd(null, null, null))',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
componentRow.attr('data-devicecomponentid', d.Component.Id);
|
||||
componentRow.find('input.description').val(d.Component.Description);
|
||||
componentRow.find('input.cost').val(d.Component.Cost);
|
||||
} else {
|
||||
alert('Unable to add component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
var editComponentJobTypes = function () {
|
||||
var edit$this = $(this);
|
||||
var componentRow = edit$this.closest('tr');
|
||||
|
||||
var id = componentRow.attr('data-devicecomponentid');
|
||||
|
||||
if (id) {
|
||||
var data = {
|
||||
id: id
|
||||
};
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.Component())',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
$dialogUpdateJobTypes = $('#dialogUpdateJobTypes');
|
||||
$dialogUpdateJobTypes.find('input:checked').each(function () { $(this).attr('checked', false) });
|
||||
for (var i = 0; i < d.Component.JobSubTypes.length; i++) {
|
||||
var sjt = d.Component.JobSubTypes[i];
|
||||
$dialogUpdateJobTypes.find('#SubTypes_' + sjt).attr('checked', true);
|
||||
}
|
||||
$('#CheckboxBulkSelect_dialogUpdateJobTypes').checkboxBulkSelect('update');
|
||||
var buttons = $dialogUpdateJobTypes.dialog("option", "buttons");
|
||||
buttons['Save'] = function () {
|
||||
$dialogUpdateJobTypes.dialog("disable");
|
||||
var selectedSJTs = [];
|
||||
$dialogUpdateJobTypes.find('input:checked').each(function () { selectedSJTs.push($(this).val()) });
|
||||
|
||||
var data = {
|
||||
id: id,
|
||||
JobSubTypes: selectedSJTs
|
||||
};
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentUpdateJobSubTypes())',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
traditional: true,
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d.Result == 'OK') {
|
||||
if (d.Component.JobSubTypes.length > 0) {
|
||||
edit$this.addClass('editAlert');
|
||||
} else {
|
||||
edit$this.removeClass('editAlert');
|
||||
}
|
||||
$dialogUpdateJobTypes.dialog("enable");
|
||||
$dialogUpdateJobTypes.dialog("close");
|
||||
} else {
|
||||
alert('Unable to update component sub types: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update component sub types: ' + textStatus);
|
||||
}
|
||||
});
|
||||
};
|
||||
var buttons = $dialogUpdateJobTypes.dialog("option", "buttons", buttons);
|
||||
$dialogUpdateJobTypes.dialog('open');
|
||||
} else {
|
||||
alert('Unable to load component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to load component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$("#dialogConfirmRemove").dialog({
|
||||
resizable: false,
|
||||
height: 140,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
buttons: {
|
||||
"Remove": function () {
|
||||
$(this).dialog("close");
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#dialogUpdateJobTypes').dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
width: 550,
|
||||
buttons: {
|
||||
"Save": function () {
|
||||
$(this).dialog("close");
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#CheckboxBulkSelect_dialogUpdateJobTypes').checkboxBulkSelect({ parentSelector: 'div' });
|
||||
|
||||
$deviceComponents.find('input').live('change', updateComponent).focus(function () { $(this).select() });
|
||||
$deviceComponents.find('span.remove').live('click', removeComponent);
|
||||
$deviceComponents.find('span.edit').live('click', editComponentJobTypes);
|
||||
|
||||
});
|
||||
</script>
|
||||
<div id="dialogUpdateJobTypes" title="Update Job Types">
|
||||
<div>
|
||||
<h2>
|
||||
Hardware Non-Warranty Job Types</h2>
|
||||
@CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.ToSelectListItems(), 2)
|
||||
<br />
|
||||
<span id="CheckboxBulkSelect_dialogUpdateJobTypes" class="checkboxBulkSelectContainer">
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="dialogConfirmRemove" title="Delete this Component?">
|
||||
<p>
|
||||
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
|
||||
This item will be permanently deleted and cannot be recovered. Are you sure?</p>
|
||||
</div>
|
||||
@model Disco.Web.Areas.Config.Models.DeviceModel.DeviceComponentsModel
|
||||
@{
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Disco-jQueryExtensions");
|
||||
}
|
||||
<table id="deviceComponents" data-devicemodelid="@(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty)">
|
||||
<tr>
|
||||
<th>
|
||||
Description
|
||||
</th>
|
||||
<th>
|
||||
Cost
|
||||
</th>
|
||||
<th>
|
||||
Job Types
|
||||
</th>
|
||||
<th class="actions">
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
@foreach (var item in Model.DeviceComponents)
|
||||
{
|
||||
<tr data-devicecomponentid="@item.Id">
|
||||
<td>
|
||||
<input type="text" class="description" value="@item.Description" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="cost" value="@item.Cost.ToString("C")" />
|
||||
</td>
|
||||
<td>
|
||||
<span class="edit@(item.JobSubTypes.Count > 0 ? " editAlert" : string.Empty)"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="remove"></span>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<a href="#" id="addDeviceComponent">Add Component</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $deviceComponents = $('#deviceComponents');
|
||||
|
||||
$('#addDeviceComponent').click(function () {
|
||||
var dc = $('<tr><td><input type="text" class="description" /></td><td><input type="text" class="cost" /></td><td><span class="edit"></span></td><td><span class="remove"></span></td></tr>');
|
||||
dc.find('input').focus(function () { $(this).select() })
|
||||
dc.insertBefore($deviceComponents.find('tr').last());
|
||||
dc.find('input.description').focus();
|
||||
return false;
|
||||
});
|
||||
|
||||
var removeComponentConfirmed = function (id, row) {
|
||||
var data = { id: id };
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentRemove())',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
row.remove();
|
||||
} else {
|
||||
alert('Unable to remove component: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to remove component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
var removeComponent = function () {
|
||||
var componentRow = $(this).closest('tr');
|
||||
var id = componentRow.attr('data-devicecomponentid');
|
||||
if (id) {
|
||||
var dialog = $("#dialogConfirmRemove");
|
||||
var buttons = dialog.dialog("option", "buttons");
|
||||
buttons['Remove'] = function () { removeComponentConfirmed(id, componentRow); $(this).dialog("close"); };
|
||||
var buttons = dialog.dialog("option", "buttons", buttons);
|
||||
dialog.dialog('open');
|
||||
} else {
|
||||
// New - Remove
|
||||
componentRow.remove();
|
||||
}
|
||||
}
|
||||
var updateComponent = function () {
|
||||
var componentRow = $(this).closest('tr');
|
||||
componentRow.find('input').attr('disabled', true).addClass('updating');
|
||||
|
||||
var id = componentRow.attr('data-devicecomponentid');
|
||||
if (id) {
|
||||
// Update
|
||||
var data = {
|
||||
id: id,
|
||||
Description: componentRow.find('input.description').val(),
|
||||
Cost: componentRow.find('input.cost').val()
|
||||
};
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentUpdate())',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
componentRow.find('input.description').val(d.Component.Description);
|
||||
componentRow.find('input.cost').val(d.Component.Cost);
|
||||
} else {
|
||||
alert('Unable to update component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Add
|
||||
id = componentRow.closest('table').attr('data-devicemodelid');
|
||||
var data = {
|
||||
id: id,
|
||||
Description: componentRow.find('input.description').val(),
|
||||
Cost: componentRow.find('input.cost').val()
|
||||
};
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentAdd(null, null, null))',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
componentRow.attr('data-devicecomponentid', d.Component.Id);
|
||||
componentRow.find('input.description').val(d.Component.Description);
|
||||
componentRow.find('input.cost').val(d.Component.Cost);
|
||||
} else {
|
||||
alert('Unable to add component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
var editComponentJobTypes = function () {
|
||||
var edit$this = $(this);
|
||||
var componentRow = edit$this.closest('tr');
|
||||
|
||||
var id = componentRow.attr('data-devicecomponentid');
|
||||
|
||||
if (id) {
|
||||
var data = {
|
||||
id: id
|
||||
};
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.Component())',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
$dialogUpdateJobTypes = $('#dialogUpdateJobTypes');
|
||||
$dialogUpdateJobTypes.find('input:checked').each(function () { $(this).prop('checked', false) });
|
||||
for (var i = 0; i < d.Component.JobSubTypes.length; i++) {
|
||||
var sjt = d.Component.JobSubTypes[i];
|
||||
$dialogUpdateJobTypes.find('#SubTypes_' + sjt).prop('checked', true);
|
||||
}
|
||||
$('#CheckboxBulkSelect_dialogUpdateJobTypes').checkboxBulkSelect('update');
|
||||
var buttons = $dialogUpdateJobTypes.dialog("option", "buttons");
|
||||
buttons['Save'] = function () {
|
||||
$dialogUpdateJobTypes.dialog("disable");
|
||||
var selectedSJTs = [];
|
||||
$dialogUpdateJobTypes.find('input:checked').each(function () { selectedSJTs.push($(this).val()) });
|
||||
|
||||
var data = {
|
||||
id: id,
|
||||
JobSubTypes: selectedSJTs
|
||||
};
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentUpdateJobSubTypes())',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
traditional: true,
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d.Result == 'OK') {
|
||||
if (d.Component.JobSubTypes.length > 0) {
|
||||
edit$this.addClass('editAlert');
|
||||
} else {
|
||||
edit$this.removeClass('editAlert');
|
||||
}
|
||||
$dialogUpdateJobTypes.dialog("enable");
|
||||
$dialogUpdateJobTypes.dialog("close");
|
||||
} else {
|
||||
alert('Unable to update component sub types: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update component sub types: ' + textStatus);
|
||||
}
|
||||
});
|
||||
};
|
||||
var buttons = $dialogUpdateJobTypes.dialog("option", "buttons", buttons);
|
||||
$dialogUpdateJobTypes.dialog('open');
|
||||
} else {
|
||||
alert('Unable to load component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to load component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$("#dialogConfirmRemove").dialog({
|
||||
resizable: false,
|
||||
height: 140,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
buttons: {
|
||||
"Remove": function () {
|
||||
$(this).dialog("close");
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#dialogUpdateJobTypes').dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
width: 550,
|
||||
buttons: {
|
||||
"Save": function () {
|
||||
$(this).dialog("close");
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#CheckboxBulkSelect_dialogUpdateJobTypes').checkboxBulkSelect({ parentSelector: 'div' });
|
||||
|
||||
$deviceComponents.on('change', 'input', updateComponent);
|
||||
$deviceComponents.on('focus', 'input', function () { $(this).select(); });
|
||||
|
||||
$deviceComponents.on('click', 'span.remove', removeComponent);
|
||||
$deviceComponents.on('click', 'span.edit', editComponentJobTypes);
|
||||
});
|
||||
</script>
|
||||
<div id="dialogUpdateJobTypes" title="Update Job Types">
|
||||
<div>
|
||||
<h2>
|
||||
Hardware Non-Warranty Job Types</h2>
|
||||
@CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.ToSelectListItems(), 2)
|
||||
<br />
|
||||
<span id="CheckboxBulkSelect_dialogUpdateJobTypes" class="checkboxBulkSelectContainer">
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="dialogConfirmRemove" title="Delete this Component?">
|
||||
<p>
|
||||
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
|
||||
This item will be permanently deleted and cannot be recovered. Are you sure?</p>
|
||||
</div>
|
||||
|
||||
@@ -1,412 +1,412 @@
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.17929
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Disco.Web.Areas.Config.Views.DeviceModel
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Helpers;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Ajax;
|
||||
using System.Web.Mvc.Html;
|
||||
using System.Web.Routing;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.WebPages;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceModel/_DeviceComponentsTable.cshtml")]
|
||||
public class DeviceComponentsTable : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.DeviceComponentsModel>
|
||||
{
|
||||
public DeviceComponentsTable()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
|
||||
#line 2 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Disco-jQueryExtensions");
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n<table");
|
||||
|
||||
WriteLiteral(" id=\"deviceComponents\"");
|
||||
|
||||
WriteLiteral(" data-devicemodelid=\"");
|
||||
|
||||
|
||||
#line 5 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(">\r\n <tr>\r\n <th>\r\n Description\r\n </th>\r\n <th>\r\n" +
|
||||
" Cost\r\n </th>\r\n <th>\r\n Job Types\r\n </" +
|
||||
"th>\r\n <th");
|
||||
|
||||
WriteLiteral(" class=\"actions\"");
|
||||
|
||||
WriteLiteral(">\r\n \r\n </th>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 20 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 20 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
foreach (var item in Model.DeviceComponents)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr");
|
||||
|
||||
WriteLiteral(" data-devicecomponentid=\"");
|
||||
|
||||
|
||||
#line 22 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(item.Id);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(">\r\n <td>\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"text\"");
|
||||
|
||||
WriteLiteral(" class=\"description\"");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 710), Tuple.Create("\"", 735)
|
||||
|
||||
#line 24 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 718), Tuple.Create<System.Object, System.Int32>(item.Description
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 718), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"text\"");
|
||||
|
||||
WriteLiteral(" class=\"cost\"");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 825), Tuple.Create("\"", 857)
|
||||
|
||||
#line 27 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 833), Tuple.Create<System.Object, System.Int32>(item.Cost.ToString("C")
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 833), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <span");
|
||||
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 921), Tuple.Create("\"", 992)
|
||||
, Tuple.Create(Tuple.Create("", 929), Tuple.Create("edit", 929), true)
|
||||
|
||||
#line 30 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 933), Tuple.Create<System.Object, System.Int32>(item.JobSubTypes.Count > 0 ? " editAlert" : string.Empty
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 933), false)
|
||||
);
|
||||
|
||||
WriteLiteral("></span>\r\n </td>\r\n <td>\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"remove\"");
|
||||
|
||||
WriteLiteral("></span>\r\n </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 36 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr>\r\n <td");
|
||||
|
||||
WriteLiteral(" colspan=\"4\"");
|
||||
|
||||
WriteLiteral(">\r\n <a");
|
||||
|
||||
WriteLiteral(" href=\"#\"");
|
||||
|
||||
WriteLiteral(" id=\"addDeviceComponent\"");
|
||||
|
||||
WriteLiteral(">Add Component</a>\r\n </td>\r\n </tr>\r\n</table>\r\n<script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(@">
|
||||
$(function () {
|
||||
var $deviceComponents = $('#deviceComponents');
|
||||
|
||||
$('#addDeviceComponent').click(function () {
|
||||
var dc = $('<tr><td><input type=""text"" class=""description"" /></td><td><input type=""text"" class=""cost"" /></td><td><span class=""edit""></span></td><td><span class=""remove""></span></td></tr>');
|
||||
dc.find('input').focus(function () { $(this).select() })
|
||||
dc.insertBefore($deviceComponents.find('tr').last());
|
||||
dc.find('input.description').focus();
|
||||
return false;
|
||||
});
|
||||
|
||||
var removeComponentConfirmed = function (id, row) {
|
||||
var data = { id: id };
|
||||
$.ajax({
|
||||
url: '");
|
||||
|
||||
|
||||
#line 58 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.ComponentRemove()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\',\r\n dataType: \'json\',\r\n data: data,\r\n " +
|
||||
" success: function (d) {\r\n if (d == \'OK\') {\r\n " +
|
||||
" row.remove();\r\n } else {\r\n a" +
|
||||
"lert(\'Unable to remove component: \' + d);\r\n }\r\n " +
|
||||
" },\r\n error: function (jqXHR, textStatus, errorThrown) {\r\n " +
|
||||
" alert(\'Unable to remove component: \' + textStatus);\r\n " +
|
||||
" }\r\n });\r\n }\r\n var removeComponent = function () {\r\n " +
|
||||
" var componentRow = $(this).closest(\'tr\');\r\n var id = compo" +
|
||||
"nentRow.attr(\'data-devicecomponentid\');\r\n if (id) {\r\n " +
|
||||
"var dialog = $(\"#dialogConfirmRemove\");\r\n var buttons = dialog.di" +
|
||||
"alog(\"option\", \"buttons\");\r\n buttons[\'Remove\'] = function () { re" +
|
||||
"moveComponentConfirmed(id, componentRow); $(this).dialog(\"close\"); };\r\n " +
|
||||
" var buttons = dialog.dialog(\"option\", \"buttons\", buttons);\r\n " +
|
||||
" dialog.dialog(\'open\');\r\n } else {\r\n // New - Remove" +
|
||||
"\r\n componentRow.remove();\r\n }\r\n }\r\n var " +
|
||||
"updateComponent = function () {\r\n var componentRow = $(this).closest(" +
|
||||
"\'tr\');\r\n componentRow.find(\'input\').attr(\'disabled\', true).addClass(\'" +
|
||||
"updating\');\r\n\r\n var id = componentRow.attr(\'data-devicecomponentid\');" +
|
||||
"\r\n if (id) {\r\n // Update\r\n var data = {" +
|
||||
"\r\n id: id,\r\n Description: componentRow.fin" +
|
||||
"d(\'input.description\').val(),\r\n Cost: componentRow.find(\'inpu" +
|
||||
"t.cost\').val()\r\n };\r\n $.ajax({\r\n " +
|
||||
" url: \'");
|
||||
|
||||
|
||||
#line 100 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.ComponentUpdate()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
componentRow.find('input.description').val(d.Component.Description);
|
||||
componentRow.find('input.cost').val(d.Component.Cost);
|
||||
} else {
|
||||
alert('Unable to update component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Add
|
||||
id = componentRow.closest('table').attr('data-devicemodelid');
|
||||
var data = {
|
||||
id: id,
|
||||
Description: componentRow.find('input.description').val(),
|
||||
Cost: componentRow.find('input.cost').val()
|
||||
};
|
||||
$.ajax({
|
||||
url: '");
|
||||
|
||||
|
||||
#line 126 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.ComponentAdd(null, null, null)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
componentRow.attr('data-devicecomponentid', d.Component.Id);
|
||||
componentRow.find('input.description').val(d.Component.Description);
|
||||
componentRow.find('input.cost').val(d.Component.Cost);
|
||||
} else {
|
||||
alert('Unable to add component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
var editComponentJobTypes = function () {
|
||||
var edit$this = $(this);
|
||||
var componentRow = edit$this.closest('tr');
|
||||
|
||||
var id = componentRow.attr('data-devicecomponentid');
|
||||
|
||||
if (id) {
|
||||
var data = {
|
||||
id: id
|
||||
};
|
||||
$.ajax({
|
||||
url: '");
|
||||
|
||||
|
||||
#line 157 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.Component()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\',\r\n dataType: \'json\',\r\n data: data,\r\n " +
|
||||
" success: function (d) {\r\n componentRow.fin" +
|
||||
"d(\'input\').attr(\'disabled\', false).removeClass(\'updating\');\r\n " +
|
||||
" if (d.Result == \'OK\') {\r\n $dialogUpdateJobTypes " +
|
||||
"= $(\'#dialogUpdateJobTypes\');\r\n $dialogUpdateJobTypes" +
|
||||
".find(\'input:checked\').each(function () { $(this).attr(\'checked\', false) });\r\n " +
|
||||
" for (var i = 0; i < d.Component.JobSubTypes.length; i+" +
|
||||
"+) {\r\n var sjt = d.Component.JobSubTypes[i];\r\n " +
|
||||
" $dialogUpdateJobTypes.find(\'#SubTypes_\' + sjt).attr" +
|
||||
"(\'checked\', true);\r\n }\r\n $" +
|
||||
"(\'#CheckboxBulkSelect_dialogUpdateJobTypes\').checkboxBulkSelect(\'update\');\r\n " +
|
||||
" var buttons = $dialogUpdateJobTypes.dialog(\"option\", \"bu" +
|
||||
"ttons\");\r\n buttons[\'Save\'] = function () {\r\n " +
|
||||
" $dialogUpdateJobTypes.dialog(\"disable\");\r\n " +
|
||||
" var selectedSJTs = [];\r\n $dialog" +
|
||||
"UpdateJobTypes.find(\'input:checked\').each(function () { selectedSJTs.push($(this" +
|
||||
").val()) });\r\n\r\n var data = {\r\n " +
|
||||
" id: id,\r\n JobSubTypes: sele" +
|
||||
"ctedSJTs\r\n };\r\n $." +
|
||||
"ajax({\r\n url: \'");
|
||||
|
||||
|
||||
#line 181 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.ComponentUpdateJobSubTypes()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\',\r\n dataType: \'json\',\r\n " +
|
||||
" type: \'POST\',\r\n traditional: tr" +
|
||||
"ue,\r\n data: data,\r\n " +
|
||||
" success: function (d) {\r\n if (d" +
|
||||
".Result == \'OK\') {\r\n if (d.Component." +
|
||||
"JobSubTypes.length > 0) {\r\n edit$" +
|
||||
"this.addClass(\'editAlert\');\r\n } else " +
|
||||
"{\r\n edit$this.removeClass(\'editAl" +
|
||||
"ert\');\r\n }\r\n " +
|
||||
" $dialogUpdateJobTypes.dialog(\"enable\");\r\n " +
|
||||
" $dialogUpdateJobTypes.dialog(\"close\");\r\n " +
|
||||
" } else {\r\n al" +
|
||||
"ert(\'Unable to update component sub types: \' + d.Result);\r\n " +
|
||||
" }\r\n },\r\n " +
|
||||
" error: function (jqXHR, textStatus, errorThrown) {\r\n " +
|
||||
" alert(\'Unable to update component sub types: \' + t" +
|
||||
"extStatus);\r\n }\r\n " +
|
||||
" });\r\n };\r\n var buttons" +
|
||||
" = $dialogUpdateJobTypes.dialog(\"option\", \"buttons\", buttons);\r\n " +
|
||||
" $dialogUpdateJobTypes.dialog(\'open\');\r\n } els" +
|
||||
"e {\r\n alert(\'Unable to load component: \' + d.Result);" +
|
||||
"\r\n }\r\n },\r\n error: " +
|
||||
"function (jqXHR, textStatus, errorThrown) {\r\n alert(\'Unab" +
|
||||
"le to load component: \' + textStatus);\r\n }\r\n }" +
|
||||
");\r\n }\r\n\r\n }\r\n\r\n $(\"#dialogConfirmRemove\").dialog({\r\n " +
|
||||
" resizable: false,\r\n height: 140,\r\n modal: true,\r" +
|
||||
"\n autoOpen: false,\r\n buttons: {\r\n \"Remove\":" +
|
||||
" function () {\r\n $(this).dialog(\"close\");\r\n }," +
|
||||
"\r\n Cancel: function () {\r\n $(this).dialog(\"clo" +
|
||||
"se\");\r\n }\r\n }\r\n });\r\n\r\n $(\'#dialogUpdate" +
|
||||
"JobTypes\').dialog({\r\n resizable: false,\r\n modal: true,\r\n " +
|
||||
" autoOpen: false,\r\n width: 550,\r\n buttons: {\r\n " +
|
||||
" \"Save\": function () {\r\n $(this).dialog(\"close\");" +
|
||||
"\r\n },\r\n Cancel: function () {\r\n " +
|
||||
" $(this).dialog(\"close\");\r\n }\r\n }\r\n });\r\n\r\n " +
|
||||
" $(\'#CheckboxBulkSelect_dialogUpdateJobTypes\').checkboxBulkSelect({ parentSel" +
|
||||
"ector: \'div\' });\r\n\r\n $deviceComponents.find(\'input\').live(\'change\', updat" +
|
||||
"eComponent).focus(function () { $(this).select() });\r\n $deviceComponents." +
|
||||
"find(\'span.remove\').live(\'click\', removeComponent);\r\n $deviceComponents.f" +
|
||||
"ind(\'span.edit\').live(\'click\', editComponentJobTypes);\r\n\r\n });\r\n</script>\r\n<d" +
|
||||
"iv");
|
||||
|
||||
WriteLiteral(" id=\"dialogUpdateJobTypes\"");
|
||||
|
||||
WriteLiteral(" title=\"Update Job Types\"");
|
||||
|
||||
WriteLiteral(">\r\n <div>\r\n <h2>\r\n Hardware Non-Warranty Job Types</h2>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 260 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.ToSelectListItems(), 2));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n <br />\r\n <span");
|
||||
|
||||
WriteLiteral(" id=\"CheckboxBulkSelect_dialogUpdateJobTypes\"");
|
||||
|
||||
WriteLiteral(" class=\"checkboxBulkSelectContainer\"");
|
||||
|
||||
WriteLiteral(">\r\n </span>\r\n </div>\r\n</div>\r\n<div");
|
||||
|
||||
WriteLiteral(" id=\"dialogConfirmRemove\"");
|
||||
|
||||
WriteLiteral(" title=\"Delete this Component?\"");
|
||||
|
||||
WriteLiteral(">\r\n <p>\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"ui-icon ui-icon-alert\"");
|
||||
|
||||
WriteLiteral(" style=\"float: left; margin: 0 7px 20px 0;\"");
|
||||
|
||||
WriteLiteral("></span>\r\n This item will be permanently deleted and cannot be recovered. " +
|
||||
"Are you sure?</p>\r\n</div>\r\n");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.17929
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Disco.Web.Areas.Config.Views.DeviceModel
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Helpers;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Ajax;
|
||||
using System.Web.Mvc.Html;
|
||||
using System.Web.Routing;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.WebPages;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceModel/_DeviceComponentsTable.cshtml")]
|
||||
public class DeviceComponentsTable : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.DeviceComponentsModel>
|
||||
{
|
||||
public DeviceComponentsTable()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
|
||||
#line 2 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Disco-jQueryExtensions");
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n<table");
|
||||
|
||||
WriteLiteral(" id=\"deviceComponents\"");
|
||||
|
||||
WriteLiteral(" data-devicemodelid=\"");
|
||||
|
||||
|
||||
#line 5 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(">\r\n <tr>\r\n <th>\r\n Description\r\n </th>\r\n <th>\r\n" +
|
||||
" Cost\r\n </th>\r\n <th>\r\n Job Types\r\n </" +
|
||||
"th>\r\n <th");
|
||||
|
||||
WriteLiteral(" class=\"actions\"");
|
||||
|
||||
WriteLiteral(">\r\n \r\n </th>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 20 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 20 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
foreach (var item in Model.DeviceComponents)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr");
|
||||
|
||||
WriteLiteral(" data-devicecomponentid=\"");
|
||||
|
||||
|
||||
#line 22 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(item.Id);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(">\r\n <td>\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"text\"");
|
||||
|
||||
WriteLiteral(" class=\"description\"");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 710), Tuple.Create("\"", 735)
|
||||
|
||||
#line 24 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 718), Tuple.Create<System.Object, System.Int32>(item.Description
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 718), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"text\"");
|
||||
|
||||
WriteLiteral(" class=\"cost\"");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 825), Tuple.Create("\"", 857)
|
||||
|
||||
#line 27 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 833), Tuple.Create<System.Object, System.Int32>(item.Cost.ToString("C")
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 833), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <span");
|
||||
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 921), Tuple.Create("\"", 992)
|
||||
, Tuple.Create(Tuple.Create("", 929), Tuple.Create("edit", 929), true)
|
||||
|
||||
#line 30 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 933), Tuple.Create<System.Object, System.Int32>(item.JobSubTypes.Count > 0 ? " editAlert" : string.Empty
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 933), false)
|
||||
);
|
||||
|
||||
WriteLiteral("></span>\r\n </td>\r\n <td>\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"remove\"");
|
||||
|
||||
WriteLiteral("></span>\r\n </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 36 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr>\r\n <td");
|
||||
|
||||
WriteLiteral(" colspan=\"4\"");
|
||||
|
||||
WriteLiteral(">\r\n <a");
|
||||
|
||||
WriteLiteral(" href=\"#\"");
|
||||
|
||||
WriteLiteral(" id=\"addDeviceComponent\"");
|
||||
|
||||
WriteLiteral(">Add Component</a>\r\n </td>\r\n </tr>\r\n</table>\r\n<script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(@">
|
||||
$(function () {
|
||||
var $deviceComponents = $('#deviceComponents');
|
||||
|
||||
$('#addDeviceComponent').click(function () {
|
||||
var dc = $('<tr><td><input type=""text"" class=""description"" /></td><td><input type=""text"" class=""cost"" /></td><td><span class=""edit""></span></td><td><span class=""remove""></span></td></tr>');
|
||||
dc.find('input').focus(function () { $(this).select() })
|
||||
dc.insertBefore($deviceComponents.find('tr').last());
|
||||
dc.find('input.description').focus();
|
||||
return false;
|
||||
});
|
||||
|
||||
var removeComponentConfirmed = function (id, row) {
|
||||
var data = { id: id };
|
||||
$.ajax({
|
||||
url: '");
|
||||
|
||||
|
||||
#line 58 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.ComponentRemove()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\',\r\n dataType: \'json\',\r\n data: data,\r\n " +
|
||||
" success: function (d) {\r\n if (d == \'OK\') {\r\n " +
|
||||
" row.remove();\r\n } else {\r\n a" +
|
||||
"lert(\'Unable to remove component: \' + d);\r\n }\r\n " +
|
||||
" },\r\n error: function (jqXHR, textStatus, errorThrown) {\r\n " +
|
||||
" alert(\'Unable to remove component: \' + textStatus);\r\n " +
|
||||
" }\r\n });\r\n }\r\n var removeComponent = function () {\r\n " +
|
||||
" var componentRow = $(this).closest(\'tr\');\r\n var id = compo" +
|
||||
"nentRow.attr(\'data-devicecomponentid\');\r\n if (id) {\r\n " +
|
||||
"var dialog = $(\"#dialogConfirmRemove\");\r\n var buttons = dialog.di" +
|
||||
"alog(\"option\", \"buttons\");\r\n buttons[\'Remove\'] = function () { re" +
|
||||
"moveComponentConfirmed(id, componentRow); $(this).dialog(\"close\"); };\r\n " +
|
||||
" var buttons = dialog.dialog(\"option\", \"buttons\", buttons);\r\n " +
|
||||
" dialog.dialog(\'open\');\r\n } else {\r\n // New - Remove" +
|
||||
"\r\n componentRow.remove();\r\n }\r\n }\r\n var " +
|
||||
"updateComponent = function () {\r\n var componentRow = $(this).closest(" +
|
||||
"\'tr\');\r\n componentRow.find(\'input\').attr(\'disabled\', true).addClass(\'" +
|
||||
"updating\');\r\n\r\n var id = componentRow.attr(\'data-devicecomponentid\');" +
|
||||
"\r\n if (id) {\r\n // Update\r\n var data = {" +
|
||||
"\r\n id: id,\r\n Description: componentRow.fin" +
|
||||
"d(\'input.description\').val(),\r\n Cost: componentRow.find(\'inpu" +
|
||||
"t.cost\').val()\r\n };\r\n $.ajax({\r\n " +
|
||||
" url: \'");
|
||||
|
||||
|
||||
#line 100 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.ComponentUpdate()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
componentRow.find('input.description').val(d.Component.Description);
|
||||
componentRow.find('input.cost').val(d.Component.Cost);
|
||||
} else {
|
||||
alert('Unable to update component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Add
|
||||
id = componentRow.closest('table').attr('data-devicemodelid');
|
||||
var data = {
|
||||
id: id,
|
||||
Description: componentRow.find('input.description').val(),
|
||||
Cost: componentRow.find('input.cost').val()
|
||||
};
|
||||
$.ajax({
|
||||
url: '");
|
||||
|
||||
|
||||
#line 126 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.ComponentAdd(null, null, null)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
componentRow.attr('data-devicecomponentid', d.Component.Id);
|
||||
componentRow.find('input.description').val(d.Component.Description);
|
||||
componentRow.find('input.cost').val(d.Component.Cost);
|
||||
} else {
|
||||
alert('Unable to add component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
var editComponentJobTypes = function () {
|
||||
var edit$this = $(this);
|
||||
var componentRow = edit$this.closest('tr');
|
||||
|
||||
var id = componentRow.attr('data-devicecomponentid');
|
||||
|
||||
if (id) {
|
||||
var data = {
|
||||
id: id
|
||||
};
|
||||
$.ajax({
|
||||
url: '");
|
||||
|
||||
|
||||
#line 157 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.Component()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\',\r\n dataType: \'json\',\r\n data: data,\r\n " +
|
||||
" success: function (d) {\r\n componentRow.fin" +
|
||||
"d(\'input\').attr(\'disabled\', false).removeClass(\'updating\');\r\n " +
|
||||
" if (d.Result == \'OK\') {\r\n $dialogUpdateJobTypes " +
|
||||
"= $(\'#dialogUpdateJobTypes\');\r\n $dialogUpdateJobTypes" +
|
||||
".find(\'input:checked\').each(function () { $(this).prop(\'checked\', false) });\r\n " +
|
||||
" for (var i = 0; i < d.Component.JobSubTypes.length; i+" +
|
||||
"+) {\r\n var sjt = d.Component.JobSubTypes[i];\r\n " +
|
||||
" $dialogUpdateJobTypes.find(\'#SubTypes_\' + sjt).prop" +
|
||||
"(\'checked\', true);\r\n }\r\n $" +
|
||||
"(\'#CheckboxBulkSelect_dialogUpdateJobTypes\').checkboxBulkSelect(\'update\');\r\n " +
|
||||
" var buttons = $dialogUpdateJobTypes.dialog(\"option\", \"bu" +
|
||||
"ttons\");\r\n buttons[\'Save\'] = function () {\r\n " +
|
||||
" $dialogUpdateJobTypes.dialog(\"disable\");\r\n " +
|
||||
" var selectedSJTs = [];\r\n $dialog" +
|
||||
"UpdateJobTypes.find(\'input:checked\').each(function () { selectedSJTs.push($(this" +
|
||||
").val()) });\r\n\r\n var data = {\r\n " +
|
||||
" id: id,\r\n JobSubTypes: sele" +
|
||||
"ctedSJTs\r\n };\r\n $." +
|
||||
"ajax({\r\n url: \'");
|
||||
|
||||
|
||||
#line 181 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.ComponentUpdateJobSubTypes()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\',\r\n dataType: \'json\',\r\n " +
|
||||
" type: \'POST\',\r\n traditional: tr" +
|
||||
"ue,\r\n data: data,\r\n " +
|
||||
" success: function (d) {\r\n if (d" +
|
||||
".Result == \'OK\') {\r\n if (d.Component." +
|
||||
"JobSubTypes.length > 0) {\r\n edit$" +
|
||||
"this.addClass(\'editAlert\');\r\n } else " +
|
||||
"{\r\n edit$this.removeClass(\'editAl" +
|
||||
"ert\');\r\n }\r\n " +
|
||||
" $dialogUpdateJobTypes.dialog(\"enable\");\r\n " +
|
||||
" $dialogUpdateJobTypes.dialog(\"close\");\r\n " +
|
||||
" } else {\r\n al" +
|
||||
"ert(\'Unable to update component sub types: \' + d.Result);\r\n " +
|
||||
" }\r\n },\r\n " +
|
||||
" error: function (jqXHR, textStatus, errorThrown) {\r\n " +
|
||||
" alert(\'Unable to update component sub types: \' + t" +
|
||||
"extStatus);\r\n }\r\n " +
|
||||
" });\r\n };\r\n var buttons" +
|
||||
" = $dialogUpdateJobTypes.dialog(\"option\", \"buttons\", buttons);\r\n " +
|
||||
" $dialogUpdateJobTypes.dialog(\'open\');\r\n } els" +
|
||||
"e {\r\n alert(\'Unable to load component: \' + d.Result);" +
|
||||
"\r\n }\r\n },\r\n error: " +
|
||||
"function (jqXHR, textStatus, errorThrown) {\r\n alert(\'Unab" +
|
||||
"le to load component: \' + textStatus);\r\n }\r\n }" +
|
||||
");\r\n }\r\n\r\n }\r\n\r\n $(\"#dialogConfirmRemove\").dialog({\r\n " +
|
||||
" resizable: false,\r\n height: 140,\r\n modal: true,\r" +
|
||||
"\n autoOpen: false,\r\n buttons: {\r\n \"Remove\":" +
|
||||
" function () {\r\n $(this).dialog(\"close\");\r\n }," +
|
||||
"\r\n Cancel: function () {\r\n $(this).dialog(\"clo" +
|
||||
"se\");\r\n }\r\n }\r\n });\r\n\r\n $(\'#dialogUpdate" +
|
||||
"JobTypes\').dialog({\r\n resizable: false,\r\n modal: true,\r\n " +
|
||||
" autoOpen: false,\r\n width: 550,\r\n buttons: {\r\n " +
|
||||
" \"Save\": function () {\r\n $(this).dialog(\"close\");" +
|
||||
"\r\n },\r\n Cancel: function () {\r\n " +
|
||||
" $(this).dialog(\"close\");\r\n }\r\n }\r\n });\r\n\r\n " +
|
||||
" $(\'#CheckboxBulkSelect_dialogUpdateJobTypes\').checkboxBulkSelect({ parentSel" +
|
||||
"ector: \'div\' });\r\n\r\n $deviceComponents.on(\'change\', \'input\', updateCompon" +
|
||||
"ent);\r\n $deviceComponents.on(\'focus\', \'input\', function () { $(this).sele" +
|
||||
"ct(); });\r\n\r\n $deviceComponents.on(\'click\', \'span.remove\', removeComponen" +
|
||||
"t);\r\n $deviceComponents.on(\'click\', \'span.edit\', editComponentJobTypes);\r" +
|
||||
"\n });\r\n</script>\r\n<div");
|
||||
|
||||
WriteLiteral(" id=\"dialogUpdateJobTypes\"");
|
||||
|
||||
WriteLiteral(" title=\"Update Job Types\"");
|
||||
|
||||
WriteLiteral(">\r\n <div>\r\n <h2>\r\n Hardware Non-Warranty Job Types</h2>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 261 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.ToSelectListItems(), 2));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n <br />\r\n <span");
|
||||
|
||||
WriteLiteral(" id=\"CheckboxBulkSelect_dialogUpdateJobTypes\"");
|
||||
|
||||
WriteLiteral(" class=\"checkboxBulkSelectContainer\"");
|
||||
|
||||
WriteLiteral(">\r\n </span>\r\n </div>\r\n</div>\r\n<div");
|
||||
|
||||
WriteLiteral(" id=\"dialogConfirmRemove\"");
|
||||
|
||||
WriteLiteral(" title=\"Delete this Component?\"");
|
||||
|
||||
WriteLiteral(">\r\n <p>\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"ui-icon ui-icon-alert\"");
|
||||
|
||||
WriteLiteral(" style=\"float: left; margin: 0 7px 20px 0;\"");
|
||||
|
||||
WriteLiteral("></span>\r\n This item will be permanently deleted and cannot be recovered. " +
|
||||
"Are you sure?</p>\r\n</div>\r\n");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
||||
@@ -1,322 +1,322 @@
|
||||
@{
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(), "Import Status");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
||||
}
|
||||
<h2>
|
||||
Documents Imported Today
|
||||
</h2>
|
||||
<div id="importStatus">
|
||||
<div id="noSessions" data-bind="visible: noSessions">
|
||||
<h3>
|
||||
No imported documents today</h3>
|
||||
</div>
|
||||
<div id="sessions" data-bind="visible: !noSessions(), foreach: {data: sessions, afterRender: sessionRendered}"
|
||||
style="display: none">
|
||||
<div class="session">
|
||||
<div class="clearfix">
|
||||
<div class="sessionLeftPane">
|
||||
<h3>
|
||||
<span data-bind="text: title"></span>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="sessionRightPane">
|
||||
<p class="sessionStart" data-bind="text: startTime">
|
||||
</p>
|
||||
<p class="sessionStatus" data-bind="text: progressStatus">
|
||||
</p>
|
||||
<div data-bind="visible: !sessionEnded(), progressValue: progressValue" class="sessionProgress">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sessionPages clearfix" data-bind="foreach: {data: sessionPages}">
|
||||
<div class="sessionPage" data-bind="style: {backgroundImage: thumbnailUrl}">
|
||||
<div class="sessionPageDetails">
|
||||
<h3 data-bind="text: title">
|
||||
</h3>
|
||||
<div data-bind="visible: undetected">
|
||||
Disco QR-Code not found<br />
|
||||
<a target="_blank" data-bind="attr: {href: manuallyAssignUrl}, visible: $parent.sessionEnded">Manually Assign Page</a>
|
||||
</div>
|
||||
<div data-bind="visible: detected">
|
||||
Document: <a target="_blank" data-bind="text: documentTemplate, attr: {href: documentTemplateUrl}">
|
||||
</a>
|
||||
<br />
|
||||
Target: <a target="_blank" data-bind="text: assignedData, attr: {href: assignedDataUrl}">
|
||||
</a>
|
||||
</div>
|
||||
<div data-bind="visible: !(detected() || undetected())">
|
||||
<p class="sessionStatus" data-bind="text: progressStatus">
|
||||
</p>
|
||||
<div data-bind="progressValue: progressValue" class="sessionProgress">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sessionInfoMessages">
|
||||
<table class="logEventsViewport">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="icon">
|
||||
|
||||
</th>
|
||||
<th class="message">
|
||||
Message
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div class="logEventsViewportContainer">
|
||||
<div class="logEventsViewportNoLogs" data-bind="visible: messages().length == 0"
|
||||
style="display: none">
|
||||
No logs
|
||||
</div>
|
||||
<table class="logEventsViewport" data-bind="visible: messages().length > 0" style="display: none">
|
||||
<tbody data-bind="foreach: messages">
|
||||
<tr>
|
||||
<td class="icon" data-bind="attr: {title: FormattedTimestamp}, css: {information: EventTypeSeverity == 0, warning: EventTypeSeverity == 1, error: EventTypeSeverity == 2}">
|
||||
|
||||
</td>
|
||||
<td class="message" data-bind="text: FormattedMessage, attr: {title: EventTypeName}">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
ko.bindingHandlers.progressValue = {
|
||||
update: function (element, valueAccessor, allBindingsAccessor, viewModel) {
|
||||
var v = ko.utils.unwrapObservable(valueAccessor());
|
||||
var vInt = parseInt(v);
|
||||
if (vInt >= 0) {
|
||||
$element = $(element);
|
||||
if (!$element.is('.ui-progressbar'))
|
||||
$element.progressbar();
|
||||
$(element).progressbar('option', 'value', vInt);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var vm;
|
||||
var host = $('#importStatus');
|
||||
var hostSessions = $('#sessions');
|
||||
var liveConnection;
|
||||
var urlDeviceShow = '@(Url.Action(MVC.Device.Show()))/'
|
||||
var urlJobShow = '@(Url.Action(MVC.Job.Show()))/'
|
||||
var urlUserShow = '@(Url.Action(MVC.User.Show()))/'
|
||||
var urlPageThumbnail = '@(Url.Action(MVC.API.DocumentTemplate.ImporterThumbnail()))/'
|
||||
var urlDocumentTemplate = '@(Url.Action(MVC.Config.DocumentTemplate.Index()))/';
|
||||
var urlManuallyAssign = '@(Url.Action(MVC.Config.DocumentTemplate.UndetectedPages()))';
|
||||
var iconErrorUrl = 'url(@(Links.ClientSource.Style.Images.Status.fail32_png))';
|
||||
var isLive = false;
|
||||
|
||||
function pageViewModel() {
|
||||
var self = this;
|
||||
|
||||
self.noSessions = ko.observable(true);
|
||||
self.sessions = ko.observableArray();
|
||||
self.sessionIndex = {};
|
||||
|
||||
self.sessionRendered = function (e, d) {
|
||||
if (!d.sessionEnded()) {
|
||||
d.progressbar = $(e).find('.sessionProgress').progressbar();
|
||||
}
|
||||
};
|
||||
}
|
||||
function sessionViewModel(id) {
|
||||
var self = this;
|
||||
|
||||
self.title = ko.observable(id);
|
||||
self.messages = ko.observableArray();
|
||||
self.progressStatus = ko.observable();
|
||||
self.progressValue = ko.observable();
|
||||
self.startTime = ko.observable();
|
||||
self.sessionEnded = ko.observable(false);
|
||||
|
||||
self.sessionPages = ko.observableArray();
|
||||
self.sessionPagesIndex = {};
|
||||
self.addSessionPage = function (sessionPage) {
|
||||
//if (isLive) {
|
||||
self.sessionPages.push(sessionPage);
|
||||
self.sessionPagesIndex[sessionPage.pageNumber] = sessionPage;
|
||||
//}
|
||||
}
|
||||
}
|
||||
function sessionPageViewModel(sessionId, pageNumber) {
|
||||
var self = this;
|
||||
|
||||
self.sessionId = sessionId;
|
||||
self.pageNumber = pageNumber;
|
||||
self.title = 'Page ' + pageNumber;
|
||||
self.progressStatus = ko.observable();
|
||||
self.progressValue = ko.observable();
|
||||
self.undetected = ko.observable(false);
|
||||
self.detected = ko.observable(false);
|
||||
self.documentTemplateId = ko.observable();
|
||||
self.documentTemplate = ko.observable();
|
||||
self.assignedDataType = ko.observable();
|
||||
self.assignedDataId = ko.observable();
|
||||
self.assignedData = ko.observable();
|
||||
self.thumbnailEnabled = ko.observable(0);
|
||||
self.updateThumbnail = function () {
|
||||
self.thumbnailEnabled(self.thumbnailEnabled() + 1);
|
||||
}
|
||||
self.documentTemplateUrl = ko.computed(function () {
|
||||
return urlDocumentTemplate + self.documentTemplateId();
|
||||
});
|
||||
self.manuallyAssignUrl = ko.computed(function () {
|
||||
return urlManuallyAssign + '#' + self.sessionId + '_' + self.pageNumber;
|
||||
});
|
||||
self.assignedDataUrl = ko.computed(function () {
|
||||
var t = self.assignedDataType();
|
||||
var dId = self.assignedDataId();
|
||||
switch (t) {
|
||||
case 'Device':
|
||||
return urlDeviceShow + dId;
|
||||
case 'Job':
|
||||
return urlJobShow + dId;
|
||||
case 'User':
|
||||
return urlUserShow + dId;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
self.thumbnailUrl = ko.computed(function () {
|
||||
var enabled = self.thumbnailEnabled();
|
||||
if (enabled > 0) {
|
||||
return 'url(' + urlPageThumbnail + '?SessionId=' + self.sessionId + '&PageNumber=' + self.pageNumber + '&NoCache=' + enabled + ')';
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
function parseLog(log) {
|
||||
if (log.ModuleId === 40 && log.Arguments && log.Arguments.length > 0) {
|
||||
// find session
|
||||
var sessionId = log.Arguments[0];
|
||||
var session = vm.sessionIndex[sessionId];
|
||||
if (!session && log.EventTypeId === 10) { // Starting Session (Ignore 'partial' sessions)
|
||||
session = new sessionViewModel(log.Arguments[1]);
|
||||
vm.sessionIndex[sessionId] = session;
|
||||
vm.sessions.unshift(session);
|
||||
vm.noSessions(false);
|
||||
}
|
||||
if (session) {
|
||||
switch (log.EventTypeId) {
|
||||
case 10: // SessionStarting
|
||||
session.startTime(log.FormattedTimestamp.substring(log.FormattedTimestamp.indexOf(' ') + 1));
|
||||
break;
|
||||
case 11: // SessionProgress
|
||||
session.progressValue(log.Arguments[1]);
|
||||
session.progressStatus(log.Arguments[2]);
|
||||
break;
|
||||
case 12: // SessionFinished
|
||||
session.sessionEnded(true);
|
||||
session.progressStatus('Import Finished');
|
||||
break;
|
||||
case 15: // SessionWarning
|
||||
session.messages.unshift(log);
|
||||
break;
|
||||
case 16: // SessionError
|
||||
session.messages.unshift(log);
|
||||
break;
|
||||
case 100: // ImportPageStarting
|
||||
session.addSessionPage(new sessionPageViewModel(sessionId, log.Arguments[1]));
|
||||
break;
|
||||
case 104: // ImportPageImageUpdate
|
||||
var p = session.sessionPagesIndex[log.Arguments[1]];
|
||||
if (p) {
|
||||
p.updateThumbnail();
|
||||
}
|
||||
break;
|
||||
case 105: // ImportPageProgress
|
||||
var p = session.sessionPagesIndex[log.Arguments[1]];
|
||||
if (p) {
|
||||
p.progressValue(log.Arguments[2]);
|
||||
p.progressStatus(log.Arguments[3]);
|
||||
}
|
||||
break;
|
||||
case 110: // ImportPageDetected
|
||||
var p = session.sessionPagesIndex[log.Arguments[1]];
|
||||
if (p) {
|
||||
p.documentTemplateId(log.Arguments[2]);
|
||||
p.documentTemplate(log.Arguments[3]);
|
||||
p.assignedDataType(log.Arguments[4]);
|
||||
p.assignedDataId(log.Arguments[5]);
|
||||
p.assignedData(log.Arguments[6]);
|
||||
p.detected(true);
|
||||
if (!isLive) {
|
||||
p.updateThumbnail();
|
||||
}
|
||||
}
|
||||
session.messages.unshift(log);
|
||||
break;
|
||||
case 115: // ImportPageUndetected
|
||||
var p = session.sessionPagesIndex[log.Arguments[1]];
|
||||
if (p) {
|
||||
p.undetected(true);
|
||||
if (!isLive) {
|
||||
p.updateThumbnail();
|
||||
}
|
||||
}
|
||||
session.messages.unshift(log);
|
||||
break;
|
||||
case 150: // Ignore: ImportPageUndetectedStored
|
||||
break;
|
||||
default:
|
||||
session.messages.unshift(log);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function init() {
|
||||
// Create View Model
|
||||
vm = new pageViewModel();
|
||||
|
||||
// Load Logs
|
||||
var d = new Date();
|
||||
var loadData = {
|
||||
Format: "json",
|
||||
Start: d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(),
|
||||
End: null,
|
||||
ModuleId: 40,
|
||||
Take: 2000
|
||||
};
|
||||
$.ajax({
|
||||
url: '@(Url.Action(MVC.API.Logging.RetrieveEvents()))',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
traditional: true,
|
||||
data: loadData,
|
||||
success: init_loadedLogs,
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to retrieve logs: ' + errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
function init_loadedLogs(logs) {
|
||||
logs.reverse();
|
||||
for (var i = 0; i < logs.length; i++) {
|
||||
parseLog(logs[i]);
|
||||
}
|
||||
// Bind
|
||||
ko.applyBindings(vm);
|
||||
|
||||
// Init Persistent Connection
|
||||
liveConnection = $.connection('@(Url.Content("~/API/Logging/Notifications"))');
|
||||
liveConnection.received(parseLog);
|
||||
liveConnection.error(function (e) { alert('Live-Log Error: ' + e) });
|
||||
isLive = true;
|
||||
liveConnection.start(function () {
|
||||
liveConnection.send('/addToGroups:@(Disco.BI.DocumentTemplateBI.Importer.DocumentImporterLog.Current.LiveLogGroupName)');
|
||||
});
|
||||
}
|
||||
init();
|
||||
});
|
||||
</script>
|
||||
@{
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(), "Import Status");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
||||
}
|
||||
<h2>
|
||||
Documents Imported Today
|
||||
</h2>
|
||||
<div id="importStatus">
|
||||
<div id="noSessions" data-bind="visible: noSessions">
|
||||
<h3>
|
||||
No imported documents today</h3>
|
||||
</div>
|
||||
<div id="sessions" data-bind="visible: !noSessions(), foreach: {data: sessions, afterRender: sessionRendered}"
|
||||
style="display: none">
|
||||
<div class="session">
|
||||
<div class="clearfix">
|
||||
<div class="sessionLeftPane">
|
||||
<h3>
|
||||
<span data-bind="text: title"></span>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="sessionRightPane">
|
||||
<p class="sessionStart" data-bind="text: startTime">
|
||||
</p>
|
||||
<p class="sessionStatus" data-bind="text: progressStatus">
|
||||
</p>
|
||||
<div data-bind="visible: !sessionEnded(), progressValue: progressValue" class="sessionProgress">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sessionPages clearfix" data-bind="foreach: {data: sessionPages}">
|
||||
<div class="sessionPage" data-bind="style: {backgroundImage: thumbnailUrl}">
|
||||
<div class="sessionPageDetails">
|
||||
<h3 data-bind="text: title">
|
||||
</h3>
|
||||
<div data-bind="visible: undetected">
|
||||
Disco QR-Code not found<br />
|
||||
<a target="_blank" data-bind="attr: {href: manuallyAssignUrl}, visible: $parent.sessionEnded">Manually Assign Page</a>
|
||||
</div>
|
||||
<div data-bind="visible: detected">
|
||||
Document: <a target="_blank" data-bind="text: documentTemplate, attr: {href: documentTemplateUrl}">
|
||||
</a>
|
||||
<br />
|
||||
Target: <a target="_blank" data-bind="text: assignedData, attr: {href: assignedDataUrl}">
|
||||
</a>
|
||||
</div>
|
||||
<div data-bind="visible: !(detected() || undetected())">
|
||||
<p class="sessionStatus" data-bind="text: progressStatus">
|
||||
</p>
|
||||
<div data-bind="progressValue: progressValue" class="sessionProgress">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sessionInfoMessages">
|
||||
<table class="logEventsViewport">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="icon">
|
||||
|
||||
</th>
|
||||
<th class="message">
|
||||
Message
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div class="logEventsViewportContainer">
|
||||
<div class="logEventsViewportNoLogs" data-bind="visible: messages().length == 0"
|
||||
style="display: none">
|
||||
No logs
|
||||
</div>
|
||||
<table class="logEventsViewport" data-bind="visible: messages().length > 0" style="display: none">
|
||||
<tbody data-bind="foreach: messages">
|
||||
<tr>
|
||||
<td class="icon" data-bind="attr: {title: FormattedTimestamp}, css: {information: EventTypeSeverity == 0, warning: EventTypeSeverity == 1, error: EventTypeSeverity == 2}">
|
||||
|
||||
</td>
|
||||
<td class="message" data-bind="text: FormattedMessage, attr: {title: EventTypeName}">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
ko.bindingHandlers.progressValue = {
|
||||
update: function (element, valueAccessor, allBindingsAccessor, viewModel) {
|
||||
var v = ko.utils.unwrapObservable(valueAccessor());
|
||||
var vInt = parseInt(v);
|
||||
if (vInt >= 0) {
|
||||
$element = $(element);
|
||||
if (!$element.is('.ui-progressbar'))
|
||||
$element.progressbar();
|
||||
$(element).progressbar('option', 'value', vInt);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var vm;
|
||||
var host = $('#importStatus');
|
||||
var hostSessions = $('#sessions');
|
||||
var liveConnection;
|
||||
var urlDeviceShow = '@(Url.Action(MVC.Device.Show()))/'
|
||||
var urlJobShow = '@(Url.Action(MVC.Job.Show()))/'
|
||||
var urlUserShow = '@(Url.Action(MVC.User.Show()))/'
|
||||
var urlPageThumbnail = '@(Url.Action(MVC.API.DocumentTemplate.ImporterThumbnail()))/'
|
||||
var urlDocumentTemplate = '@(Url.Action(MVC.Config.DocumentTemplate.Index()))/';
|
||||
var urlManuallyAssign = '@(Url.Action(MVC.Config.DocumentTemplate.UndetectedPages()))';
|
||||
var iconErrorUrl = 'url(@(Links.ClientSource.Style.Images.Status.fail32_png))';
|
||||
var isLive = false;
|
||||
|
||||
function pageViewModel() {
|
||||
var self = this;
|
||||
|
||||
self.noSessions = ko.observable(true);
|
||||
self.sessions = ko.observableArray();
|
||||
self.sessionIndex = {};
|
||||
|
||||
self.sessionRendered = function (e, d) {
|
||||
if (!d.sessionEnded()) {
|
||||
d.progressbar = $(e).find('.sessionProgress').progressbar();
|
||||
}
|
||||
};
|
||||
}
|
||||
function sessionViewModel(id) {
|
||||
var self = this;
|
||||
|
||||
self.title = ko.observable(id);
|
||||
self.messages = ko.observableArray();
|
||||
self.progressStatus = ko.observable();
|
||||
self.progressValue = ko.observable();
|
||||
self.startTime = ko.observable();
|
||||
self.sessionEnded = ko.observable(false);
|
||||
|
||||
self.sessionPages = ko.observableArray();
|
||||
self.sessionPagesIndex = {};
|
||||
self.addSessionPage = function (sessionPage) {
|
||||
//if (isLive) {
|
||||
self.sessionPages.push(sessionPage);
|
||||
self.sessionPagesIndex[sessionPage.pageNumber] = sessionPage;
|
||||
//}
|
||||
}
|
||||
}
|
||||
function sessionPageViewModel(sessionId, pageNumber) {
|
||||
var self = this;
|
||||
|
||||
self.sessionId = sessionId;
|
||||
self.pageNumber = pageNumber;
|
||||
self.title = 'Page ' + pageNumber;
|
||||
self.progressStatus = ko.observable();
|
||||
self.progressValue = ko.observable();
|
||||
self.undetected = ko.observable(false);
|
||||
self.detected = ko.observable(false);
|
||||
self.documentTemplateId = ko.observable();
|
||||
self.documentTemplate = ko.observable();
|
||||
self.assignedDataType = ko.observable();
|
||||
self.assignedDataId = ko.observable();
|
||||
self.assignedData = ko.observable();
|
||||
self.thumbnailEnabled = ko.observable(0);
|
||||
self.updateThumbnail = function () {
|
||||
self.thumbnailEnabled(self.thumbnailEnabled() + 1);
|
||||
}
|
||||
self.documentTemplateUrl = ko.computed(function () {
|
||||
return urlDocumentTemplate + self.documentTemplateId();
|
||||
});
|
||||
self.manuallyAssignUrl = ko.computed(function () {
|
||||
return urlManuallyAssign + '#' + self.sessionId + '_' + self.pageNumber;
|
||||
});
|
||||
self.assignedDataUrl = ko.computed(function () {
|
||||
var t = self.assignedDataType();
|
||||
var dId = self.assignedDataId();
|
||||
switch (t) {
|
||||
case 'Device':
|
||||
return urlDeviceShow + dId;
|
||||
case 'Job':
|
||||
return urlJobShow + dId;
|
||||
case 'User':
|
||||
return urlUserShow + dId;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
self.thumbnailUrl = ko.computed(function () {
|
||||
var enabled = self.thumbnailEnabled();
|
||||
if (enabled > 0) {
|
||||
return 'url(' + urlPageThumbnail + '?SessionId=' + self.sessionId + '&PageNumber=' + self.pageNumber + '&NoCache=' + enabled + ')';
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
function parseLog(log) {
|
||||
if (log.ModuleId === 40 && log.Arguments && log.Arguments.length > 0) {
|
||||
// find session
|
||||
var sessionId = log.Arguments[0];
|
||||
var session = vm.sessionIndex[sessionId];
|
||||
if (!session && log.EventTypeId === 10) { // Starting Session (Ignore 'partial' sessions)
|
||||
session = new sessionViewModel(log.Arguments[1]);
|
||||
vm.sessionIndex[sessionId] = session;
|
||||
vm.sessions.unshift(session);
|
||||
vm.noSessions(false);
|
||||
}
|
||||
if (session) {
|
||||
switch (log.EventTypeId) {
|
||||
case 10: // SessionStarting
|
||||
session.startTime(log.FormattedTimestamp.substring(log.FormattedTimestamp.indexOf(' ') + 1));
|
||||
break;
|
||||
case 11: // SessionProgress
|
||||
session.progressValue(log.Arguments[1]);
|
||||
session.progressStatus(log.Arguments[2]);
|
||||
break;
|
||||
case 12: // SessionFinished
|
||||
session.sessionEnded(true);
|
||||
session.progressStatus('Import Finished');
|
||||
break;
|
||||
case 15: // SessionWarning
|
||||
session.messages.unshift(log);
|
||||
break;
|
||||
case 16: // SessionError
|
||||
session.messages.unshift(log);
|
||||
break;
|
||||
case 100: // ImportPageStarting
|
||||
session.addSessionPage(new sessionPageViewModel(sessionId, log.Arguments[1]));
|
||||
break;
|
||||
case 104: // ImportPageImageUpdate
|
||||
var p = session.sessionPagesIndex[log.Arguments[1]];
|
||||
if (p) {
|
||||
p.updateThumbnail();
|
||||
}
|
||||
break;
|
||||
case 105: // ImportPageProgress
|
||||
var p = session.sessionPagesIndex[log.Arguments[1]];
|
||||
if (p) {
|
||||
p.progressValue(log.Arguments[2]);
|
||||
p.progressStatus(log.Arguments[3]);
|
||||
}
|
||||
break;
|
||||
case 110: // ImportPageDetected
|
||||
var p = session.sessionPagesIndex[log.Arguments[1]];
|
||||
if (p) {
|
||||
p.documentTemplateId(log.Arguments[2]);
|
||||
p.documentTemplate(log.Arguments[3]);
|
||||
p.assignedDataType(log.Arguments[4]);
|
||||
p.assignedDataId(log.Arguments[5]);
|
||||
p.assignedData(log.Arguments[6]);
|
||||
p.detected(true);
|
||||
if (!isLive) {
|
||||
p.updateThumbnail();
|
||||
}
|
||||
}
|
||||
session.messages.unshift(log);
|
||||
break;
|
||||
case 115: // ImportPageUndetected
|
||||
var p = session.sessionPagesIndex[log.Arguments[1]];
|
||||
if (p) {
|
||||
p.undetected(true);
|
||||
if (!isLive) {
|
||||
p.updateThumbnail();
|
||||
}
|
||||
}
|
||||
session.messages.unshift(log);
|
||||
break;
|
||||
case 150: // Ignore: ImportPageUndetectedStored
|
||||
break;
|
||||
default:
|
||||
session.messages.unshift(log);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function init() {
|
||||
// Create View Model
|
||||
vm = new pageViewModel();
|
||||
|
||||
// Load Logs
|
||||
var d = new Date();
|
||||
var loadData = {
|
||||
Format: "json",
|
||||
Start: d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(),
|
||||
End: null,
|
||||
ModuleId: 40,
|
||||
Take: 2000
|
||||
};
|
||||
$.ajax({
|
||||
url: '@(Url.Action(MVC.API.Logging.RetrieveEvents()))',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
traditional: true,
|
||||
data: loadData,
|
||||
success: init_loadedLogs,
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to retrieve logs: ' + errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
function init_loadedLogs(logs) {
|
||||
logs.reverse();
|
||||
for (var i = 0; i < logs.length; i++) {
|
||||
parseLog(logs[i]);
|
||||
}
|
||||
// Bind
|
||||
ko.applyBindings(vm);
|
||||
|
||||
// Init Persistent Connection
|
||||
liveConnection = $.connection('@(Url.Content("~/API/Logging/Notifications"))');
|
||||
liveConnection.received(parseLog);
|
||||
liveConnection.error(function (e) { if (e.status != 200) alert('Live-Log Error: ' + e.statusText + ': ' + e.responseText); });
|
||||
isLive = true;
|
||||
liveConnection.start(function () {
|
||||
liveConnection.send('/addToGroups:@(Disco.BI.DocumentTemplateBI.Importer.DocumentImporterLog.Current.LiveLogGroupName)');
|
||||
});
|
||||
}
|
||||
init();
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,484 +1,484 @@
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.17929
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Disco.Web.Areas.Config.Views.DocumentTemplate
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Helpers;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Ajax;
|
||||
using System.Web.Mvc.Html;
|
||||
using System.Web.Routing;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.WebPages;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DocumentTemplate/ImportStatus.cshtml")]
|
||||
public class ImportStatus : System.Web.Mvc.WebViewPage<dynamic>
|
||||
{
|
||||
public ImportStatus()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
|
||||
#line 1 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(), "Import Status");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n<h2>\r\n Documents Imported Today\r\n</h2>\r\n<div");
|
||||
|
||||
WriteLiteral(" id=\"importStatus\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"noSessions\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: noSessions\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3>\r\n No imported documents today</h3>\r\n </div>\r\n <d" +
|
||||
"iv");
|
||||
|
||||
WriteLiteral(" id=\"sessions\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: !noSessions(), foreach: {data: sessions, afterRender: sessio" +
|
||||
"nRendered}\"");
|
||||
|
||||
WriteLiteral("\r\n style=\"display: none\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"session\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"clearfix\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"sessionLeftPane\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3>\r\n <span");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: title\"");
|
||||
|
||||
WriteLiteral("></span>\r\n </h3>\r\n </div>\r\n <div" +
|
||||
"");
|
||||
|
||||
WriteLiteral(" class=\"sessionRightPane\"");
|
||||
|
||||
WriteLiteral(">\r\n <p");
|
||||
|
||||
WriteLiteral(" class=\"sessionStart\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: startTime\"");
|
||||
|
||||
WriteLiteral(">\r\n </p>\r\n <p");
|
||||
|
||||
WriteLiteral(" class=\"sessionStatus\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: progressStatus\"");
|
||||
|
||||
WriteLiteral(">\r\n </p>\r\n <div");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: !sessionEnded(), progressValue: progressValue\"");
|
||||
|
||||
WriteLiteral(" class=\"sessionProgress\"");
|
||||
|
||||
WriteLiteral(">\r\n </div>\r\n </div>\r\n </div>\r\n " +
|
||||
" <div");
|
||||
|
||||
WriteLiteral(" class=\"sessionPages clearfix\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"foreach: {data: sessionPages}\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"sessionPage\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"style: {backgroundImage: thumbnailUrl}\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"sessionPageDetails\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: title\"");
|
||||
|
||||
WriteLiteral(">\r\n </h3>\r\n <div");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: undetected\"");
|
||||
|
||||
WriteLiteral(">\r\n Disco QR-Code not found<br />\r\n " +
|
||||
" <a");
|
||||
|
||||
WriteLiteral(" target=\"_blank\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"attr: {href: manuallyAssignUrl}, visible: $parent.sessionEnded\"");
|
||||
|
||||
WriteLiteral(">Manually Assign Page</a>\r\n </div>\r\n " +
|
||||
" <div");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: detected\"");
|
||||
|
||||
WriteLiteral(">\r\n Document: <a");
|
||||
|
||||
WriteLiteral(" target=\"_blank\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: documentTemplate, attr: {href: documentTemplateUrl}\"");
|
||||
|
||||
WriteLiteral(">\r\n </a>\r\n <br />\r\n " +
|
||||
" Target: <a");
|
||||
|
||||
WriteLiteral(" target=\"_blank\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: assignedData, attr: {href: assignedDataUrl}\"");
|
||||
|
||||
WriteLiteral(">\r\n </a>\r\n </div>\r\n " +
|
||||
" <div");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: !(detected() || undetected())\"");
|
||||
|
||||
WriteLiteral(">\r\n <p");
|
||||
|
||||
WriteLiteral(" class=\"sessionStatus\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: progressStatus\"");
|
||||
|
||||
WriteLiteral(">\r\n </p>\r\n <div");
|
||||
|
||||
WriteLiteral(" data-bind=\"progressValue: progressValue\"");
|
||||
|
||||
WriteLiteral(" class=\"sessionProgress\"");
|
||||
|
||||
WriteLiteral(">\r\n </div>\r\n </div>\r\n " +
|
||||
" </div>\r\n </div>\r\n </div>\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"sessionInfoMessages\"");
|
||||
|
||||
WriteLiteral(">\r\n <table");
|
||||
|
||||
WriteLiteral(" class=\"logEventsViewport\"");
|
||||
|
||||
WriteLiteral(">\r\n <thead>\r\n <tr>\r\n " +
|
||||
" <th");
|
||||
|
||||
WriteLiteral(" class=\"icon\"");
|
||||
|
||||
WriteLiteral(">\r\n \r\n </th>\r\n " +
|
||||
" <th");
|
||||
|
||||
WriteLiteral(" class=\"message\"");
|
||||
|
||||
WriteLiteral(">\r\n Message\r\n </th>\r\n " +
|
||||
" </tr>\r\n </thead>\r\n </tab" +
|
||||
"le>\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"logEventsViewportContainer\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"logEventsViewportNoLogs\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: messages().length == 0\"");
|
||||
|
||||
WriteLiteral("\r\n style=\"display: none\"");
|
||||
|
||||
WriteLiteral(">\r\n No logs\r\n </div>\r\n " +
|
||||
" <table");
|
||||
|
||||
WriteLiteral(" class=\"logEventsViewport\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: messages().length > 0\"");
|
||||
|
||||
WriteLiteral(" style=\"display: none\"");
|
||||
|
||||
WriteLiteral(">\r\n <tbody");
|
||||
|
||||
WriteLiteral(" data-bind=\"foreach: messages\"");
|
||||
|
||||
WriteLiteral(">\r\n <tr>\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"icon\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"attr: {title: FormattedTimestamp}, css: {information: EventTypeSeveri" +
|
||||
"ty == 0, warning: EventTypeSeverity == 1, error: EventTypeSeverity == 2}\"");
|
||||
|
||||
WriteLiteral(">\r\n \r\n </" +
|
||||
"td>\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"message\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: FormattedMessage, attr: {title: EventTypeName}\"");
|
||||
|
||||
WriteLiteral(">\r\n </td>\r\n </tr>\r\n " +
|
||||
" </tbody>\r\n </table>\r\n </di" +
|
||||
"v>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n<script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(@">
|
||||
ko.bindingHandlers.progressValue = {
|
||||
update: function (element, valueAccessor, allBindingsAccessor, viewModel) {
|
||||
var v = ko.utils.unwrapObservable(valueAccessor());
|
||||
var vInt = parseInt(v);
|
||||
if (vInt >= 0) {
|
||||
$element = $(element);
|
||||
if (!$element.is('.ui-progressbar'))
|
||||
$element.progressbar();
|
||||
$(element).progressbar('option', 'value', vInt);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(">\r\n $(function () {\r\n var vm;\r\n var host = $(\'#importStatus\');\r\n" +
|
||||
" var hostSessions = $(\'#sessions\');\r\n var liveConnection;\r\n " +
|
||||
" var urlDeviceShow = \'");
|
||||
|
||||
|
||||
#line 111 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Url.Action(MVC.Device.Show()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("/\'\r\n var urlJobShow = \'");
|
||||
|
||||
|
||||
#line 112 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Url.Action(MVC.Job.Show()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("/\'\r\n var urlUserShow = \'");
|
||||
|
||||
|
||||
#line 113 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Url.Action(MVC.User.Show()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("/\'\r\n var urlPageThumbnail = \'");
|
||||
|
||||
|
||||
#line 114 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Url.Action(MVC.API.DocumentTemplate.ImporterThumbnail()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("/\'\r\n var urlDocumentTemplate = \'");
|
||||
|
||||
|
||||
#line 115 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Url.Action(MVC.Config.DocumentTemplate.Index()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("/\';\r\n var urlManuallyAssign = \'");
|
||||
|
||||
|
||||
#line 116 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Url.Action(MVC.Config.DocumentTemplate.UndetectedPages()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\';\r\n var iconErrorUrl = \'url(");
|
||||
|
||||
|
||||
#line 117 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Links.ClientSource.Style.Images.Status.fail32_png);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(")\';\r\n var isLive = false;\r\n\r\n function pageViewModel() {\r\n " +
|
||||
" var self = this;\r\n\r\n self.noSessions = ko.observable(true);\r\n " +
|
||||
" self.sessions = ko.observableArray();\r\n self.sessionIndex = {}" +
|
||||
";\r\n\r\n self.sessionRendered = function (e, d) {\r\n if (!" +
|
||||
"d.sessionEnded()) {\r\n d.progressbar = $(e).find(\'.sessionProg" +
|
||||
"ress\').progressbar();\r\n }\r\n };\r\n }\r\n fun" +
|
||||
"ction sessionViewModel(id) {\r\n var self = this;\r\n\r\n self.t" +
|
||||
"itle = ko.observable(id);\r\n self.messages = ko.observableArray();\r\n " +
|
||||
" self.progressStatus = ko.observable();\r\n self.progressValue" +
|
||||
" = ko.observable();\r\n self.startTime = ko.observable();\r\n " +
|
||||
"self.sessionEnded = ko.observable(false);\r\n\r\n self.sessionPages = ko." +
|
||||
"observableArray();\r\n self.sessionPagesIndex = {};\r\n self.a" +
|
||||
"ddSessionPage = function (sessionPage) {\r\n //if (isLive) {\r\n " +
|
||||
" self.sessionPages.push(sessionPage);\r\n self.sessionPag" +
|
||||
"esIndex[sessionPage.pageNumber] = sessionPage;\r\n //}\r\n " +
|
||||
" }\r\n }\r\n function sessionPageViewModel(sessionId, pageNumber) {\r\n " +
|
||||
" var self = this;\r\n\r\n self.sessionId = sessionId;\r\n " +
|
||||
" self.pageNumber = pageNumber;\r\n self.title = \'Page \' + pageNumber" +
|
||||
";\r\n self.progressStatus = ko.observable();\r\n self.progress" +
|
||||
"Value = ko.observable();\r\n self.undetected = ko.observable(false);\r\n " +
|
||||
" self.detected = ko.observable(false);\r\n self.documentTempl" +
|
||||
"ateId = ko.observable();\r\n self.documentTemplate = ko.observable();\r\n" +
|
||||
" self.assignedDataType = ko.observable();\r\n self.assignedD" +
|
||||
"ataId = ko.observable();\r\n self.assignedData = ko.observable();\r\n " +
|
||||
" self.thumbnailEnabled = ko.observable(0);\r\n self.updateThumbn" +
|
||||
"ail = function () {\r\n self.thumbnailEnabled(self.thumbnailEnabled" +
|
||||
"() + 1);\r\n }\r\n self.documentTemplateUrl = ko.computed(func" +
|
||||
"tion () {\r\n return urlDocumentTemplate + self.documentTemplateId(" +
|
||||
");\r\n });\r\n self.manuallyAssignUrl = ko.computed(function (" +
|
||||
") {\r\n return urlManuallyAssign + \'#\' + self.sessionId + \'_\' + sel" +
|
||||
"f.pageNumber;\r\n });\r\n self.assignedDataUrl = ko.computed(f" +
|
||||
"unction () {\r\n var t = self.assignedDataType();\r\n " +
|
||||
"var dId = self.assignedDataId();\r\n switch (t) {\r\n " +
|
||||
" case \'Device\':\r\n return urlDeviceShow + dId;\r\n " +
|
||||
" case \'Job\':\r\n return urlJobShow + dId;\r\n " +
|
||||
" case \'User\':\r\n return urlUserShow + dId;\r" +
|
||||
"\n }\r\n return null;\r\n });\r\n s" +
|
||||
"elf.thumbnailUrl = ko.computed(function () {\r\n var enabled = self" +
|
||||
".thumbnailEnabled();\r\n if (enabled > 0) {\r\n re" +
|
||||
"turn \'url(\' + urlPageThumbnail + \'?SessionId=\' + self.sessionId + \'&PageNumber=\'" +
|
||||
" + self.pageNumber + \'&NoCache=\' + enabled + \')\';\r\n }\r\n " +
|
||||
" return null;\r\n });\r\n }\r\n\r\n function parseLog(log)" +
|
||||
" {\r\n if (log.ModuleId === 40 && log.Arguments && log.Arguments.length" +
|
||||
" > 0) {\r\n // find session\r\n var sessionId = log.Ar" +
|
||||
"guments[0];\r\n var session = vm.sessionIndex[sessionId];\r\n " +
|
||||
" if (!session && log.EventTypeId === 10) { // Starting Session (Ignore \'p" +
|
||||
"artial\' sessions)\r\n session = new sessionViewModel(log.Argume" +
|
||||
"nts[1]);\r\n vm.sessionIndex[sessionId] = session;\r\n " +
|
||||
" vm.sessions.unshift(session);\r\n vm.noSessions(false)" +
|
||||
";\r\n }\r\n if (session) {\r\n switch" +
|
||||
" (log.EventTypeId) {\r\n case 10: // SessionStarting\r\n " +
|
||||
" session.startTime(log.FormattedTimestamp.substring(log.Fo" +
|
||||
"rmattedTimestamp.indexOf(\' \') + 1));\r\n break;\r\n " +
|
||||
" case 11: // SessionProgress\r\n sessi" +
|
||||
"on.progressValue(log.Arguments[1]);\r\n session.progres" +
|
||||
"sStatus(log.Arguments[2]);\r\n break;\r\n " +
|
||||
" case 12: // SessionFinished\r\n session.session" +
|
||||
"Ended(true);\r\n session.progressStatus(\'Import Finishe" +
|
||||
"d\');\r\n break;\r\n case 15: // Se" +
|
||||
"ssionWarning\r\n session.messages.unshift(log);\r\n " +
|
||||
" break;\r\n case 16: // SessionError\r\n" +
|
||||
" session.messages.unshift(log);\r\n " +
|
||||
" break;\r\n case 100: // ImportPageStarting\r\n " +
|
||||
" session.addSessionPage(new sessionPageViewModel(sessionId, " +
|
||||
"log.Arguments[1]));\r\n break;\r\n " +
|
||||
" case 104: // ImportPageImageUpdate\r\n var p = session" +
|
||||
".sessionPagesIndex[log.Arguments[1]];\r\n if (p) {\r\n " +
|
||||
" p.updateThumbnail();\r\n }" +
|
||||
"\r\n break;\r\n case 105: // Impor" +
|
||||
"tPageProgress\r\n var p = session.sessionPagesIndex[log" +
|
||||
".Arguments[1]];\r\n if (p) {\r\n " +
|
||||
" p.progressValue(log.Arguments[2]);\r\n p.pro" +
|
||||
"gressStatus(log.Arguments[3]);\r\n }\r\n " +
|
||||
" break;\r\n case 110: // ImportPageDetected\r\n " +
|
||||
" var p = session.sessionPagesIndex[log.Arguments[1]];\r\n " +
|
||||
" if (p) {\r\n p.documentTe" +
|
||||
"mplateId(log.Arguments[2]);\r\n p.documentTemplate(" +
|
||||
"log.Arguments[3]);\r\n p.assignedDataType(log.Argum" +
|
||||
"ents[4]);\r\n p.assignedDataId(log.Arguments[5]);\r\n" +
|
||||
" p.assignedData(log.Arguments[6]);\r\n " +
|
||||
" p.detected(true);\r\n if (!isLiv" +
|
||||
"e) {\r\n p.updateThumbnail();\r\n " +
|
||||
" }\r\n }\r\n se" +
|
||||
"ssion.messages.unshift(log);\r\n break;\r\n " +
|
||||
" case 115: // ImportPageUndetected\r\n var p =" +
|
||||
" session.sessionPagesIndex[log.Arguments[1]];\r\n if (p" +
|
||||
") {\r\n p.undetected(true);\r\n " +
|
||||
" if (!isLive) {\r\n p.updateThumbnail(" +
|
||||
");\r\n }\r\n }\r\n " +
|
||||
" session.messages.unshift(log);\r\n br" +
|
||||
"eak;\r\n case 150: // Ignore: ImportPageUndetectedStored\r\n " +
|
||||
" break;\r\n default:\r\n " +
|
||||
" session.messages.unshift(log);\r\n }\r\n " +
|
||||
" }\r\n }\r\n }\r\n function init() {\r\n // C" +
|
||||
"reate View Model\r\n vm = new pageViewModel();\r\n\r\n // Load L" +
|
||||
"ogs\r\n var d = new Date();\r\n var loadData = {\r\n " +
|
||||
" Format: \"json\",\r\n Start: d.getFullYear() + \'-\' + (d.getMonth(" +
|
||||
") + 1) + \'-\' + d.getDate(),\r\n End: null,\r\n ModuleI" +
|
||||
"d: 40,\r\n Take: 2000\r\n };\r\n $.ajax({\r\n " +
|
||||
" url: \'");
|
||||
|
||||
|
||||
#line 292 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Url.Action(MVC.API.Logging.RetrieveEvents()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
traditional: true,
|
||||
data: loadData,
|
||||
success: init_loadedLogs,
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to retrieve logs: ' + errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
function init_loadedLogs(logs) {
|
||||
logs.reverse();
|
||||
for (var i = 0; i < logs.length; i++) {
|
||||
parseLog(logs[i]);
|
||||
}
|
||||
// Bind
|
||||
ko.applyBindings(vm);
|
||||
|
||||
// Init Persistent Connection
|
||||
liveConnection = $.connection('");
|
||||
|
||||
|
||||
#line 312 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Url.Content("~/API/Logging/Notifications"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"');
|
||||
liveConnection.received(parseLog);
|
||||
liveConnection.error(function (e) { alert('Live-Log Error: ' + e) });
|
||||
isLive = true;
|
||||
liveConnection.start(function () {
|
||||
liveConnection.send('/addToGroups:");
|
||||
|
||||
|
||||
#line 317 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Disco.BI.DocumentTemplateBI.Importer.DocumentImporterLog.Current.LiveLogGroupName);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\');\r\n });\r\n }\r\n init();\r\n });\r\n</script>\r\n");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.17929
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Disco.Web.Areas.Config.Views.DocumentTemplate
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Helpers;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Ajax;
|
||||
using System.Web.Mvc.Html;
|
||||
using System.Web.Routing;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.WebPages;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DocumentTemplate/ImportStatus.cshtml")]
|
||||
public class ImportStatus : System.Web.Mvc.WebViewPage<dynamic>
|
||||
{
|
||||
public ImportStatus()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
|
||||
#line 1 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(), "Import Status");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n<h2>\r\n Documents Imported Today\r\n</h2>\r\n<div");
|
||||
|
||||
WriteLiteral(" id=\"importStatus\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"noSessions\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: noSessions\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3>\r\n No imported documents today</h3>\r\n </div>\r\n <d" +
|
||||
"iv");
|
||||
|
||||
WriteLiteral(" id=\"sessions\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: !noSessions(), foreach: {data: sessions, afterRender: sessio" +
|
||||
"nRendered}\"");
|
||||
|
||||
WriteLiteral("\r\n style=\"display: none\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"session\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"clearfix\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"sessionLeftPane\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3>\r\n <span");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: title\"");
|
||||
|
||||
WriteLiteral("></span>\r\n </h3>\r\n </div>\r\n <div" +
|
||||
"");
|
||||
|
||||
WriteLiteral(" class=\"sessionRightPane\"");
|
||||
|
||||
WriteLiteral(">\r\n <p");
|
||||
|
||||
WriteLiteral(" class=\"sessionStart\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: startTime\"");
|
||||
|
||||
WriteLiteral(">\r\n </p>\r\n <p");
|
||||
|
||||
WriteLiteral(" class=\"sessionStatus\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: progressStatus\"");
|
||||
|
||||
WriteLiteral(">\r\n </p>\r\n <div");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: !sessionEnded(), progressValue: progressValue\"");
|
||||
|
||||
WriteLiteral(" class=\"sessionProgress\"");
|
||||
|
||||
WriteLiteral(">\r\n </div>\r\n </div>\r\n </div>\r\n " +
|
||||
" <div");
|
||||
|
||||
WriteLiteral(" class=\"sessionPages clearfix\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"foreach: {data: sessionPages}\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"sessionPage\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"style: {backgroundImage: thumbnailUrl}\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"sessionPageDetails\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: title\"");
|
||||
|
||||
WriteLiteral(">\r\n </h3>\r\n <div");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: undetected\"");
|
||||
|
||||
WriteLiteral(">\r\n Disco QR-Code not found<br />\r\n " +
|
||||
" <a");
|
||||
|
||||
WriteLiteral(" target=\"_blank\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"attr: {href: manuallyAssignUrl}, visible: $parent.sessionEnded\"");
|
||||
|
||||
WriteLiteral(">Manually Assign Page</a>\r\n </div>\r\n " +
|
||||
" <div");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: detected\"");
|
||||
|
||||
WriteLiteral(">\r\n Document: <a");
|
||||
|
||||
WriteLiteral(" target=\"_blank\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: documentTemplate, attr: {href: documentTemplateUrl}\"");
|
||||
|
||||
WriteLiteral(">\r\n </a>\r\n <br />\r\n " +
|
||||
" Target: <a");
|
||||
|
||||
WriteLiteral(" target=\"_blank\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: assignedData, attr: {href: assignedDataUrl}\"");
|
||||
|
||||
WriteLiteral(">\r\n </a>\r\n </div>\r\n " +
|
||||
" <div");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: !(detected() || undetected())\"");
|
||||
|
||||
WriteLiteral(">\r\n <p");
|
||||
|
||||
WriteLiteral(" class=\"sessionStatus\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: progressStatus\"");
|
||||
|
||||
WriteLiteral(">\r\n </p>\r\n <div");
|
||||
|
||||
WriteLiteral(" data-bind=\"progressValue: progressValue\"");
|
||||
|
||||
WriteLiteral(" class=\"sessionProgress\"");
|
||||
|
||||
WriteLiteral(">\r\n </div>\r\n </div>\r\n " +
|
||||
" </div>\r\n </div>\r\n </div>\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"sessionInfoMessages\"");
|
||||
|
||||
WriteLiteral(">\r\n <table");
|
||||
|
||||
WriteLiteral(" class=\"logEventsViewport\"");
|
||||
|
||||
WriteLiteral(">\r\n <thead>\r\n <tr>\r\n " +
|
||||
" <th");
|
||||
|
||||
WriteLiteral(" class=\"icon\"");
|
||||
|
||||
WriteLiteral(">\r\n \r\n </th>\r\n " +
|
||||
" <th");
|
||||
|
||||
WriteLiteral(" class=\"message\"");
|
||||
|
||||
WriteLiteral(">\r\n Message\r\n </th>\r\n " +
|
||||
" </tr>\r\n </thead>\r\n </tab" +
|
||||
"le>\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"logEventsViewportContainer\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"logEventsViewportNoLogs\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: messages().length == 0\"");
|
||||
|
||||
WriteLiteral("\r\n style=\"display: none\"");
|
||||
|
||||
WriteLiteral(">\r\n No logs\r\n </div>\r\n " +
|
||||
" <table");
|
||||
|
||||
WriteLiteral(" class=\"logEventsViewport\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: messages().length > 0\"");
|
||||
|
||||
WriteLiteral(" style=\"display: none\"");
|
||||
|
||||
WriteLiteral(">\r\n <tbody");
|
||||
|
||||
WriteLiteral(" data-bind=\"foreach: messages\"");
|
||||
|
||||
WriteLiteral(">\r\n <tr>\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"icon\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"attr: {title: FormattedTimestamp}, css: {information: EventTypeSeveri" +
|
||||
"ty == 0, warning: EventTypeSeverity == 1, error: EventTypeSeverity == 2}\"");
|
||||
|
||||
WriteLiteral(">\r\n \r\n </" +
|
||||
"td>\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"message\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: FormattedMessage, attr: {title: EventTypeName}\"");
|
||||
|
||||
WriteLiteral(">\r\n </td>\r\n </tr>\r\n " +
|
||||
" </tbody>\r\n </table>\r\n </di" +
|
||||
"v>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n<script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(@">
|
||||
ko.bindingHandlers.progressValue = {
|
||||
update: function (element, valueAccessor, allBindingsAccessor, viewModel) {
|
||||
var v = ko.utils.unwrapObservable(valueAccessor());
|
||||
var vInt = parseInt(v);
|
||||
if (vInt >= 0) {
|
||||
$element = $(element);
|
||||
if (!$element.is('.ui-progressbar'))
|
||||
$element.progressbar();
|
||||
$(element).progressbar('option', 'value', vInt);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(">\r\n $(function () {\r\n var vm;\r\n var host = $(\'#importStatus\');\r\n" +
|
||||
" var hostSessions = $(\'#sessions\');\r\n var liveConnection;\r\n " +
|
||||
" var urlDeviceShow = \'");
|
||||
|
||||
|
||||
#line 111 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Url.Action(MVC.Device.Show()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("/\'\r\n var urlJobShow = \'");
|
||||
|
||||
|
||||
#line 112 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Url.Action(MVC.Job.Show()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("/\'\r\n var urlUserShow = \'");
|
||||
|
||||
|
||||
#line 113 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Url.Action(MVC.User.Show()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("/\'\r\n var urlPageThumbnail = \'");
|
||||
|
||||
|
||||
#line 114 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Url.Action(MVC.API.DocumentTemplate.ImporterThumbnail()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("/\'\r\n var urlDocumentTemplate = \'");
|
||||
|
||||
|
||||
#line 115 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Url.Action(MVC.Config.DocumentTemplate.Index()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("/\';\r\n var urlManuallyAssign = \'");
|
||||
|
||||
|
||||
#line 116 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Url.Action(MVC.Config.DocumentTemplate.UndetectedPages()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\';\r\n var iconErrorUrl = \'url(");
|
||||
|
||||
|
||||
#line 117 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Links.ClientSource.Style.Images.Status.fail32_png);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(")\';\r\n var isLive = false;\r\n\r\n function pageViewModel() {\r\n " +
|
||||
" var self = this;\r\n\r\n self.noSessions = ko.observable(true);\r\n " +
|
||||
" self.sessions = ko.observableArray();\r\n self.sessionIndex = {}" +
|
||||
";\r\n\r\n self.sessionRendered = function (e, d) {\r\n if (!" +
|
||||
"d.sessionEnded()) {\r\n d.progressbar = $(e).find(\'.sessionProg" +
|
||||
"ress\').progressbar();\r\n }\r\n };\r\n }\r\n fun" +
|
||||
"ction sessionViewModel(id) {\r\n var self = this;\r\n\r\n self.t" +
|
||||
"itle = ko.observable(id);\r\n self.messages = ko.observableArray();\r\n " +
|
||||
" self.progressStatus = ko.observable();\r\n self.progressValue" +
|
||||
" = ko.observable();\r\n self.startTime = ko.observable();\r\n " +
|
||||
"self.sessionEnded = ko.observable(false);\r\n\r\n self.sessionPages = ko." +
|
||||
"observableArray();\r\n self.sessionPagesIndex = {};\r\n self.a" +
|
||||
"ddSessionPage = function (sessionPage) {\r\n //if (isLive) {\r\n " +
|
||||
" self.sessionPages.push(sessionPage);\r\n self.sessionPag" +
|
||||
"esIndex[sessionPage.pageNumber] = sessionPage;\r\n //}\r\n " +
|
||||
" }\r\n }\r\n function sessionPageViewModel(sessionId, pageNumber) {\r\n " +
|
||||
" var self = this;\r\n\r\n self.sessionId = sessionId;\r\n " +
|
||||
" self.pageNumber = pageNumber;\r\n self.title = \'Page \' + pageNumber" +
|
||||
";\r\n self.progressStatus = ko.observable();\r\n self.progress" +
|
||||
"Value = ko.observable();\r\n self.undetected = ko.observable(false);\r\n " +
|
||||
" self.detected = ko.observable(false);\r\n self.documentTempl" +
|
||||
"ateId = ko.observable();\r\n self.documentTemplate = ko.observable();\r\n" +
|
||||
" self.assignedDataType = ko.observable();\r\n self.assignedD" +
|
||||
"ataId = ko.observable();\r\n self.assignedData = ko.observable();\r\n " +
|
||||
" self.thumbnailEnabled = ko.observable(0);\r\n self.updateThumbn" +
|
||||
"ail = function () {\r\n self.thumbnailEnabled(self.thumbnailEnabled" +
|
||||
"() + 1);\r\n }\r\n self.documentTemplateUrl = ko.computed(func" +
|
||||
"tion () {\r\n return urlDocumentTemplate + self.documentTemplateId(" +
|
||||
");\r\n });\r\n self.manuallyAssignUrl = ko.computed(function (" +
|
||||
") {\r\n return urlManuallyAssign + \'#\' + self.sessionId + \'_\' + sel" +
|
||||
"f.pageNumber;\r\n });\r\n self.assignedDataUrl = ko.computed(f" +
|
||||
"unction () {\r\n var t = self.assignedDataType();\r\n " +
|
||||
"var dId = self.assignedDataId();\r\n switch (t) {\r\n " +
|
||||
" case \'Device\':\r\n return urlDeviceShow + dId;\r\n " +
|
||||
" case \'Job\':\r\n return urlJobShow + dId;\r\n " +
|
||||
" case \'User\':\r\n return urlUserShow + dId;\r" +
|
||||
"\n }\r\n return null;\r\n });\r\n s" +
|
||||
"elf.thumbnailUrl = ko.computed(function () {\r\n var enabled = self" +
|
||||
".thumbnailEnabled();\r\n if (enabled > 0) {\r\n re" +
|
||||
"turn \'url(\' + urlPageThumbnail + \'?SessionId=\' + self.sessionId + \'&PageNumber=\'" +
|
||||
" + self.pageNumber + \'&NoCache=\' + enabled + \')\';\r\n }\r\n " +
|
||||
" return null;\r\n });\r\n }\r\n\r\n function parseLog(log)" +
|
||||
" {\r\n if (log.ModuleId === 40 && log.Arguments && log.Arguments.length" +
|
||||
" > 0) {\r\n // find session\r\n var sessionId = log.Ar" +
|
||||
"guments[0];\r\n var session = vm.sessionIndex[sessionId];\r\n " +
|
||||
" if (!session && log.EventTypeId === 10) { // Starting Session (Ignore \'p" +
|
||||
"artial\' sessions)\r\n session = new sessionViewModel(log.Argume" +
|
||||
"nts[1]);\r\n vm.sessionIndex[sessionId] = session;\r\n " +
|
||||
" vm.sessions.unshift(session);\r\n vm.noSessions(false)" +
|
||||
";\r\n }\r\n if (session) {\r\n switch" +
|
||||
" (log.EventTypeId) {\r\n case 10: // SessionStarting\r\n " +
|
||||
" session.startTime(log.FormattedTimestamp.substring(log.Fo" +
|
||||
"rmattedTimestamp.indexOf(\' \') + 1));\r\n break;\r\n " +
|
||||
" case 11: // SessionProgress\r\n sessi" +
|
||||
"on.progressValue(log.Arguments[1]);\r\n session.progres" +
|
||||
"sStatus(log.Arguments[2]);\r\n break;\r\n " +
|
||||
" case 12: // SessionFinished\r\n session.session" +
|
||||
"Ended(true);\r\n session.progressStatus(\'Import Finishe" +
|
||||
"d\');\r\n break;\r\n case 15: // Se" +
|
||||
"ssionWarning\r\n session.messages.unshift(log);\r\n " +
|
||||
" break;\r\n case 16: // SessionError\r\n" +
|
||||
" session.messages.unshift(log);\r\n " +
|
||||
" break;\r\n case 100: // ImportPageStarting\r\n " +
|
||||
" session.addSessionPage(new sessionPageViewModel(sessionId, " +
|
||||
"log.Arguments[1]));\r\n break;\r\n " +
|
||||
" case 104: // ImportPageImageUpdate\r\n var p = session" +
|
||||
".sessionPagesIndex[log.Arguments[1]];\r\n if (p) {\r\n " +
|
||||
" p.updateThumbnail();\r\n }" +
|
||||
"\r\n break;\r\n case 105: // Impor" +
|
||||
"tPageProgress\r\n var p = session.sessionPagesIndex[log" +
|
||||
".Arguments[1]];\r\n if (p) {\r\n " +
|
||||
" p.progressValue(log.Arguments[2]);\r\n p.pro" +
|
||||
"gressStatus(log.Arguments[3]);\r\n }\r\n " +
|
||||
" break;\r\n case 110: // ImportPageDetected\r\n " +
|
||||
" var p = session.sessionPagesIndex[log.Arguments[1]];\r\n " +
|
||||
" if (p) {\r\n p.documentTe" +
|
||||
"mplateId(log.Arguments[2]);\r\n p.documentTemplate(" +
|
||||
"log.Arguments[3]);\r\n p.assignedDataType(log.Argum" +
|
||||
"ents[4]);\r\n p.assignedDataId(log.Arguments[5]);\r\n" +
|
||||
" p.assignedData(log.Arguments[6]);\r\n " +
|
||||
" p.detected(true);\r\n if (!isLiv" +
|
||||
"e) {\r\n p.updateThumbnail();\r\n " +
|
||||
" }\r\n }\r\n se" +
|
||||
"ssion.messages.unshift(log);\r\n break;\r\n " +
|
||||
" case 115: // ImportPageUndetected\r\n var p =" +
|
||||
" session.sessionPagesIndex[log.Arguments[1]];\r\n if (p" +
|
||||
") {\r\n p.undetected(true);\r\n " +
|
||||
" if (!isLive) {\r\n p.updateThumbnail(" +
|
||||
");\r\n }\r\n }\r\n " +
|
||||
" session.messages.unshift(log);\r\n br" +
|
||||
"eak;\r\n case 150: // Ignore: ImportPageUndetectedStored\r\n " +
|
||||
" break;\r\n default:\r\n " +
|
||||
" session.messages.unshift(log);\r\n }\r\n " +
|
||||
" }\r\n }\r\n }\r\n function init() {\r\n // C" +
|
||||
"reate View Model\r\n vm = new pageViewModel();\r\n\r\n // Load L" +
|
||||
"ogs\r\n var d = new Date();\r\n var loadData = {\r\n " +
|
||||
" Format: \"json\",\r\n Start: d.getFullYear() + \'-\' + (d.getMonth(" +
|
||||
") + 1) + \'-\' + d.getDate(),\r\n End: null,\r\n ModuleI" +
|
||||
"d: 40,\r\n Take: 2000\r\n };\r\n $.ajax({\r\n " +
|
||||
" url: \'");
|
||||
|
||||
|
||||
#line 292 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Url.Action(MVC.API.Logging.RetrieveEvents()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
traditional: true,
|
||||
data: loadData,
|
||||
success: init_loadedLogs,
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to retrieve logs: ' + errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
function init_loadedLogs(logs) {
|
||||
logs.reverse();
|
||||
for (var i = 0; i < logs.length; i++) {
|
||||
parseLog(logs[i]);
|
||||
}
|
||||
// Bind
|
||||
ko.applyBindings(vm);
|
||||
|
||||
// Init Persistent Connection
|
||||
liveConnection = $.connection('");
|
||||
|
||||
|
||||
#line 312 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Url.Content("~/API/Logging/Notifications"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"');
|
||||
liveConnection.received(parseLog);
|
||||
liveConnection.error(function (e) { if (e.status != 200) alert('Live-Log Error: ' + e.statusText + ': ' + e.responseText); });
|
||||
isLive = true;
|
||||
liveConnection.start(function () {
|
||||
liveConnection.send('/addToGroups:");
|
||||
|
||||
|
||||
#line 317 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||
Write(Disco.BI.DocumentTemplateBI.Importer.DocumentImporterLog.Current.LiveLogGroupName);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\');\r\n });\r\n }\r\n init();\r\n });\r\n</script>\r\n");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
||||
@@ -1,362 +1,362 @@
|
||||
@model Disco.Web.Areas.Config.Models.DocumentTemplate.ShowModel
|
||||
@{
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(null), Model.DocumentTemplate.Description);
|
||||
}
|
||||
<div class="form" style="width: 650px">
|
||||
<table>
|
||||
<tr>
|
||||
<th>
|
||||
Id:
|
||||
</th>
|
||||
<td>@Html.DisplayFor(model => model.DocumentTemplate.Id)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Stored Instances:
|
||||
</th>
|
||||
<td>@Html.DisplayFor(model => model.StoredInstanceCount)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Description:
|
||||
</th>
|
||||
<td>@Html.TextBoxFor(model => model.DocumentTemplate.Description)
|
||||
@AjaxHelpers.AjaxSave()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $Description = $('#DocumentTemplate_Description');
|
||||
var $DescriptionAjaxSave = $Description.next('.ajaxSave');
|
||||
$Description
|
||||
.watermark('Description')
|
||||
.focus(function () { $Description.select() })
|
||||
.keydown(function (e) {
|
||||
$DescriptionAjaxSave.show();
|
||||
if (e.which == 13) {
|
||||
$(this).blur();
|
||||
}
|
||||
}).blur(function () {
|
||||
$DescriptionAjaxSave.hide();
|
||||
})
|
||||
.change(function () {
|
||||
$DescriptionAjaxSave.hide();
|
||||
var $ajaxLoading = $DescriptionAjaxSave.next('.ajaxLoading').show();
|
||||
var data = { Description: $Description.val() };
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DocumentTemplate.UpdateDescription(Model.DocumentTemplate.Id))',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
} else {
|
||||
$ajaxLoading.hide();
|
||||
alert('Unable to update description: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update description: ' + textStatus);
|
||||
$ajaxLoading.hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Always Flatten Form:
|
||||
</th>
|
||||
<td>
|
||||
<input id="DocumentTemplate_FlattenForm" type="checkbox" @(Model.DocumentTemplate.FlattenForm ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty))/>
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('#DocumentTemplate_FlattenForm').click(function () {
|
||||
var $this = $(this);
|
||||
var $ajaxLoading = $this.next('.ajaxLoading').show();
|
||||
var data = { FlattenForm: $this.is(':checked') };
|
||||
$.getJSON('@(Url.Action(MVC.API.DocumentTemplate.UpdateFlattenForm(Model.DocumentTemplate.Id)))', data, function (response, result) {
|
||||
if (result != 'success' || response != 'OK') {
|
||||
alert('Unable to change Flatten Form:\n' + response);
|
||||
$ajaxLoading.hide();
|
||||
} else {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Scope:
|
||||
</th>
|
||||
<td>
|
||||
@Html.DropDownListFor(model => model.DocumentTemplate.Scope, Model.Scopes.ToSelectListItems(null))
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $scope = $('#DocumentTemplate_Scope');
|
||||
$scope.change(function () {
|
||||
var $ajaxLoading = $scope.next('.ajaxLoading').show();
|
||||
var data = { Scope: $scope.val() };
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DocumentTemplate.UpdateScope(Model.DocumentTemplate.Id))',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
scopeChange();
|
||||
} else {
|
||||
$ajaxLoading.hide();
|
||||
alert('Unable to update scope: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update scope: ' + textStatus);
|
||||
$ajaxLoading.hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var $trJobTypes = $('#trJobTypes');
|
||||
var $trJobTypeActions = $('#trJobTypeActions');
|
||||
var $jobTypes = $trJobTypes.find('input[type="checkbox"]');
|
||||
$jobTypes.change(jobTypesChange);
|
||||
|
||||
function scopeChange() {
|
||||
if ($scope.val() == 'Job') {
|
||||
$trJobTypes.show();
|
||||
$trJobTypeActions.show();
|
||||
jobTypesChange();
|
||||
} else {
|
||||
$trJobTypes.hide();
|
||||
$trJobTypeActions.hide();
|
||||
$jobTypes.filter(':checked').each(function () {
|
||||
$(this).attr('checked', false);
|
||||
});
|
||||
$('.jobSubTypes').hide().find('input[type="checkbox"]:checked').each(function () {
|
||||
$(this).attr('checked', false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function jobTypesChange() {
|
||||
$('.jobSubTypes').hide();
|
||||
$jobTypes.filter(':checked').each(function () {
|
||||
$('#trJobSubType' + $(this).val()).show();
|
||||
});
|
||||
}
|
||||
|
||||
$('#TypeAction_Save').click(function () {
|
||||
var data = { SubTypes: [] };
|
||||
var $ajaxLoading = $('#TypeAction_Save').next('.ajaxLoading').show();
|
||||
|
||||
$jobTypes.filter(':checked').each(function () {
|
||||
var $this = $(this);
|
||||
$('#trJobSubType' + $this.val()).find('input[type="checkbox"]:checked').each(function () {
|
||||
data.SubTypes.push($(this).val());
|
||||
});
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DocumentTemplate.UpdateSubTypes(Model.DocumentTemplate.Id))',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
traditional: true,
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
scopeChange();
|
||||
} else {
|
||||
$ajaxLoading.hide();
|
||||
alert('Unable to update job types: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update job types: ' + textStatus);
|
||||
$ajaxLoading.hide();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
scopeChange();
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="trJobTypes">
|
||||
<th class="name">
|
||||
Types:
|
||||
</th>
|
||||
<td class="value">
|
||||
@CommonHelpers.CheckBoxList("Types", Model.JobTypes.ToSelectListItems(Model.Types), 2)
|
||||
</td>
|
||||
</tr>
|
||||
@foreach (var jt in Model.JobTypes)
|
||||
{
|
||||
<tr id="trJobSubType@(jt.Id)" class="jobSubTypes">
|
||||
<th class="name">
|
||||
@jt.Description<br />
|
||||
Sub Types<br />
|
||||
@CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id))
|
||||
</th>
|
||||
<td class="value">
|
||||
@CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.Where(jst => jst.JobTypeId == jt.Id).ToList().ToSelectListItems(Model.SubTypes), 2)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<tr id="trJobTypeActions">
|
||||
<th class="name">
|
||||
</th>
|
||||
<td class="value">
|
||||
<a id="TypeAction_Save" href="#" class="button">Save Job Types</a>@AjaxHelpers.AjaxLoader()
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Template PDF
|
||||
</th>
|
||||
<td>
|
||||
@Html.ActionLink("Download Template", MVC.API.DocumentTemplate.Template(Model.DocumentTemplate.Id))
|
||||
<br />
|
||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.Template(Model.DocumentTemplate.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
|
||||
{
|
||||
<input type="file" name="Template" id="Template" style="width: 250px;" />
|
||||
<input class="button" type="submit" value="Upload" />
|
||||
}
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $template = $('#Template');
|
||||
$template.closest('form').submit(function () {
|
||||
if ($template.val() == '') {
|
||||
alert('A template file is required to upload.');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Filter Expression:
|
||||
</th>
|
||||
<td>@Html.TextBoxFor(model => model.DocumentTemplate.FilterExpression)
|
||||
@AjaxHelpers.AjaxRemove()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $FilterExpression = $('#DocumentTemplate_FilterExpression');
|
||||
var $ajaxLoading = $FilterExpression.nextAll('.ajaxLoading').first();
|
||||
var $ajaxRemove = $FilterExpression.nextAll('.ajaxRemove').first();
|
||||
$FilterExpression
|
||||
.watermark('Filter Expression')
|
||||
.focus(function () { $FilterExpression.select() })
|
||||
.keydown(function (e) {
|
||||
if (e.which == 13) {
|
||||
$(this).blur();
|
||||
}
|
||||
}).change(function () {
|
||||
updateFilterExpression($FilterExpression.val());
|
||||
});
|
||||
if ($FilterExpression.val() != '')
|
||||
$ajaxRemove.show();
|
||||
$ajaxRemove.click(function () {
|
||||
updateFilterExpression('');
|
||||
$FilterExpression.val('');
|
||||
});
|
||||
var updateFilterExpression = function (filterExpression) {
|
||||
$ajaxLoading.show();
|
||||
$ajaxRemove.hide();
|
||||
var data = { FilterExpression: filterExpression };
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DocumentTemplate.UpdateFilterExpression(Model.DocumentTemplate.Id))',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
if (data.FilterExpression != '')
|
||||
$ajaxRemove.fadeIn('fast');
|
||||
} else {
|
||||
$ajaxLoading.hide();
|
||||
alert('Unable to update filter expression: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update filter expression: ' + textStatus);
|
||||
$ajaxLoading.hide();
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Bulk Generate
|
||||
</th>
|
||||
<td>
|
||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id), FormMethod.Post))
|
||||
{
|
||||
<textarea name="DataIds"></textarea>
|
||||
<input class="button" type="submit" value="Generate" />
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<h2>
|
||||
Template Expressions</h2>
|
||||
@Html.Partial(MVC.Config.DocumentTemplate.Views._ExpressionsTable, Model.TemplateExpressions)
|
||||
<div id="dialogConfirmDelete" title="Delete this Document Template?">
|
||||
<p>
|
||||
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 100px 0;">
|
||||
</span>This item will be permanently deleted and cannot be recovered.<br />
|
||||
<em>This <strong>will not delete attachments</strong> which have already been imported,
|
||||
but any generated documents will no longer be automatically imported.</em><br />
|
||||
Are you sure?</p>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var button = $('#buttonDelete');
|
||||
var buttonDialog = $("#dialogConfirmDelete");
|
||||
var buttonLink = button.attr('href');
|
||||
button.attr('href', '#');
|
||||
button.click(function () {
|
||||
buttonDialog.dialog('open');
|
||||
return false;
|
||||
});
|
||||
buttonDialog.dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
buttons: {
|
||||
"Delete": function () {
|
||||
$this = $(this);
|
||||
$this.dialog('disable');
|
||||
$this.dialog("option", "buttons", null);
|
||||
window.location.href = buttonLink;
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<div class="actionBar">
|
||||
@Html.ActionLinkButton("Expression Browser", MVC.Config.DocumentTemplate.ExpressionBrowser())
|
||||
@Html.ActionLinkButton("Delete", MVC.API.DocumentTemplate.Delete(Model.DocumentTemplate.Id, true), "buttonDelete")
|
||||
</div>
|
||||
@model Disco.Web.Areas.Config.Models.DocumentTemplate.ShowModel
|
||||
@{
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(null), Model.DocumentTemplate.Description);
|
||||
}
|
||||
<div class="form" style="width: 650px">
|
||||
<table>
|
||||
<tr>
|
||||
<th>
|
||||
Id:
|
||||
</th>
|
||||
<td>@Html.DisplayFor(model => model.DocumentTemplate.Id)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Stored Instances:
|
||||
</th>
|
||||
<td>@Html.DisplayFor(model => model.StoredInstanceCount)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Description:
|
||||
</th>
|
||||
<td>@Html.TextBoxFor(model => model.DocumentTemplate.Description)
|
||||
@AjaxHelpers.AjaxSave()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $Description = $('#DocumentTemplate_Description');
|
||||
var $DescriptionAjaxSave = $Description.next('.ajaxSave');
|
||||
$Description
|
||||
.watermark('Description')
|
||||
.focus(function () { $Description.select() })
|
||||
.keydown(function (e) {
|
||||
$DescriptionAjaxSave.show();
|
||||
if (e.which == 13) {
|
||||
$(this).blur();
|
||||
}
|
||||
}).blur(function () {
|
||||
$DescriptionAjaxSave.hide();
|
||||
})
|
||||
.change(function () {
|
||||
$DescriptionAjaxSave.hide();
|
||||
var $ajaxLoading = $DescriptionAjaxSave.next('.ajaxLoading').show();
|
||||
var data = { Description: $Description.val() };
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DocumentTemplate.UpdateDescription(Model.DocumentTemplate.Id))',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
} else {
|
||||
$ajaxLoading.hide();
|
||||
alert('Unable to update description: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update description: ' + textStatus);
|
||||
$ajaxLoading.hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Always Flatten Form:
|
||||
</th>
|
||||
<td>
|
||||
<input id="DocumentTemplate_FlattenForm" type="checkbox" @(Model.DocumentTemplate.FlattenForm ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty))/>
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('#DocumentTemplate_FlattenForm').click(function () {
|
||||
var $this = $(this);
|
||||
var $ajaxLoading = $this.next('.ajaxLoading').show();
|
||||
var data = { FlattenForm: $this.is(':checked') };
|
||||
$.getJSON('@(Url.Action(MVC.API.DocumentTemplate.UpdateFlattenForm(Model.DocumentTemplate.Id)))', data, function (response, result) {
|
||||
if (result != 'success' || response != 'OK') {
|
||||
alert('Unable to change Flatten Form:\n' + response);
|
||||
$ajaxLoading.hide();
|
||||
} else {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Scope:
|
||||
</th>
|
||||
<td>
|
||||
@Html.DropDownListFor(model => model.DocumentTemplate.Scope, Model.Scopes.ToSelectListItems(null))
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $scope = $('#DocumentTemplate_Scope');
|
||||
$scope.change(function () {
|
||||
var $ajaxLoading = $scope.next('.ajaxLoading').show();
|
||||
var data = { Scope: $scope.val() };
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DocumentTemplate.UpdateScope(Model.DocumentTemplate.Id))',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
scopeChange();
|
||||
} else {
|
||||
$ajaxLoading.hide();
|
||||
alert('Unable to update scope: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update scope: ' + textStatus);
|
||||
$ajaxLoading.hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var $trJobTypes = $('#trJobTypes');
|
||||
var $trJobTypeActions = $('#trJobTypeActions');
|
||||
var $jobTypes = $trJobTypes.find('input[type="checkbox"]');
|
||||
$jobTypes.change(jobTypesChange);
|
||||
|
||||
function scopeChange() {
|
||||
if ($scope.val() == 'Job') {
|
||||
$trJobTypes.show();
|
||||
$trJobTypeActions.show();
|
||||
jobTypesChange();
|
||||
} else {
|
||||
$trJobTypes.hide();
|
||||
$trJobTypeActions.hide();
|
||||
$jobTypes.filter(':checked').each(function () {
|
||||
$(this).prop('checked', false);
|
||||
});
|
||||
$('.jobSubTypes').hide().find('input[type="checkbox"]:checked').each(function () {
|
||||
$(this).prop('checked', false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function jobTypesChange() {
|
||||
$('.jobSubTypes').hide();
|
||||
$jobTypes.filter(':checked').each(function () {
|
||||
$('#trJobSubType' + $(this).val()).show();
|
||||
});
|
||||
}
|
||||
|
||||
$('#TypeAction_Save').click(function () {
|
||||
var data = { SubTypes: [] };
|
||||
var $ajaxLoading = $('#TypeAction_Save').next('.ajaxLoading').show();
|
||||
|
||||
$jobTypes.filter(':checked').each(function () {
|
||||
var $this = $(this);
|
||||
$('#trJobSubType' + $this.val()).find('input[type="checkbox"]:checked').each(function () {
|
||||
data.SubTypes.push($(this).val());
|
||||
});
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DocumentTemplate.UpdateSubTypes(Model.DocumentTemplate.Id))',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
traditional: true,
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
scopeChange();
|
||||
} else {
|
||||
$ajaxLoading.hide();
|
||||
alert('Unable to update job types: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update job types: ' + textStatus);
|
||||
$ajaxLoading.hide();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
scopeChange();
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="trJobTypes">
|
||||
<th class="name">
|
||||
Types:
|
||||
</th>
|
||||
<td class="value">
|
||||
@CommonHelpers.CheckBoxList("Types", Model.JobTypes.ToSelectListItems(Model.Types), 2)
|
||||
</td>
|
||||
</tr>
|
||||
@foreach (var jt in Model.JobTypes)
|
||||
{
|
||||
<tr id="trJobSubType@(jt.Id)" class="jobSubTypes">
|
||||
<th class="name">
|
||||
@jt.Description<br />
|
||||
Sub Types<br />
|
||||
@CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id))
|
||||
</th>
|
||||
<td class="value">
|
||||
@CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.Where(jst => jst.JobTypeId == jt.Id).ToList().ToSelectListItems(Model.SubTypes), 2)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<tr id="trJobTypeActions">
|
||||
<th class="name">
|
||||
</th>
|
||||
<td class="value">
|
||||
<a id="TypeAction_Save" href="#" class="button">Save Job Types</a>@AjaxHelpers.AjaxLoader()
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Template PDF
|
||||
</th>
|
||||
<td>
|
||||
@Html.ActionLink("Download Template", MVC.API.DocumentTemplate.Template(Model.DocumentTemplate.Id))
|
||||
<br />
|
||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.Template(Model.DocumentTemplate.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
|
||||
{
|
||||
<input type="file" name="Template" id="Template" style="width: 250px;" />
|
||||
<input class="button" type="submit" value="Upload" />
|
||||
}
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $template = $('#Template');
|
||||
$template.closest('form').submit(function () {
|
||||
if ($template.val() == '') {
|
||||
alert('A template file is required to upload.');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Filter Expression:
|
||||
</th>
|
||||
<td>@Html.TextBoxFor(model => model.DocumentTemplate.FilterExpression)
|
||||
@AjaxHelpers.AjaxRemove()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $FilterExpression = $('#DocumentTemplate_FilterExpression');
|
||||
var $ajaxLoading = $FilterExpression.nextAll('.ajaxLoading').first();
|
||||
var $ajaxRemove = $FilterExpression.nextAll('.ajaxRemove').first();
|
||||
$FilterExpression
|
||||
.watermark('Filter Expression')
|
||||
.focus(function () { $FilterExpression.select() })
|
||||
.keydown(function (e) {
|
||||
if (e.which == 13) {
|
||||
$(this).blur();
|
||||
}
|
||||
}).change(function () {
|
||||
updateFilterExpression($FilterExpression.val());
|
||||
});
|
||||
if ($FilterExpression.val() != '')
|
||||
$ajaxRemove.show();
|
||||
$ajaxRemove.click(function () {
|
||||
updateFilterExpression('');
|
||||
$FilterExpression.val('');
|
||||
});
|
||||
var updateFilterExpression = function (filterExpression) {
|
||||
$ajaxLoading.show();
|
||||
$ajaxRemove.hide();
|
||||
var data = { FilterExpression: filterExpression };
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DocumentTemplate.UpdateFilterExpression(Model.DocumentTemplate.Id))',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
if (data.FilterExpression != '')
|
||||
$ajaxRemove.fadeIn('fast');
|
||||
} else {
|
||||
$ajaxLoading.hide();
|
||||
alert('Unable to update filter expression: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update filter expression: ' + textStatus);
|
||||
$ajaxLoading.hide();
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Bulk Generate
|
||||
</th>
|
||||
<td>
|
||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id), FormMethod.Post))
|
||||
{
|
||||
<textarea name="DataIds"></textarea>
|
||||
<input class="button" type="submit" value="Generate" />
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<h2>
|
||||
Template Expressions</h2>
|
||||
@Html.Partial(MVC.Config.DocumentTemplate.Views._ExpressionsTable, Model.TemplateExpressions)
|
||||
<div id="dialogConfirmDelete" title="Delete this Document Template?">
|
||||
<p>
|
||||
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 100px 0;">
|
||||
</span>This item will be permanently deleted and cannot be recovered.<br />
|
||||
<em>This <strong>will not delete attachments</strong> which have already been imported,
|
||||
but any generated documents will no longer be automatically imported.</em><br />
|
||||
Are you sure?</p>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var button = $('#buttonDelete');
|
||||
var buttonDialog = $("#dialogConfirmDelete");
|
||||
var buttonLink = button.attr('href');
|
||||
button.attr('href', '#');
|
||||
button.click(function () {
|
||||
buttonDialog.dialog('open');
|
||||
return false;
|
||||
});
|
||||
buttonDialog.dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
buttons: {
|
||||
"Delete": function () {
|
||||
$this = $(this);
|
||||
$this.dialog('disable');
|
||||
$this.dialog("option", "buttons", null);
|
||||
window.location.href = buttonLink;
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<div class="actionBar">
|
||||
@Html.ActionLinkButton("Expression Browser", MVC.Config.DocumentTemplate.ExpressionBrowser())
|
||||
@Html.ActionLinkButton("Delete", MVC.API.DocumentTemplate.Delete(Model.DocumentTemplate.Id, true), "buttonDelete")
|
||||
</div>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,370 +1,370 @@
|
||||
@{
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Enrolment", MVC.Config.Enrolment.Index(), "Status");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-Isotope");
|
||||
}
|
||||
<div id="enrolStatus">
|
||||
<div id="noSessions" data-bind="visible: noSessions">
|
||||
<h2>
|
||||
No enrolment sessions today</h2>
|
||||
</div>
|
||||
<div id="sessions" data-bind="visible: !noSessions(), foreach: {data: sessions, afterRender: sessionRendered, afterAdd: sessionAdded}"
|
||||
style="display: none">
|
||||
<div class="session" data-bind="style: {backgroundImage: deviceModelImageUrl}, click: select">
|
||||
<h3>
|
||||
<span data-bind="text: title"></span><span class="details" data-bind="text: '(' + deviceModelDescription() + ')'">
|
||||
</span>
|
||||
</h3>
|
||||
<p class="sessionStart" data-bind="text: startTime">
|
||||
</p>
|
||||
<p class="sessionStatus" data-bind="text: progressStatus">
|
||||
</p>
|
||||
<div data-bind="visible: !sessionEnded(), progressValue: progressValue" class="sessionProgress">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="dialogSession" data-bind="with: currentSession">
|
||||
<div class="sessionHeader clearfix" data-bind="style: {backgroundImage: deviceModelImageUrl}">
|
||||
<h2>
|
||||
<a href="" target="_blank" data-bind="text: title, attr: {href: deviceUrl}"></a>
|
||||
</h2>
|
||||
<h3 data-bind="text: deviceModelDescription">
|
||||
</h3>
|
||||
<table data-bind="if: sessionDeviceInfo">
|
||||
<tr>
|
||||
<th style="width: 128px">
|
||||
Computer Name:
|
||||
</th>
|
||||
<td data-bind="text: sessionDeviceInfo().Arguments[3]">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 128px">
|
||||
UUID:
|
||||
</th>
|
||||
<td data-bind="text: sessionDeviceInfo().Arguments[2]">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 128px">
|
||||
LAN Mac Address:
|
||||
</th>
|
||||
<td data-bind="text: sessionDeviceInfo().Arguments[4]">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 128px">
|
||||
WLAN Mac Address:
|
||||
</th>
|
||||
<td data-bind="text: sessionDeviceInfo().Arguments[5]">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 128px">
|
||||
Manufacturer/Model:
|
||||
</th>
|
||||
<td data-bind="text: sessionDeviceInfo().Arguments[6] + ' ' + sessionDeviceInfo().Arguments[7]">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="sessionProgress clearfix">
|
||||
<p class="sessionStart" data-bind="text: startTime">
|
||||
</p>
|
||||
<p class="sessionStatus" data-bind="text: progressStatus">
|
||||
</p>
|
||||
<div data-bind="visible: !sessionEnded(), progressValue: progressValue">
|
||||
</div>
|
||||
</div>
|
||||
<div class="sessionInfoContainer clearfix">
|
||||
<div class="sessionInfoMessages">
|
||||
<table class="logEventsViewport">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="icon">
|
||||
|
||||
</th>
|
||||
<th class="message">
|
||||
Message
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div class="logEventsViewportContainer">
|
||||
<div class="logEventsViewportNoLogs" data-bind="visible: messages().length == 0"
|
||||
style="display: none">
|
||||
No logs
|
||||
</div>
|
||||
<table class="logEventsViewport" data-bind="visible: messages().length > 0" style="display: none">
|
||||
<tbody data-bind="foreach: messages">
|
||||
<tr>
|
||||
<td class="icon" data-bind="attr: {title: FormattedTimestamp}, css: {information: EventTypeSeverity == 0, warning: EventTypeSeverity == 1, error: EventTypeSeverity == 2}">
|
||||
|
||||
</td>
|
||||
<td class="message" data-bind="text: FormattedMessage, attr: {title: EventTypeName}">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sessionInfoConsole" data-bind="foreach: console">
|
||||
<span data-bind="text: Arguments[1]"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
ko.bindingHandlers.progressValue = {
|
||||
update: function (element, valueAccessor, allBindingsAccessor, viewModel) {
|
||||
var v = ko.utils.unwrapObservable(valueAccessor());
|
||||
var vInt = parseInt(v);
|
||||
if (vInt >= 0) {
|
||||
$element = $(element);
|
||||
if (!$element.is('.ui-progressbar'))
|
||||
$element.progressbar();
|
||||
$(element).progressbar('option', 'value', vInt);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var vm;
|
||||
var host = $('#enrolStatus');
|
||||
var hostSessions = $('#sessions');
|
||||
var hostDialogSessions = $('#dialogSession');
|
||||
//var hostDialogSessionsProgress = $('#dialogSession').find('.sessionProgress');
|
||||
var deviceModels = {};
|
||||
var liveConnection;
|
||||
var deviceBaseUrl = '@(Url.Action(MVC.Device.Show()))/'
|
||||
var deviceModelImageUrl = '@(Url.Action(MVC.API.DeviceModel.Image()))/'
|
||||
var iconWarningUrl = 'url(@(Links.ClientSource.Style.Images.Status.warning32_png))';
|
||||
var iconErrorUrl = 'url(@(Links.ClientSource.Style.Images.Status.fail32_png))';
|
||||
|
||||
function pageViewModel() {
|
||||
var self = this;
|
||||
|
||||
self.noSessions = ko.observable(true);
|
||||
self.sessions = ko.observableArray();
|
||||
self.sessionIndex = {};
|
||||
|
||||
self.isotopeInited = false;
|
||||
|
||||
self.currentSession = ko.observable();
|
||||
|
||||
self.sessionRendered = function (e, d) {
|
||||
if (!d.sessionEnded()) {
|
||||
d.progressbar = $(e).find('.sessionProgress').progressbar();
|
||||
}
|
||||
};
|
||||
self.sessionAdded = function (e, d) {
|
||||
if (self.isotopeInited) {
|
||||
hostSessions.isotope('reloadItems').isotope({ sortBy: 'original-order' });
|
||||
}
|
||||
};
|
||||
}
|
||||
function sessionViewModel(id) {
|
||||
var self = this;
|
||||
|
||||
self.title = ko.observable(id);
|
||||
self.messages = ko.observableArray();
|
||||
self.console = ko.observableArray();
|
||||
self.serialNumber = ko.observable();
|
||||
self.sessionDeviceInfo = ko.observable();
|
||||
self.progressStatus = ko.observable();
|
||||
self.progressValue = ko.observable();
|
||||
self.startTime = ko.observable();
|
||||
self.sessionEnded = ko.observable(false);
|
||||
self.progressbar = null;
|
||||
self.hasError = ko.observable(false);
|
||||
self.hasWarning = ko.observable(false);
|
||||
self.deviceModelId = ko.observable();
|
||||
self.deviceModelDescription = ko.computed(function () {
|
||||
var deviceModelId = self.deviceModelId();
|
||||
var sessionDeviceInfo = self.sessionDeviceInfo();
|
||||
if (deviceModelId) {
|
||||
var dm = deviceModels[deviceModelId];
|
||||
if (dm) {
|
||||
if (dm.Description)
|
||||
return dm.Description;
|
||||
else
|
||||
return dm.Manufacturer + ' ' + dm.Model;
|
||||
}
|
||||
}
|
||||
if (sessionDeviceInfo) {
|
||||
return sessionDeviceInfo.Arguments[6] + ' ' + sessionDeviceInfo.Arguments[7];
|
||||
}
|
||||
});
|
||||
self.deviceUrl = ko.computed(function () {
|
||||
var serialNumber = self.serialNumber();
|
||||
if (serialNumber)
|
||||
return deviceBaseUrl + serialNumber;
|
||||
else
|
||||
return null;
|
||||
});
|
||||
self.deviceModelImageUrl = ko.computed(function () {
|
||||
var deviceModelImage;
|
||||
if (self.deviceModelId())
|
||||
deviceModelImage = 'url(' + deviceModelImageUrl + self.deviceModelId() + ')';
|
||||
else
|
||||
deviceModelImage = 'url(' + deviceModelImageUrl + ')';
|
||||
if (self.hasError())
|
||||
return iconErrorUrl + ', ' + deviceModelImage;
|
||||
else
|
||||
if (self.hasWarning())
|
||||
return iconWarningUrl + ', ' + deviceModelImage;
|
||||
else
|
||||
return 'none, ' + deviceModelImage;
|
||||
});
|
||||
self.select = function (e, d) {
|
||||
vm.currentSession(self);
|
||||
hostDialogSessions.dialog('open');
|
||||
hostDialogSessions.dialog('option', 'title', 'Device Enrolment: ' + self.title());
|
||||
}
|
||||
}
|
||||
|
||||
function parseLog(log) {
|
||||
if (log.ModuleId === 50 && log.Arguments && log.Arguments.length > 0) {
|
||||
// find session
|
||||
var sessionId = log.Arguments[0];
|
||||
var session = vm.sessionIndex[sessionId];
|
||||
if (!session && log.EventTypeId === 10) { // Starting Session (Ignore 'partial' sessions)
|
||||
session = new sessionViewModel(sessionId);
|
||||
vm.sessionIndex[sessionId] = session;
|
||||
vm.sessions.unshift(session);
|
||||
vm.noSessions(false);
|
||||
}
|
||||
if (session) {
|
||||
switch (log.EventTypeId) {
|
||||
case 10: // SessionStarting
|
||||
session.title(log.Arguments[1]);
|
||||
session.startTime(log.FormattedTimestamp.substring(log.FormattedTimestamp.indexOf(' ') + 1));
|
||||
session.messages.unshift(log);
|
||||
break;
|
||||
case 11: // SessionProgress
|
||||
//session.progressbar.progressbar('option', 'value', log.Arguments[1]);
|
||||
session.progressValue(log.Arguments[1]);
|
||||
session.progressStatus(log.Arguments[2]);
|
||||
break;
|
||||
case 12: // SessionDevice
|
||||
session.title(log.Arguments[1]);
|
||||
session.serialNumber(log.Arguments[1]);
|
||||
if (log.Arguments.length >= 3 && log.Arguments[2])
|
||||
session.deviceModelId(log.Arguments[2]);
|
||||
break;
|
||||
break;
|
||||
case 13: // SessionDeviceInfo
|
||||
session.title(log.Arguments[1]);
|
||||
session.serialNumber(log.Arguments[1]);
|
||||
session.sessionDeviceInfo(log);
|
||||
if (log.Arguments.length >= 10 && log.Arguments[9])
|
||||
session.deviceModelId(log.Arguments[9]);
|
||||
break;
|
||||
case 20: // SessionFinished
|
||||
session.sessionEnded(true);
|
||||
if (session.hasError())
|
||||
session.progressStatus('Enrolment Finished with an Error');
|
||||
else
|
||||
if (session.hasWarning())
|
||||
session.progressStatus('Enrolment Finished with a Warning');
|
||||
else
|
||||
session.progressStatus('Enrolment Finished Successfully');
|
||||
session.messages.unshift(log);
|
||||
break;
|
||||
case 21: // SessionDiagnosticInformation
|
||||
session.console.push(log);
|
||||
break;
|
||||
case 22: // SessionWarning
|
||||
session.hasWarning(true);
|
||||
session.messages.unshift(log);
|
||||
break;
|
||||
case 23: // SessionError
|
||||
case 24: // SessionErrorWithInner
|
||||
case 25: // SessionClientError
|
||||
session.hasError(true);
|
||||
session.messages.unshift(log);
|
||||
break;
|
||||
default:
|
||||
session.messages.unshift(log);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function init() {
|
||||
hostDialogSessions.dialog({
|
||||
modal: true,
|
||||
height: 664,
|
||||
width: 900,
|
||||
resizable: false,
|
||||
autoOpen: false,
|
||||
buttons: { 'Close': function () { $(this).dialog('close'); } }
|
||||
});
|
||||
//hostDialogSessionsProgress.progressbar();
|
||||
|
||||
// Create View Model
|
||||
vm = new pageViewModel();
|
||||
$.ajax({
|
||||
url: '@(Url.Action(MVC.API.DeviceModel.Index()))',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
success: init_loadedDeviceModels,
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to retrieve device models: ' + errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
function init_loadedDeviceModels(models) {
|
||||
for (var i = 0; i < models.length; i++) {
|
||||
var m = models[i];
|
||||
deviceModels[m.Id] = m;
|
||||
}
|
||||
|
||||
// Load Logs
|
||||
var d = new Date();
|
||||
var loadData = {
|
||||
Format: "json",
|
||||
Start: d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(),
|
||||
End: null,
|
||||
ModuleId: 50,
|
||||
Take: 2000
|
||||
};
|
||||
$.ajax({
|
||||
url: '@(Url.Action(MVC.API.Logging.RetrieveEvents()))',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
traditional: true,
|
||||
data: loadData,
|
||||
success: init_loadedLogs,
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to retrieve logs: ' + errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
function init_loadedLogs(logs) {
|
||||
logs.reverse();
|
||||
for (var i = 0; i < logs.length; i++) {
|
||||
parseLog(logs[i]);
|
||||
}
|
||||
// Bind
|
||||
ko.applyBindings(vm);
|
||||
|
||||
// Isotope
|
||||
hostSessions.isotope({
|
||||
itemSelector: '.session',
|
||||
layoutMode: 'fitRows'
|
||||
});
|
||||
vm.isotopeInited = true;
|
||||
|
||||
// Init Persistent Connection
|
||||
liveConnection = $.connection('@(Url.Content("~/API/Logging/Notifications"))');
|
||||
liveConnection.received(parseLog);
|
||||
liveConnection.error(function (e) { alert('Live-Log Error: ' + e) });
|
||||
liveConnection.start(function () {
|
||||
liveConnection.send('/addToGroups:@(Disco.BI.DeviceBI.EnrolmentLog.Current.LiveLogGroupName)');
|
||||
});
|
||||
}
|
||||
init();
|
||||
});
|
||||
</script>
|
||||
@{
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Enrolment", MVC.Config.Enrolment.Index(), "Status");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-Isotope");
|
||||
}
|
||||
<div id="enrolStatus">
|
||||
<div id="noSessions" data-bind="visible: noSessions">
|
||||
<h2>
|
||||
No enrolment sessions today</h2>
|
||||
</div>
|
||||
<div id="sessions" data-bind="visible: !noSessions(), foreach: {data: sessions, afterRender: sessionRendered, afterAdd: sessionAdded}"
|
||||
style="display: none">
|
||||
<div class="session" data-bind="style: {backgroundImage: deviceModelImageUrl}, click: select">
|
||||
<h3>
|
||||
<span data-bind="text: title"></span><span class="details" data-bind="text: '(' + deviceModelDescription() + ')'">
|
||||
</span>
|
||||
</h3>
|
||||
<p class="sessionStart" data-bind="text: startTime">
|
||||
</p>
|
||||
<p class="sessionStatus" data-bind="text: progressStatus">
|
||||
</p>
|
||||
<div data-bind="visible: !sessionEnded(), progressValue: progressValue" class="sessionProgress">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="dialogSession" data-bind="with: currentSession">
|
||||
<div class="sessionHeader clearfix" data-bind="style: {backgroundImage: deviceModelImageUrl}">
|
||||
<h2>
|
||||
<a href="" target="_blank" data-bind="text: title, attr: {href: deviceUrl}"></a>
|
||||
</h2>
|
||||
<h3 data-bind="text: deviceModelDescription">
|
||||
</h3>
|
||||
<table data-bind="if: sessionDeviceInfo">
|
||||
<tr>
|
||||
<th style="width: 128px">
|
||||
Computer Name:
|
||||
</th>
|
||||
<td data-bind="text: sessionDeviceInfo().Arguments[3]">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 128px">
|
||||
UUID:
|
||||
</th>
|
||||
<td data-bind="text: sessionDeviceInfo().Arguments[2]">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 128px">
|
||||
LAN Mac Address:
|
||||
</th>
|
||||
<td data-bind="text: sessionDeviceInfo().Arguments[4]">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 128px">
|
||||
WLAN Mac Address:
|
||||
</th>
|
||||
<td data-bind="text: sessionDeviceInfo().Arguments[5]">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 128px">
|
||||
Manufacturer/Model:
|
||||
</th>
|
||||
<td data-bind="text: sessionDeviceInfo().Arguments[6] + ' ' + sessionDeviceInfo().Arguments[7]">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="sessionProgress clearfix">
|
||||
<p class="sessionStart" data-bind="text: startTime">
|
||||
</p>
|
||||
<p class="sessionStatus" data-bind="text: progressStatus">
|
||||
</p>
|
||||
<div data-bind="visible: !sessionEnded(), progressValue: progressValue">
|
||||
</div>
|
||||
</div>
|
||||
<div class="sessionInfoContainer clearfix">
|
||||
<div class="sessionInfoMessages">
|
||||
<table class="logEventsViewport">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="icon">
|
||||
|
||||
</th>
|
||||
<th class="message">
|
||||
Message
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div class="logEventsViewportContainer">
|
||||
<div class="logEventsViewportNoLogs" data-bind="visible: messages().length == 0"
|
||||
style="display: none">
|
||||
No logs
|
||||
</div>
|
||||
<table class="logEventsViewport" data-bind="visible: messages().length > 0" style="display: none">
|
||||
<tbody data-bind="foreach: messages">
|
||||
<tr>
|
||||
<td class="icon" data-bind="attr: {title: FormattedTimestamp}, css: {information: EventTypeSeverity == 0, warning: EventTypeSeverity == 1, error: EventTypeSeverity == 2}">
|
||||
|
||||
</td>
|
||||
<td class="message" data-bind="text: FormattedMessage, attr: {title: EventTypeName}">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sessionInfoConsole" data-bind="foreach: console">
|
||||
<span data-bind="text: Arguments[1]"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
ko.bindingHandlers.progressValue = {
|
||||
update: function (element, valueAccessor, allBindingsAccessor, viewModel) {
|
||||
var v = ko.utils.unwrapObservable(valueAccessor());
|
||||
var vInt = parseInt(v);
|
||||
if (vInt >= 0) {
|
||||
$element = $(element);
|
||||
if (!$element.is('.ui-progressbar'))
|
||||
$element.progressbar();
|
||||
$(element).progressbar('option', 'value', vInt);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var vm;
|
||||
var host = $('#enrolStatus');
|
||||
var hostSessions = $('#sessions');
|
||||
var hostDialogSessions = $('#dialogSession');
|
||||
//var hostDialogSessionsProgress = $('#dialogSession').find('.sessionProgress');
|
||||
var deviceModels = {};
|
||||
var liveConnection;
|
||||
var deviceBaseUrl = '@(Url.Action(MVC.Device.Show()))/'
|
||||
var deviceModelImageUrl = '@(Url.Action(MVC.API.DeviceModel.Image()))/'
|
||||
var iconWarningUrl = 'url(@(Links.ClientSource.Style.Images.Status.warning32_png))';
|
||||
var iconErrorUrl = 'url(@(Links.ClientSource.Style.Images.Status.fail32_png))';
|
||||
|
||||
function pageViewModel() {
|
||||
var self = this;
|
||||
|
||||
self.noSessions = ko.observable(true);
|
||||
self.sessions = ko.observableArray();
|
||||
self.sessionIndex = {};
|
||||
|
||||
self.isotopeInited = false;
|
||||
|
||||
self.currentSession = ko.observable();
|
||||
|
||||
self.sessionRendered = function (e, d) {
|
||||
if (!d.sessionEnded()) {
|
||||
d.progressbar = $(e).find('.sessionProgress').progressbar();
|
||||
}
|
||||
};
|
||||
self.sessionAdded = function (e, d) {
|
||||
if (self.isotopeInited) {
|
||||
hostSessions.isotope('reloadItems').isotope({ sortBy: 'original-order' });
|
||||
}
|
||||
};
|
||||
}
|
||||
function sessionViewModel(id) {
|
||||
var self = this;
|
||||
|
||||
self.title = ko.observable(id);
|
||||
self.messages = ko.observableArray();
|
||||
self.console = ko.observableArray();
|
||||
self.serialNumber = ko.observable();
|
||||
self.sessionDeviceInfo = ko.observable();
|
||||
self.progressStatus = ko.observable();
|
||||
self.progressValue = ko.observable();
|
||||
self.startTime = ko.observable();
|
||||
self.sessionEnded = ko.observable(false);
|
||||
self.progressbar = null;
|
||||
self.hasError = ko.observable(false);
|
||||
self.hasWarning = ko.observable(false);
|
||||
self.deviceModelId = ko.observable();
|
||||
self.deviceModelDescription = ko.computed(function () {
|
||||
var deviceModelId = self.deviceModelId();
|
||||
var sessionDeviceInfo = self.sessionDeviceInfo();
|
||||
if (deviceModelId) {
|
||||
var dm = deviceModels[deviceModelId];
|
||||
if (dm) {
|
||||
if (dm.Description)
|
||||
return dm.Description;
|
||||
else
|
||||
return dm.Manufacturer + ' ' + dm.Model;
|
||||
}
|
||||
}
|
||||
if (sessionDeviceInfo) {
|
||||
return sessionDeviceInfo.Arguments[6] + ' ' + sessionDeviceInfo.Arguments[7];
|
||||
}
|
||||
});
|
||||
self.deviceUrl = ko.computed(function () {
|
||||
var serialNumber = self.serialNumber();
|
||||
if (serialNumber)
|
||||
return deviceBaseUrl + serialNumber;
|
||||
else
|
||||
return null;
|
||||
});
|
||||
self.deviceModelImageUrl = ko.computed(function () {
|
||||
var deviceModelImage;
|
||||
if (self.deviceModelId())
|
||||
deviceModelImage = 'url(' + deviceModelImageUrl + self.deviceModelId() + ')';
|
||||
else
|
||||
deviceModelImage = 'url(' + deviceModelImageUrl + ')';
|
||||
if (self.hasError())
|
||||
return iconErrorUrl + ', ' + deviceModelImage;
|
||||
else
|
||||
if (self.hasWarning())
|
||||
return iconWarningUrl + ', ' + deviceModelImage;
|
||||
else
|
||||
return 'none, ' + deviceModelImage;
|
||||
});
|
||||
self.select = function (e, d) {
|
||||
vm.currentSession(self);
|
||||
hostDialogSessions.dialog('open');
|
||||
hostDialogSessions.dialog('option', 'title', 'Device Enrolment: ' + self.title());
|
||||
}
|
||||
}
|
||||
|
||||
function parseLog(log) {
|
||||
if (log.ModuleId === 50 && log.Arguments && log.Arguments.length > 0) {
|
||||
// find session
|
||||
var sessionId = log.Arguments[0];
|
||||
var session = vm.sessionIndex[sessionId];
|
||||
if (!session && log.EventTypeId === 10) { // Starting Session (Ignore 'partial' sessions)
|
||||
session = new sessionViewModel(sessionId);
|
||||
vm.sessionIndex[sessionId] = session;
|
||||
vm.sessions.unshift(session);
|
||||
vm.noSessions(false);
|
||||
}
|
||||
if (session) {
|
||||
switch (log.EventTypeId) {
|
||||
case 10: // SessionStarting
|
||||
session.title(log.Arguments[1]);
|
||||
session.startTime(log.FormattedTimestamp.substring(log.FormattedTimestamp.indexOf(' ') + 1));
|
||||
session.messages.unshift(log);
|
||||
break;
|
||||
case 11: // SessionProgress
|
||||
//session.progressbar.progressbar('option', 'value', log.Arguments[1]);
|
||||
session.progressValue(log.Arguments[1]);
|
||||
session.progressStatus(log.Arguments[2]);
|
||||
break;
|
||||
case 12: // SessionDevice
|
||||
session.title(log.Arguments[1]);
|
||||
session.serialNumber(log.Arguments[1]);
|
||||
if (log.Arguments.length >= 3 && log.Arguments[2])
|
||||
session.deviceModelId(log.Arguments[2]);
|
||||
break;
|
||||
break;
|
||||
case 13: // SessionDeviceInfo
|
||||
session.title(log.Arguments[1]);
|
||||
session.serialNumber(log.Arguments[1]);
|
||||
session.sessionDeviceInfo(log);
|
||||
if (log.Arguments.length >= 10 && log.Arguments[9])
|
||||
session.deviceModelId(log.Arguments[9]);
|
||||
break;
|
||||
case 20: // SessionFinished
|
||||
session.sessionEnded(true);
|
||||
if (session.hasError())
|
||||
session.progressStatus('Enrolment Finished with an Error');
|
||||
else
|
||||
if (session.hasWarning())
|
||||
session.progressStatus('Enrolment Finished with a Warning');
|
||||
else
|
||||
session.progressStatus('Enrolment Finished Successfully');
|
||||
session.messages.unshift(log);
|
||||
break;
|
||||
case 21: // SessionDiagnosticInformation
|
||||
session.console.push(log);
|
||||
break;
|
||||
case 22: // SessionWarning
|
||||
session.hasWarning(true);
|
||||
session.messages.unshift(log);
|
||||
break;
|
||||
case 23: // SessionError
|
||||
case 24: // SessionErrorWithInner
|
||||
case 25: // SessionClientError
|
||||
session.hasError(true);
|
||||
session.messages.unshift(log);
|
||||
break;
|
||||
default:
|
||||
session.messages.unshift(log);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function init() {
|
||||
hostDialogSessions.dialog({
|
||||
modal: true,
|
||||
height: 664,
|
||||
width: 900,
|
||||
resizable: false,
|
||||
autoOpen: false,
|
||||
buttons: { 'Close': function () { $(this).dialog('close'); } }
|
||||
});
|
||||
//hostDialogSessionsProgress.progressbar();
|
||||
|
||||
// Create View Model
|
||||
vm = new pageViewModel();
|
||||
$.ajax({
|
||||
url: '@(Url.Action(MVC.API.DeviceModel.Index()))',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
success: init_loadedDeviceModels,
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to retrieve device models: ' + errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
function init_loadedDeviceModels(models) {
|
||||
for (var i = 0; i < models.length; i++) {
|
||||
var m = models[i];
|
||||
deviceModels[m.Id] = m;
|
||||
}
|
||||
|
||||
// Load Logs
|
||||
var d = new Date();
|
||||
var loadData = {
|
||||
Format: "json",
|
||||
Start: d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(),
|
||||
End: null,
|
||||
ModuleId: 50,
|
||||
Take: 2000
|
||||
};
|
||||
$.ajax({
|
||||
url: '@(Url.Action(MVC.API.Logging.RetrieveEvents()))',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
traditional: true,
|
||||
data: loadData,
|
||||
success: init_loadedLogs,
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to retrieve logs: ' + errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
function init_loadedLogs(logs) {
|
||||
logs.reverse();
|
||||
for (var i = 0; i < logs.length; i++) {
|
||||
parseLog(logs[i]);
|
||||
}
|
||||
// Bind
|
||||
ko.applyBindings(vm);
|
||||
|
||||
// Isotope
|
||||
hostSessions.isotope({
|
||||
itemSelector: '.session',
|
||||
layoutMode: 'fitRows'
|
||||
});
|
||||
vm.isotopeInited = true;
|
||||
|
||||
// Init Persistent Connection
|
||||
liveConnection = $.connection('@(Url.Content("~/API/Logging/Notifications"))');
|
||||
liveConnection.received(parseLog);
|
||||
liveConnection.error(function (e) { if (e.status != 200) alert('Live-Log Error: ' + e.statusText + ': ' + e.responseText); });
|
||||
liveConnection.start(function () {
|
||||
liveConnection.send('/addToGroups:@(Disco.BI.DeviceBI.EnrolmentLog.Current.LiveLogGroupName)');
|
||||
});
|
||||
}
|
||||
init();
|
||||
});
|
||||
</script>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,164 +1,164 @@
|
||||
@model Disco.Web.Areas.Config.Models.Logging.IndexModel
|
||||
@using Disco.Services.Logging
|
||||
@{
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Logging");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQueryUI-TimePicker");
|
||||
}
|
||||
@using (Html.BeginForm(MVC.API.Logging.RetrieveEvents()))
|
||||
{
|
||||
<div class="form" style="width: 520px;">
|
||||
<h2>
|
||||
Export Logs</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<th style="width: 105px;">
|
||||
Start Filter
|
||||
</th>
|
||||
<td>
|
||||
<input id="filterStart" type="text" name="Start" />
|
||||
<span class="smallMessage">* Optional</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
End Filter
|
||||
</th>
|
||||
<td>
|
||||
<input id="filterEnd" type="text" name="End" />
|
||||
<span class="smallMessage">* Optional</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Limit Filter
|
||||
</th>
|
||||
<td>
|
||||
<select name="Take">
|
||||
<option selected="selected" value="">- All Events -</option>
|
||||
<option value="1000">1,000 Events</option>
|
||||
<option value="500">500 Events</option>
|
||||
<option value="100">100 Events</option>
|
||||
<option value="50">50 Events</option>
|
||||
<option value="10">10 Events</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Module Filter
|
||||
</th>
|
||||
<td>
|
||||
<select id="moduleId" name="ModuleId">
|
||||
<option value="" selected="selected">- All Modules -</option>
|
||||
@foreach (var lm in Model.LogModules.Keys.OrderBy(lm => lm.ModuleDescription))
|
||||
{
|
||||
<option value="@lm.ModuleId">@lm.ModuleDescription</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="trLogModuleEventTypes" style="display: none">
|
||||
<th>
|
||||
Event Type Filter <span style="display: block;" class="checkboxBulkSelectContainer">
|
||||
Select: <a id="eventTypesSelectAll" href="#">ALL</a> | <a id="eventTypesSelectNone"
|
||||
href="#">NONE</a></span>
|
||||
</th>
|
||||
<td>
|
||||
@{int uniqueIdSeed = 0;
|
||||
}
|
||||
@foreach (var lm in Model.LogModules)
|
||||
{
|
||||
<div data-logmoduleid="@lm.Key.ModuleId" class="logModuleEventTypes">
|
||||
@CommonHelpers.CheckBoxList("EventTypeIds", lm.Value.ToSelectListItems(), 2, false, uniqueIdSeed)
|
||||
</div>
|
||||
uniqueIdSeed += lm.Value.Count;
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
</th>
|
||||
<td>
|
||||
@Html.Hidden("Format", "CSV")
|
||||
<input type="submit" class="button" value="Download CSV" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var filterStart = $('#filterStart').watermark('Start').datetimepicker({
|
||||
ampm: true,
|
||||
stepMinute: 1,
|
||||
changeYear: true,
|
||||
changeMonth: true,
|
||||
dateFormat: 'yy/mm/dd'
|
||||
});
|
||||
var filterEnd = $('#filterEnd').watermark('End').datetimepicker({
|
||||
ampm: true,
|
||||
stepMinute: 1,
|
||||
changeYear: true,
|
||||
changeMonth: true,
|
||||
dateFormat: 'yy/mm/dd'
|
||||
});
|
||||
var moduleId = $('#moduleId');
|
||||
var trLogModuleEventTypes = $('#trLogModuleEventTypes');
|
||||
var logModuleEventTypes = trLogModuleEventTypes.find('.logModuleEventTypes').hide();
|
||||
var logModuleEventTypeCheckboxes = logModuleEventTypes.find('input[type="checkbox"]');
|
||||
|
||||
moduleId.change(function () {
|
||||
// Unselect All
|
||||
logModuleEventTypes.slideUp();
|
||||
logModuleEventTypeCheckboxes.filter(':checked').attr('checked', false);
|
||||
var selectedModule = moduleId.val();
|
||||
if (selectedModule) {
|
||||
trLogModuleEventTypes.show();
|
||||
var selectedModuleEventTypes = logModuleEventTypes.filter('[data-logmoduleid="' + selectedModule + '"]');
|
||||
if (selectedModuleEventTypes.length > 0) {
|
||||
var selectedModuleEventTypeCheckboxes = selectedModuleEventTypes.find('input[type="checkbox"]');
|
||||
selectedModuleEventTypeCheckboxes.attr('checked', true);
|
||||
trLogModuleEventTypes.show();
|
||||
selectedModuleEventTypes.slideDown();
|
||||
} else {
|
||||
trLogModuleEventTypes.hide();
|
||||
}
|
||||
} else {
|
||||
trLogModuleEventTypes.hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#eventTypesSelectAll').click(function () {
|
||||
var selectedModule = moduleId.val();
|
||||
if (selectedModule) {
|
||||
var selectedModuleEventTypes = logModuleEventTypes.filter('[data-logmoduleid="' + selectedModule + '"]');
|
||||
if (selectedModuleEventTypes.length > 0) {
|
||||
var selectedModuleEventTypeCheckboxes = selectedModuleEventTypes.find('input[type="checkbox"]');
|
||||
selectedModuleEventTypeCheckboxes.attr('checked', true);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$('#eventTypesSelectNone').click(function () {
|
||||
var selectedModule = moduleId.val();
|
||||
if (selectedModule) {
|
||||
var selectedModuleEventTypes = logModuleEventTypes.filter('[data-logmoduleid="' + selectedModule + '"]');
|
||||
if (selectedModuleEventTypes.length > 0) {
|
||||
var selectedModuleEventTypeCheckboxes = selectedModuleEventTypes.find('input[type="checkbox"]');
|
||||
selectedModuleEventTypeCheckboxes.attr('checked', false);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
}
|
||||
<h2>
|
||||
Live Logging</h2>
|
||||
@Html.Partial(MVC.Config.Shared.Views.LogEvents, new Disco.Web.Areas.Config.Models.Shared.LogEventsModel()
|
||||
{
|
||||
IsLive = true,
|
||||
TakeFilter = 100,
|
||||
StartFilter = DateTime.Today.AddDays(-1),
|
||||
ViewPortHeight = 450
|
||||
})
|
||||
@model Disco.Web.Areas.Config.Models.Logging.IndexModel
|
||||
@using Disco.Services.Logging
|
||||
@{
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Logging");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQueryUI-TimePicker");
|
||||
}
|
||||
@using (Html.BeginForm(MVC.API.Logging.RetrieveEvents()))
|
||||
{
|
||||
<div class="form" style="width: 520px;">
|
||||
<h2>
|
||||
Export Logs</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<th style="width: 105px;">
|
||||
Start Filter
|
||||
</th>
|
||||
<td>
|
||||
<input id="filterStart" type="text" name="Start" />
|
||||
<span class="smallMessage">* Optional</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
End Filter
|
||||
</th>
|
||||
<td>
|
||||
<input id="filterEnd" type="text" name="End" />
|
||||
<span class="smallMessage">* Optional</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Limit Filter
|
||||
</th>
|
||||
<td>
|
||||
<select name="Take">
|
||||
<option selected="selected" value="">- All Events -</option>
|
||||
<option value="1000">1,000 Events</option>
|
||||
<option value="500">500 Events</option>
|
||||
<option value="100">100 Events</option>
|
||||
<option value="50">50 Events</option>
|
||||
<option value="10">10 Events</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Module Filter
|
||||
</th>
|
||||
<td>
|
||||
<select id="moduleId" name="ModuleId">
|
||||
<option value="" selected="selected">- All Modules -</option>
|
||||
@foreach (var lm in Model.LogModules.Keys.OrderBy(lm => lm.ModuleDescription))
|
||||
{
|
||||
<option value="@lm.ModuleId">@lm.ModuleDescription</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="trLogModuleEventTypes" style="display: none">
|
||||
<th>
|
||||
Event Type Filter <span style="display: block;" class="checkboxBulkSelectContainer">
|
||||
Select: <a id="eventTypesSelectAll" href="#">ALL</a> | <a id="eventTypesSelectNone"
|
||||
href="#">NONE</a></span>
|
||||
</th>
|
||||
<td>
|
||||
@{int uniqueIdSeed = 0;
|
||||
}
|
||||
@foreach (var lm in Model.LogModules)
|
||||
{
|
||||
<div data-logmoduleid="@lm.Key.ModuleId" class="logModuleEventTypes">
|
||||
@CommonHelpers.CheckBoxList("EventTypeIds", lm.Value.ToSelectListItems(), 2, false, uniqueIdSeed)
|
||||
</div>
|
||||
uniqueIdSeed += lm.Value.Count;
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
</th>
|
||||
<td>
|
||||
@Html.Hidden("Format", "CSV")
|
||||
<input type="submit" class="button" value="Download CSV" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var filterStart = $('#filterStart').watermark('Start').datetimepicker({
|
||||
ampm: true,
|
||||
stepMinute: 1,
|
||||
changeYear: true,
|
||||
changeMonth: true,
|
||||
dateFormat: 'yy/mm/dd'
|
||||
});
|
||||
var filterEnd = $('#filterEnd').watermark('End').datetimepicker({
|
||||
ampm: true,
|
||||
stepMinute: 1,
|
||||
changeYear: true,
|
||||
changeMonth: true,
|
||||
dateFormat: 'yy/mm/dd'
|
||||
});
|
||||
var moduleId = $('#moduleId');
|
||||
var trLogModuleEventTypes = $('#trLogModuleEventTypes');
|
||||
var logModuleEventTypes = trLogModuleEventTypes.find('.logModuleEventTypes').hide();
|
||||
var logModuleEventTypeCheckboxes = logModuleEventTypes.find('input[type="checkbox"]');
|
||||
|
||||
moduleId.change(function () {
|
||||
// Unselect All
|
||||
logModuleEventTypes.slideUp();
|
||||
logModuleEventTypeCheckboxes.filter(':checked').prop('checked', false);
|
||||
var selectedModule = moduleId.val();
|
||||
if (selectedModule) {
|
||||
trLogModuleEventTypes.show();
|
||||
var selectedModuleEventTypes = logModuleEventTypes.filter('[data-logmoduleid="' + selectedModule + '"]');
|
||||
if (selectedModuleEventTypes.length > 0) {
|
||||
var selectedModuleEventTypeCheckboxes = selectedModuleEventTypes.find('input[type="checkbox"]');
|
||||
selectedModuleEventTypeCheckboxes.prop('checked', true);
|
||||
trLogModuleEventTypes.show();
|
||||
selectedModuleEventTypes.slideDown();
|
||||
} else {
|
||||
trLogModuleEventTypes.hide();
|
||||
}
|
||||
} else {
|
||||
trLogModuleEventTypes.hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#eventTypesSelectAll').click(function () {
|
||||
var selectedModule = moduleId.val();
|
||||
if (selectedModule) {
|
||||
var selectedModuleEventTypes = logModuleEventTypes.filter('[data-logmoduleid="' + selectedModule + '"]');
|
||||
if (selectedModuleEventTypes.length > 0) {
|
||||
var selectedModuleEventTypeCheckboxes = selectedModuleEventTypes.find('input[type="checkbox"]');
|
||||
selectedModuleEventTypeCheckboxes.prop('checked', true);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$('#eventTypesSelectNone').click(function () {
|
||||
var selectedModule = moduleId.val();
|
||||
if (selectedModule) {
|
||||
var selectedModuleEventTypes = logModuleEventTypes.filter('[data-logmoduleid="' + selectedModule + '"]');
|
||||
if (selectedModuleEventTypes.length > 0) {
|
||||
var selectedModuleEventTypeCheckboxes = selectedModuleEventTypes.find('input[type="checkbox"]');
|
||||
selectedModuleEventTypeCheckboxes.prop('checked', false);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
}
|
||||
<h2>
|
||||
Live Logging</h2>
|
||||
@Html.Partial(MVC.Config.Shared.Views.LogEvents, new Disco.Web.Areas.Config.Models.Shared.LogEventsModel()
|
||||
{
|
||||
IsLive = true,
|
||||
TakeFilter = 100,
|
||||
StartFilter = DateTime.Today.AddDays(-1),
|
||||
ViewPortHeight = 450
|
||||
})
|
||||
|
||||
@@ -1,388 +1,388 @@
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.17929
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Disco.Web.Areas.Config.Views.Logging
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Helpers;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Ajax;
|
||||
using System.Web.Mvc.Html;
|
||||
using System.Web.Routing;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.WebPages;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
|
||||
#line 2 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
using Disco.Services.Logging;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/Logging/Index.cshtml")]
|
||||
public class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.Logging.IndexModel>
|
||||
{
|
||||
public Index()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
|
||||
#line 3 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Logging");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQueryUI-TimePicker");
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 7 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
using (Html.BeginForm(MVC.API.Logging.RetrieveEvents()))
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <div");
|
||||
|
||||
WriteLiteral(" class=\"form\"");
|
||||
|
||||
WriteLiteral(" style=\"width: 520px;\"");
|
||||
|
||||
WriteLiteral(">\r\n <h2>\r\n Export Logs</h2>\r\n <table>\r\n <tr>\r" +
|
||||
"\n <th");
|
||||
|
||||
WriteLiteral(" style=\"width: 105px;\"");
|
||||
|
||||
WriteLiteral(">\r\n Start Filter\r\n </th>\r\n <td>\r" +
|
||||
"\n <input");
|
||||
|
||||
WriteLiteral(" id=\"filterStart\"");
|
||||
|
||||
WriteLiteral(" type=\"text\"");
|
||||
|
||||
WriteLiteral(" name=\"Start\"");
|
||||
|
||||
WriteLiteral(" />\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"smallMessage\"");
|
||||
|
||||
WriteLiteral(">* Optional</span>\r\n </td>\r\n </tr>\r\n <tr>\r\n " +
|
||||
" <th>\r\n End Filter\r\n </th>\r\n " +
|
||||
" <td>\r\n <input");
|
||||
|
||||
WriteLiteral(" id=\"filterEnd\"");
|
||||
|
||||
WriteLiteral(" type=\"text\"");
|
||||
|
||||
WriteLiteral(" name=\"End\"");
|
||||
|
||||
WriteLiteral(" />\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"smallMessage\"");
|
||||
|
||||
WriteLiteral(">* Optional</span>\r\n </td>\r\n </tr>\r\n <tr>\r\n " +
|
||||
" <th>\r\n Limit Filter\r\n </th>\r\n " +
|
||||
" <td>\r\n <select");
|
||||
|
||||
WriteLiteral(" name=\"Take\"");
|
||||
|
||||
WriteLiteral(">\r\n <option");
|
||||
|
||||
WriteLiteral(" selected=\"selected\"");
|
||||
|
||||
WriteLiteral(" value=\"\"");
|
||||
|
||||
WriteLiteral(">- All Events -</option>\r\n <option");
|
||||
|
||||
WriteLiteral(" value=\"1000\"");
|
||||
|
||||
WriteLiteral(">1,000 Events</option>\r\n <option");
|
||||
|
||||
WriteLiteral(" value=\"500\"");
|
||||
|
||||
WriteLiteral(">500 Events</option>\r\n <option");
|
||||
|
||||
WriteLiteral(" value=\"100\"");
|
||||
|
||||
WriteLiteral(">100 Events</option>\r\n <option");
|
||||
|
||||
WriteLiteral(" value=\"50\"");
|
||||
|
||||
WriteLiteral(">50 Events</option>\r\n <option");
|
||||
|
||||
WriteLiteral(" value=\"10\"");
|
||||
|
||||
WriteLiteral(">10 Events</option>\r\n </select>\r\n </td>\r\n " +
|
||||
" </tr>\r\n <tr>\r\n <th>\r\n Module " +
|
||||
"Filter\r\n </th>\r\n <td>\r\n <select" +
|
||||
"");
|
||||
|
||||
WriteLiteral(" id=\"moduleId\"");
|
||||
|
||||
WriteLiteral(" name=\"ModuleId\"");
|
||||
|
||||
WriteLiteral(">\r\n <option");
|
||||
|
||||
WriteLiteral(" value=\"\"");
|
||||
|
||||
WriteLiteral(" selected=\"selected\"");
|
||||
|
||||
WriteLiteral(">- All Modules -</option>\r\n");
|
||||
|
||||
|
||||
#line 53 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 53 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
foreach (var lm in Model.LogModules.Keys.OrderBy(lm => lm.ModuleDescription))
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <option");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 2126), Tuple.Create("\"", 2146)
|
||||
|
||||
#line 55 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 2134), Tuple.Create<System.Object, System.Int32>(lm.ModuleId
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 2134), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">");
|
||||
|
||||
|
||||
#line 55 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
Write(lm.ModuleDescription);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</option> \r\n");
|
||||
|
||||
|
||||
#line 56 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </select>\r\n </td>\r\n </tr>\r\n " +
|
||||
" <tr");
|
||||
|
||||
WriteLiteral(" id=\"trLogModuleEventTypes\"");
|
||||
|
||||
WriteLiteral(" style=\"display: none\"");
|
||||
|
||||
WriteLiteral(">\r\n <th>\r\n Event Type Filter <span");
|
||||
|
||||
WriteLiteral(" style=\"display: block;\"");
|
||||
|
||||
WriteLiteral(" class=\"checkboxBulkSelectContainer\"");
|
||||
|
||||
WriteLiteral(">\r\n Select: <a");
|
||||
|
||||
WriteLiteral(" id=\"eventTypesSelectAll\"");
|
||||
|
||||
WriteLiteral(" href=\"#\"");
|
||||
|
||||
WriteLiteral(">ALL</a> | <a");
|
||||
|
||||
WriteLiteral(" id=\"eventTypesSelectNone\"");
|
||||
|
||||
WriteLiteral("\r\n href=\"#\"");
|
||||
|
||||
WriteLiteral(">NONE</a></span>\r\n </th>\r\n <td>\r\n");
|
||||
|
||||
|
||||
#line 67 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 67 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
int uniqueIdSeed = 0;
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 69 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 69 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
foreach (var lm in Model.LogModules)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <div");
|
||||
|
||||
WriteLiteral(" data-logmoduleid=\"");
|
||||
|
||||
|
||||
#line 71 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
Write(lm.Key.ModuleId);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(" class=\"logModuleEventTypes\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 72 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
Write(CommonHelpers.CheckBoxList("EventTypeIds", lm.Value.ToSelectListItems(), 2, false, uniqueIdSeed));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </div>\r\n");
|
||||
|
||||
|
||||
#line 74 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
uniqueIdSeed += lm.Value.Count;
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th>\r" +
|
||||
"\n </th>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 82 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
Write(Html.Hidden("Format", "CSV"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"submit\"");
|
||||
|
||||
WriteLiteral(" class=\"button\"");
|
||||
|
||||
WriteLiteral(" value=\"Download CSV\"");
|
||||
|
||||
WriteLiteral(" />\r\n </td>\r\n </tr>\r\n </table>\r\n <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(">\r\n $(function () {\r\n var filterStart = $(\'#filterStart" +
|
||||
"\').watermark(\'Start\').datetimepicker({\r\n ampm: true,\r\n " +
|
||||
" stepMinute: 1,\r\n changeYear: true,\r\n " +
|
||||
" changeMonth: true,\r\n dateFormat: \'yy/mm/dd\'\r\n " +
|
||||
" });\r\n var filterEnd = $(\'#filterEnd\').watermark(\'End\').da" +
|
||||
"tetimepicker({\r\n ampm: true,\r\n stepMinute:" +
|
||||
" 1,\r\n changeYear: true,\r\n changeMonth: tru" +
|
||||
"e,\r\n dateFormat: \'yy/mm/dd\'\r\n });\r\n " +
|
||||
" var moduleId = $(\'#moduleId\');\r\n var trLogModuleEventTypes =" +
|
||||
" $(\'#trLogModuleEventTypes\');\r\n var logModuleEventTypes = trLogMo" +
|
||||
"duleEventTypes.find(\'.logModuleEventTypes\').hide();\r\n var logModu" +
|
||||
"leEventTypeCheckboxes = logModuleEventTypes.find(\'input[type=\"checkbox\"]\');\r\n\r\n " +
|
||||
" moduleId.change(function () {\r\n // Unselect Al" +
|
||||
"l\r\n logModuleEventTypes.slideUp();\r\n logMo" +
|
||||
"duleEventTypeCheckboxes.filter(\':checked\').attr(\'checked\', false);\r\n " +
|
||||
" var selectedModule = moduleId.val();\r\n if (selectedMo" +
|
||||
"dule) {\r\n trLogModuleEventTypes.show();\r\n " +
|
||||
" var selectedModuleEventTypes = logModuleEventTypes.filter(\'[data-logmodu" +
|
||||
"leid=\"\' + selectedModule + \'\"]\');\r\n if (selectedModuleEve" +
|
||||
"ntTypes.length > 0) {\r\n var selectedModuleEventTypeCh" +
|
||||
"eckboxes = selectedModuleEventTypes.find(\'input[type=\"checkbox\"]\');\r\n " +
|
||||
" selectedModuleEventTypeCheckboxes.attr(\'checked\', true);\r\n " +
|
||||
" trLogModuleEventTypes.show();\r\n " +
|
||||
" selectedModuleEventTypes.slideDown();\r\n } else {\r\n " +
|
||||
" trLogModuleEventTypes.hide();\r\n }\r" +
|
||||
"\n } else {\r\n trLogModuleEventTypes.hid" +
|
||||
"e();\r\n }\r\n });\r\n\r\n $(\'#eventTyp" +
|
||||
"esSelectAll\').click(function () {\r\n var selectedModule = modu" +
|
||||
"leId.val();\r\n if (selectedModule) {\r\n " +
|
||||
"var selectedModuleEventTypes = logModuleEventTypes.filter(\'[data-logmoduleid=\"\' " +
|
||||
"+ selectedModule + \'\"]\');\r\n if (selectedModuleEventTypes." +
|
||||
"length > 0) {\r\n var selectedModuleEventTypeCheckboxes" +
|
||||
" = selectedModuleEventTypes.find(\'input[type=\"checkbox\"]\');\r\n " +
|
||||
" selectedModuleEventTypeCheckboxes.attr(\'checked\', true);\r\n " +
|
||||
" }\r\n }\r\n return false;\r\n " +
|
||||
" });\r\n $(\'#eventTypesSelectNone\').click(function () {\r\n " +
|
||||
" var selectedModule = moduleId.val();\r\n if (s" +
|
||||
"electedModule) {\r\n var selectedModuleEventTypes = logModu" +
|
||||
"leEventTypes.filter(\'[data-logmoduleid=\"\' + selectedModule + \'\"]\');\r\n " +
|
||||
" if (selectedModuleEventTypes.length > 0) {\r\n " +
|
||||
" var selectedModuleEventTypeCheckboxes = selectedModuleEventTypes.find(\'inpu" +
|
||||
"t[type=\"checkbox\"]\');\r\n selectedModuleEventTypeCheckb" +
|
||||
"oxes.attr(\'checked\', false);\r\n }\r\n }\r\n" +
|
||||
" return false;\r\n });\r\n\r\n });\r\n " +
|
||||
" </script>\r\n </div>\r\n");
|
||||
|
||||
|
||||
#line 155 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("<h2>\r\n Live Logging</h2>\r\n");
|
||||
|
||||
|
||||
#line 158 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
Write(Html.Partial(MVC.Config.Shared.Views.LogEvents, new Disco.Web.Areas.Config.Models.Shared.LogEventsModel()
|
||||
{
|
||||
IsLive = true,
|
||||
TakeFilter = 100,
|
||||
StartFilter = DateTime.Today.AddDays(-1),
|
||||
ViewPortHeight = 450
|
||||
}));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.17929
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Disco.Web.Areas.Config.Views.Logging
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Helpers;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Ajax;
|
||||
using System.Web.Mvc.Html;
|
||||
using System.Web.Routing;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.WebPages;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
|
||||
#line 2 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
using Disco.Services.Logging;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/Logging/Index.cshtml")]
|
||||
public class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.Logging.IndexModel>
|
||||
{
|
||||
public Index()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
|
||||
#line 3 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Logging");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQueryUI-TimePicker");
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 7 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
using (Html.BeginForm(MVC.API.Logging.RetrieveEvents()))
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <div");
|
||||
|
||||
WriteLiteral(" class=\"form\"");
|
||||
|
||||
WriteLiteral(" style=\"width: 520px;\"");
|
||||
|
||||
WriteLiteral(">\r\n <h2>\r\n Export Logs</h2>\r\n <table>\r\n <tr>\r" +
|
||||
"\n <th");
|
||||
|
||||
WriteLiteral(" style=\"width: 105px;\"");
|
||||
|
||||
WriteLiteral(">\r\n Start Filter\r\n </th>\r\n <td>\r" +
|
||||
"\n <input");
|
||||
|
||||
WriteLiteral(" id=\"filterStart\"");
|
||||
|
||||
WriteLiteral(" type=\"text\"");
|
||||
|
||||
WriteLiteral(" name=\"Start\"");
|
||||
|
||||
WriteLiteral(" />\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"smallMessage\"");
|
||||
|
||||
WriteLiteral(">* Optional</span>\r\n </td>\r\n </tr>\r\n <tr>\r\n " +
|
||||
" <th>\r\n End Filter\r\n </th>\r\n " +
|
||||
" <td>\r\n <input");
|
||||
|
||||
WriteLiteral(" id=\"filterEnd\"");
|
||||
|
||||
WriteLiteral(" type=\"text\"");
|
||||
|
||||
WriteLiteral(" name=\"End\"");
|
||||
|
||||
WriteLiteral(" />\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"smallMessage\"");
|
||||
|
||||
WriteLiteral(">* Optional</span>\r\n </td>\r\n </tr>\r\n <tr>\r\n " +
|
||||
" <th>\r\n Limit Filter\r\n </th>\r\n " +
|
||||
" <td>\r\n <select");
|
||||
|
||||
WriteLiteral(" name=\"Take\"");
|
||||
|
||||
WriteLiteral(">\r\n <option");
|
||||
|
||||
WriteLiteral(" selected=\"selected\"");
|
||||
|
||||
WriteLiteral(" value=\"\"");
|
||||
|
||||
WriteLiteral(">- All Events -</option>\r\n <option");
|
||||
|
||||
WriteLiteral(" value=\"1000\"");
|
||||
|
||||
WriteLiteral(">1,000 Events</option>\r\n <option");
|
||||
|
||||
WriteLiteral(" value=\"500\"");
|
||||
|
||||
WriteLiteral(">500 Events</option>\r\n <option");
|
||||
|
||||
WriteLiteral(" value=\"100\"");
|
||||
|
||||
WriteLiteral(">100 Events</option>\r\n <option");
|
||||
|
||||
WriteLiteral(" value=\"50\"");
|
||||
|
||||
WriteLiteral(">50 Events</option>\r\n <option");
|
||||
|
||||
WriteLiteral(" value=\"10\"");
|
||||
|
||||
WriteLiteral(">10 Events</option>\r\n </select>\r\n </td>\r\n " +
|
||||
" </tr>\r\n <tr>\r\n <th>\r\n Module " +
|
||||
"Filter\r\n </th>\r\n <td>\r\n <select" +
|
||||
"");
|
||||
|
||||
WriteLiteral(" id=\"moduleId\"");
|
||||
|
||||
WriteLiteral(" name=\"ModuleId\"");
|
||||
|
||||
WriteLiteral(">\r\n <option");
|
||||
|
||||
WriteLiteral(" value=\"\"");
|
||||
|
||||
WriteLiteral(" selected=\"selected\"");
|
||||
|
||||
WriteLiteral(">- All Modules -</option>\r\n");
|
||||
|
||||
|
||||
#line 53 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 53 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
foreach (var lm in Model.LogModules.Keys.OrderBy(lm => lm.ModuleDescription))
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <option");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 2126), Tuple.Create("\"", 2146)
|
||||
|
||||
#line 55 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 2134), Tuple.Create<System.Object, System.Int32>(lm.ModuleId
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 2134), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">");
|
||||
|
||||
|
||||
#line 55 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
Write(lm.ModuleDescription);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</option> \r\n");
|
||||
|
||||
|
||||
#line 56 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </select>\r\n </td>\r\n </tr>\r\n " +
|
||||
" <tr");
|
||||
|
||||
WriteLiteral(" id=\"trLogModuleEventTypes\"");
|
||||
|
||||
WriteLiteral(" style=\"display: none\"");
|
||||
|
||||
WriteLiteral(">\r\n <th>\r\n Event Type Filter <span");
|
||||
|
||||
WriteLiteral(" style=\"display: block;\"");
|
||||
|
||||
WriteLiteral(" class=\"checkboxBulkSelectContainer\"");
|
||||
|
||||
WriteLiteral(">\r\n Select: <a");
|
||||
|
||||
WriteLiteral(" id=\"eventTypesSelectAll\"");
|
||||
|
||||
WriteLiteral(" href=\"#\"");
|
||||
|
||||
WriteLiteral(">ALL</a> | <a");
|
||||
|
||||
WriteLiteral(" id=\"eventTypesSelectNone\"");
|
||||
|
||||
WriteLiteral("\r\n href=\"#\"");
|
||||
|
||||
WriteLiteral(">NONE</a></span>\r\n </th>\r\n <td>\r\n");
|
||||
|
||||
|
||||
#line 67 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 67 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
int uniqueIdSeed = 0;
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 69 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 69 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
foreach (var lm in Model.LogModules)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <div");
|
||||
|
||||
WriteLiteral(" data-logmoduleid=\"");
|
||||
|
||||
|
||||
#line 71 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
Write(lm.Key.ModuleId);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(" class=\"logModuleEventTypes\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 72 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
Write(CommonHelpers.CheckBoxList("EventTypeIds", lm.Value.ToSelectListItems(), 2, false, uniqueIdSeed));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </div>\r\n");
|
||||
|
||||
|
||||
#line 74 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
uniqueIdSeed += lm.Value.Count;
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th>\r" +
|
||||
"\n </th>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 82 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
Write(Html.Hidden("Format", "CSV"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"submit\"");
|
||||
|
||||
WriteLiteral(" class=\"button\"");
|
||||
|
||||
WriteLiteral(" value=\"Download CSV\"");
|
||||
|
||||
WriteLiteral(" />\r\n </td>\r\n </tr>\r\n </table>\r\n <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(">\r\n $(function () {\r\n var filterStart = $(\'#filterStart" +
|
||||
"\').watermark(\'Start\').datetimepicker({\r\n ampm: true,\r\n " +
|
||||
" stepMinute: 1,\r\n changeYear: true,\r\n " +
|
||||
" changeMonth: true,\r\n dateFormat: \'yy/mm/dd\'\r\n " +
|
||||
" });\r\n var filterEnd = $(\'#filterEnd\').watermark(\'End\').da" +
|
||||
"tetimepicker({\r\n ampm: true,\r\n stepMinute:" +
|
||||
" 1,\r\n changeYear: true,\r\n changeMonth: tru" +
|
||||
"e,\r\n dateFormat: \'yy/mm/dd\'\r\n });\r\n " +
|
||||
" var moduleId = $(\'#moduleId\');\r\n var trLogModuleEventTypes =" +
|
||||
" $(\'#trLogModuleEventTypes\');\r\n var logModuleEventTypes = trLogMo" +
|
||||
"duleEventTypes.find(\'.logModuleEventTypes\').hide();\r\n var logModu" +
|
||||
"leEventTypeCheckboxes = logModuleEventTypes.find(\'input[type=\"checkbox\"]\');\r\n\r\n " +
|
||||
" moduleId.change(function () {\r\n // Unselect Al" +
|
||||
"l\r\n logModuleEventTypes.slideUp();\r\n logMo" +
|
||||
"duleEventTypeCheckboxes.filter(\':checked\').prop(\'checked\', false);\r\n " +
|
||||
" var selectedModule = moduleId.val();\r\n if (selectedMo" +
|
||||
"dule) {\r\n trLogModuleEventTypes.show();\r\n " +
|
||||
" var selectedModuleEventTypes = logModuleEventTypes.filter(\'[data-logmodu" +
|
||||
"leid=\"\' + selectedModule + \'\"]\');\r\n if (selectedModuleEve" +
|
||||
"ntTypes.length > 0) {\r\n var selectedModuleEventTypeCh" +
|
||||
"eckboxes = selectedModuleEventTypes.find(\'input[type=\"checkbox\"]\');\r\n " +
|
||||
" selectedModuleEventTypeCheckboxes.prop(\'checked\', true);\r\n " +
|
||||
" trLogModuleEventTypes.show();\r\n " +
|
||||
" selectedModuleEventTypes.slideDown();\r\n } else {\r\n " +
|
||||
" trLogModuleEventTypes.hide();\r\n }\r" +
|
||||
"\n } else {\r\n trLogModuleEventTypes.hid" +
|
||||
"e();\r\n }\r\n });\r\n\r\n $(\'#eventTyp" +
|
||||
"esSelectAll\').click(function () {\r\n var selectedModule = modu" +
|
||||
"leId.val();\r\n if (selectedModule) {\r\n " +
|
||||
"var selectedModuleEventTypes = logModuleEventTypes.filter(\'[data-logmoduleid=\"\' " +
|
||||
"+ selectedModule + \'\"]\');\r\n if (selectedModuleEventTypes." +
|
||||
"length > 0) {\r\n var selectedModuleEventTypeCheckboxes" +
|
||||
" = selectedModuleEventTypes.find(\'input[type=\"checkbox\"]\');\r\n " +
|
||||
" selectedModuleEventTypeCheckboxes.prop(\'checked\', true);\r\n " +
|
||||
" }\r\n }\r\n return false;\r\n " +
|
||||
" });\r\n $(\'#eventTypesSelectNone\').click(function () {\r\n " +
|
||||
" var selectedModule = moduleId.val();\r\n if (s" +
|
||||
"electedModule) {\r\n var selectedModuleEventTypes = logModu" +
|
||||
"leEventTypes.filter(\'[data-logmoduleid=\"\' + selectedModule + \'\"]\');\r\n " +
|
||||
" if (selectedModuleEventTypes.length > 0) {\r\n " +
|
||||
" var selectedModuleEventTypeCheckboxes = selectedModuleEventTypes.find(\'inpu" +
|
||||
"t[type=\"checkbox\"]\');\r\n selectedModuleEventTypeCheckb" +
|
||||
"oxes.prop(\'checked\', false);\r\n }\r\n }\r\n" +
|
||||
" return false;\r\n });\r\n\r\n });\r\n " +
|
||||
" </script>\r\n </div>\r\n");
|
||||
|
||||
|
||||
#line 155 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("<h2>\r\n Live Logging</h2>\r\n");
|
||||
|
||||
|
||||
#line 158 "..\..\Areas\Config\Views\Logging\Index.cshtml"
|
||||
Write(Html.Partial(MVC.Config.Shared.Views.LogEvents, new Disco.Web.Areas.Config.Models.Shared.LogEventsModel()
|
||||
{
|
||||
IsLive = true,
|
||||
TakeFilter = 100,
|
||||
StartFilter = DateTime.Today.AddDays(-1),
|
||||
ViewPortHeight = 450
|
||||
}));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
||||
@@ -242,7 +242,7 @@
|
||||
function updateWithLive() {
|
||||
liveConnection = $.connection('@(Url.Content("~/API/Logging/TaskStatusNotifications"))');
|
||||
liveConnection.received(update_Received);
|
||||
liveConnection.error(function (e) { alert('Live-Status Error: ' + e) });
|
||||
liveConnection.error(function (e) { if (e.status != 200) alert('Live-Status Error: ' + e.statusText + ': ' + e.responseText); });
|
||||
liveConnection.start(function () {
|
||||
liveConnection.send('/addToGroups:' + sessionId);
|
||||
updateWithAjax();
|
||||
|
||||
@@ -294,7 +294,7 @@ WriteLiteral("\';\r\n\r\n var view = $(\'#scheduledTaskStatus\');\r\n
|
||||
#line hidden
|
||||
WriteLiteral(@"');
|
||||
liveConnection.received(update_Received);
|
||||
liveConnection.error(function (e) { alert('Live-Status Error: ' + e) });
|
||||
liveConnection.error(function (e) { if (e.status != 200) alert('Live-Status Error: ' + e.statusText + ': ' + e.responseText); });
|
||||
liveConnection.start(function () {
|
||||
liveConnection.send('/addToGroups:' + sessionId);
|
||||
updateWithAjax();
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
}
|
||||
},
|
||||
Cancel: function () {
|
||||
uninstallPluginData.removeAttr('checked');
|
||||
uninstallPluginData.prop('checked', false);
|
||||
$('#uninstallPluginDataAlert').hide();
|
||||
$(this).dialog("close");
|
||||
}
|
||||
@@ -125,7 +125,7 @@
|
||||
$(this).dialog("disable");
|
||||
},
|
||||
Cancel: function () {
|
||||
uninstallPluginData.removeAttr('checked');
|
||||
uninstallPluginData.prop('checked', false);
|
||||
$('#uninstallPluginDataAlert').hide();
|
||||
$(this).dialog("close");
|
||||
}
|
||||
|
||||
@@ -383,33 +383,33 @@ WriteLiteral("/\';\r\n var uninstallPlugin, uninstallPluginData,
|
||||
"stallPluginDataConfirm.hide();\r\n\r\n $dialogConfirm" +
|
||||
".dialog(\'open\');\r\n $(this).dialog(\"close\");\r\n " +
|
||||
" }\r\n },\r\n C" +
|
||||
"ancel: function () {\r\n uninstallPluginData.removeAttr" +
|
||||
"(\'checked\');\r\n $(\'#uninstallPluginDataAlert\').hide();" +
|
||||
"\r\n $(this).dialog(\"close\");\r\n " +
|
||||
"}\r\n }\r\n });\r\n\r\n $dialogConfirm " +
|
||||
"= $(\'#dialogUninstallPluginConfirm\').dialog({\r\n resizable: fa" +
|
||||
"lse,\r\n modal: true,\r\n width: 350,\r\n " +
|
||||
" autoOpen: false,\r\n buttons: {\r\n " +
|
||||
" \"Confirm Uninstall\": function () {\r\n var url =" +
|
||||
" uninstallUrl + pluginId;\r\n if (pluginUninstallData)\r" +
|
||||
"\n url += \'?UninstallData=true\'\r\n " +
|
||||
" else\r\n url += \'?UninstallData=false\'\r\n" +
|
||||
"\r\n window.location.href = url;\r\n " +
|
||||
" $(this).dialog(\"disable\");\r\n },\r\n " +
|
||||
" Cancel: function () {\r\n uninstallPluginData.re" +
|
||||
"moveAttr(\'checked\');\r\n $(\'#uninstallPluginDataAlert\')" +
|
||||
".hide();\r\n $(this).dialog(\"close\");\r\n " +
|
||||
" }\r\n }\r\n });\r\n\r\n uninsta" +
|
||||
"llPlugin = $(\'#uninstallPlugin\');\r\n uninstallPluginData = $(\'#uni" +
|
||||
"nstallPluginData\');\r\n uninstallPluginConfirm = $(\'#uninstallPlugi" +
|
||||
"nConfirm\');\r\n uninstallPluginDataConfirm = $(\'#uninstallPluginDat" +
|
||||
"aConfirm\');\r\n\r\n $(\'#buttonUninstall\').click(function () {\r\n " +
|
||||
" $dialog.dialog(\'open\');\r\n return false;\r\n " +
|
||||
" });\r\n\r\n $(\'#uninstallPluginData\').change(function () {\r" +
|
||||
"\n if ($(this).is(\':checked\')) {\r\n $(\'#" +
|
||||
"uninstallPluginDataAlert\').slideDown();\r\n } else {\r\n " +
|
||||
" $(\'#uninstallPluginDataAlert\').slideUp();\r\n }\r" +
|
||||
"\n });\r\n });\r\n </script>\r\n");
|
||||
"ancel: function () {\r\n uninstallPluginData.prop(\'chec" +
|
||||
"ked\', false);\r\n $(\'#uninstallPluginDataAlert\').hide()" +
|
||||
";\r\n $(this).dialog(\"close\");\r\n " +
|
||||
" }\r\n }\r\n });\r\n\r\n $dialogConfirm" +
|
||||
" = $(\'#dialogUninstallPluginConfirm\').dialog({\r\n resizable: f" +
|
||||
"alse,\r\n modal: true,\r\n width: 350,\r\n " +
|
||||
" autoOpen: false,\r\n buttons: {\r\n " +
|
||||
" \"Confirm Uninstall\": function () {\r\n var url " +
|
||||
"= uninstallUrl + pluginId;\r\n if (pluginUninstallData)" +
|
||||
"\r\n url += \'?UninstallData=true\'\r\n " +
|
||||
" else\r\n url += \'?UninstallData=false\'\r" +
|
||||
"\n\r\n window.location.href = url;\r\n " +
|
||||
" $(this).dialog(\"disable\");\r\n },\r\n " +
|
||||
" Cancel: function () {\r\n uninstallPluginData.p" +
|
||||
"rop(\'checked\', false);\r\n $(\'#uninstallPluginDataAlert" +
|
||||
"\').hide();\r\n $(this).dialog(\"close\");\r\n " +
|
||||
" }\r\n }\r\n });\r\n\r\n unins" +
|
||||
"tallPlugin = $(\'#uninstallPlugin\');\r\n uninstallPluginData = $(\'#u" +
|
||||
"ninstallPluginData\');\r\n uninstallPluginConfirm = $(\'#uninstallPlu" +
|
||||
"ginConfirm\');\r\n uninstallPluginDataConfirm = $(\'#uninstallPluginD" +
|
||||
"ataConfirm\');\r\n\r\n $(\'#buttonUninstall\').click(function () {\r\n " +
|
||||
" $dialog.dialog(\'open\');\r\n return false;\r\n " +
|
||||
" });\r\n\r\n $(\'#uninstallPluginData\').change(function () " +
|
||||
"{\r\n if ($(this).is(\':checked\')) {\r\n $(" +
|
||||
"\'#uninstallPluginDataAlert\').slideDown();\r\n } else {\r\n " +
|
||||
" $(\'#uninstallPluginDataAlert\').slideUp();\r\n " +
|
||||
"}\r\n });\r\n });\r\n </script>\r\n");
|
||||
|
||||
|
||||
#line 154 "..\..\Areas\Config\Views\Plugins\Index.cshtml"
|
||||
|
||||
@@ -1,143 +1,135 @@
|
||||
@model Disco.Web.Areas.Config.Models.Shared.LogEventsModel
|
||||
@{
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
||||
var uniqueId = Guid.NewGuid().ToString("N");
|
||||
}
|
||||
<div id="LogEvents_@(uniqueId)" class="logEventsViewport">
|
||||
<table class="logEventsViewport">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="icon">
|
||||
|
||||
</th>
|
||||
<th class="timestamp">
|
||||
Date/Time
|
||||
</th>
|
||||
<th class="eventType">
|
||||
Event Type
|
||||
</th>
|
||||
<th class="message">
|
||||
Message
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div class="logEventsViewportContainer" style="@(Model.ViewPortWidth.HasValue ? string.Format("width:{0}px;", Model.ViewPortWidth.Value) : null)@(Model.ViewPortHeight.HasValue ? string.Format("height:{0}px;", Model.ViewPortHeight.Value - 18) : null)">
|
||||
<div class="logEventsViewportNoLogs" data-bind="visible: EventLogs().length == 0"
|
||||
style="display: none">
|
||||
No logs
|
||||
</div>
|
||||
<table class="logEventsViewport" data-bind="visible: EventLogs().length > 0" style="display: none">
|
||||
<tbody data-bind="foreach: EventLogs">
|
||||
<tr>
|
||||
<td class="icon" data-bind="css: {information: EventTypeSeverity == 0, warning: EventTypeSeverity == 1, error: EventTypeSeverity == 2}">
|
||||
|
||||
</td>
|
||||
<td class="timestamp" data-bind="text: FormattedTimestamp">
|
||||
</td>
|
||||
<td class="eventType" data-bind="text: EventTypeName, attr: {title: ModuleDescription}">
|
||||
</td>
|
||||
<td class="message" data-bind="text: FormattedMessage, attr: {title: $parent.LogArguments($data)}">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@{
|
||||
var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
|
||||
var eventTypesFilterJson = (Model.EventTypesFilter != null) ? serializer.Serialize(Model.EventTypesFilter.Select(et => et.Id).ToArray()) : "null";
|
||||
}
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var logEventsHost = $('LogEvents_@(uniqueId)');
|
||||
var logModuleId = '@(Model.ModuleFilter != null ? Model.ModuleFilter.ModuleId.ToString() : null)';
|
||||
var logModuleLiveGroupName = '@(Model.ModuleFilter != null ? Model.ModuleFilter.LiveLogGroupName : Disco.Services.Logging.LogContext.LiveLogAllEventsGroupName)';
|
||||
var logEventTypeFiltered = @(eventTypesFilterJson);
|
||||
var logStartFiler = @(AjaxHelpers.JsonDate(Model.StartFilter));
|
||||
var logEndFiler = @(AjaxHelpers.JsonDate(Model.EndFilter));
|
||||
var logTakeFiler = '@(Model.TakeFilter)';
|
||||
var liveConnection = null;
|
||||
var liveEventReceivedFunction = '@(Model.JavascriptLiveEventFunctionName)';
|
||||
var useLive = ('True'==='@(Model.IsLive)');
|
||||
|
||||
// View Model
|
||||
var logsViewModel;
|
||||
function LogsViewModel(initialLogs){
|
||||
var self = this;
|
||||
|
||||
self.EventLogs = ko.observableArray(initialLogs);
|
||||
self.LogArguments = function(log){
|
||||
if (log.Arguments)
|
||||
return log.Arguments.join('\n');
|
||||
else
|
||||
return null;
|
||||
};
|
||||
}
|
||||
function formatDate(d){
|
||||
if (d){
|
||||
return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':'+d.getMinutes()+':'+d.getSeconds();
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function loadInitialData(){
|
||||
// Load Data
|
||||
var loadData = {
|
||||
Format: "json",
|
||||
Start: formatDate(logStartFiler),
|
||||
End: logEndFiler,
|
||||
ModuleId: logModuleId,
|
||||
Take: logTakeFiler
|
||||
};
|
||||
if (logEventTypeFiltered)
|
||||
loadData["EventTypeIds"] = logEventTypeFiltered;
|
||||
$.ajax({
|
||||
url: '@(Url.Action(MVC.API.Logging.RetrieveEvents()))',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: loadData,
|
||||
success: function (d) {
|
||||
initLogs(d);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to retrieve logs: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initLogs(loadedLogs){
|
||||
logsViewModel = new LogsViewModel(loadedLogs);
|
||||
ko.applyBindings(logsViewModel, logEventsHost.get(0));
|
||||
|
||||
if (useLive){
|
||||
if (liveEventReceivedFunction){
|
||||
if (!document.DiscoFunctions) document.DiscoFunctions = {};
|
||||
if (!document.DiscoFunctions.LogEventsFunctions) document.DiscoFunctions.LogEventsFunctions = {};
|
||||
if (document.DiscoFunctions.LogEventsFunctions[liveEventReceivedFunction]){
|
||||
liveEventReceivedFunction = document.DiscoFunctions.LogEventsFunctions[liveEventReceivedFunction];
|
||||
}else{
|
||||
liveEventReceivedFunction = null;
|
||||
}
|
||||
}
|
||||
|
||||
liveConnection = $.connection('@(Url.Content("~/API/Logging/Notifications"))');
|
||||
liveConnection.received(logReceived);
|
||||
liveConnection.error(function(e){alert('Live-Log Error: '+e)});
|
||||
liveConnection.start(function(){
|
||||
if (logModuleLiveGroupName){
|
||||
liveConnection.send('/addToGroups:' + logModuleLiveGroupName);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function logReceived(log){
|
||||
if (log.UseDisplay) logsViewModel.EventLogs.unshift(log);
|
||||
if (liveEventReceivedFunction) liveEventReceivedFunction(log);
|
||||
}
|
||||
|
||||
loadInitialData();
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
@model Disco.Web.Areas.Config.Models.Shared.LogEventsModel
|
||||
@{
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
||||
var uniqueId = Guid.NewGuid().ToString("N");
|
||||
}
|
||||
<div id="LogEvents_@(uniqueId)" class="logEventsViewport">
|
||||
<table class="logEventsViewport">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="icon">
|
||||
</th>
|
||||
<th class="timestamp">Date/Time
|
||||
</th>
|
||||
<th class="eventType">Event Type
|
||||
</th>
|
||||
<th class="message">Message
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div class="logEventsViewportContainer" style="@(Model.ViewPortWidth.HasValue ? string.Format("width:{0}px;", Model.ViewPortWidth.Value) : null)@(Model.ViewPortHeight.HasValue ? string.Format("height:{0}px;", Model.ViewPortHeight.Value - 18) : null)">
|
||||
<div class="logEventsViewportNoLogs" data-bind="visible: EventLogs().length == 0"
|
||||
style="display: none">
|
||||
No logs
|
||||
</div>
|
||||
<table class="logEventsViewport" data-bind="visible: EventLogs().length > 0" style="display: none">
|
||||
<tbody data-bind="foreach: EventLogs">
|
||||
<tr>
|
||||
<td class="icon" data-bind="css: {information: EventTypeSeverity == 0, warning: EventTypeSeverity == 1, error: EventTypeSeverity == 2}">
|
||||
</td>
|
||||
<td class="timestamp" data-bind="text: FormattedTimestamp"></td>
|
||||
<td class="eventType" data-bind="text: EventTypeName, attr: {title: ModuleDescription}"></td>
|
||||
<td class="message" data-bind="text: FormattedMessage, attr: {title: $parent.LogArguments($data)}"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@{
|
||||
var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
|
||||
var eventTypesFilterJson = (Model.EventTypesFilter != null) ? serializer.Serialize(Model.EventTypesFilter.Select(et => et.Id).ToArray()) : "null";
|
||||
}
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var logEventsHost = $('LogEvents_@(uniqueId)');
|
||||
var logModuleId = '@(Model.ModuleFilter != null ? Model.ModuleFilter.ModuleId.ToString() : null)';
|
||||
var logModuleLiveGroupName = '@(Model.ModuleFilter != null ? Model.ModuleFilter.LiveLogGroupName : Disco.Services.Logging.LogContext.LiveLogAllEventsGroupName)';
|
||||
var logEventTypeFiltered = @(eventTypesFilterJson);
|
||||
var logStartFiler = @(AjaxHelpers.JsonDate(Model.StartFilter));
|
||||
var logEndFiler = @(AjaxHelpers.JsonDate(Model.EndFilter));
|
||||
var logTakeFiler = '@(Model.TakeFilter)';
|
||||
var liveConnection = null;
|
||||
var liveEventReceivedFunction = '@(Model.JavascriptLiveEventFunctionName)';
|
||||
var useLive = ('True'==='@(Model.IsLive)');
|
||||
|
||||
// View Model
|
||||
var logsViewModel;
|
||||
function LogsViewModel(initialLogs){
|
||||
var self = this;
|
||||
|
||||
self.EventLogs = ko.observableArray(initialLogs);
|
||||
self.LogArguments = function(log){
|
||||
if (log.Arguments)
|
||||
return log.Arguments.join('\n');
|
||||
else
|
||||
return null;
|
||||
};
|
||||
}
|
||||
function formatDate(d){
|
||||
if (d){
|
||||
return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':'+d.getMinutes()+':'+d.getSeconds();
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function loadInitialData(){
|
||||
// Load Data
|
||||
var loadData = {
|
||||
Format: "json",
|
||||
Start: formatDate(logStartFiler),
|
||||
End: logEndFiler,
|
||||
ModuleId: logModuleId,
|
||||
Take: logTakeFiler
|
||||
};
|
||||
if (logEventTypeFiltered)
|
||||
loadData["EventTypeIds"] = logEventTypeFiltered;
|
||||
$.ajax({
|
||||
url: '@(Url.Action(MVC.API.Logging.RetrieveEvents()))',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: loadData,
|
||||
success: function (d) {
|
||||
initLogs(d);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to retrieve logs: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initLogs(loadedLogs){
|
||||
logsViewModel = new LogsViewModel(loadedLogs);
|
||||
ko.applyBindings(logsViewModel, logEventsHost.get(0));
|
||||
|
||||
if (useLive){
|
||||
if (liveEventReceivedFunction){
|
||||
if (!document.DiscoFunctions) document.DiscoFunctions = {};
|
||||
if (!document.DiscoFunctions.LogEventsFunctions) document.DiscoFunctions.LogEventsFunctions = {};
|
||||
if (document.DiscoFunctions.LogEventsFunctions[liveEventReceivedFunction]){
|
||||
liveEventReceivedFunction = document.DiscoFunctions.LogEventsFunctions[liveEventReceivedFunction];
|
||||
}else{
|
||||
liveEventReceivedFunction = null;
|
||||
}
|
||||
}
|
||||
|
||||
liveConnection = $.connection('@(Url.Content("~/API/Logging/Notifications"))');
|
||||
liveConnection.received(logReceived);
|
||||
liveConnection.error(function(e){if (e.status != 200) alert('Live-Log Error: '+e.statusText +': '+e.responseText);});
|
||||
liveConnection.start(function(){
|
||||
if (logModuleLiveGroupName){
|
||||
liveConnection.send('/addToGroups:' + logModuleLiveGroupName);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function logReceived(log){
|
||||
if (log.UseDisplay) logsViewModel.EventLogs.unshift(log);
|
||||
if (liveEventReceivedFunction) liveEventReceivedFunction(log);
|
||||
}
|
||||
|
||||
loadInitialData();
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -1,365 +1,364 @@
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.17929
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Disco.Web.Areas.Config.Views.Shared
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Helpers;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Ajax;
|
||||
using System.Web.Mvc.Html;
|
||||
using System.Web.Routing;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.WebPages;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/Shared/LogEvents.cshtml")]
|
||||
public class LogEvents : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.Shared.LogEventsModel>
|
||||
{
|
||||
public LogEvents()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
|
||||
#line 2 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
||||
var uniqueId = Guid.NewGuid().ToString("N");
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n<div");
|
||||
|
||||
WriteAttribute("id", Tuple.Create(" id=\"", 251), Tuple.Create("\"", 277)
|
||||
, Tuple.Create(Tuple.Create("", 256), Tuple.Create("LogEvents_", 256), true)
|
||||
|
||||
#line 7 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 266), Tuple.Create<System.Object, System.Int32>(uniqueId
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 266), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" class=\"logEventsViewport\"");
|
||||
|
||||
WriteLiteral(">\r\n <table");
|
||||
|
||||
WriteLiteral(" class=\"logEventsViewport\"");
|
||||
|
||||
WriteLiteral(">\r\n <thead>\r\n <tr>\r\n <th");
|
||||
|
||||
WriteLiteral(" class=\"icon\"");
|
||||
|
||||
WriteLiteral(">\r\n \r\n </th>\r\n <th");
|
||||
|
||||
WriteLiteral(" class=\"timestamp\"");
|
||||
|
||||
WriteLiteral(">\r\n Date/Time\r\n </th>\r\n <th");
|
||||
|
||||
WriteLiteral(" class=\"eventType\"");
|
||||
|
||||
WriteLiteral(">\r\n Event Type\r\n </th>\r\n <th");
|
||||
|
||||
WriteLiteral(" class=\"message\"");
|
||||
|
||||
WriteLiteral(">\r\n Message\r\n </th>\r\n </tr>\r\n " +
|
||||
" </thead>\r\n </table>\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"logEventsViewportContainer\"");
|
||||
|
||||
WriteAttribute("style", Tuple.Create(" style=\"", 840), Tuple.Create("\"", 1050)
|
||||
|
||||
#line 26 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 848), Tuple.Create<System.Object, System.Int32>(Model.ViewPortWidth.HasValue ? string.Format("width:{0}px;", Model.ViewPortWidth.Value) : null
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 848), false)
|
||||
|
||||
#line 26 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 945), Tuple.Create<System.Object, System.Int32>(Model.ViewPortHeight.HasValue ? string.Format("height:{0}px;", Model.ViewPortHeight.Value - 18) : null
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 945), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"logEventsViewportNoLogs\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: EventLogs().length == 0\"");
|
||||
|
||||
WriteLiteral("\r\n style=\"display: none\"");
|
||||
|
||||
WriteLiteral(">\r\n No logs\r\n </div>\r\n <table");
|
||||
|
||||
WriteLiteral(" class=\"logEventsViewport\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: EventLogs().length > 0\"");
|
||||
|
||||
WriteLiteral(" style=\"display: none\"");
|
||||
|
||||
WriteLiteral(">\r\n <tbody");
|
||||
|
||||
WriteLiteral(" data-bind=\"foreach: EventLogs\"");
|
||||
|
||||
WriteLiteral(">\r\n <tr>\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"icon\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"css: {information: EventTypeSeverity == 0, warning: EventTypeSeverity" +
|
||||
" == 1, error: EventTypeSeverity == 2}\"");
|
||||
|
||||
WriteLiteral(">\r\n \r\n </td>\r\n " +
|
||||
" <td");
|
||||
|
||||
WriteLiteral(" class=\"timestamp\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: FormattedTimestamp\"");
|
||||
|
||||
WriteLiteral(">\r\n </td>\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"eventType\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: EventTypeName, attr: {title: ModuleDescription}\"");
|
||||
|
||||
WriteLiteral(">\r\n </td>\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"message\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: FormattedMessage, attr: {title: $parent.LogArguments($data)}\"");
|
||||
|
||||
WriteLiteral(">\r\n </td>\r\n </tr>\r\n </tbody>\r\n " +
|
||||
" </table>\r\n </div>\r\n");
|
||||
|
||||
|
||||
#line 47 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 47 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
|
||||
var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
|
||||
var eventTypesFilterJson = (Model.EventTypesFilter != null) ? serializer.Serialize(Model.EventTypesFilter.Select(et => et.Id).ToArray()) : "null";
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(">\r\n $(function () {\r\n var logEventsHost = $(\'LogEvents_");
|
||||
|
||||
|
||||
#line 53 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(uniqueId);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\');\r\n var logModuleId = \'");
|
||||
|
||||
|
||||
#line 54 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(Model.ModuleFilter != null ? Model.ModuleFilter.ModuleId.ToString() : null);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\';\r\n var logModuleLiveGroupName = \'");
|
||||
|
||||
|
||||
#line 55 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(Model.ModuleFilter != null ? Model.ModuleFilter.LiveLogGroupName : Disco.Services.Logging.LogContext.LiveLogAllEventsGroupName);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\';\r\n var logEventTypeFiltered = ");
|
||||
|
||||
|
||||
#line 56 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(eventTypesFilterJson);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(";\r\n var logStartFiler = ");
|
||||
|
||||
|
||||
#line 57 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(AjaxHelpers.JsonDate(Model.StartFilter));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(";\r\n var logEndFiler = ");
|
||||
|
||||
|
||||
#line 58 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(AjaxHelpers.JsonDate(Model.EndFilter));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(";\r\n var logTakeFiler = \'");
|
||||
|
||||
|
||||
#line 59 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(Model.TakeFilter);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\';\r\n var liveConnection = null;\r\n var liveEventReceivedFunc" +
|
||||
"tion = \'");
|
||||
|
||||
|
||||
#line 61 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(Model.JavascriptLiveEventFunctionName);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\';\r\n var useLive = (\'True\'===\'");
|
||||
|
||||
|
||||
#line 62 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(Model.IsLive);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"');
|
||||
|
||||
// View Model
|
||||
var logsViewModel;
|
||||
function LogsViewModel(initialLogs){
|
||||
var self = this;
|
||||
|
||||
self.EventLogs = ko.observableArray(initialLogs);
|
||||
self.LogArguments = function(log){
|
||||
if (log.Arguments)
|
||||
return log.Arguments.join('\n');
|
||||
else
|
||||
return null;
|
||||
};
|
||||
}
|
||||
function formatDate(d){
|
||||
if (d){
|
||||
return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':'+d.getMinutes()+':'+d.getSeconds();
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function loadInitialData(){
|
||||
// Load Data
|
||||
var loadData = {
|
||||
Format: ""json"",
|
||||
Start: formatDate(logStartFiler),
|
||||
End: logEndFiler,
|
||||
ModuleId: logModuleId,
|
||||
Take: logTakeFiler
|
||||
};
|
||||
if (logEventTypeFiltered)
|
||||
loadData[""EventTypeIds""] = logEventTypeFiltered;
|
||||
$.ajax({
|
||||
url: '");
|
||||
|
||||
|
||||
#line 96 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(Url.Action(MVC.API.Logging.RetrieveEvents()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: loadData,
|
||||
success: function (d) {
|
||||
initLogs(d);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to retrieve logs: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initLogs(loadedLogs){
|
||||
logsViewModel = new LogsViewModel(loadedLogs);
|
||||
ko.applyBindings(logsViewModel, logEventsHost.get(0));
|
||||
|
||||
if (useLive){
|
||||
if (liveEventReceivedFunction){
|
||||
if (!document.DiscoFunctions) document.DiscoFunctions = {};
|
||||
if (!document.DiscoFunctions.LogEventsFunctions) document.DiscoFunctions.LogEventsFunctions = {};
|
||||
if (document.DiscoFunctions.LogEventsFunctions[liveEventReceivedFunction]){
|
||||
liveEventReceivedFunction = document.DiscoFunctions.LogEventsFunctions[liveEventReceivedFunction];
|
||||
}else{
|
||||
liveEventReceivedFunction = null;
|
||||
}
|
||||
}
|
||||
|
||||
liveConnection = $.connection('");
|
||||
|
||||
|
||||
#line 124 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(Url.Content("~/API/Logging/Notifications"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"');
|
||||
liveConnection.received(logReceived);
|
||||
liveConnection.error(function(e){alert('Live-Log Error: '+e)});
|
||||
liveConnection.start(function(){
|
||||
if (logModuleLiveGroupName){
|
||||
liveConnection.send('/addToGroups:' + logModuleLiveGroupName);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function logReceived(log){
|
||||
if (log.UseDisplay) logsViewModel.EventLogs.unshift(log);
|
||||
if (liveEventReceivedFunction) liveEventReceivedFunction(log);
|
||||
}
|
||||
|
||||
loadInitialData();
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.17929
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Disco.Web.Areas.Config.Views.Shared
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Helpers;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Ajax;
|
||||
using System.Web.Mvc.Html;
|
||||
using System.Web.Routing;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.WebPages;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/Shared/LogEvents.cshtml")]
|
||||
public class LogEvents : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.Shared.LogEventsModel>
|
||||
{
|
||||
public LogEvents()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
|
||||
#line 2 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
||||
var uniqueId = Guid.NewGuid().ToString("N");
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n<div");
|
||||
|
||||
WriteAttribute("id", Tuple.Create(" id=\"", 251), Tuple.Create("\"", 277)
|
||||
, Tuple.Create(Tuple.Create("", 256), Tuple.Create("LogEvents_", 256), true)
|
||||
|
||||
#line 7 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 266), Tuple.Create<System.Object, System.Int32>(uniqueId
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 266), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" class=\"logEventsViewport\"");
|
||||
|
||||
WriteLiteral(">\r\n <table");
|
||||
|
||||
WriteLiteral(" class=\"logEventsViewport\"");
|
||||
|
||||
WriteLiteral(">\r\n <thead>\r\n <tr>\r\n <th");
|
||||
|
||||
WriteLiteral(" class=\"icon\"");
|
||||
|
||||
WriteLiteral("> \r\n </th>\r\n <th");
|
||||
|
||||
WriteLiteral(" class=\"timestamp\"");
|
||||
|
||||
WriteLiteral(">Date/Time\r\n </th>\r\n <th");
|
||||
|
||||
WriteLiteral(" class=\"eventType\"");
|
||||
|
||||
WriteLiteral(">Event Type\r\n </th>\r\n <th");
|
||||
|
||||
WriteLiteral(" class=\"message\"");
|
||||
|
||||
WriteLiteral(">Message\r\n </th>\r\n </tr>\r\n </thead>\r\n </table" +
|
||||
">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"logEventsViewportContainer\"");
|
||||
|
||||
WriteAttribute("style", Tuple.Create(" style=\"", 752), Tuple.Create("\"", 962)
|
||||
|
||||
#line 22 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 760), Tuple.Create<System.Object, System.Int32>(Model.ViewPortWidth.HasValue ? string.Format("width:{0}px;", Model.ViewPortWidth.Value) : null
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 760), false)
|
||||
|
||||
#line 22 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 857), Tuple.Create<System.Object, System.Int32>(Model.ViewPortHeight.HasValue ? string.Format("height:{0}px;", Model.ViewPortHeight.Value - 18) : null
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 857), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"logEventsViewportNoLogs\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: EventLogs().length == 0\"");
|
||||
|
||||
WriteLiteral("\r\n style=\"display: none\"");
|
||||
|
||||
WriteLiteral(">\r\n No logs\r\n </div>\r\n <table");
|
||||
|
||||
WriteLiteral(" class=\"logEventsViewport\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: EventLogs().length > 0\"");
|
||||
|
||||
WriteLiteral(" style=\"display: none\"");
|
||||
|
||||
WriteLiteral(">\r\n <tbody");
|
||||
|
||||
WriteLiteral(" data-bind=\"foreach: EventLogs\"");
|
||||
|
||||
WriteLiteral(">\r\n <tr>\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"icon\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"css: {information: EventTypeSeverity == 0, warning: EventTypeSeverity" +
|
||||
" == 1, error: EventTypeSeverity == 2}\"");
|
||||
|
||||
WriteLiteral("> \r\n </td>\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"timestamp\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: FormattedTimestamp\"");
|
||||
|
||||
WriteLiteral("></td>\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"eventType\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: EventTypeName, attr: {title: ModuleDescription}\"");
|
||||
|
||||
WriteLiteral("></td>\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"message\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: FormattedMessage, attr: {title: $parent.LogArguments($data)}\"");
|
||||
|
||||
WriteLiteral("></td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>" +
|
||||
"\r\n");
|
||||
|
||||
|
||||
#line 39 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 39 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
|
||||
var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
|
||||
var eventTypesFilterJson = (Model.EventTypesFilter != null) ? serializer.Serialize(Model.EventTypesFilter.Select(et => et.Id).ToArray()) : "null";
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(">\r\n $(function () {\r\n var logEventsHost = $(\'LogEvents_");
|
||||
|
||||
|
||||
#line 45 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(uniqueId);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\');\r\n var logModuleId = \'");
|
||||
|
||||
|
||||
#line 46 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(Model.ModuleFilter != null ? Model.ModuleFilter.ModuleId.ToString() : null);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\';\r\n var logModuleLiveGroupName = \'");
|
||||
|
||||
|
||||
#line 47 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(Model.ModuleFilter != null ? Model.ModuleFilter.LiveLogGroupName : Disco.Services.Logging.LogContext.LiveLogAllEventsGroupName);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\';\r\n var logEventTypeFiltered = ");
|
||||
|
||||
|
||||
#line 48 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(eventTypesFilterJson);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(";\r\n var logStartFiler = ");
|
||||
|
||||
|
||||
#line 49 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(AjaxHelpers.JsonDate(Model.StartFilter));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(";\r\n var logEndFiler = ");
|
||||
|
||||
|
||||
#line 50 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(AjaxHelpers.JsonDate(Model.EndFilter));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(";\r\n var logTakeFiler = \'");
|
||||
|
||||
|
||||
#line 51 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(Model.TakeFilter);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\';\r\n var liveConnection = null;\r\n var liveEventReceivedFunc" +
|
||||
"tion = \'");
|
||||
|
||||
|
||||
#line 53 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(Model.JavascriptLiveEventFunctionName);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\';\r\n var useLive = (\'True\'===\'");
|
||||
|
||||
|
||||
#line 54 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(Model.IsLive);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"');
|
||||
|
||||
// View Model
|
||||
var logsViewModel;
|
||||
function LogsViewModel(initialLogs){
|
||||
var self = this;
|
||||
|
||||
self.EventLogs = ko.observableArray(initialLogs);
|
||||
self.LogArguments = function(log){
|
||||
if (log.Arguments)
|
||||
return log.Arguments.join('\n');
|
||||
else
|
||||
return null;
|
||||
};
|
||||
}
|
||||
function formatDate(d){
|
||||
if (d){
|
||||
return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':'+d.getMinutes()+':'+d.getSeconds();
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function loadInitialData(){
|
||||
// Load Data
|
||||
var loadData = {
|
||||
Format: ""json"",
|
||||
Start: formatDate(logStartFiler),
|
||||
End: logEndFiler,
|
||||
ModuleId: logModuleId,
|
||||
Take: logTakeFiler
|
||||
};
|
||||
if (logEventTypeFiltered)
|
||||
loadData[""EventTypeIds""] = logEventTypeFiltered;
|
||||
$.ajax({
|
||||
url: '");
|
||||
|
||||
|
||||
#line 88 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(Url.Action(MVC.API.Logging.RetrieveEvents()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: loadData,
|
||||
success: function (d) {
|
||||
initLogs(d);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to retrieve logs: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initLogs(loadedLogs){
|
||||
logsViewModel = new LogsViewModel(loadedLogs);
|
||||
ko.applyBindings(logsViewModel, logEventsHost.get(0));
|
||||
|
||||
if (useLive){
|
||||
if (liveEventReceivedFunction){
|
||||
if (!document.DiscoFunctions) document.DiscoFunctions = {};
|
||||
if (!document.DiscoFunctions.LogEventsFunctions) document.DiscoFunctions.LogEventsFunctions = {};
|
||||
if (document.DiscoFunctions.LogEventsFunctions[liveEventReceivedFunction]){
|
||||
liveEventReceivedFunction = document.DiscoFunctions.LogEventsFunctions[liveEventReceivedFunction];
|
||||
}else{
|
||||
liveEventReceivedFunction = null;
|
||||
}
|
||||
}
|
||||
|
||||
liveConnection = $.connection('");
|
||||
|
||||
|
||||
#line 116 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
|
||||
Write(Url.Content("~/API/Logging/Notifications"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"');
|
||||
liveConnection.received(logReceived);
|
||||
liveConnection.error(function(e){if (e.status != 200) alert('Live-Log Error: '+e.statusText +': '+e.responseText);});
|
||||
liveConnection.start(function(){
|
||||
if (logModuleLiveGroupName){
|
||||
liveConnection.send('/addToGroups:' + logModuleLiveGroupName);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function logReceived(log){
|
||||
if (log.UseDisplay) logsViewModel.EventLogs.unshift(log);
|
||||
if (liveEventReceivedFunction) liveEventReceivedFunction(log);
|
||||
}
|
||||
|
||||
loadInitialData();
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
||||
Reference in New Issue
Block a user