added new pop columns

This commit is contained in:
Luca Haid
2025-05-13 15:42:24 +02:00
parent 6d4d4ea386
commit e976246ed7
5 changed files with 24 additions and 5 deletions

View File

@@ -70,8 +70,6 @@
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.14.0/Sortable.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-draggable-next@2.1.0"></script>
<script type="text/javascript">
baseurl = '<?=self::getResourcePath()?>';
</script>

View File

@@ -32,6 +32,9 @@ class PopController extends mfBaseController
"name" => $pop->name,
"networkArea" => $pop->networks,
"location" => $pop->location,
"state" => $pop->state,
"folder_link" => $pop->folder_link,
"doku_date" => $pop->doku_date,
"vlan" => [
"public" => $pop->vlan_public,
"nat" => $pop->vlan_nat,
@@ -51,6 +54,7 @@ class PopController extends mfBaseController
],
"NETWORKS" => $networks,
"POPS" => $pops,
"IS_ADMIN" => $this->me->is("Admin"),
];
$this->layout()->set("vueViewName", "Pop");

View File

@@ -102,7 +102,7 @@ class PopModel
{
$items = [];
$db = FronkDB::singleton();
$sql = "SELECT `Pop`.`id`, `Pop`.`network_id`, `Pop`.`name`, `Pop`.`gps_lat`, `Pop`.`gps_long`, `Pop`.`location`, `Pop`.`vlan_public`, `Pop`.`vlan_nat`, `Pop`.`vlan_ipv6`, `Pop`.`note`,`Network`.`name` as Networkname FROM `Pop`
$sql = "SELECT `Pop`.*,`Network`.`name` as Networkname FROM `Pop`
INNER JOIN `PopNetwork` ON (`Pop`.`id`=`PopNetwork`.`pop_id`)
INNER JOIN `Network` ON (`Network`.`id`=`PopNetwork`.`network_id`)";
$res = $db->query($sql);

View File

@@ -15,6 +15,10 @@ Vue.component('Pop', {
<template v-slot:name="{ row }">
<a target="_blank" :href="window['TT_CONFIG']['BASE_URL'] +'/Pop/Detail?id=' + row.id">{{row.name}}</a>
</template>
<template v-slot:doku_date="{ row }">
<span>{{row.doku_date ? window.moment.unix(row.doku_date).format('DD.MM.YYYY') : ''}}</span>
</template>
<template v-slot:vlan="{ row }">
<span v-if="row.vlan.public" class="order-date-pill text-nowrap active mb-1">Public: <span class="font-weight-bold">{{row.vlan.public}}</span></span>
@@ -34,6 +38,7 @@ Vue.component('Pop', {
<template v-slot:actions="{ row }">
<a :href="window['TT_CONFIG']['BASE_URL'] +'/Pop/edit/?id=' + row.id"><i class="far fa-edit" title="Bearbeiten"></i></a>
<a v-if="row.folder_link && window.TT_CONFIG.IS_ADMIN === '1'" :href="row.folder_link" target="_blank"><i class="fas fa-folder" title="Ordner"></i></a>
<a :href="window['TT_CONFIG']['BASE_URL'] +'/Pop/delete/?id=' + row.id" onclick="if(!confirm('Device wirklich löschen?')) return false;" class="text-danger" title="Löschen"><i class="fas fa-trash "></i></a>
</template>
@@ -50,7 +55,7 @@ Vue.component('Pop', {
defaultPageSize: 25,
headers: [
{text: 'Name', key: 'name', priority: 10},
{text: 'Netzgebiet', key: 'networkArea', class: 'text-center',
{text: 'Netzgebiet', key: 'networkArea', class: 'text-center',
// TODO: fix autocomplete Filter
// filter: 'autocomplete',
// filterOptions: window['TT_CONFIG']['NETWORKS'],
@@ -58,6 +63,13 @@ Vue.component('Pop', {
},
{text: 'Zutritt', key: 'location', class: 'text-center', priority: 1},
{text: 'Standort', key: 'gps', class: 'text-center', priority: 2},
{text: 'Status', key: 'state', class: 'text-center', priority: 3, filter: 'select', filterOptions: [
{value: '1', text: 'Planung'},
{value: '2', text: 'Bauphase'},
{value: '3', text: 'Grobdoku'},
{value: '4', text: 'In Betrieb'},
{value: '5', text: 'Abgenommen'}]},
{text: 'Doku-Stand', key: 'doku_date', class: 'text-center', priority: 4, filter: 'date'},
{text: 'Vlan Public/Nat/ipv6', key: 'vlan', class: 'text-center', priority: 7},
{text: 'Aktionen', key: 'actions', class: 'text-center', sortable: false, filter: false, priority: 9},
],

View File

@@ -209,7 +209,7 @@ Vue.component('tt-table', {
</span>
<span v-else-if="column.filter === 'select'">{{ columns[key].filterOptions.find(option => option.value.toString() === row[key].toString())?.text }}</span>
<span v-else-if="column.filter === 'select'">{{ columns[key].filterOptions.find(option => option.value?.toString() === row[key]?.toString())?.text }}</span>
<span v-else-if="key === 'create'">{{ window.moment(row[key] * 1000).format('DD.MM.YYYY HH:mm:ss') }}</span>
<span v-else-if="row[key] !== null"
v-html="(column.prefix) + (row[key] === null || typeof row[key] === 'undefined' ? '' : row[key]?.toString()?.replace('\\\\n', '<br>')) + (column.suffix )"></span>
@@ -754,6 +754,11 @@ Vue.component('tt-table', {
}
} else if (header.filter === 'date') {
if (!filterValue.from || !filterValue.to) continue;
if (!row[header.key]) {
match = false;
break;
}
console.log(row);
const dateInt = row[header.key].length === 10 ? parseInt(row[header.key]) * 1000 : parseInt(row[header.key]);
let rowDate = new Date(dateInt).getTime() / 1000;