commit 09/10/2025
User Management belum kelar
This commit is contained in:
@@ -20,263 +20,6 @@ window.languages = [];
|
||||
*/
|
||||
window.scheduledays = []
|
||||
|
||||
/**
|
||||
* @typedef {Object} MessageBank
|
||||
* @property {number} index
|
||||
* @property {string} description
|
||||
* @property {string} language
|
||||
* @property {number} aNN_ID
|
||||
* @property {string} voice_Type
|
||||
* @property {string} message_Detail
|
||||
* @property {string} message_TAGS
|
||||
*/
|
||||
|
||||
/**
|
||||
* List of Messagebank data loaded from server
|
||||
* taruh di sini karena dipakai di banyak tempat
|
||||
* @type {MessageBank[]}
|
||||
*/
|
||||
window.messagebankdata ??= [];
|
||||
|
||||
/**
|
||||
* Reload message bank from server
|
||||
* @param {string} APIURL API URL endpoint, default "MessageBank/"
|
||||
* @param {Function|null} callback Optional callback function to execute after loading
|
||||
*/
|
||||
function reloadMessageBank(APIURL = "MessageBank/", callback=null) {
|
||||
window.messagebankdata ??= [];
|
||||
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
||||
if (Array.isArray(okdata)) {
|
||||
window.messagebankdata.push(...okdata);
|
||||
console.log("Loaded " + window.messagebankdata.length + " message bank items");
|
||||
window.selectedmessagerow = null;
|
||||
if (callback && typeof callback === 'function') callback();
|
||||
}
|
||||
}, (errdata) => {
|
||||
alert("Error loading messagebank : " + errdata.message);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} ScheduleBank
|
||||
* @property {number} index
|
||||
* @property {string} description
|
||||
* @property {string} day
|
||||
* @property {string} time
|
||||
* @property {string} soundpath
|
||||
* @property {number} repeat
|
||||
* @property {boolean} enable
|
||||
* @property {string} broadcastZones
|
||||
* @property {string} language
|
||||
*/
|
||||
|
||||
/** List of Schedulebank data loaded from server
|
||||
* @type {ScheduleBank[]}
|
||||
*/
|
||||
window.schedulebankdata = [];
|
||||
|
||||
/**
|
||||
* Reload timer bank from server
|
||||
* taruh di sini karena dipakai di banyak tempat
|
||||
* @param {string} APIURL API URL endpoint, default "ScheduleBank/"
|
||||
* @param {Function|null} callback Optional callback function to execute after loading
|
||||
*/
|
||||
function reloadTimerBank(APIURL = "ScheduleBank/", callback=null) {
|
||||
window.schedulebankdata = [];
|
||||
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
||||
if (Array.isArray(okdata)) {
|
||||
window.schedulebankdata.push(...okdata);
|
||||
selectedschedulerow = null;
|
||||
console.log("Loaded " + window.schedulebankdata.length + " schedule bank items");
|
||||
if (callback && typeof callback === 'function') callback();
|
||||
}
|
||||
}, (errdata) => {
|
||||
alert("Error loading schedulebank : " + errdata.message);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} BroadcastZone
|
||||
* @property {number} index
|
||||
* @property {string} description
|
||||
* @property {String} SoundChannel
|
||||
* @property {String} Box
|
||||
* @property {String} Relay
|
||||
*/
|
||||
|
||||
/**
|
||||
* List of broadcast zones available
|
||||
* @type {BroadcastZone[]}
|
||||
*/
|
||||
window.BroadcastZoneList ??= [];
|
||||
|
||||
/**
|
||||
* Reload broadcast zones from server
|
||||
* taruh di sini karena dipakai di banyak tempat
|
||||
* @param {String} APIURL API URL endpoint (default "BroadcastZones/")
|
||||
* @param {Function|null} callback Optional callback function to execute after loading
|
||||
*/
|
||||
function reloadBroadcastZones(APIURL = "BroadcastZones/", callback=null) {
|
||||
window.BroadcastZoneList = [];
|
||||
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
||||
if (Array.isArray(okdata)) {
|
||||
//console.log("reloadBroadcastZones : ", okdata)
|
||||
window.BroadcastZoneList.push(...okdata);
|
||||
console.log("Loaded " + window.BroadcastZoneList.length + " broadcast zone items");
|
||||
window.selectedbroadcastzonerow = null;
|
||||
if (callback && typeof callback === 'function') callback();
|
||||
} else console.log("reloadBroadcastZones: okdata is not array");
|
||||
}, (errdata) => {
|
||||
alert("Error loading broadcast zones : " + errdata.message);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} SoundBank
|
||||
* @property {number} index
|
||||
* @property {string} description
|
||||
* @property {string} tag
|
||||
* @property {string} category
|
||||
* @property {string} language
|
||||
* @property {string} voiceType
|
||||
* @property {string} path
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} Select2item
|
||||
* @property {number} id
|
||||
* @property {string} text
|
||||
*/
|
||||
|
||||
/**
|
||||
* List of Soundbank data loaded from server
|
||||
* taruh di sini karena dipakai di banyak tempat
|
||||
* @type {SoundBank[]}
|
||||
*/
|
||||
window.soundbankdata = [];
|
||||
|
||||
/**
|
||||
* List of sound files in the soundbank directory, that ends with .wav or .mp3
|
||||
* taruh di sini karena dipakai di banyak tempat
|
||||
* @type {string[]}
|
||||
*/
|
||||
window.soundbankfiles = [];
|
||||
|
||||
/**
|
||||
* Select2 data source
|
||||
* See https://select2.org/data-sources/formats
|
||||
* @type {Select2item[]}
|
||||
*/
|
||||
window.select2data = [];
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reload sound bank from server
|
||||
* @param {String} APIURL API URL endpoint, default "SoundBank/"
|
||||
* @param {Function|null} callback Optional callback function to execute after loading
|
||||
*/
|
||||
function reloadSoundBank(APIURL = "SoundBank/", callback=null) {
|
||||
window.soundbankdata = [];
|
||||
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
||||
|
||||
if (Array.isArray(okdata)) {
|
||||
window.soundbankdata.push(...okdata);
|
||||
window.selectedsoundrow = null;
|
||||
console.log("Loaded " + window.soundbankdata.length + " sound bank items");
|
||||
if (callback && typeof callback === 'function') callback();
|
||||
}
|
||||
}, (errdata) => {
|
||||
alert("Error loading soundbank : " + errdata.message);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload soundbank files from server
|
||||
* @param {String} APIURL API URL endpoint (default "SoundBank/")
|
||||
* @param {Function|null} callback Optional callback function to execute after loading
|
||||
*/
|
||||
function reloadSoundbankFiles(APIURL = "SoundBank/",callback=null) {
|
||||
window.soundbankfiles = [];
|
||||
fetchAPI(APIURL + "ListFiles", "GET", {}, null, (okdata) => {
|
||||
// okdata is a string contains elements separated by semicolon ;
|
||||
if (Array.isArray(okdata)) {
|
||||
window.soundbankfiles = okdata.filter(item => item.trim().length > 0);
|
||||
// refill select2data
|
||||
window.select2data = window.soundbankfiles.map((item, index) => ({ id: index + 1, text: item }));
|
||||
console.log("Loaded " + window.soundbankfiles.length + " sound bank files");
|
||||
if (callback && typeof callback === 'function') callback();
|
||||
} else console.log("reloadSoundbankFiles: okdata is not array");
|
||||
}, (errdata) => {
|
||||
alert("Error loading soundbank files : " + errdata.message);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} SoundChannel
|
||||
* @property {number} index - The index of the sound channel.
|
||||
* @property {string} channel - The name of the sound channel.
|
||||
* @property {string} ip - The IP address associated with the sound channel.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @type {SoundChannel[]}
|
||||
*/
|
||||
window.soundChannels = [];
|
||||
|
||||
/**
|
||||
* Reload sound channels from server
|
||||
* @param {String} APIURL API URL endpoint (default "SoundChannel/")
|
||||
* @param {Function|null} callback Optional callback function to execute after loading
|
||||
*/
|
||||
function reloadSoundChannel(APIURL = "SoundChannel/", callback=null) {
|
||||
window.soundChannels = [];
|
||||
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
||||
if (Array.isArray(okdata)) {
|
||||
//console.log("reloadSoundChannel : ", okdata)
|
||||
window.soundChannels.push(...okdata);
|
||||
window.selectedsoundchannelrow = null;
|
||||
console.log("Loaded " + window.soundChannels.length + " sound channel items");
|
||||
if (callback && typeof callback === 'function') callback();
|
||||
} else console.log("reloadSoundChannel: okdata is not array");
|
||||
}, (errdata) => {
|
||||
alert("Error loading sound channels : " + errdata.message);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} LanguageBank
|
||||
* @property {number} index
|
||||
* @property {string} tag
|
||||
* @property {string} language
|
||||
*
|
||||
*/
|
||||
|
||||
/** List of Languagebank data loaded from server
|
||||
* @type {LanguageBank[]}
|
||||
*/
|
||||
window.languagebankdata = [];
|
||||
|
||||
/**
|
||||
* Reload language bank from server
|
||||
* @param {string} APIURL API URL endpoint, default "LanguageLink/"
|
||||
* @param {Function|null} callback Optional callback function to execute after loading
|
||||
*/
|
||||
function reloadLanguageBank(APIURL = "LanguageLink/", callback=null) {
|
||||
window.languagebankdata = [];
|
||||
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
||||
if (Array.isArray(okdata)) {
|
||||
window.languagebankdata.push(...okdata);
|
||||
window.selectedlanguagerow = null;
|
||||
console.log("Loaded " + window.languagebankdata.length + " language bank items");
|
||||
if (callback && typeof callback === 'function') callback();
|
||||
}
|
||||
}, (errdata) => {
|
||||
alert("Error loading languagebank : " + errdata.message);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a list item element
|
||||
* @param {String} text Text Content for the list item
|
||||
@@ -568,13 +311,7 @@ $(document).ready(function () {
|
||||
getCategories();
|
||||
getLanguages();
|
||||
getScheduledDays();
|
||||
reloadMessageBank();
|
||||
reloadTimerBank();
|
||||
reloadBroadcastZones();
|
||||
reloadSoundBank();
|
||||
reloadSoundbankFiles();
|
||||
reloadSoundChannel();
|
||||
reloadLanguageBank();
|
||||
|
||||
|
||||
// Initialize WebSocket connection
|
||||
window.ws = new WebSocket(wsURL);
|
||||
|
||||
Reference in New Issue
Block a user