mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Merge pull request #13638 from marcusmoore/bug/sc-20704
Fixed exception being thrown when selected import was deleted
This commit is contained in:
commit
660abeca9e
|
@ -484,8 +484,17 @@ class Importer extends Component
|
|||
|
||||
public function selectFile($id)
|
||||
{
|
||||
$this->clearMessage();
|
||||
|
||||
$this->activeFile = Import::find($id);
|
||||
|
||||
if (!$this->activeFile) {
|
||||
$this->message = trans('admin/hardware/message.import.file_missing');
|
||||
$this->message_type = 'danger';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->field_map = null;
|
||||
foreach($this->activeFile->header_row as $element) {
|
||||
if(isset($this->activeFile->field_map[$element])) {
|
||||
|
@ -520,6 +529,12 @@ class Importer extends Component
|
|||
}
|
||||
}
|
||||
|
||||
public function clearMessage()
|
||||
{
|
||||
$this->message = null;
|
||||
$this->message_type = null;
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->files = Import::orderBy('id','desc')->get(); //HACK - slows down renders.
|
||||
|
|
|
@ -51,6 +51,7 @@ return [
|
|||
'success' => 'Your file has been imported',
|
||||
'file_delete_success' => 'Your file has been been successfully deleted',
|
||||
'file_delete_error' => 'The file was unable to be deleted',
|
||||
'file_missing' => 'The file selected is missing',
|
||||
'header_row_has_malformed_characters' => 'One or more attributes in the header row contain malformed UTF-8 characters',
|
||||
'content_row_has_malformed_characters' => 'One or more attributes in the first row of content contain malformed UTF-8 characters',
|
||||
],
|
||||
|
|
|
@ -303,6 +303,7 @@
|
|||
};
|
||||
data.process().done( function () {data.submit();});
|
||||
@this.progress = 0;
|
||||
@this.clearMessage();
|
||||
},
|
||||
progress: function(e, data) {
|
||||
@this.progress = parseInt((data.loaded / data.total * 100, 10));
|
||||
|
|
Loading…
Reference in a new issue