Skip to content

A free open source IT asset/license management system

Remove iCheck calls, fixed some bootstrap HTML

snipe506021dbe3e1
diff --git a/resources/lang/en/general.php b/resources/lang/en/general.php
index aa2e85c2fe..cb51b28a42 100644
--- a/resources/lang/en/general.php
+++ b/resources/lang/en/general.php
@@ -438,4 +438,5 @@ return [
'setup_successful_migrations' => 'Your database tables have been created',
'setup_migration_output' => 'Migration output:',
'setup_migration_create_user' => 'Next: Create User',
+ 'importer_generic_error' => 'Your file import is complete, but we did receive an error. This is usually caused by third-party API throttling from a notification webhook (such as Slack) and would not have interfered with the import itself, but you should confirm this.',
];
diff --git a/resources/views/livewire/importer.blade.php b/resources/views/livewire/importer.blade.php
index d711c96d6c..9fb7b4b84c 100644
--- a/resources/views/livewire/importer.blade.php
+++ b/resources/views/livewire/importer.blade.php
@@ -138,11 +138,9 @@
<tr class="warning">
<td colspan="4">
- <div class="col-md-12">
+ <div class="form-group">
- <div class="form-group col-md-12">
-
- <label for="activeFile.import_type" class="col-md-3 col-xs-12 text-right">
+ <label for="activeFile.import_type" class="col-md-3 col-xs-12">
{{ trans('general.import_type') }}
</label>
@@ -157,45 +155,40 @@
'data-livewire-component' => $_instance->id
]) }}
@if ($activeFile->import_type === 'asset' && $snipeSettings->auto_increment_assets == 0)
- <span class="help-block">
+ <p class="help-block">
{{ trans('general.auto_incrementing_asset_tags_disabled_so_tags_required') }}
- </span>
+ </p>
@endif
</div>
</div>
- <div class="form-group col-md-12">
- <label for="update" class="col-md-9 col-md-offset-3 col-xs-12">
- <input type="checkbox" class="minimal livewire-icheck" name="update" data-livewire-component="{{ $_instance->id }}" wire:model="update">
+ <div class="form-group col-md-9 col-md-offset-3">
+ <label class="form-control">
+ <input type="checkbox" name="update" data-livewire-component="{{ $_instance->id }}" wire:model="update">
{{ trans('general.update_existing_values') }}
- @if ($activeFile->import_type === 'asset' && $snipeSettings->auto_increment_assets == 1 && $update)
- <span class="help-block">
- {{ trans('general.auto_incrementing_asset_tags_enabled_so_now_assets_will_be_created') }}
- </span>
- @endif
</label>
- </div>
+ @if ($activeFile->import_type === 'asset' && $snipeSettings->auto_increment_assets == 1 && $update)
+ <p class="help-block">
+ {{ trans('general.auto_incrementing_asset_tags_enabled_so_now_assets_will_be_created') }}
+ </p>
+ @endif
- <div class="form-group col-md-12">
- <label for="send_welcome" class="col-md-9 col-md-offset-3 col-xs-12">
- <input type="checkbox" class="minimal livewire-icheck" name="send_welcome" data-livewire-component="{{ $_instance->id }}" wire:model="send_welcome">
+ <label class="form-control">
+ <input type="checkbox" name="send_welcome" data-livewire-component="{{ $_instance->id }}" wire:model="send_welcome">
{{ trans('general.send_welcome_email_to_users') }}
</label>
- </div>
- <div class="form-group col-md-12">
- <label for="run_backup" class="col-md-9 col-md-offset-3 col-xs-12">
- <input type="checkbox" class="minimal livewire-icheck" name="run_backup" data-livewire-component="{{ $_instance->id }}" wire:model="run_backup">
+ <label class="form-control">
+ <input type="checkbox" name="run_backup" data-livewire-component="{{ $_instance->id }}" wire:model="run_backup">
{{ trans('general.back_before_importing') }}
</label>
+
</div>
- @if ($statusText)
- <div class="form-group">
- <div class="alert col-md-8 col-md-offset-2 {{ $statusType == 'success' ? 'alert-success' : ($statusType == 'error' ? 'alert-danger' : 'alert-info') }}" style="text-align:left">
- {{ $statusText }}
- </div><!-- /alert -->
+ @if($statusText)
+ <div class="alert col-md-8 col-md-offset-3{{ $statusType == 'success' ? ' alert-success' : ($statusType == 'error' ? ' alert-danger' : ' alert-info') }}" style="padding-top: 20px;">
+ {!! $statusText !!}
</div>
@endif
@@ -258,14 +251,14 @@
</div>
@if($statusText)
- <div class="alert col-md-12 col-md-offset-2 {{ $statusType == 'success' ? 'alert-success' : ($statusType == 'error' ? 'alert-danger' : 'alert-info') }}" style="padding-top: 20px;">
- {{ $statusText }}
+ <div class="alert col-md-8 col-md-offset-3{{ $statusType == 'success' ? ' alert-success' : ($statusType == 'error' ? ' alert-danger' : ' alert-info') }}" style="padding-top: 20px;">
+ {!! $statusText !!}
</div>
@endif
@else
- <div class="form-group col-md-12">
+ <div class="form-group col-md-10">
<div class="col-md-3 text-left">
- <a href="#" wire:click="$set('activeFile',null)"><?php echo e(trans('general.cancel')); ?></a>
+ <a href="#" wire:click="$set('activeFile',null)">{{ trans('general.cancel') }}</a>
</div>
</div>
@endif {{-- end of if ... activeFile->import_type --}}
@@ -325,10 +318,7 @@
// For the importFile part:
$(function () {
- // initialize iCheck for use with livewire
- $('.minimal.livewire-icheck').iCheck({
- checkboxClass: 'icheckbox_minimal-blue',
- })
+
// we have to hook up to the `<tr id='importer-file'>` at the root of this display,
// because the #import button isn't visible until you click an import_type
@@ -339,7 +329,7 @@
return;
}
@this.statusType ='pending';
- @this.statusText = "{{ trans('admin/hardware/form.processing_spinner') }}";
+ @this.statusText = '<i class="fa fa-spinner fa-spin" aria-hidden="true"></i> {{ trans('admin/hardware/form.processing_spinner') }}';
@this.generate_field_map().then(function (mappings_raw) {
var mappings = JSON.parse(mappings_raw)
// console.warn("Here is the mappings:")
@@ -369,18 +359,29 @@
}).fail( function (jqXHR, textStatus, error) {
// Failure
var body = jqXHR.responseJSON
- if(body.status == 'import-errors') {
+ if((body) && (body.status) && body.status == 'import-errors') {
@this.emit('importError', body.messages);
@this.import_errors = body.messages
@this.statusType='error';
@this.statusText = "Error";
+
+ // If Slack/notifications hits API thresholds, we *do* 500, but we never
+ // actually surface that info.
+ //
+ // A 500 on notifications doesn't mean your import failed, so this is a confusing state.
+ //
+ // Ideally we'd have a message like "Your import worked, but not all
+ // notifications could be sent".
} else {
- console.warn("Not import-errors, just regular errors")
- console.dir(body)
-{{-- @this.emit('alert', body.error)--}}
- @this.message_type="danger"
- @this.message = body.error
+ console.warn("Not import-errors, just regular errors - maybe API limits")
+ @this.message_type="warning"
+ if ((body) && (error in body)) {
+ @this.message = body.error ? body.error:"Unknown error - might just be throttling by notifications."
+ } else {
+ @this.message = "{{ trans('general.importer_generic_error') }}"
+ }
+
}
@this.activeFile = null; //@this.set('hideDetails')
});