Skip to content

Commit

Permalink
Merge pull request #938 from dbarzin/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dbarzin authored Nov 2, 2024
2 parents 6ba9e43 + a441f50 commit 1f80282
Show file tree
Hide file tree
Showing 135 changed files with 13,156 additions and 2,078 deletions.
2 changes: 2 additions & 0 deletions app/Http/Controllers/Admin/CartographyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1688,12 +1688,14 @@ public function cartography(Request $request)
// =====================================
if ($vlans->count() > 0) {
$section->addTitle(trans('cruds.vlan.title'), 2);
$section->addText(trans('cruds.vlan.vlan_id'));
$section->addText(trans('cruds.vlan.description'));
$section->addTextBreak(1);

foreach ($vlans as $vlan) {
$section->addBookmark('VLAN'.$vlan->id);
$table = $this->addTable($section, $vlan->name);
$this->addTextRow($table, trans('cruds.vlan.fields.vlan_id'), $vlan->vlan_id);
$this->addHTMLRow($table, trans('cruds.vlan.fields.description'), $vlan->description);

// Sous-réseaux
Expand Down
35 changes: 19 additions & 16 deletions app/Http/Controllers/Admin/ReportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2789,6 +2789,7 @@ public function vlans()

$header = [
'Name',
'VLAN-ID',
'Description',
'subnet name',
'subnet address',
Expand All @@ -2807,19 +2808,20 @@ public function vlans()

// Widths
$sheet->getColumnDimension('A')->setAutoSize(true); // Name
$sheet->getColumnDimension('B')->setWidth(100, 'pt'); // Desc
$sheet->getColumnDimension('C')->setWidth(100, 'pt'); // subnets name
$sheet->getColumnDimension('D')->setWidth(100, 'pt'); // subnets address
$sheet->getColumnDimension('E')->setWidth(200, 'pt'); // logical servers
$sheet->getColumnDimension('F')->setWidth(200, 'pt'); // physical servers
$sheet->getColumnDimension('G')->setWidth(200, 'pt'); // switches
$sheet->getColumnDimension('H')->setWidth(200, 'pt'); // workstations
$sheet->getColumnDimension('B')->setWidth(30, 'pt'); // VLAN-ID
$sheet->getColumnDimension('C')->setWidth(200, 'pt'); // Desc
$sheet->getColumnDimension('D')->setWidth(100, 'pt'); // subnets name
$sheet->getColumnDimension('E')->setWidth(100, 'pt'); // subnets address
$sheet->getColumnDimension('F')->setWidth(200, 'pt'); // logical servers
$sheet->getColumnDimension('G')->setWidth(200, 'pt'); // physical servers
$sheet->getColumnDimension('H')->setWidth(200, 'pt'); // switches
$sheet->getColumnDimension('I')->setWidth(200, 'pt'); // workstations

// wordwrap
$sheet->getStyle('E')->getAlignment()->setWrapText(true);
$sheet->getStyle('F')->getAlignment()->setWrapText(true);
$sheet->getStyle('G')->getAlignment()->setWrapText(true);
$sheet->getStyle('H')->getAlignment()->setWrapText(true);
$sheet->getStyle('I')->getAlignment()->setWrapText(true);

// converter
$html = new \PhpOffice\PhpSpreadsheet\Helper\Html();
Expand All @@ -2830,16 +2832,17 @@ public function vlans()
// create the sheet
foreach ($vlans as $vlan) {
$sheet->setCellValue("A{$row}", $vlan->name);
$sheet->setCellValue("B{$row}", $html->toRichTextObject($vlan->description));
$sheet->setCellValue("B{$row}", $vlan->vlan_id);
$sheet->setCellValue("C{$row}", $html->toRichTextObject($vlan->description));

// Subnets
foreach ($vlan->subnetworks as $subnet) {
if ($vlan->subnetworks->first() !== $subnet) {
$sheet->setCellValue("A{$row}", $vlan->name);
$sheet->setCellValue("B{$row}", $html->toRichTextObject($vlan->description));
$sheet->setCellValue("C{$row}", $html->toRichTextObject($vlan->description));
}
$sheet->setCellValue("C{$row}", $subnet->name);
$sheet->setCellValue("D{$row}", $subnet->address);
$sheet->setCellValue("D{$row}", $subnet->name);
$sheet->setCellValue("E{$row}", $subnet->address);
// Logical Servers
$txt = '';
foreach ($lservers as $server) {
Expand All @@ -2852,7 +2855,7 @@ public function vlans()
}
}
}
$sheet->setCellValue("E{$row}", $txt);
$sheet->setCellValue("F{$row}", $txt);
// Physical Servers
$txt = '';
foreach ($pservers as $server) {
Expand All @@ -2865,7 +2868,7 @@ public function vlans()
}
}
}
$sheet->setCellValue("F{$row}", $txt);
$sheet->setCellValue("G{$row}", $txt);
// Switches
$txt = '';
foreach ($switches as $switch) {
Expand All @@ -2878,7 +2881,7 @@ public function vlans()
}
}
}
$sheet->setCellValue("G{$row}", $txt);
$sheet->setCellValue("H{$row}", $txt);
// Workstations
$txt = '';
foreach ($workstations as $workstation) {
Expand All @@ -2891,7 +2894,7 @@ public function vlans()
}
}
}
$sheet->setCellValue("H{$row}", $txt);
$sheet->setCellValue("I{$row}", $txt);

if ($vlan->subnetworks->last() !== $subnet) {
$row++;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Requests/StoreVlanRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function rules()
return [
'name' => [
'min:3',
'max:32',
'max:64',
'required',
'unique:vlans,name,NULL,id,deleted_at,NULL',
],
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Requests/UpdateVlanRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function rules()
return [
'name' => [
'min:3',
'max:32',
'max:64',
'required',
'unique:vlans,name,'.request()->route('vlan')->id.',id,deleted_at,NULL',
],
Expand Down
1 change: 1 addition & 0 deletions app/Vlan.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Vlan extends Model

protected $fillable = [
'name',
'vlan_id',
'description',
'created_at',
'updated_at',
Expand Down
38 changes: 38 additions & 0 deletions database/migrations/2024_10_31_220940_add_vlan_id.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('vlans', function(Blueprint $table) {
$table->integer('vlan_id')->after('description')->nullable();
});

Schema::table('audit_logs', function(Blueprint $table) {
$table->string('description')->change();
});

}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('vlans', function(Blueprint $table) {
$table->dropColumn('vlan_id');
});

Schema::table('audit_logs', function(Blueprint $table) {
$table->text('description')->change();
});

}
};
11 changes: 5 additions & 6 deletions public/css/bootstrap.min.css

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion public/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ table.dataTable thead .sorting_desc {
border-left: 0;
}

.dropdown-item i {
color: #7C123E;
}

.sidebar .nav-link {
display: block;
padding: .75rem 1rem;
Expand All @@ -108,6 +112,11 @@ table.dataTable thead .sorting_desc {
color: #7C123E;
}

.nav-link {
color: #000000;
background-color: #FFFFFF;
}

.sidebar .nav-link.active {
color: #000000;
background-color: #FFFFFF;
Expand Down Expand Up @@ -326,4 +335,3 @@ html {
color: #20a8d8;
cursor: pointer
}

7 changes: 7 additions & 0 deletions public/js/bootstrap.bundle.min.js

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions public/js/bootstrap.min.js

This file was deleted.

1 change: 0 additions & 1 deletion public/js/bootstrap.min.js.map

This file was deleted.

Loading

0 comments on commit 1f80282

Please sign in to comment.