Properly setup Mount model, add database migration, get mount admin page added

This commit is contained in:
Matthew Penner 2020-05-20 18:00:53 -06:00
parent 59a150148a
commit 00d1b5861a
5 changed files with 169 additions and 27 deletions

View file

@ -3,6 +3,7 @@
{{-- This software is licensed under the terms of the MIT license. --}}
{{-- https://opensource.org/licenses/MIT --}}
@extends('layouts.admin')
@section('title')
@ -25,7 +26,7 @@
<h3 class="box-title">Mount List</h3>
<div class="box-tools">
<button class="btn btn-sm btn-primary" data-toggle="modal" data-target="#newLocationModal">Create New</button>
<button class="btn btn-sm btn-primary" data-toggle="modal" data-target="#newMountModal">Create New</button>
</div>
</div>
@ -34,19 +35,23 @@
<tbody>
<tr>
<th>ID</th>
<th>Short Code</th>
<th>Description</th>
<th>Name</th>
<th>Source</th>
<th>Target</th>
<th class="text-center">Eggs</th>
<th class="text-center">Nodes</th>
<th class="text-center">Servers</th>
</tr>
@foreach ($locations as $location)
@foreach ($mounts as $mount)
<tr>
<td><code>{{ $location->id }}</code></td>
<td><a href="{{ route('admin.locations.view', $location->id) }}">{{ $location->short }}</a></td>
<td>{{ $location->long }}</td>
<td class="text-center">{{ $location->nodes_count }}</td>
<td class="text-center">{{ $location->servers_count }}</td>
<td><code>{{ $mount->id }}</code></td>
<td><a href="{{ route('admin.locations.view', $mount->id) }}">{{ $mount->name }}</a></td>
<td>{{ $mount->source }}</td>
<td>{{ $mount->target }}</td>
<td class="text-center">{{ $mount->eggs_count }}</td>
<td class="text-center">{{ $mount->nodes_count }}</td>
<td class="text-center">{{ $mount->servers_count }}</td>
</tr>
@endforeach
</tbody>
@ -56,27 +61,30 @@
</div>
</div>
<div class="modal fade" id="newLocationModal" tabindex="-1" role="dialog">
<div class="modal fade" id="newMountModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form action="{{ route('admin.locations') }}" method="POST">
<form action="{{ route('admin.mounts') }}" method="POST">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Create Location</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true" style="color: #FFFFFF">&times;</span>
</button>
<h4 class="modal-title">Create Mount</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<label for="pShortModal" class="form-label">Short Code</label>
<input type="text" name="short" id="pShortModal" class="form-control" />
<p class="text-muted small">A short identifier used to distinguish this location from others. Must be between 1 and 60 characters, for example, <code>us.nyc.lvl3</code>.</p>
<label for="pName" class="form-label">Name</label>
<input type="text" id="pName" name="name" class="form-control" />
<p class="text-muted small">Thiccc boi name used to separate this mount from another!</p>
</div>
<div class="col-md-12">
<label for="pLongModal" class="form-label">Description</label>
<textarea name="long" id="pLongModal" class="form-control" rows="4"></textarea>
<p class="text-muted small">A longer description of this location. Must be less than 255 characters.</p>
<label for="pDescription" class="form-label">Description</label>
<textarea id="pDescription" name="description" class="form-control" rows="4"></textarea>
<p class="text-muted small">A longer description of this mount. Must be less than 255 characters.</p>
</div>
</div>
</div>