feature: device model/profile decommissioning
This commit is contained in:
@@ -730,6 +730,32 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
return RedirectToAction(MVC.Device.ImportReview(context.SessionId));
|
||||
}
|
||||
|
||||
[DiscoAuthorize(Claims.Device.Actions.Import)]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public virtual ActionResult DeviceProfileDecommission(int id, DecommissionReasons? decommissionReason = null, bool? unassignUsers = null)
|
||||
{
|
||||
var deviceProfile = Database.DeviceProfiles.Find(id)
|
||||
?? throw new ArgumentException("Invalid Device Profile Id", nameof(id));
|
||||
if (decommissionReason == null)
|
||||
throw new ArgumentNullException(nameof(decommissionReason), "Decommission Reason is required");
|
||||
var context = DeviceImport.BeginDecommissionImport(Database, deviceProfile, decommissionReason.Value, unassignUsers.GetValueOrDefault());
|
||||
Import_StoreContext(context);
|
||||
return RedirectToAction(MVC.Device.ImportReview(context.SessionId));
|
||||
}
|
||||
|
||||
[DiscoAuthorize(Claims.Device.Actions.Import)]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public virtual ActionResult DeviceModelDecommission(int id, DecommissionReasons? decommissionReason = null, bool? unassignUsers = null)
|
||||
{
|
||||
var deviceModel = Database.DeviceModels.Find(id)
|
||||
?? throw new ArgumentException("Invalid Device Model Id", nameof(id));
|
||||
if (decommissionReason == null)
|
||||
throw new ArgumentNullException(nameof(decommissionReason), "Decommission Reason is required");
|
||||
var context = DeviceImport.BeginDecommissionImport(Database, deviceModel, decommissionReason.Value, unassignUsers.GetValueOrDefault());
|
||||
Import_StoreContext(context);
|
||||
return RedirectToAction(MVC.Device.ImportReview(context.SessionId));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Exporting
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
};
|
||||
|
||||
m.CanDelete = m.DeviceModel.CanDelete(Database);
|
||||
m.CanDecommission = m.DeviceModel.CanDecommission(Database);
|
||||
|
||||
if (m.DeviceCount - m.DeviceDecommissionedCount > 0)
|
||||
m.BulkGenerateDocumentTemplates = Database.DocumentTemplates.Where(t => !t.IsHidden).ToList();
|
||||
|
||||
@@ -85,6 +85,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
});
|
||||
}
|
||||
m.CanDelete = m.DeviceProfile.CanDelete(Database);
|
||||
m.CanDecommission = m.DeviceProfile.CanDecommission(Database);
|
||||
|
||||
if (m.DeviceCount - m.DeviceDecommissionedCount > 0)
|
||||
m.BulkGenerateDocumentTemplates = Database.DocumentTemplates.Where(t => !t.IsHidden).ToList();
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Disco.Web.Areas.Config.Models.DeviceModel
|
||||
public int DeviceDecommissionedCount { get; set; }
|
||||
|
||||
public bool CanDelete { get; set; }
|
||||
public bool CanDecommission { get; set; }
|
||||
|
||||
public override int DeviceGroupId => DeviceModel.Id;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace Disco.Web.Areas.Config.Models.DeviceProfile
|
||||
public int DeviceDecommissionedCount { get; set; }
|
||||
|
||||
public bool CanDelete { get; set; }
|
||||
public bool CanDecommission { get; set; }
|
||||
|
||||
public override int DeviceGroupId => DeviceProfile.Id;
|
||||
}
|
||||
|
||||
@@ -247,6 +247,65 @@
|
||||
@Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model.DeviceComponentsModel)
|
||||
@Html.Partial(MVC.Config.Shared.Views._DeviceGroupDocumentBulkGenerate, Model)
|
||||
<div class="actionBar">
|
||||
@if (Model.CanDecommission)
|
||||
{
|
||||
<button id="DeviceModel_Decommission" class="button">Decommission All Devices</button>
|
||||
<div id="DeviceModel_Decommission_Dialog" class="dialog" title="Model Device Decommission">
|
||||
@using (Html.BeginForm(MVC.API.Device.DeviceModelDecommission(Model.DeviceModel.Id), FormMethod.Post))
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
<div class="clearfix" style="margin-bottom: 10px;">
|
||||
<i class="fa fa-question-circle fa-lg information"></i> Why are these devices to be decommissioned?
|
||||
</div>
|
||||
<div>
|
||||
<ul class="none">
|
||||
@foreach (DecommissionReasons decommissionReason in Enum.GetValues(typeof(DecommissionReasons)).Cast<DecommissionReasons>().OrderBy(r => r.ToString()))
|
||||
{
|
||||
<li>
|
||||
<input type="radio" id="DeviceModel_Decommission_Dialog_Reason_@((int)decommissionReason)"
|
||||
name="decommissionReason" value="@((int)decommissionReason)" @((decommissionReason == DecommissionReasons.EndOfLife) ? "checked=\"checked\"" : string.Empty) />
|
||||
<label for="DeviceModel_Decommission_Dialog_Reason_@((int)decommissionReason)">@(decommissionReason.ReasonMessage())</label>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
<br />
|
||||
<label>
|
||||
<input type="checkbox" value="true" name="unassignUsers" />
|
||||
Unassign devices users
|
||||
</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
let buttonDialog = null;
|
||||
$('#DeviceModel_Decommission').click(function () {
|
||||
if (!buttonDialog) {
|
||||
buttonDialog = $('#DeviceModel_Decommission_Dialog')
|
||||
.dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
buttons: {
|
||||
"Decommission": function () {
|
||||
const $this = $(this);
|
||||
$this.find('form').trigger('submit');
|
||||
$this.dialog("disable");
|
||||
$this.dialog("option", "buttons", null);
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
buttonDialog.dialog('open');
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
}
|
||||
@if (Model.CanDelete)
|
||||
{
|
||||
@Html.ActionLinkButton("Delete", MVC.API.DeviceModel.Delete(Model.DeviceModel.Id, true), "buttonDelete")
|
||||
|
||||
@@ -824,6 +824,224 @@ WriteLiteral(">\r\n");
|
||||
#line hidden
|
||||
|
||||
#line 250 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
if (Model.CanDecommission)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <button");
|
||||
|
||||
WriteLiteral(" id=\"DeviceModel_Decommission\"");
|
||||
|
||||
WriteLiteral(" class=\"button\"");
|
||||
|
||||
WriteLiteral(">Decommission All Devices</button>\r\n");
|
||||
|
||||
WriteLiteral(" <div");
|
||||
|
||||
WriteLiteral(" id=\"DeviceModel_Decommission_Dialog\"");
|
||||
|
||||
WriteLiteral(" class=\"dialog\"");
|
||||
|
||||
WriteLiteral(" title=\"Model Device Decommission\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 254 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 254 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
using (Html.BeginForm(MVC.API.Device.DeviceModelDecommission(Model.DeviceModel.Id), FormMethod.Post))
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 256 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.AntiForgeryToken());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 256 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <div");
|
||||
|
||||
WriteLiteral(" class=\"clearfix\"");
|
||||
|
||||
WriteLiteral(" style=\"margin-bottom: 10px;\"");
|
||||
|
||||
WriteLiteral(">\r\n <i");
|
||||
|
||||
WriteLiteral(" class=\"fa fa-question-circle fa-lg information\"");
|
||||
|
||||
WriteLiteral("></i> Why are these devices to be decommissioned?\r\n </div>\r\n");
|
||||
|
||||
WriteLiteral(" <div>\r\n <ul");
|
||||
|
||||
WriteLiteral(" class=\"none\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 262 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 262 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
foreach (DecommissionReasons decommissionReason in Enum.GetValues(typeof(DecommissionReasons)).Cast<DecommissionReasons>().OrderBy(r => r.ToString()))
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <li>\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"radio\"");
|
||||
|
||||
WriteAttribute("id", Tuple.Create(" id=\"", 9803), Tuple.Create("\"", 9873)
|
||||
, Tuple.Create(Tuple.Create("", 9808), Tuple.Create("DeviceModel_Decommission_Dialog_Reason_", 9808), true)
|
||||
|
||||
#line 265 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 9847), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 9847), false)
|
||||
);
|
||||
|
||||
WriteLiteral("\r\n name=\"decommissionReason\"");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 9940), Tuple.Create("\"", 9974)
|
||||
|
||||
#line 266 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 9948), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 9948), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 266 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write((decommissionReason == DecommissionReasons.EndOfLife) ? "checked=\"checked\"" : string.Empty);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" />\r\n <label");
|
||||
|
||||
WriteAttribute("for", Tuple.Create(" for=\"", 10114), Tuple.Create("\"", 10185)
|
||||
, Tuple.Create(Tuple.Create("", 10120), Tuple.Create("DeviceModel_Decommission_Dialog_Reason_", 10120), true)
|
||||
|
||||
#line 267 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 10159), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 10159), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">");
|
||||
|
||||
|
||||
#line 267 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(decommissionReason.ReasonMessage());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</label>\r\n </li>\r\n");
|
||||
|
||||
|
||||
#line 269 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </ul>\r\n <br />\r\n <label" +
|
||||
">\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"checkbox\"");
|
||||
|
||||
WriteLiteral(" value=\"true\"");
|
||||
|
||||
WriteLiteral(" name=\"unassignUsers\"");
|
||||
|
||||
WriteLiteral(" />\r\n Unassign devices users\r\n </label>" +
|
||||
"\r\n </div>\r\n");
|
||||
|
||||
|
||||
#line 277 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </div>\r\n");
|
||||
|
||||
WriteLiteral(" <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(@">
|
||||
$(function () {
|
||||
let buttonDialog = null;
|
||||
$('#DeviceModel_Decommission').click(function () {
|
||||
if (!buttonDialog) {
|
||||
buttonDialog = $('#DeviceModel_Decommission_Dialog')
|
||||
.dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
buttons: {
|
||||
""Decommission"": function () {
|
||||
const $this = $(this);
|
||||
$this.find('form').trigger('submit');
|
||||
$this.dialog(""disable"");
|
||||
$this.dialog(""option"", ""buttons"", null);
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog(""close"");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
buttonDialog.dialog('open');
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
");
|
||||
|
||||
|
||||
#line 308 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 309 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
if (Model.CanDelete)
|
||||
{
|
||||
|
||||
@@ -831,14 +1049,14 @@ WriteLiteral(">\r\n");
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 252 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 311 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.ActionLinkButton("Delete", MVC.API.DeviceModel.Delete(Model.DeviceModel.Id, true), "buttonDelete"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 252 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 311 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
}
|
||||
|
||||
@@ -848,7 +1066,7 @@ WriteLiteral(">\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 254 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 313 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
if (Model.DeviceCount > 0)
|
||||
{
|
||||
if (Authorization.Has(Claims.Device.Actions.Export))
|
||||
@@ -858,14 +1076,14 @@ WriteLiteral(" ");
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 258 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 317 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.DeviceExportTypes.Model, Model.DeviceModel.Id)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 258 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 317 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
}
|
||||
if (Authorization.Has(Claims.Device.Search) && Model.DeviceCount > 0)
|
||||
@@ -875,14 +1093,14 @@ WriteLiteral(" ");
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 262 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 321 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.ActionLinkButton(string.Format("View {0} Device{1}", Model.DeviceCount, (Model.DeviceCount != 1 ? "s" : null)), MVC.Search.Query(Model.DeviceModel.Id.ToString(), "DeviceModel")));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 262 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 321 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1006,6 +1006,65 @@
|
||||
}
|
||||
@Html.Partial(MVC.Config.Shared.Views._DeviceGroupDocumentBulkGenerate, Model)
|
||||
<div class="actionBar">
|
||||
@if (Model.CanDecommission)
|
||||
{
|
||||
<button id="DeviceProfile_Decommission" class="button">Decommission All Devices</button>
|
||||
<div id="DeviceProfile_Decommission_Dialog" class="dialog" title="Profile Device Decommission">
|
||||
@using (Html.BeginForm(MVC.API.Device.DeviceProfileDecommission(Model.DeviceProfile.Id), FormMethod.Post))
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
<div class="clearfix" style="margin-bottom: 10px;">
|
||||
<i class="fa fa-question-circle fa-lg information"></i> Why are these devices to be decommissioned?
|
||||
</div>
|
||||
<div>
|
||||
<ul class="none">
|
||||
@foreach (DecommissionReasons decommissionReason in Enum.GetValues(typeof(DecommissionReasons)).Cast<DecommissionReasons>().OrderBy(r => r.ToString()))
|
||||
{
|
||||
<li>
|
||||
<input type="radio" id="DeviceProfile_Decommission_Dialog_Reason_@((int)decommissionReason)"
|
||||
name="decommissionReason" value="@((int)decommissionReason)" @((decommissionReason == DecommissionReasons.EndOfLife) ? "checked=\"checked\"" : string.Empty) />
|
||||
<label for="DeviceProfile_Decommission_Dialog_Reason_@((int)decommissionReason)">@(decommissionReason.ReasonMessage())</label>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
<br />
|
||||
<label>
|
||||
<input type="checkbox" value="true" name="unassignUsers" />
|
||||
Unassign devices users
|
||||
</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
let buttonDialog = null;
|
||||
$('#DeviceProfile_Decommission').click(function () {
|
||||
if (!buttonDialog) {
|
||||
buttonDialog = $('#DeviceProfile_Decommission_Dialog')
|
||||
.dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
buttons: {
|
||||
"Decommission": function () {
|
||||
const $this = $(this);
|
||||
$this.find('form').trigger('submit');
|
||||
$this.dialog("disable");
|
||||
$this.dialog("option", "buttons", null);
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
buttonDialog.dialog('open');
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
}
|
||||
@if (canDelete)
|
||||
{
|
||||
@Html.ActionLinkButton("Delete", MVC.API.DeviceProfile.Delete(Model.DeviceProfile.Id, true), "buttonDelete")
|
||||
|
||||
@@ -2989,6 +2989,224 @@ WriteLiteral(">\r\n");
|
||||
#line hidden
|
||||
|
||||
#line 1009 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
if (Model.CanDecommission)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <button");
|
||||
|
||||
WriteLiteral(" id=\"DeviceProfile_Decommission\"");
|
||||
|
||||
WriteLiteral(" class=\"button\"");
|
||||
|
||||
WriteLiteral(">Decommission All Devices</button>\r\n");
|
||||
|
||||
WriteLiteral(" <div");
|
||||
|
||||
WriteLiteral(" id=\"DeviceProfile_Decommission_Dialog\"");
|
||||
|
||||
WriteLiteral(" class=\"dialog\"");
|
||||
|
||||
WriteLiteral(" title=\"Profile Device Decommission\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 1013 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 1013 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
using (Html.BeginForm(MVC.API.Device.DeviceProfileDecommission(Model.DeviceProfile.Id), FormMethod.Post))
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 1015 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
Write(Html.AntiForgeryToken());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 1015 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <div");
|
||||
|
||||
WriteLiteral(" class=\"clearfix\"");
|
||||
|
||||
WriteLiteral(" style=\"margin-bottom: 10px;\"");
|
||||
|
||||
WriteLiteral(">\r\n <i");
|
||||
|
||||
WriteLiteral(" class=\"fa fa-question-circle fa-lg information\"");
|
||||
|
||||
WriteLiteral("></i> Why are these devices to be decommissioned?\r\n </div>\r\n");
|
||||
|
||||
WriteLiteral(" <div>\r\n <ul");
|
||||
|
||||
WriteLiteral(" class=\"none\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 1021 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 1021 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
foreach (DecommissionReasons decommissionReason in Enum.GetValues(typeof(DecommissionReasons)).Cast<DecommissionReasons>().OrderBy(r => r.ToString()))
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <li>\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"radio\"");
|
||||
|
||||
WriteAttribute("id", Tuple.Create(" id=\"", 56977), Tuple.Create("\"", 57049)
|
||||
, Tuple.Create(Tuple.Create("", 56982), Tuple.Create("DeviceProfile_Decommission_Dialog_Reason_", 56982), true)
|
||||
|
||||
#line 1024 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 57023), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 57023), false)
|
||||
);
|
||||
|
||||
WriteLiteral("\r\n name=\"decommissionReason\"");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 57116), Tuple.Create("\"", 57150)
|
||||
|
||||
#line 1025 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 57124), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 57124), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 1025 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
Write((decommissionReason == DecommissionReasons.EndOfLife) ? "checked=\"checked\"" : string.Empty);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" />\r\n <label");
|
||||
|
||||
WriteAttribute("for", Tuple.Create(" for=\"", 57290), Tuple.Create("\"", 57363)
|
||||
, Tuple.Create(Tuple.Create("", 57296), Tuple.Create("DeviceProfile_Decommission_Dialog_Reason_", 57296), true)
|
||||
|
||||
#line 1026 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 57337), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 57337), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">");
|
||||
|
||||
|
||||
#line 1026 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
Write(decommissionReason.ReasonMessage());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</label>\r\n </li>\r\n");
|
||||
|
||||
|
||||
#line 1028 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </ul>\r\n <br />\r\n <label" +
|
||||
">\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"checkbox\"");
|
||||
|
||||
WriteLiteral(" value=\"true\"");
|
||||
|
||||
WriteLiteral(" name=\"unassignUsers\"");
|
||||
|
||||
WriteLiteral(" />\r\n Unassign devices users\r\n </label>" +
|
||||
"\r\n </div>\r\n");
|
||||
|
||||
|
||||
#line 1036 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </div>\r\n");
|
||||
|
||||
WriteLiteral(" <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(@">
|
||||
$(function () {
|
||||
let buttonDialog = null;
|
||||
$('#DeviceProfile_Decommission').click(function () {
|
||||
if (!buttonDialog) {
|
||||
buttonDialog = $('#DeviceProfile_Decommission_Dialog')
|
||||
.dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
buttons: {
|
||||
""Decommission"": function () {
|
||||
const $this = $(this);
|
||||
$this.find('form').trigger('submit');
|
||||
$this.dialog(""disable"");
|
||||
$this.dialog(""option"", ""buttons"", null);
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog(""close"");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
buttonDialog.dialog('open');
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
");
|
||||
|
||||
|
||||
#line 1067 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 1068 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
if (canDelete)
|
||||
{
|
||||
|
||||
@@ -2996,14 +3214,14 @@ WriteLiteral(">\r\n");
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 1011 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
#line 1070 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
Write(Html.ActionLinkButton("Delete", MVC.API.DeviceProfile.Delete(Model.DeviceProfile.Id, true), "buttonDelete"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 1011 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
#line 1070 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
|
||||
}
|
||||
|
||||
@@ -3013,7 +3231,7 @@ WriteLiteral(">\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 1013 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
#line 1072 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
if (Authorization.Has(Claims.Device.Actions.Export))
|
||||
{
|
||||
|
||||
@@ -3021,14 +3239,14 @@ WriteLiteral(" ");
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 1015 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
#line 1074 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
Write(Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.DeviceExportTypes.Profile, Model.DeviceProfile.Id)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 1015 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
#line 1074 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
|
||||
}
|
||||
|
||||
@@ -3038,7 +3256,7 @@ WriteLiteral(" ");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 1017 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
#line 1076 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
if (Authorization.Has(Claims.Device.Search) && Model.DeviceCount > 0)
|
||||
{
|
||||
|
||||
@@ -3046,14 +3264,14 @@ WriteLiteral(" ");
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 1019 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
#line 1078 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
Write(Html.ActionLinkButton(string.Format("View {0} Device{1}", Model.DeviceCount, (Model.DeviceCount != 1 ? "s" : null)), MVC.Search.Query(Model.DeviceProfile.Id.ToString(), "DeviceProfile")));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 1019 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
#line 1078 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user