Path: blob/1.0-develop/resources/views/admin/servers/view/database.blade.php
7461 views
@extends('layouts.admin')12@section('title')3Server — {{ $server->name }}: Databases4@endsection56@section('content-header')7<h1>{{ $server->name }}<small>Manage server databases.</small></h1>8<ol class="breadcrumb">9<li><a href="{{ route('admin.index') }}">Admin</a></li>10<li><a href="{{ route('admin.servers') }}">Servers</a></li>11<li><a href="{{ route('admin.servers.view', $server->id) }}">{{ $server->name }}</a></li>12<li class="active">Databases</li>13</ol>14@endsection1516@section('content')17@include('admin.servers.partials.navigation')18<div class="row">19<div class="col-sm-7">20<div class="alert alert-info">21Database passwords can be viewed when <a href="/server/{{ $server->uuidShort }}/databases">visiting this server</a> on the front-end.22</div>23<div class="box box-primary">24<div class="box-header with-border">25<h3 class="box-title">Active Databases</h3>26</div>27<div class="box-body table-responsible no-padding">28<table class="table table-hover">29<tr>30<th>Database</th>31<th>Username</th>32<th>Connections From</th>33<th>Host</th>34<th>Max Connections</th>35<th></th>36</tr>37@foreach($server->databases as $database)38<tr>39<td>{{ $database->database }}</td>40<td>{{ $database->username }}</td>41<td>{{ $database->remote }}</td>42<td><code>{{ $database->host->host }}:{{ $database->host->port }}</code></td>43@if($database->max_connections != null)44<td>{{ $database->max_connections }}</td>45@else46<td>Unlimited</td>47@endif48<td class="text-center">49<button data-action="reset-password" data-id="{{ $database->id }}" class="btn btn-xs btn-primary"><i class="fa fa-refresh"></i></button>50<button data-action="remove" data-id="{{ $database->id }}" class="btn btn-xs btn-danger"><i class="fa fa-trash"></i></button>51</td>52</tr>53@endforeach54</table>55</div>56</div>57</div>58<div class="col-sm-5">59<div class="box box-success">60<div class="box-header with-border">61<h3 class="box-title">Create New Database</h3>62</div>63<form action="{{ route('admin.servers.view.database', $server->id) }}" method="POST">64<div class="box-body">65<div class="form-group">66<label for="pDatabaseHostId" class="control-label">Database Host</label>67<select id="pDatabaseHostId" name="database_host_id" class="form-control">68@foreach($hosts as $host)69<option value="{{ $host->id }}">{{ $host->name }}</option>70@endforeach71</select>72<p class="text-muted small">Select the host database server that this database should be created on.</p>73</div>74<div class="form-group">75<label for="pDatabaseName" class="control-label">Database</label>76<div class="input-group">77<span class="input-group-addon">s{{ $server->id }}_</span>78<input id="pDatabaseName" type="text" name="database" class="form-control" placeholder="database" />79</div>80</div>81<div class="form-group">82<label for="pRemote" class="control-label">Connections</label>83<input id="pRemote" type="text" name="remote" class="form-control" value="%" />84<p class="text-muted small">This should reflect the IP address that connections are allowed from. Uses standard MySQL notation. If unsure leave as <code>%</code>.</p>85</div>86<div class="form-group">87<label for="pmax_connections" class="control-label">Concurrent Connections</label>88<input id="pmax_connections" type="text" name="max_connections" class="form-control"/>89<p class="text-muted small">This should reflect the max number of concurrent connections from this user to the database. Leave empty for unlimited.</p>90</div>91</div>92<div class="box-footer">93{!! csrf_field() !!}94<p class="text-muted small no-margin">A username and password for this database will be randomly generated after form submission.</p>95<input type="submit" class="btn btn-sm btn-success pull-right" value="Create Database" />96</div>97</form>98</div>99</div>100</div>101@endsection102103@section('footer-scripts')104@parent105<script>106$('#pDatabaseHost').select2();107$('[data-action="remove"]').click(function (event) {108event.preventDefault();109var self = $(this);110swal({111title: '',112type: 'warning',113text: 'Are you sure that you want to delete this database? There is no going back, all data will immediately be removed.',114showCancelButton: true,115confirmButtonText: 'Delete',116confirmButtonColor: '#d9534f',117closeOnConfirm: false,118showLoaderOnConfirm: true,119}, function () {120$.ajax({121method: 'DELETE',122url: '/admin/servers/view/{{ $server->id }}/database/' + self.data('id') + '/delete',123headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') },124}).done(function () {125self.parent().parent().slideUp();126swal.close();127}).fail(function (jqXHR) {128console.error(jqXHR);129swal({130type: 'error',131title: 'Whoops!',132text: (typeof jqXHR.responseJSON.error !== 'undefined') ? jqXHR.responseJSON.error : 'An error occurred while processing this request.'133});134});135});136});137$('[data-action="reset-password"]').click(function (e) {138e.preventDefault();139var block = $(this);140$(this).addClass('disabled').find('i').addClass('fa-spin');141$.ajax({142type: 'PATCH',143url: '/admin/servers/view/{{ $server->id }}/database',144headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') },145data: { database: $(this).data('id') },146}).done(function (data) {147swal({148type: 'success',149title: '',150text: 'The password for this database has been reset.',151});152}).fail(function(jqXHR, textStatus, errorThrown) {153console.error(jqXHR);154var error = 'An error occurred while trying to process this request.';155if (typeof jqXHR.responseJSON !== 'undefined' && typeof jqXHR.responseJSON.error !== 'undefined') {156error = jqXHR.responseJSON.error;157}158swal({159type: 'error',160title: 'Whoops!',161text: error162});163}).always(function () {164block.removeClass('disabled').find('i').removeClass('fa-spin');165});166});167</script>168@endsection169170171