Finalize service option import/export

This commit is contained in:
Dane Everitt 2017-10-03 23:31:04 -05:00
parent d608c313c3
commit 6269a08db7
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
16 changed files with 405 additions and 271 deletions

View file

@ -21,6 +21,7 @@ return [
'service' => [
'delete_has_servers' => 'A service with active servers attached to it cannot be deleted from the Panel.',
'options' => [
'duplicate_tag' => 'A service option with that tag already exists for this service.',
'delete_has_servers' => 'A service option with active servers attached to it cannot be deleted from the Panel.',
'invalid_copy_id' => 'The service option selected for copying a script from either does not exist, or is copying a script itself.',
'must_be_child' => 'The "Copy Settings From" directive for this option must be a child option for the selected service.',
@ -30,6 +31,10 @@ return [
'env_not_unique' => 'The environment variable :name must be unique to this service option.',
'reserved_name' => 'The environment variable :name is protected and cannot be assigned to a variable.',
],
'exporter' => [
'import_file_error' => 'The XML file provided was not valid.',
'invalid_json_provided' => 'The JSON file provided is not in a format that can be recognized.',
],
],
'packs' => [
'delete_has_servers' => 'Cannot delete a pack that is attached to active servers.',

View file

@ -31,7 +31,8 @@
<div class="box-header with-border">
<h3 class="box-title">Configured Service</h3>
<div class="box-tools">
<a href="{{ route('admin.services.new') }}"><button class="btn btn-primary btn-sm">Create New</button></a>
<a href="#" class="btn btn-sm btn-success" data-toggle="modal" data-target="#importServiceOptionModal" role="button"><i class="fa fa-upload"></i> Import Service Option</a>
<a href="{{ route('admin.services.new') }}" class="btn btn-primary btn-sm">Create New</a>
</div>
</div>
<div class="box-body table-responsive no-padding">
@ -57,4 +58,50 @@
</div>
</div>
</div>
<div class="modal fade" tabindex="-1" role="dialog" id="importServiceOptionModal">
<div class="modal-dialog" role="document">
<div class="modal-content">
<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">Import a Service Option</h4>
</div>
<form action="{{ route('admin.services.option.import') }}" enctype="multipart/form-data" method="POST">
<div class="modal-body">
<div class="form-group">
<label class="control-label" for="pImportFile">Service File <span class="field-required"></span></label>
<div>
<input id="pImportFile" type="file" name="import_file" class="form-control" accept="application/json" />
<p class="small text-muted">Select the <code>.json</code> file for the new service option that you wish to import.</p>
</div>
</div>
<div class="form-group">
<label class="control-label" for="pImportToService">Associated Service <span class="field-required"></span></label>
<div>
<select id="pImportToService" name="import_to_service">
@foreach($services as $service)
<option value="{{ $service->id }}">{{ $service->name }} &lt;{{ $service->author }}&gt;</option>
@endforeach
</select>
<p class="small text-muted">Select the service that this option will be associated with from the dropdown. If you wish to associate it with a new service you will need to create that service before continuing.</p>
</div>
</div>
</div>
<div class="modal-footer">
{{ csrf_field() }}
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary">Import</button>
</div>
</form>
</div>
</div>
</div>
@endsection
@section('footer-scripts')
@parent
<script>
$(document).ready(function() {
$('#pImportToService').select2();
});
</script>
@endsection