Add PC-machine relationships API and report, fix shopfloor dashboard
- Add getPCMachineRelationships API endpoint for PC-to-machine mappings - Add pcmachinerelationships.asp report page with copy table/CSV/JSON export - Fix shopfloor dashboard to immediately hide deactivated notifications - Add Firewall (machinetypeid 46) support to network device pages - Add model migration warning banner to networkdevices.asp - Create SQL script for hybrid model/machine type view Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
<a class="dropdown-item" href="deviceidf.asp?id=0"><i class="zmdi zmdi-city-alt"></i> Add IDF</a>
|
||||
<a class="dropdown-item" href="deviceserver.asp?id=0"><i class="zmdi zmdi-storage"></i> Add Server</a>
|
||||
<a class="dropdown-item" href="deviceswitch.asp?id=0"><i class="zmdi zmdi-device-hub"></i> Add Switch</a>
|
||||
<a class="dropdown-item" href="devicefirewall.asp?id=0"><i class="zmdi zmdi-shield-security"></i> Add Firewall</a>
|
||||
<a class="dropdown-item" href="devicecamera.asp?id=0"><i class="zmdi zmdi-videocam"></i> Add Camera</a>
|
||||
<a class="dropdown-item" href="deviceaccesspoint.asp?id=0"><i class="zmdi zmdi-wifi"></i> Add Access Point</a>
|
||||
<a class="dropdown-item" href="addprinter.asp"><i class="zmdi zmdi-print"></i> Add Printer</a>
|
||||
@@ -47,6 +48,107 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Model Migration Warning - Devices needing vendor/model updates -->
|
||||
<%
|
||||
' Check for devices that need model fixes
|
||||
Dim rsModelIssues, modelIssueCount
|
||||
Dim strModelIssueSQL
|
||||
strModelIssueSQL = "SELECT " & _
|
||||
"ma.machineid, " & _
|
||||
"COALESCE(ma.alias, ma.machinenumber) as device_name, " & _
|
||||
"mt_machine.machinetype as current_type, " & _
|
||||
"ma.machinetypeid as machine_typeid, " & _
|
||||
"mo.modelnumber, " & _
|
||||
"CASE " & _
|
||||
" WHEN ma.modelnumberid IS NULL THEN 'No model assigned' " & _
|
||||
" WHEN mo.machinetypeid IS NULL THEN 'Model has no type set' " & _
|
||||
" WHEN mo.machinetypeid NOT IN (16,17,18,19,20,46) THEN 'Model has incorrect type' " & _
|
||||
" ELSE 'OK' " & _
|
||||
"END as issue " & _
|
||||
"FROM machines ma " & _
|
||||
"JOIN machinetypes mt_machine ON ma.machinetypeid = mt_machine.machinetypeid " & _
|
||||
"LEFT JOIN models mo ON ma.modelnumberid = mo.modelnumberid " & _
|
||||
"WHERE ma.machinetypeid IN (16,17,18,19,20,46) " & _
|
||||
"AND ma.isactive = 1 " & _
|
||||
"AND (ma.modelnumberid IS NULL OR mo.machinetypeid IS NULL OR mo.machinetypeid NOT IN (16,17,18,19,20,46)) " & _
|
||||
"ORDER BY mt_machine.machinetype, ma.alias"
|
||||
Set rsModelIssues = objConn.Execute(strModelIssueSQL)
|
||||
|
||||
' Count issues
|
||||
modelIssueCount = 0
|
||||
If Not rsModelIssues.EOF Then
|
||||
rsModelIssues.MoveFirst
|
||||
Do While Not rsModelIssues.EOF
|
||||
modelIssueCount = modelIssueCount + 1
|
||||
rsModelIssues.MoveNext
|
||||
Loop
|
||||
rsModelIssues.MoveFirst
|
||||
End If
|
||||
|
||||
If modelIssueCount > 0 Then
|
||||
%>
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert" style="margin-bottom:20px;">
|
||||
<h5 class="alert-heading"><i class="zmdi zmdi-alert-triangle"></i> Model Migration Required</h5>
|
||||
<p><strong><%=modelIssueCount%> device(s)</strong> need vendor/model updates to complete the migration from machine-level type assignment to model-level type assignment.</p>
|
||||
<hr>
|
||||
<p class="mb-0">
|
||||
<a class="btn btn-sm btn-warning" data-toggle="collapse" href="#modelIssuesList" role="button">
|
||||
<i class="zmdi zmdi-eye"></i> Show Devices Needing Updates
|
||||
</a>
|
||||
</p>
|
||||
<div class="collapse mt-3" id="modelIssuesList">
|
||||
<table class="table table-sm table-bordered" style="background:#fff; color:#333;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Device</th>
|
||||
<th>Type</th>
|
||||
<th>Current Model</th>
|
||||
<th>Issue</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
Dim editUrl
|
||||
Do While Not rsModelIssues.EOF
|
||||
Select Case rsModelIssues("current_type")
|
||||
Case "IDF"
|
||||
editUrl = "deviceidf.asp?id=" & rsModelIssues("machineid")
|
||||
Case "Server"
|
||||
editUrl = "deviceserver.asp?id=" & rsModelIssues("machineid")
|
||||
Case "Switch"
|
||||
editUrl = "deviceswitch.asp?id=" & rsModelIssues("machineid")
|
||||
Case "Firewall"
|
||||
editUrl = "devicefirewall.asp?id=" & rsModelIssues("machineid")
|
||||
Case "Camera"
|
||||
editUrl = "devicecamera.asp?id=" & rsModelIssues("machineid")
|
||||
Case "Access Point"
|
||||
editUrl = "deviceaccesspoint.asp?id=" & rsModelIssues("machineid")
|
||||
Case Else
|
||||
editUrl = "displaydevice.asp?id=" & rsModelIssues("machineid")
|
||||
End Select
|
||||
%>
|
||||
<tr>
|
||||
<td><%=Server.HTMLEncode(rsModelIssues("device_name") & "")%></td>
|
||||
<td><%=Server.HTMLEncode(rsModelIssues("current_type") & "")%></td>
|
||||
<td><%If IsNull(rsModelIssues("modelnumber")) Or rsModelIssues("modelnumber") = "" Then Response.Write("<em>None</em>") Else Response.Write(Server.HTMLEncode(rsModelIssues("modelnumber") & ""))%></td>
|
||||
<td><span class="badge badge-warning"><%=Server.HTMLEncode(rsModelIssues("issue") & "")%></span></td>
|
||||
<td><a href="<%=editUrl%>" class="btn btn-xs btn-primary"><i class="zmdi zmdi-edit"></i> Edit</a></td>
|
||||
</tr>
|
||||
<%
|
||||
rsModelIssues.MoveNext
|
||||
Loop
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
End If
|
||||
rsModelIssues.Close
|
||||
Set rsModelIssues = Nothing
|
||||
%>
|
||||
|
||||
<!-- Filter Tabs -->
|
||||
<%
|
||||
Dim filterType
|
||||
@@ -89,6 +191,11 @@
|
||||
<i class="zmdi zmdi-device-hub"></i> Switches
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <%If filterType="Firewall" Then Response.Write("active")%>" href="networkdevices.asp?filter=Firewall">
|
||||
<i class="zmdi zmdi-shield-security"></i> Firewalls
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="table-responsive">
|
||||
@@ -102,8 +209,8 @@ If filterType = "IDF" Then
|
||||
Response.Write("<th scope='col'><i class='zmdi zmdi-pin'></i></th>")
|
||||
Response.Write("<th scope='col'>Name</th>")
|
||||
Response.Write("<th scope='col'>Description</th>")
|
||||
ElseIf filterType = "Server" Or filterType = "Switch" Then
|
||||
' Server/Switch columns: Location, Name, Vendor, Model, Serial, IP Address, FQDN, Description
|
||||
ElseIf filterType = "Server" Or filterType = "Switch" Or filterType = "Firewall" Then
|
||||
' Server/Switch/Firewall columns: Location, Name, Vendor, Model, Serial, IP Address, FQDN, Description
|
||||
Response.Write("<th scope='col'><i class='zmdi zmdi-pin'></i></th>")
|
||||
Response.Write("<th scope='col'>Name</th>")
|
||||
Response.Write("<th scope='col'>Vendor</th>")
|
||||
@@ -255,7 +362,7 @@ End If
|
||||
End If
|
||||
Response.Write("</td>")
|
||||
|
||||
ElseIf filterType = "Server" Or filterType = "Switch" Then
|
||||
ElseIf filterType = "Server" Or filterType = "Switch" Or filterType = "Firewall" Then
|
||||
' Vendor, Model, Serial, IP Address, FQDN, Description, Actions
|
||||
Response.Write("<td>")
|
||||
If Not IsNull(rs("vendor")) Then
|
||||
@@ -475,6 +582,9 @@ End If
|
||||
Case "Switch":
|
||||
noDataMessage = "No switches found."
|
||||
colspanCount = "8"
|
||||
Case "Firewall":
|
||||
noDataMessage = "No firewalls found."
|
||||
colspanCount = "8"
|
||||
Case "Camera":
|
||||
noDataMessage = "No cameras found."
|
||||
colspanCount = "8"
|
||||
|
||||
Reference in New Issue
Block a user