Reworked Pop Table View

This commit is contained in:
2024-05-28 10:58:20 +02:00
parent 2d7a701fab
commit a66d6bf776
5 changed files with 246 additions and 415 deletions

View File

@@ -19,11 +19,43 @@ class PopController extends mfBaseController
protected function indexAction()
{
$networks = array_map(function($network) {
return [
"text" => $network->name,
"value" => $network->name
];
}, NetworkModel::getAll());
$this->layout()->setTemplate("Pop/Index");
$pops = PopModel::getAlladv();
$pops = array_map(function($pop) {
return [
"id" => $pop->id,
"name" => $pop->name,
"networkArea" => $pop->network->name,
"location" => $pop->location,
"vlan" => [
"public" => $pop->vlan_public,
"nat" => $pop->vlan_nat,
"ipv6" => $pop->vlan_ipv6
],
"gps" => $pop->gps_lat . ", " . $pop->gps_long
];
}, PopModel::getAlladv());
$this->layout()->set("pops", $pops);
$JSGlobals = ["BASE_URL" => self::getUrl(""),
"DASHBOARD_URL" => self::getUrl("Dashboard"),
"MFAPPNAME" => MFAPPNAME_SLUG,
"PAGE_TITLE" => "Pops",
"PATH" => [
["text" => MFAPPNAME_SLUG, "href" => self::getUrl("Dashboard")],
["text" => "Devices", "href" => self::getUrl("Pop")]
],
"NETWORKS" => $networks,
"POPS" => $pops,
];
$this->layout()->set("vueViewName", "Pop");
$this->layout()->set("JSGlobals", $JSGlobals);
$this->layout()->setTemplate("VueViews/Vue");
}
@@ -81,7 +113,7 @@ class PopController extends mfBaseController
$popnetwork = PopNetworkModel::getbyPopid($id);
$this->layout()->set("popnetwork", $popnetwork['network_id']);
$this->layout()->set("pop", $pop);
return $this->addAction();
$this->addAction();
}
protected function saveAction()
@@ -136,8 +168,8 @@ class PopController extends mfBaseController
if (!$new_id) {
$this->layout()->setFlash("Fehler beim Speichern", "error");
$this->layout()->set("network", $network);
return $this->addAction();
if (isset($network)) $this->layout()->set("network", $network);
$this->addAction();
}
if ($r->network_id) {
@@ -188,8 +220,6 @@ class PopController extends mfBaseController
$this->layout()->setFlash("Pop erfolgreich gespeichert.", "success");
$this->redirect($this->returUrl, $returnAction, $returnVariables, $returnAnker);
}
protected function apiAction()