hide decommissioned device profiles and batches by default when updating a devices batch or profile

This commit is contained in:
Gary Sharp committed 2023-11-09 20:48:16 +11:00
1 parent 2e091383ec
commit 46222f2a78
8 files changed
+371 -202

No files matched your search

@@ -10,9 +10,11 @@ namespace Disco.Models.UI.Device
Repository.Device Device { get; set; } Repository.Device Device { get; set; }
List<Repository.DeviceProfile> DeviceProfiles { get; set; } List<Repository.DeviceProfile> DeviceProfiles { get; set; }
HashSet<int> DecommissionedDeviceProfileIds { get; set; }
OrganisationAddress DeviceProfileDefaultOrganisationAddress { get; set; } OrganisationAddress DeviceProfileDefaultOrganisationAddress { get; set; }
List<Repository.DeviceBatch> DeviceBatches { get; set; } List<Repository.DeviceBatch> DeviceBatches { get; set; }
HashSet<int> DecommissionedDeviceBatchIds { get; set; }
JobTableModel Jobs { get; set; } JobTableModel Jobs { get; set; }
+4
View File
@@ -213,6 +213,10 @@
background-color: #cddbec; background-color: #cddbec;
font-weight: 600; font-weight: 600;
} }
#Device_Show_Policies_Profile_Actions_Update_Dialog label,
#Device_Show_Policies_Batch_Actions_Update_Dialog label {
display: block;
}
#DeviceDetailTab-JobsContainer div.jobTable { #DeviceDetailTab-JobsContainer div.jobTable {
margin: -1px; margin: -1px;
border: 1px solid #ddd; border: 1px solid #ddd;
+3
View File
@@ -185,6 +185,9 @@
} }
} }
} }
label {
display: block;
}
} }
#DeviceDetailTab-JobsContainer { #DeviceDetailTab-JobsContainer {
+1 -1
View File
@@ -1 +1 @@
.tableData{border:solid 1px #f4f4f4;border-collapse:collapse;}.tableData>tbody>tr>td{border:solid 1px #f4f4f4;background-color:#fff;}.tableData>tbody>tr:nth-child(odd)>td{background-color:hsl(0,0%,98.5%);}.tableData>thead>tr>th,.tableData>tbody>tr>th{background-color:#f4f4f4;border:solid 1px #f4f4f4;}.tableData>tbody>tr:hover>td{background-color:hsl(0,0%,97.5%);}.tableData>tfoot>tr>th,.tableData>tfoot>tr>td{background-color:#f4f4f4;}.tableDataDark{border:solid 1px #d8d8d8;border-collapse:collapse;}.tableDataDark td{border:solid 1px #d8d8d8;background-color:#fff;}.tableDataDark th{background-color:#eee;border:solid 1px #d8d8d8;}.tableDataContainer{background-color:#fff;}.tableDataVertical{border:solid 1px #f4f4f4;border-collapse:collapse;}.tableDataVertical>tbody>tr:nth-child(odd){background-color:#f4f4f4;margin:0;padding:0;}.tableDataVertical>tbody>tr>th.name{width:170px;text-align:right;}.tableDataVertical table.sub>tbody>tr:not(:first-child)>th,.tableDataVertical table.sub>tbody>tr:not(:first-child)>td{border-top:1px dashed #aaa;}.tableDataVertical table.sub>tbody>tr>th{font-weight:normal;text-align:right;}.tableDataVertical table.sub>tbody>tr>th.name{text-align:right;}.icon16{display:inline-block;height:16px;width:16px;margin-left:2px;cursor:pointer;}.subtleUntilHover{-moz-opacity:.3;opacity:.3;}.subtleUntilHover:hover{-moz-opacity:1;opacity:1;}#layout_PageHeading #Device_Show_Status{margin-left:20px;display:inline-block;height:50px;font-family:"Segoe UI",Arial,Verdana,Tahoma,sans-serif;font-weight:lighter;font-stretch:condensed;font-size:.7em;text-transform:uppercase;}#layout_PageHeading #Device_Show_Status span.icon{margin-right:6px;}#Device_Show #Device_Show_Subjects{table-layout:fixed;}#Device_Show #Device_Show_Subjects>tbody>tr>td{padding-top:0;height:100%;}#Device_Show #Device_Show_Subjects>tbody>tr>td>div{position:relative;}#Device_Show #Device_Show_Subjects>tbody>tr>td>div div.status{margin-top:2px;padding-top:2px;border-top:1px dashed #ddd;}#Device_Show #Device_Show_Subjects>tbody>tr>td>div input.discreet{margin-left:-2px;}#Device_Show #Device_Show_Subjects>tbody>tr>td:not(:last-child){border-right:1px dashed #aaa;}#Device_Show #Device_Show_Subjects #Device_Show_Details table.verticalHeadings>tbody>tr>td:first-child{width:104px;font-weight:600;}#Device_Show #Device_Show_Subjects #Device_Show_Details #Device_Show_Details_Asset_Name{font-weight:600;}#Device_Show #Device_Show_Subjects #Device_Show_Details #Device_Show_Details_Asset_Enrolled_Trusted{display:inline-block;height:16px;padding-left:16px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACWUlEQVQ4y6XRXWiSURgHcJsXa4WNNuuyiy6CoAupixERoXXhmljuxaJiFrVA1i72cVFCOSMt8rNt2YfGO5g5Z1NstWW+c4ZBq4QpqMkEbZDSCObAMprjdf90sIjxsgUdODd/zvmd5zwPCwDrf/aGB7q6utgmk8ngdruzVqt10eVyTWu1Wuk/AXK5vMpoNPpjsRgGbU8/9fbdH/J4PAuRSARKpfLKhoBYLG595nTCaDSZVjPp6TPbHQ5H0mAwfBeJRHXrAp0dna9JcqCguX2H/Xd+S625aLFYQBDE8XWBd+8/TI6Njc+vzcfGX4nLX4FOp5OuC0wGAlS53NzaPPAm2Gi32+H3+5tYJEl+pigKoVAIPp+PnpqaosPhMF1uHB2Px2mv14vya6VgMKhhHGN3d/dSMplENptFIpHA3NwcCoUCSqUSKqvScZVKBbPZHGQEFApFMZ1OI5PJIBqNrkD5fB40Ta8AlcrUajVsNpufEbh+42YxHEkh+/UbUqlZpGd/lAH8WTMzMzDd64d7NMAMDOobi/OpHqh6rqK9jcCvBQncQzK0Xm5DPn0BJ4lz6GgVIkedYAaamxqK0dEDePl4FziczehTsZGLs7BnNwdiwRac4lejvp6La83VzABv/8FF/qG9oD/WQS/fhNptHEw8rEJiuAo7ubXACAtH9m0Fu2YHxQzweEuEVIYnaiFmvQ04f1aItksi5KaP4ZFGjDB5GG/7j4LL5YYYgZYW2c/yiJbv6h/A0EvC4RjGiOsFnK4J+KgABmyjsDufL0skki8CgYCoXOLz+TWrwG+kXMkgQ6yv+QAAAABJRU5ErkJggg==);background-repeat:no-repeat;}#Device_Show #Device_Show_Subjects #Device_Show_Details #Device_Show_User #Device_Show_User_Photo_Container{float:left;padding-right:2px;}#Device_Show #Device_Show_Subjects #Device_Show_Details #Device_Show_User #Device_Show_User_Photo{max-width:48px;height:auto;}#Device_Show #Device_Show_Subjects #Device_Show_Details #Device_Show_User #Device_Show_User_Flags{font-size:16px;}#Device_Show #Device_Show_Subjects #Device_Show_Details #Device_Show_User #Device_Show_User_Flags>i{cursor:default;}#Device_Show #Device_Show_Subjects #Device_Show_Details #Device_Show_User #Device_Show_User_Flags>i>.details{display:none;}#Device_Show #Device_Show_Subjects #Device_Show_Details #Device_Show_GenerateDocument_Container{padding-top:4px;}#Device_Show #Device_Show_Subjects #Device_Show_Policies table.verticalHeadings>tbody>tr>td:first-child{width:120px;font-weight:600;}#Device_Show #Device_Show_Subjects #Device_Show_Aspects #Device_Show_Aspects_Model_Image{display:block;width:256px;height:256px;margin:0 auto;}#Device_Show #Device_Show_Subjects #Device_Show_Subjects_Actions>td{padding-top:4px;}#DeviceDetailTabs{margin-top:10px;border-radius:0;background-image:none;background-color:#fff;border:0;padding:0;}#DeviceDetailTabs #DeviceDetailTabItems{border-radius:0;border-top:1px solid #ddd;border-right:1px solid #ddd;border-left:1px solid #ddd;border-bottom:0;padding:2px 0 0 4px;background-image:none;background-color:#eee;display:table;}#DeviceDetailTabs #DeviceDetailTabItems>li{top:0;borLine truncated .tableData{border:solid 1px #f4f4f4;border-collapse:collapse;}.tableData>tbody>tr>td{border:solid 1px #f4f4f4;background-color:#fff;}.tableData>tbody>tr:nth-child(odd)>td{background-color:hsl(0,0%,98.5%);}.tableData>thead>tr>th,.tableData>tbody>tr>th{background-color:#f4f4f4;border:solid 1px #f4f4f4;}.tableData>tbody>tr:hover>td{background-color:hsl(0,0%,97.5%);}.tableData>tfoot>tr>th,.tableData>tfoot>tr>td{background-color:#f4f4f4;}.tableDataDark{border:solid 1px #d8d8d8;border-collapse:collapse;}.tableDataDark td{border:solid 1px #d8d8d8;background-color:#fff;}.tableDataDark th{background-color:#eee;border:solid 1px #d8d8d8;}.tableDataContainer{background-color:#fff;}.tableDataVertical{border:solid 1px #f4f4f4;border-collapse:collapse;}.tableDataVertical>tbody>tr:nth-child(odd){background-color:#f4f4f4;margin:0;padding:0;}.tableDataVertical>tbody>tr>th.name{width:170px;text-align:right;}.tableDataVertical table.sub>tbody>tr:not(:first-child)>th,.tableDataVertical table.sub>tbody>tr:not(:first-child)>td{border-top:1px dashed #aaa;}.tableDataVertical table.sub>tbody>tr>th{font-weight:normal;text-align:right;}.tableDataVertical table.sub>tbody>tr>th.name{text-align:right;}.icon16{display:inline-block;height:16px;width:16px;margin-left:2px;cursor:pointer;}.subtleUntilHover{-moz-opacity:.3;opacity:.3;}.subtleUntilHover:hover{-moz-opacity:1;opacity:1;}#layout_PageHeading #Device_Show_Status{margin-left:20px;display:inline-block;height:50px;font-family:"Segoe UI",Arial,Verdana,Tahoma,sans-serif;font-weight:lighter;font-stretch:condensed;font-size:.7em;text-transform:uppercase;}#layout_PageHeading #Device_Show_Status span.icon{margin-right:6px;}#Device_Show #Device_Show_Subjects{table-layout:fixed;}#Device_Show #Device_Show_Subjects>tbody>tr>td{padding-top:0;height:100%;}#Device_Show #Device_Show_Subjects>tbody>tr>td>div{position:relative;}#Device_Show #Device_Show_Subjects>tbody>tr>td>div div.status{margin-top:2px;padding-top:2px;border-top:1px dashed #ddd;}#Device_Show #Device_Show_Subjects>tbody>tr>td>div input.discreet{margin-left:-2px;}#Device_Show #Device_Show_Subjects>tbody>tr>td:not(:last-child){border-right:1px dashed #aaa;}#Device_Show #Device_Show_Subjects #Device_Show_Details table.verticalHeadings>tbody>tr>td:first-child{width:104px;font-weight:600;}#Device_Show #Device_Show_Subjects #Device_Show_Details #Device_Show_Details_Asset_Name{font-weight:600;}#Device_Show #Device_Show_Subjects #Device_Show_Details #Device_Show_Details_Asset_Enrolled_Trusted{display:inline-block;height:16px;padding-left:16px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACWUlEQVQ4y6XRXWiSURgHcJsXa4WNNuuyiy6CoAupixERoXXhmljuxaJiFrVA1i72cVFCOSMt8rNt2YfGO5g5Z1NstWW+c4ZBq4QpqMkEbZDSCObAMprjdf90sIjxsgUdODd/zvmd5zwPCwDrf/aGB7q6utgmk8ngdruzVqt10eVyTWu1Wuk/AXK5vMpoNPpjsRgGbU8/9fbdH/J4PAuRSARKpfLKhoBYLG595nTCaDSZVjPp6TPbHQ5H0mAwfBeJRHXrAp0dna9JcqCguX2H/Xd+S625aLFYQBDE8XWBd+8/TI6Njc+vzcfGX4nLX4FOp5OuC0wGAlS53NzaPPAm2Gi32+H3+5tYJEl+pigKoVAIPp+PnpqaosPhMF1uHB2Px2mv14vya6VgMKhhHGN3d/dSMplENptFIpHA3NwcCoUCSqUSKqvScZVKBbPZHGQEFApFMZ1OI5PJIBqNrkD5fB40Ta8AlcrUajVsNpufEbh+42YxHEkh+/UbUqlZpGd/lAH8WTMzMzDd64d7NMAMDOobi/OpHqh6rqK9jcCvBQncQzK0Xm5DPn0BJ4lz6GgVIkedYAaamxqK0dEDePl4FziczehTsZGLs7BnNwdiwRac4lejvp6La83VzABv/8FF/qG9oD/WQS/fhNptHEw8rEJiuAo7ubXACAtH9m0Fu2YHxQzweEuEVIYnaiFmvQ04f1aItksi5KaP4ZFGjDB5GG/7j4LL5YYYgZYW2c/yiJbv6h/A0EvC4RjGiOsFnK4J+KgABmyjsDufL0skki8CgYCoXOLz+TWrwG+kXMkgQ6yv+QAAAABJRU5ErkJggg==);background-repeat:no-repeat;}#Device_Show #Device_Show_Subjects #Device_Show_Details #Device_Show_User #Device_Show_User_Photo_Container{float:left;padding-right:2px;}#Device_Show #Device_Show_Subjects #Device_Show_Details #Device_Show_User #Device_Show_User_Photo{max-width:48px;height:auto;}#Device_Show #Device_Show_Subjects #Device_Show_Details #Device_Show_User #Device_Show_User_Flags{font-size:16px;}#Device_Show #Device_Show_Subjects #Device_Show_Details #Device_Show_User #Device_Show_User_Flags>i{cursor:default;}#Device_Show #Device_Show_Subjects #Device_Show_Details #Device_Show_User #Device_Show_User_Flags>i>.details{display:none;}#Device_Show #Device_Show_Subjects #Device_Show_Details #Device_Show_GenerateDocument_Container{padding-top:4px;}#Device_Show #Device_Show_Subjects #Device_Show_Policies table.verticalHeadings>tbody>tr>td:first-child{width:120px;font-weight:600;}#Device_Show #Device_Show_Subjects #Device_Show_Aspects #Device_Show_Aspects_Model_Image{display:block;width:256px;height:256px;margin:0 auto;}#Device_Show #Device_Show_Subjects #Device_Show_Subjects_Actions>td{padding-top:4px;}#DeviceDetailTabs{margin-top:10px;border-radius:0;background-image:none;background-color:#fff;border:0;padding:0;}#DeviceDetailTabs #DeviceDetailTabItems{border-radius:0;border-top:1px solid #ddd;border-right:1px solid #ddd;border-left:1px solid #ddd;border-bottom:0;padding:2px 0 0 4px;background-image:none;background-color:#eee;display:table;}#DeviceDetailTabs #DeviceDetailTabItems>li{top:0;borLine truncated
+22 -2
View File
@@ -245,10 +245,30 @@ namespace Disco.Web.Controllers
//} //}
if (Authorization.Has(Claims.Device.Properties.DeviceProfile)) if (Authorization.Has(Claims.Device.Properties.DeviceProfile))
m.DeviceProfiles = Database.DeviceProfiles.ToList(); {
var profiles = Database.DeviceProfiles.Select(dp =>
new
{
Profile = dp,
DecommissionedCount = dp.Devices.Count(d => d.DecommissionedDate.HasValue),
DeviceCount = dp.Devices.Count(),
}).ToList();
m.DeviceProfiles = profiles.Select(p => p.Profile).OrderBy(p => p.Name).ToList();
m.DecommissionedDeviceProfileIds = new HashSet<int>(profiles.Where(p => p.DeviceCount > 0 && p.DecommissionedCount == p.DeviceCount).Select(p => p.Profile.Id));
}
if (Authorization.Has(Claims.Device.Properties.DeviceBatch)) if (Authorization.Has(Claims.Device.Properties.DeviceBatch))
m.DeviceBatches = Database.DeviceBatches.ToList(); {
var batches = Database.DeviceBatches.Select(db =>
new
{
Batch = db,
DecommissionedCount = db.Devices.Count(d => d.DecommissionedDate.HasValue),
DeviceCount = db.Devices.Count(),
}).ToList();
m.DeviceBatches = batches.Select(b => b.Batch).OrderBy(b => b.Name).ToList();
m.DecommissionedDeviceBatchIds = new HashSet<int>(batches.Where(b => b.DeviceCount > 0 && b.DecommissionedCount == b.DeviceCount).Select(b => b.Batch.Id));
}
if (Authorization.Has(Claims.Device.ShowJobs)) if (Authorization.Has(Claims.Device.ShowJobs))
{ {
+2
View File
@@ -14,11 +14,13 @@ namespace Disco.Web.Models.Device
public Disco.Models.Repository.Device Device { get; set; } public Disco.Models.Repository.Device Device { get; set; }
public List<Disco.Models.Repository.DeviceProfile> DeviceProfiles { get; set; } public List<Disco.Models.Repository.DeviceProfile> DeviceProfiles { get; set; }
public HashSet<int> DecommissionedDeviceProfileIds { get; set; }
public Disco.Models.BI.Config.OrganisationAddress DeviceProfileDefaultOrganisationAddress { get; set; } public Disco.Models.BI.Config.OrganisationAddress DeviceProfileDefaultOrganisationAddress { get; set; }
public List<PluginFeatureManifest> DeviceProfileCertificateProviders { get; set; } public List<PluginFeatureManifest> DeviceProfileCertificateProviders { get; set; }
public List<PluginFeatureManifest> DeviceProfileWirelessProfileProviders { get; set; } public List<PluginFeatureManifest> DeviceProfileWirelessProfileProviders { get; set; }
public List<Disco.Models.Repository.DeviceBatch> DeviceBatches { get; set; } public List<Disco.Models.Repository.DeviceBatch> DeviceBatches { get; set; }
public HashSet<int> DecommissionedDeviceBatchIds { get; set; }
public JobTableModel Jobs { get; set; } public JobTableModel Jobs { get; set; }
public List<Disco.Models.Repository.DeviceCertificate> Certificates { get; set; } public List<Disco.Models.Repository.DeviceCertificate> Certificates { get; set; }
@@ -393,11 +393,23 @@
<ul class="none"> <ul class="none">
@foreach (var dp in Model.DeviceProfiles.OrderBy(i => i.Name)) @foreach (var dp in Model.DeviceProfiles.OrderBy(i => i.Name))
{ {
<li> var isDecommissioned = Model.DecommissionedDeviceProfileIds.Contains(dp.Id);
<input type="radio" data-deviceprofileid="@dp.Id" name="DeviceProfile" id="DeviceProfile_@(dp.Id)" /><label for="DeviceProfile_@(dp.Id)" title="Distribution: @(dp.DistributionType)">@dp.Name</label> <li class="@(isDecommissioned ? "hidden" : null)">
<label title="Distribution: @(dp.DistributionType)">
<input type="radio" data-deviceprofileid="@dp.Id" name="DeviceProfile" />
@dp.Name
</label>
</li> </li>
if (isDecommissioned)
{
<li class="hidden decommissioned-padding"></li>
}
} }
</ul> </ul>
@if (Model.DecommissionedDeviceProfileIds.Count > 0)
{
<a class="button small show-decommissioned" href="#">Show Decommissioned</a>
}
</div> </div>
</div> </div>
<script> <script>
@@ -442,6 +454,16 @@
dialogContainers.removeClass('selected'); dialogContainers.removeClass('selected');
$(this).closest('li').addClass('selected'); $(this).closest('li').addClass('selected');
}); });
buttonDialog.find('.show-decommissioned')
.click(function (e) {
e.preventDefault();
var $this = $(this);
buttonDialog.find('ul.none')
.find('li.hidden').removeClass('hidden')
.filter('.decommissioned-padding').remove();
$this.remove();
return false;
})
} }
dialogInputs.filter('[data-deviceprofileid=' + currentProfile + ']').prop('checked', true).change(); dialogInputs.filter('[data-deviceprofileid=' + currentProfile + ']').prop('checked', true).change();
@@ -523,11 +545,23 @@
<ul class="none"> <ul class="none">
@foreach (var db in Model.DeviceBatches.OrderBy(i => i.Name)) @foreach (var db in Model.DeviceBatches.OrderBy(i => i.Name))
{ {
<li> var isDecommissioned = Model.DecommissionedDeviceBatchIds.Contains(db.Id);
<input type="radio" data-devicebatchid="@db.Id" name="DeviceBatch" id="DeviceBatch_@(db.Id)" /><label for="DeviceBatch_@(db.Id)" title="Purchased: @(db.PurchaseDate.ToLongDateString())">@db.Name</label> <li class="@(isDecommissioned ? "hidden" : null)">
<label title="Purchased: @(db.PurchaseDate.ToLongDateString())">
<input type="radio" data-devicebatchid="@db.Id" name="DeviceBatch" />
@db.Name
</label>
</li> </li>
if (isDecommissioned)
{
<li class="hidden decommissioned-padding"></li>
}
} }
</ul> </ul>
@if (Model.DecommissionedDeviceBatchIds.Count > 0)
{
<a class="button small show-decommissioned" href="#">Show Decommissioned</a>
}
</div> </div>
</div> </div>
<script> <script>
@@ -572,6 +606,16 @@
dialogContainers.removeClass('selected'); dialogContainers.removeClass('selected');
$(this).closest('li').addClass('selected'); $(this).closest('li').addClass('selected');
}); });
buttonDialog.find('.show-decommissioned')
.click(function (e) {
e.preventDefault();
var $this = $(this);
buttonDialog.find('ul.none')
.find('li.hidden').removeClass('hidden')
.filter('.decommissioned-padding').remove();
$this.remove();
return false;
})
} }
if (!!currentBatch) { if (!!currentBatch) {
File diff suppressed because it is too large. Load diff