mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-23 12:44:12 -08:00
Added ability to purge soft-deletes from admin
This commit is contained in:
parent
78aa0cc378
commit
49c09dd356
|
@ -26,7 +26,7 @@ class Purge extends Command
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'snipeit:purge';
|
||||
protected $signature = 'snipeit:purge {--force=false}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
@ -52,8 +52,8 @@ class Purge extends Command
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
||||
if ($this->confirm("\n****************************************************\nTHIS WILL PURGE ALL SOFT-DELETED ITEMS IN YOUR SYSTEM. \nThere is NO undo. This WILL permanently destroy \nALL of your deleted data. \n****************************************************\n\nDo you wish to continue? No backsies! [y|N]")) {
|
||||
$force = $this->option('force');
|
||||
if (($this->confirm("\n****************************************************\nTHIS WILL PURGE ALL SOFT-DELETED ITEMS IN YOUR SYSTEM. \nThere is NO undo. This WILL permanently destroy \nALL of your deleted data. \n****************************************************\n\nDo you wish to continue? No backsies! [y|N]")) || $force == 'true') {
|
||||
|
||||
/**
|
||||
* Delete assets
|
||||
|
|
|
@ -516,4 +516,29 @@ class SettingsController extends Controller
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Purges soft-deletes
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v3.0]
|
||||
* @return View
|
||||
*/
|
||||
public function postPurge()
|
||||
{
|
||||
if (!config('app.lock_passwords')) {
|
||||
if (Input::get('confirm_purge')=='DELETE') {
|
||||
Artisan::call('snipeit:purge',['--force'=>'true','--no-interaction'=>true]);
|
||||
$output = Artisan::output();
|
||||
return View::make('settings/purge')
|
||||
->with('output', $output)->with('success', trans('admin/settings/message.purge.success'));
|
||||
} else {
|
||||
return Redirect::back()->with('error', trans('admin/settings/message.purge.validation_failed'));
|
||||
}
|
||||
|
||||
} else {
|
||||
return Redirect::back()->with('error', trans('general.feature_disabled'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -433,9 +433,13 @@ Route::group([ 'prefix' => 'admin','middleware' => ['web','auth','authorize:admi
|
|||
# Admin Settings Routes (for categories, maufactureres, etc)
|
||||
Route::group([ 'prefix' => 'settings'], function () {
|
||||
|
||||
|
||||
|
||||
# Settings
|
||||
Route::group([ 'prefix' => 'app' ], function () {
|
||||
|
||||
Route::post('purge', ['as' => 'purge', 'uses' => 'SettingsController@postPurge']);
|
||||
|
||||
Route::get('/', [ 'as' => 'app', 'uses' => 'SettingsController@getIndex' ]);
|
||||
Route::get('edit', [ 'as' => 'edit/settings', 'uses' => 'SettingsController@getEdit' ]);
|
||||
Route::post('edit', 'SettingsController@postEdit');
|
||||
|
@ -472,6 +476,8 @@ Route::group([ 'prefix' => 'admin','middleware' => ['web','auth','authorize:admi
|
|||
Route::post('create', 'CompaniesController@postCreate');
|
||||
});
|
||||
|
||||
|
||||
|
||||
# Manufacturers
|
||||
Route::group([ 'prefix' => 'manufacturers' ], function () {
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ return array(
|
|||
'backups' => 'Backups',
|
||||
'barcode_type' => 'Barcode Type',
|
||||
'barcode_settings' => 'Barcode Settings',
|
||||
'confirm_purge' => 'Confirm Purge',
|
||||
'confirm_purge_help' => 'Enter the text "DELETE" in the box below to purge your deleted records. This action cannot be undone.',
|
||||
'custom_css' => 'Custom CSS',
|
||||
'custom_css_help' => 'Enter any custom CSS overrides you would like to use. Do not include the <style></style> tags.',
|
||||
'default_currency' => 'Default Currency',
|
||||
|
@ -76,6 +78,7 @@ return array(
|
|||
'labels_per_page' => 'Labels per page',
|
||||
'label_dimensions' => 'Label dimensions (inches)',
|
||||
'page_padding' => 'Page margins (inches)',
|
||||
'purge' => 'Purge Deleted Records',
|
||||
'labels_display_bgutter' => 'Label bottom gutter',
|
||||
'labels_display_sgutter' => 'Label side gutter',
|
||||
'labels_fontsize' => 'Label font size',
|
||||
|
|
|
@ -13,5 +13,10 @@ return array(
|
|||
'generated' => 'A new backup file was successfully created.',
|
||||
'file_not_found' => 'That backup file could not be found on the server.',
|
||||
),
|
||||
'purge' => array(
|
||||
'error' => 'An error has occurred while purging. ',
|
||||
'validation_failed' => 'Your purge confirmation is incorrect. Please type the word "DELETE" in the confirmation box.',
|
||||
'success' => 'Deleted records successfully purged.'
|
||||
),
|
||||
|
||||
);
|
||||
|
|
|
@ -174,10 +174,46 @@
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<div class="box box-danger">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><i class="fa fa-warning"></i> {{ trans('admin/settings/general.purge') }}</h3>
|
||||
</div>
|
||||
{{ Form::open(['method' => 'POST', 'route' => ['purge'], 'class' => 'form-horizontal', 'role' => 'form' ]) }}
|
||||
<!-- CSRF Token -->
|
||||
{{ Form::hidden('_token', csrf_token()) }}
|
||||
<div class="box-body">
|
||||
<p>{{ trans('admin/settings/general.confirm_purge_help') }}</p>
|
||||
|
||||
|
||||
|
||||
<div class="col-md-3{{ $errors->has('confirm_purge') ? 'error' : '' }}">
|
||||
{{ Form::label('confirm_purge', trans('admin/settings/general.confirm_purge')) }}
|
||||
</div>
|
||||
<div class="col-md-9{{ $errors->has('confirm_purge') ? 'error' : '' }}">
|
||||
@if (config('app.lock_passwords')===true)
|
||||
{{ Form::text('confirm_purge', Input::old('confirm_purge'), array('class' => 'form-control', 'disabled'=>'disabled')) }}
|
||||
@else
|
||||
{{ Form::text('confirm_purge', Input::old('confirm_purge'), array('class' => 'form-control')) }}
|
||||
@endif
|
||||
|
||||
{!! $errors->first('ldap_version', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="box-footer text-right">
|
||||
<button type="submit" class="btn btn-danger">{{ trans('admin/settings/general.purge') }}</button>
|
||||
</div> <!-- /box body -->
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@stop
|
||||
|
|
30
resources/views/settings/purge.blade.php
Normal file
30
resources/views/settings/purge.blade.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
@extends('layouts/default')
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('title')
|
||||
{{ trans('admin/settings/general.purge') }}
|
||||
@parent
|
||||
@stop
|
||||
|
||||
@section('header_right')
|
||||
<a href="{{ URL::previous() }}" class="btn btn-primary pull-right">
|
||||
{{ trans('general.back') }}</a>
|
||||
@stop
|
||||
|
||||
|
||||
{{-- Page content --}}
|
||||
@section('content')
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
<div class="box box-default">
|
||||
<div class="box-body">
|
||||
{!! nl2br($output) !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@stop
|
Loading…
Reference in a new issue