commit 01/10/2025
This commit is contained in:
@@ -8,20 +8,21 @@
|
||||
/**
|
||||
* @type {SoundChannel[]}
|
||||
*/
|
||||
let soundChannels = [];
|
||||
window.soundChannels = [];
|
||||
|
||||
// Currently selected sound channel row in the table
|
||||
let selectedSoundChannel = null;
|
||||
window.selectedSoundChannel = null;
|
||||
|
||||
/**
|
||||
* Fills the sound channel table body with the provided data.
|
||||
* @param {SoundChannel[]} vv Sound channel data to populate the table.
|
||||
*/
|
||||
function fill_soundchanneltablebody(vv) {
|
||||
const $tbody = $('#soundchanneltablebody');
|
||||
const $btnEditSoundChannel = $('#btnEditSoundChannel');
|
||||
const $tablesizeSoundChannel = $('#tablesizeSoundChannel');
|
||||
let $tbody = $('#soundchanneltablebody');
|
||||
let $btnEditSoundChannel = $('#btnEditSoundChannel');
|
||||
let $tablesizeSoundChannel = $('#tablesizeSoundChannel');
|
||||
$tbody.empty();
|
||||
|
||||
$tablesizeSoundChannel.text('Table Length : N/A');
|
||||
if (!Array.isArray(vv) || vv.length === 0) return;
|
||||
|
||||
@@ -55,12 +56,12 @@ function fill_soundchanneltablebody(vv) {
|
||||
* @param {String} APIURL API URL endpoint (default "SoundChannel/")
|
||||
*/
|
||||
function reloadSoundChannel(APIURL = "SoundChannel/") {
|
||||
SoundChannelList = [];
|
||||
window.soundChannels = [];
|
||||
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
||||
if (Array.isArray(okdata)) {
|
||||
//console.log("reloadSoundChannel : ", okdata)
|
||||
SoundChannelList = okdata;
|
||||
fill_soundchanneltablebody(SoundChannelList);
|
||||
window.soundChannels.push(...okdata);
|
||||
fill_soundchanneltablebody(window.soundChannels);
|
||||
} else console.log("reloadSoundChannel: okdata is not array");
|
||||
}, (errdata) => {
|
||||
alert("Error loading sound channels : " + errdata.message);
|
||||
@@ -85,12 +86,14 @@ $(document).ready(function () {
|
||||
$findsoundchannel.on('input', function () {
|
||||
let searchTerm = $(this).val().toLowerCase();
|
||||
if (searchTerm.length==0){
|
||||
fill_soundchanneltablebody(SoundChannelList);
|
||||
window.selectedSoundChannel = null;
|
||||
fill_soundchanneltablebody(window.soundChannels);
|
||||
} else {
|
||||
let filteredChannels = SoundChannelList.filter(channel =>
|
||||
channel.index.toString().includes(searchTerm) ||
|
||||
channel.description.toLowerCase().includes(searchTerm) ||
|
||||
channel.ip.toLowerCase().includes(searchTerm)
|
||||
window.selectedSoundChannel = null;
|
||||
let filteredChannels = window.soundChannels.filter(xx =>
|
||||
xx.index.toString().includes(searchTerm) ||
|
||||
xx.channel.toLowerCase().includes(searchTerm) ||
|
||||
xx.ip.toLowerCase().includes(searchTerm)
|
||||
);
|
||||
fill_soundchanneltablebody(filteredChannels);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user