Feature: Device Importing & Exporting
This commit is contained in:
@@ -0,0 +1,192 @@
|
||||
@model Disco.Web.Models.Device.ImportModel
|
||||
@{
|
||||
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Import/Export Devices");
|
||||
}
|
||||
<div id="deviceImport">
|
||||
@using (Html.BeginForm(MVC.API.Device.ImportParse(), FormMethod.Post, new { enctype = "multipart/form-data" }))
|
||||
{
|
||||
@Html.ValidationSummary()
|
||||
<div id="importDialog" class="form" style="width: 450px">
|
||||
<h2>Import Devices</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<th>
|
||||
@Html.LabelFor(m => m.ImportFile)
|
||||
</th>
|
||||
<td>
|
||||
<input id="ImportFile" name="ImportFile" type="file" data-val="true" data-val-required="An Import File is required." />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="actions">
|
||||
<input type="submit" class="button" value="Import" />
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
<div id="documentation">
|
||||
<h3>CSV Import Specification</h3>
|
||||
<h4>Format</h4>
|
||||
<ul>
|
||||
<li>The import file must be in <strong>comma-separated values format</strong> (<a href="http://en.wikipedia.org/wiki/Comma-separated_values" target="_blank">CSV Reference</a>).</li>
|
||||
<li>The <strong>first line will be ignored</strong> (it is assumed the file includes headers).</li>
|
||||
<li>Be conscious of editors removing leading zeros from serial numbers (ie: Microsoft Excel).</li>
|
||||
</ul>
|
||||
<h4>Fields</h4>
|
||||
<div class="smallMessage">The following fields/columns are available for to the import file. The <strong>order of the fields</strong> must be as shown below.</div>
|
||||
<table class="tableData">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 100px;">Field Name</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Serial Number</th>
|
||||
<td><strong>Required</strong> - must contain the device serial number (maximum of 60 characters).
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Device Model</th>
|
||||
<td>The <span class="code">ID</span> for the Device Model (<a href="#" id="showDeviceModels">Show IDs</a>). <em>Default: <span class="code">1</span> [@Html.ActionLink(Model.DeviceModels[0].ToString(), MVC.Config.DeviceModel.Index(Model.DeviceModels[0].Id))]</em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Device Profile</th>
|
||||
<td>The <span class="code">ID</span> for the Device Profile (<a href="#" id="showDeviceProfiles">Show IDs</a>). <em>Default: <span class="code">1</span> [@Html.ActionLink(Model.DeviceProfiles[0].ToString(), MVC.Config.DeviceProfile.Index(Model.DeviceProfiles[0].Id))]</em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Device Batch</th>
|
||||
<td>The <span class="code">ID</span> for the Device Batch (<a href="#" id="showDeviceBatches">Show IDs</a>). <em>Default: <span class="code"><None></span></em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Assigned User</th>
|
||||
<td>The <span class="code">ID</span> for the User assigned to the device. <em>Default: <span class="code"><None></span></em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Location</th>
|
||||
<td>Updates the Location of the device. Maximum of 250 characters. <em>Default: <span class="code"><None></span></em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Asset Number</th>
|
||||
<td>Updates the Asset Number of the device. Maximum of 40 characters. <em>Default: <span class="code"><None></span></em>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<div id="showDeviceModelsDialog" class="hiddenDialog" title="Disco Device Model Ids">
|
||||
<table class="tableData">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Description</th>
|
||||
<th>Manufacturer</th>
|
||||
<th>Model</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var dm in Model.DeviceModels)
|
||||
{
|
||||
<tr>
|
||||
<td>@Html.ActionLink(dm.Id.ToString(), MVC.Config.DeviceModel.Index(dm.Id))</td>
|
||||
<td>@dm.ToString()</td>
|
||||
<td>@dm.Manufacturer</td>
|
||||
<td>@dm.Model</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="showDeviceProfilesDialog" class="hiddenDialog" title="Disco Device Profile Ids">
|
||||
<table class="tableData">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>Short Name</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var dp in Model.DeviceProfiles)
|
||||
{
|
||||
<tr>
|
||||
<td>@Html.ActionLink(dp.Id.ToString(), MVC.Config.DeviceProfile.Index(dp.Id))</td>
|
||||
<td>@dp.Name</td>
|
||||
<td>@dp.ShortName</td>
|
||||
<td>@dp.Description</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="showDeviceBatchesDialog" class="hiddenDialog" title="Disco Device Batch Ids">
|
||||
<table class="tableData">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>Purchase Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var db in Model.DeviceBatches)
|
||||
{
|
||||
<tr>
|
||||
<td>@Html.ActionLink(db.Id.ToString(), MVC.Config.DeviceBatch.Index(db.Id))</td>
|
||||
<td>@db.Name</td>
|
||||
<td>@CommonHelpers.FriendlyDate(db.PurchaseDate)</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
var dialogOptions = {
|
||||
width: 700,
|
||||
height: 600,
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false
|
||||
},
|
||||
$showDeviceModelsDialog = null,
|
||||
$showDeviceProfilesDialog = null,
|
||||
$showDeviceBatchesDialog = null;
|
||||
|
||||
$('#showDeviceModels').click(function (e) {
|
||||
e.preventDefault();
|
||||
if (!$showDeviceModelsDialog)
|
||||
$showDeviceModelsDialog = $('#showDeviceModelsDialog').dialog(dialogOptions);
|
||||
$showDeviceModelsDialog.dialog('open');
|
||||
});
|
||||
|
||||
$('#showDeviceProfiles').click(function (e) {
|
||||
e.preventDefault();
|
||||
if (!$showDeviceProfilesDialog)
|
||||
$showDeviceProfilesDialog = $('#showDeviceProfilesDialog').dialog(dialogOptions);
|
||||
$showDeviceProfilesDialog.dialog('open');
|
||||
});
|
||||
$('#showDeviceBatches').click(function (e) {
|
||||
e.preventDefault();
|
||||
if (!$showDeviceBatchesDialog)
|
||||
$showDeviceBatchesDialog = $('#showDeviceBatchesDialog').dialog(dialogOptions);
|
||||
$showDeviceBatchesDialog.dialog('open');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="actionBar">
|
||||
@Html.ActionLinkButton("Export All Devices", MVC.API.Device.ExportAllDevices())
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user