Fixed Bug in View when no or a single voice call is active

This commit is contained in:
Luca Haid
2024-05-08 21:19:23 +02:00
parent 1f30671cf9
commit 1f477a4b2f
3 changed files with 5 additions and 3 deletions

View File

@@ -42,7 +42,7 @@ include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php")
<tt-page-title :title="window['TT_CONFIG']['PAGE_TITLE']" :path="window['TT_CONFIG']['PATH']"></tt-page-title>
<tt-table :fetch-url="window['TT_CONFIG']['VOICE_CALL_ACTIVE_API_URL'] + '?do=getActiveCalls'" :config="VoiceCallActiveTableConfig"
small ssr ref="table">
small ref="table">
<template v-slot:top-buttons>
<button type="button" class="btn btn-primary" @click="refresh" data-toggle="tooltip" data-placement="bottom" title="Refreshing too often will run into API-Rate limits and will cause errors.">

View File

@@ -54,8 +54,10 @@ class VoiceCallActiveController extends mfBaseController {
}
private function getActiveCalls(): array {
$activeCalls = $this->kolmisoftMore->getActiveCalls();
return [
"rows" => array_reverse($this->kolmisoftMore->getActiveCalls())
"rows" => is_null($activeCalls) ? [] : (is_object($activeCalls) ? [$activeCalls] : $activeCalls),
];
}
}

View File

@@ -235,7 +235,7 @@ Vue.component('tt-table', {
this.pagination = {
page: page++,
per_page: this.pagination?.per_page ? parseInt(this.pagination.per_page) : 10,
total_rows: this.rawRows.length,
total_rows: this.rawRows.length || 0,
total_pages: this.rawRows.length / this.pagination?.per_page,
filtered_available: this.rawRows.length
};