mirror of
https://github.com/anthonyaxenov/iptv.git
synced 2024-12-22 06:15:48 +00:00
Фиксы статусов проверки плейлистов в списке
This commit is contained in:
parent
e42b8dec7d
commit
0df777ef0a
@ -22,9 +22,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{% for id, playlist in playlists %}
|
{% for id, playlist in playlists %}
|
||||||
<tr class="pls" data-playlist-id="{{ id }}">
|
<tr class="pls" data-playlist-id="{{ id }}">
|
||||||
<td class="text-center id">
|
<td class="text-center font-monospace id">{{ id }}</td>
|
||||||
<strong>{{ id }}</strong>
|
|
||||||
</td>
|
|
||||||
<td class="info">
|
<td class="info">
|
||||||
<span class="badge small bg-secondary text-dark status">loading</span>
|
<span class="badge small bg-secondary text-dark status">loading</span>
|
||||||
<strong>{{ playlist.name }}</strong>
|
<strong>{{ playlist.name }}</strong>
|
||||||
@ -42,8 +40,6 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="col-3 d-none d-sm-table-cell">
|
<td class="col-3 d-none d-sm-table-cell">
|
||||||
<span onclick="prompt('Скопируй адрес плейлиста', '{{ playlist.url }}')"
|
<span onclick="prompt('Скопируй адрес плейлиста', '{{ playlist.url }}')"
|
||||||
data-bs-toggle="tooltip"
|
|
||||||
data-bs-placement="top"
|
|
||||||
title="Нажми на ссылку, чтобы скопировать её в буфер обмена"
|
title="Нажми на ссылку, чтобы скопировать её в буфер обмена"
|
||||||
class="font-monospace cursor-pointer">
|
class="font-monospace cursor-pointer">
|
||||||
{{ playlist.url }}
|
{{ playlist.url }}
|
||||||
@ -84,11 +80,10 @@
|
|||||||
let el_count = tr.querySelector('td.count')
|
let el_count = tr.querySelector('td.count')
|
||||||
xhr.onreadystatechange = () => {
|
xhr.onreadystatechange = () => {
|
||||||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||||
console.log('[' + id + '] DONE', xhr.response)
|
|
||||||
el_status.classList.remove('bg-secondary')
|
el_status.classList.remove('bg-secondary')
|
||||||
el_status.innerText = xhr.response.status.possibleStatus
|
el_status.innerText = xhr.response?.status.possibleStatus ?? 'error'
|
||||||
el_count.innerText = xhr.response?.content.channelCount ?? 0
|
el_count.innerText = xhr.response?.content.channelCount ?? 0
|
||||||
switch (xhr.response.status.possibleStatus) {
|
switch (el_status.innerText) {
|
||||||
case 'online':
|
case 'online':
|
||||||
el_status.classList.add('bg-success')
|
el_status.classList.add('bg-success')
|
||||||
break
|
break
|
||||||
@ -99,24 +94,21 @@
|
|||||||
el_status.classList.add('bg-danger')
|
el_status.classList.add('bg-danger')
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if (xhr.response.error) {
|
if (xhr.response?.error) {
|
||||||
el_status.title = '[' + xhr.response.error.code + '] ' + xhr.response.error.message
|
el_status.title = '[' + xhr.response.error.code + '] ' + xhr.response.error.message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xhr.onerror = () => {
|
xhr.onerror = () => {
|
||||||
console.log('[' + id + '] ERROR', xhr.response)
|
|
||||||
el_status.classList.add('bg-danger')
|
el_status.classList.add('bg-danger')
|
||||||
el_status.innerText = 'error'
|
el_status.innerText = 'error'
|
||||||
el_count.innerText = 0
|
el_count.innerText = 0
|
||||||
}
|
}
|
||||||
xhr.onabort = () => {
|
xhr.onabort = () => {
|
||||||
console.log('[' + id + '] ABORTED', xhr.response)
|
|
||||||
el_status.classList.add('bg-secondary')
|
el_status.classList.add('bg-secondary')
|
||||||
el_count.innerText = 0
|
el_count.innerText = 0
|
||||||
}
|
}
|
||||||
xhr.ontimeout = () => {
|
xhr.ontimeout = () => {
|
||||||
console.log('[' + id + '] TIMEOUT', xhr.response)
|
|
||||||
el_status.classList.add('bg-secondary')
|
el_status.classList.add('bg-secondary')
|
||||||
el_status.innerText = 'timeout'
|
el_status.innerText = 'timeout'
|
||||||
el_count.innerText = 0
|
el_count.innerText = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user