mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-06-22 07:10:07 -04:00
@@ -2675,6 +2675,8 @@ table.dataTable tbody > tr.selected
|
|||||||
background: var(--skel-section);
|
background: var(--skel-section);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pluginsPage .skel-table-box, .plugin-content .skel-table-box { background: var(--skel-bg); }
|
||||||
|
|
||||||
/* Panel-toned backgrounds */
|
/* Panel-toned backgrounds */
|
||||||
.skel-overview-body, .skel-overview-header, .skel-plugin-body,
|
.skel-overview-body, .skel-overview-header, .skel-plugin-body,
|
||||||
.skel-detail-info-panel, .skel-detail-form {
|
.skel-detail-info-panel, .skel-detail-form {
|
||||||
|
|||||||
@@ -150,12 +150,7 @@ class sensor_config:
|
|||||||
"device_class": "timestamp"
|
"device_class": "timestamp"
|
||||||
})
|
})
|
||||||
|
|
||||||
# Handle 'binary_sensor' or 'sensor' types
|
# prepare mac for "connections"
|
||||||
if self.sensorType in ['binary_sensor', 'sensor']:
|
|
||||||
self.topic = f'homeassistant/{self.sensorType}/{self.deviceId}/{self.sensorName}/config'
|
|
||||||
self.state_topic = f'{topic_root}/{self.sensorType}/{self.deviceId}/state'
|
|
||||||
self.unique_id = f'{self.deviceId}_sensor_{self.sensorName}'
|
|
||||||
|
|
||||||
if self.mac != "":
|
if self.mac != "":
|
||||||
connections_snippet = [
|
connections_snippet = [
|
||||||
["mac", self.mac]
|
["mac", self.mac]
|
||||||
@@ -163,6 +158,12 @@ class sensor_config:
|
|||||||
else:
|
else:
|
||||||
connections_snippet = []
|
connections_snippet = []
|
||||||
|
|
||||||
|
# Handle 'binary_sensor' or 'sensor' types
|
||||||
|
if self.sensorType in ['binary_sensor', 'sensor']:
|
||||||
|
self.topic = f'homeassistant/{self.sensorType}/{self.deviceId}/{self.sensorName}/config'
|
||||||
|
self.state_topic = f'{topic_root}/{self.sensorType}/{self.deviceId}/state'
|
||||||
|
self.unique_id = f'{self.deviceId}_sensor_{self.sensorName}'
|
||||||
|
|
||||||
# Update the message dictionary, expanding it without overwriting
|
# Update the message dictionary, expanding it without overwriting
|
||||||
self.message.update({
|
self.message.update({
|
||||||
"name": self.sensorName,
|
"name": self.sensorName,
|
||||||
@@ -172,8 +173,7 @@ class sensor_config:
|
|||||||
"device": {
|
"device": {
|
||||||
"identifiers": [f"{self.deviceId}_sensor"],
|
"identifiers": [f"{self.deviceId}_sensor"],
|
||||||
"manufacturer": "NetAlertX",
|
"manufacturer": "NetAlertX",
|
||||||
"name": self.deviceName,
|
"name": self.deviceName
|
||||||
"connections": connections_snippet
|
|
||||||
},
|
},
|
||||||
"icon": f'mdi:{self.icon}'
|
"icon": f'mdi:{self.icon}'
|
||||||
})
|
})
|
||||||
@@ -198,7 +198,8 @@ class sensor_config:
|
|||||||
"identifiers": [f"{self.deviceId}_sensor", self.unique_id],
|
"identifiers": [f"{self.deviceId}_sensor", self.unique_id],
|
||||||
"manufacturer": "NetAlertX",
|
"manufacturer": "NetAlertX",
|
||||||
"model": self.model or "Unknown", # Use model if available, else set to 'Unknown'
|
"model": self.model or "Unknown", # Use model if available, else set to 'Unknown'
|
||||||
"name": self.deviceName
|
"name": self.deviceName,
|
||||||
|
"connections": connections_snippet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -630,7 +630,7 @@ function generateDataTable(prefix, tableType, colDefinitions) {
|
|||||||
|
|
||||||
return `
|
return `
|
||||||
<div id="${tableType.toLowerCase()}Target_${prefix}" class="tab-pane ${tableType == "Objects" ? "active":""}" style="position:relative;">
|
<div id="${tableType.toLowerCase()}Target_${prefix}" class="tab-pane ${tableType == "Objects" ? "active":""}" style="position:relative;">
|
||||||
<div id="skel-${tableType.toLowerCase()}Target_${prefix}" class="skel-plugins-tab-pane" style="position:absolute;top:0;left:0;right:0;z-index:1;background:inherit;">${skelHtml}</div>
|
<div id="skel-${tableType.toLowerCase()}Target_${prefix}" class="skel-plugins-tab-pane" style="position:absolute;top:0;left:0;right:0;z-index:1">${skelHtml}</div>
|
||||||
<table id="${tableType.toLowerCase()}Table_${prefix}" class="display table table-striped table-stretched" data-my-dbtable="Plugins_${tableType}">
|
<table id="${tableType.toLowerCase()}Table_${prefix}" class="display table table-striped table-stretched" data-my-dbtable="Plugins_${tableType}">
|
||||||
<thead><tr>${headersHtml}</tr></thead>
|
<thead><tr>${headersHtml}</tr></thead>
|
||||||
</table>
|
</table>
|
||||||
@@ -668,7 +668,7 @@ function initializeDataTables(prefix, colDefinitions, pluginObj) {
|
|||||||
// Fade out the skeleton only after the first draw so there is no gap
|
// Fade out the skeleton only after the first draw so there is no gap
|
||||||
// between the skeleton disappearing and the table rows appearing.
|
// between the skeleton disappearing and the table rows appearing.
|
||||||
initComplete: function() {
|
initComplete: function() {
|
||||||
$(skelId).fadeOut(250, function() { $(this).remove(); });
|
$(skelId).fadeOut(50, function() { $(this).remove(); });
|
||||||
},
|
},
|
||||||
createdRow: function(row, data) {
|
createdRow: function(row, data) {
|
||||||
$(row).attr('data-my-index', data.index);
|
$(row).attr('data-my-index', data.index);
|
||||||
|
|||||||
Reference in New Issue
Block a user