Determine if an inbound file is a nodelist
This commit is contained in:
parent
edd41ad187
commit
2790381a30
@ -26,6 +26,7 @@ class FileareaController extends Controller
|
||||
'description' => 'required',
|
||||
'active' => 'required|boolean',
|
||||
'public' => 'required|boolean',
|
||||
'nodelist' => 'nullable|string|max:12'
|
||||
]);
|
||||
|
||||
foreach (['name','description','active','public','notes','domain_id'] as $key)
|
||||
@ -33,6 +34,12 @@ class FileareaController extends Controller
|
||||
|
||||
$o->save();
|
||||
|
||||
if ($request->post('nodelist')) {
|
||||
$o->domain->nodelist_filename = $request->post('nodelist');
|
||||
$o->domain->nodelist_filearea_id = $o->id;
|
||||
$o->domain->save();
|
||||
}
|
||||
|
||||
return redirect()->action([self::class,'home']);
|
||||
}
|
||||
|
||||
|
@ -41,5 +41,8 @@ class TicProcess implements ShouldQueue
|
||||
Log::info(sprintf('%s:Processed [%s] storing [%s] as id [%d]',self::LOGKEY,$this->file,$to->fo->file,$to->fo->id));
|
||||
|
||||
unlink($this->file);
|
||||
|
||||
if ($to->isNodelist())
|
||||
NodelistImport::dispatch($to->fo);
|
||||
}
|
||||
}
|
@ -44,6 +44,11 @@ class Domain extends Model
|
||||
return $this->hasMany(Filearea::class);
|
||||
}
|
||||
|
||||
public function nodelist_filearea()
|
||||
{
|
||||
return $this->belongsTo(Filearea::class);
|
||||
}
|
||||
|
||||
public function zones()
|
||||
{
|
||||
return $this->hasMany(Zone::class);
|
||||
|
37
database/migrations/2022_11_03_115325_nodelist.php
Normal file
37
database/migrations/2022_11_03_115325_nodelist.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('domains', function (Blueprint $table) {
|
||||
$table->string('nodelist_filename')->nullable();
|
||||
|
||||
$table->bigInteger('nodelist_filearea_id')->nullable();
|
||||
$table->foreign('nodelist_filearea_id')->references('id')->on('fileareas');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('domains', function (Blueprint $table) {
|
||||
$table->dropForeign(['nodelist_filearea_id']);
|
||||
|
||||
$table->dropColumn(['nodelist_filename','nodelist_filearea_id']);
|
||||
});
|
||||
}
|
||||
};
|
@ -41,6 +41,18 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
@if ($o->nodelist_filename)
|
||||
<label for="nodelist_filename" class="form-label">Nodelist Filearea</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="bi bi bi-file-earmark-break-fill"></i></span>
|
||||
<input type="text" class="form-control" id="nodelist_filename" placeholder="Nodelist" name="nodelist_filename" value="{{ $o->nodelist_filename }}" readonly>
|
||||
</div>
|
||||
@else
|
||||
No Nodelist filearea
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
@ -69,6 +81,18 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if ($o->nodelist_filename)
|
||||
<div class="col-4">
|
||||
<label for="name" class="form-label">Nodelist File Area</label>
|
||||
<a href="{{ url('ftn/filearea/addedit',$o->nodelist_filearea_id) }}">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="bi bi bi-collection-fill"></i></span>
|
||||
<input type="text" class="form-control @error('nodelist') is-invalid @enderror" id="nodelist" placeholder="Nodelist" name="nodelist" value="{{ $o->nodelist_filearea->name }}" readonly>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
@ -1,3 +1,4 @@
|
||||
<!-- $o=Filearea::class -->
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('htmlheader_title')
|
||||
@ -78,7 +79,7 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<div class="col-7">
|
||||
<label for="description" class="form-label">Description</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-file-text-fill"></i></span>
|
||||
@ -91,6 +92,18 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-5">
|
||||
<label for="nodelist" class="form-label">Nodelist File Name</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-file-earmark-break-fill"></i></span>
|
||||
<input type="text" class="form-control @error('nodelist') is-invalid @enderror" id="nodelist" placeholder="NODELIST.Z??" name="nodelist" value="{{ old('nodelist',$o->domain->nodelist) }}" @cannot('admin',$o->domain)disabled @endcannot>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('nodelist')
|
||||
{{ $message }}
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
Loading…
Reference in New Issue
Block a user