Added option to disable backup in import

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2020-05-11 20:41:10 -07:00
parent 9a2ed804ca
commit 95cc48e422
No known key found for this signature in database
GPG key ID: 10BFFDA3ED34B5AC
11 changed files with 95 additions and 85 deletions

View file

@ -119,7 +119,14 @@ class ImportController extends Controller
{
$this->authorize('import');
// Run a backup immediately before processing
Artisan::call('backup:run');
if ($request->has('run-backup')) {
\Log::debug('Backup manually requested via importer');
Artisan::call('backup:run');
} else {
\Log::debug('NO BACKUP requested via importer');
}
$errors = $request->import(Import::find($import_id));
$redirectTo = "hardware.index";
switch ($request->get('import-type')) {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
public/js/dist/all.js vendored

Binary file not shown.

View file

@ -1,11 +1,11 @@
{
"/js/build/vue.js": "/js/build/vue.js?id=684d1ab5c98c5b1b9d3c",
"/js/build/vue.js": "/js/build/vue.js?id=1d5d300bca67f973816c",
"/css/AdminLTE.css": "/css/AdminLTE.css?id=56b8066cfbc70df10545",
"/css/app.css": "/css/app.css?id=407edb63cc6b6dc62405",
"/css/overrides.css": "/css/overrides.css?id=014ba62bc420467fd405",
"/css/skins/skin-blue.css": "/css/skins/skin-blue.css?id=c28283a1d468e2337428",
"/css/skins/skin-red.css": "/css/skins/skin-red.css?id=079dd6c501fa9ea60a98",
"/css/skins/skin-contrast.css": "/css/skins/skin-contrast.css?id=47303dc15032d3ecb343",
"/css/skins/skin-contrast.css": "/css/skins/skin-contrast.css?id=62e14190151e9efc9995",
"/css/skins/skin-green.css": "/css/skins/skin-green.css?id=2c53f7ed585fcad563b2",
"/css/skins/skin-green-dark.css": "/css/skins/skin-green-dark.css?id=cb34691dbbb72cae7f5f",
"/css/skins/skin-black.css": "/css/skins/skin-black.css?id=1dfec89b8640b69dc0fc",
@ -18,13 +18,13 @@
"/css/skins/skin-blue-dark.css": "/css/skins/skin-blue-dark.css?id=d25c77d9c6f4cfe2efd4",
"/css/skins/skin-orange-dark.css": "/css/skins/skin-orange-dark.css?id=abc219c1fed59cecb860",
"/css/skins/skin-orange.css": "/css/skins/skin-orange.css?id=59664dbd286988d2a438",
"/js/build/vue.js.map": "/js/build/vue.js.map?id=8fafb985154034fd882a",
"/js/build/vue.js.map": "/js/build/vue.js.map?id=f89fab0f3e7a8694efa9",
"/css/AdminLTE.css.map": "/css/AdminLTE.css.map?id=5a2d6f3c59191ce716e2",
"/css/app.css.map": "/css/app.css.map?id=96b5c985e860716e6a16",
"/css/overrides.css.map": "/css/overrides.css.map?id=fe0a3186bd85efc442ca",
"/css/skins/skin-blue.css.map": "/css/skins/skin-blue.css.map?id=129b9523e6ffd5683230",
"/css/skins/skin-red.css.map": "/css/skins/skin-red.css.map?id=292dfa49bf2b6f23fa59",
"/css/skins/skin-contrast.css.map": "/css/skins/skin-contrast.css.map?id=141c0891e3ed15673d22",
"/css/skins/skin-contrast.css.map": "/css/skins/skin-contrast.css.map?id=bf37f812f0b6a109b5ce",
"/css/skins/skin-green.css.map": "/css/skins/skin-green.css.map?id=50461604ff9b1934d580",
"/css/skins/skin-green-dark.css.map": "/css/skins/skin-green-dark.css.map?id=988cf7da13d22c56bd8c",
"/css/skins/skin-black.css.map": "/css/skins/skin-black.css.map?id=ad0bf20283280a01b34f",
@ -37,8 +37,8 @@
"/css/skins/skin-blue-dark.css.map": "/css/skins/skin-blue-dark.css.map?id=32784cb5d02773eb0e69",
"/css/skins/skin-orange-dark.css.map": "/css/skins/skin-orange-dark.css.map?id=68b998638217fd08ef29",
"/css/skins/skin-orange.css.map": "/css/skins/skin-orange.css.map?id=f90fda3cc0a48c048a9e",
"/css/dist/all.css": "/css/dist/all.css?id=41fe3b2990d453da1997",
"/js/dist/all.js": "/js/dist/all.js?id=8ec0e00558ab4b60acb8",
"/css/build/all.css": "/css/build/all.css?id=41fe3b2990d453da1997",
"/js/build/all.js": "/js/build/all.js?id=8ec0e00558ab4b60acb8"
}
"/css/dist/all.css": "/css/dist/all.css?id=32f6e6a70fdaa03a0d88",
"/js/dist/all.js": "/js/dist/all.js?id=f46f0f728670ee80267a",
"/css/build/all.css": "/css/build/all.css?id=32f6e6a70fdaa03a0d88",
"/js/build/all.js": "/js/build/all.js?id=f46f0f728670ee80267a"
}

View file

@ -1,9 +1,3 @@
<style>
tr {
padding-left:30px;
}
</style>
<template>
<div v-show="processDetail">
@ -11,30 +5,38 @@ tr {
<div class="col-md-2"></div>
<div class="col-md-8" style="padding-top: 30px; margin: 0 auto;">
<div class="dynamic-form-row">
<div class="col-md-5 col-xs-12">
<label for="import-type">Import Type:</label>
<div class="col-md-5 col-xs-12">
<label for="import-type">Import Type:</label>
</div>
<div class="col-md-7 col-xs-12">
<select2 :options="options.importTypes" v-model="options.importType" required>
<option disabled value="0"></option>
</select2>
</div>
</div>
<div class="col-md-7 col-xs-12">
<select2 :options="options.importTypes" v-model="options.importType" required>
<option disabled value="0"></option>
</select2>
<div class="dynamic-form-row">
<div class="col-md-5 col-xs-12">
<label for="import-update">Update Existing Values?:</label>
</div>
<div class="col-md-7 col-xs-12">
<input type="checkbox" class="minimal" name="import-update" v-model="options.update">
</div>
</div>
</div>
<div class="dynamic-form-row">
<div class="col-md-5 col-xs-12">
<label for="import-update">Update Existing Values?:</label>
</div>
<div class="col-md-7 col-xs-12">
<input type="checkbox" name="import-update" v-model="options.update">
</div>
</div>
<div class="dynamic-form-row">
<div class="col-md-5 col-xs-12">
<label for="send-welcome">Send Welcome Email for new Users?</label>
</div>
<div class="col-md-7 col-xs-12">
<input type="checkbox" name="send-welcome" v-model="options.send_welcome">
<div class="dynamic-form-row">
<div class="col-md-5 col-xs-12">
<label for="send-welcome">Send Welcome Email for new Users?</label>
</div>
<div class="col-md-7 col-xs-12">
<input type="checkbox" class="minimal" name="send-welcome" v-model="options.send_welcome">
</div>
</div>
<div class="dynamic-form-row">
<div class="col-md-5 col-xs-12">
<label for="send-welcome">Backup before importing?</label>
</div>
<div class="col-md-7 col-xs-12">
<input type="checkbox" class="minimal" name="run-backup" v-model="options.run_backup">
</div>
</div>
</div>
<div class="alert col-md-8 col-md-offset-2" style="text-align:left"
@ -43,53 +45,53 @@ tr {
{{ this.statusText }}
</div>
</div>
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8" style="padding-top: 30px;">
<div class="col-md-4 text-right"><h4>Header Field</h4></div>
<div class="col-md-4"><h4>Import Field</h4></div>
<div class="col-md-4"><h4>Sample Value</h4></div>
</div>
</div>
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8" style="padding-top: 30px;">
<div class="col-md-4 text-right"><h4>Header Field</h4></div>
<div class="col-md-4"><h4>Import Field</h4></div>
<div class="col-md-4"><h4>Sample Value</h4></div>
</div>
</div>
<template v-for="(header, index) in file.header_row">
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="col-md-4 text-right">
<label :for="header" class="control-label">{{ header }}</label>
</div>
<div class="col-md-4 form-group">
<div required>
<select2 :options="columns" v-model="columnMappings[header]">
<option value="0">Do Not Import</option>
</select2>
</div>
</div>
<div class="col-md-4">
<p class="form-control-static">{{ activeFile.first_row[index] }}</p>
</div>
<template v-for="(header, index) in file.header_row">
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="col-md-4 text-right">
<label :for="header" class="control-label">{{ header }}</label>
</div>
<div class="col-md-4 form-group">
<div required>
<select2 :options="columns" v-model="columnMappings[header]">
<option value="0">Do Not Import</option>
</select2>
</div>
</div>
</template>
<div class="row">
<div class="col-md-6 col-md-offset-2 text-right" style="padding-top: 20px;">
<button type="button" class="btn btn-sm btn-default" @click="processDetail = false">Cancel</button>
<button type="submit" class="btn btn-sm btn-primary" @click="postSave">Import</button>
<br><br>
</div>
</div>
<div class="row">
<div class="alert col-md-8 col-md-offset-2" style="padding-top: 20px;"
:class="alertClass"
v-if="statusText">
{{ this.statusText }}
<div class="col-md-4">
<p class="form-control-static">{{ activeFile.first_row[index] }}</p>
</div>
</div>
</div>
</div>
</template>
<div class="row">
<div class="col-md-6 col-md-offset-2 text-right" style="padding-top: 20px;">
<button type="button" class="btn btn-sm btn-default" @click="processDetail = false">Cancel</button>
<button type="submit" class="btn btn-sm btn-primary" @click="postSave">Import</button>
<br><br>
</div>
</div>
<div class="row">
<div class="alert col-md-8 col-md-offset-2" style="padding-top: 20px;"
:class="alertClass"
v-if="statusText">
{{ this.statusText }}
</div>
</div>
</div>
</template>
<script>
@ -192,14 +194,14 @@ tr {
switch(this.options.importType) {
case 'asset':
return this.columnOptions.general
.concat(this.columnOptions.assets)
.concat(this.columnOptions.customFields)
.sort(sorter);
.concat(this.columnOptions.assets)
.concat(this.columnOptions.customFields)
.sort(sorter);
case 'consumable':
return this.columnOptions.general
.concat(this.columnOptions.consumables)
.sort(sorter);
.concat(this.columnOptions.consumables)
.sort(sorter);
case 'license':
return this.columnOptions.general.concat(this.columnOptions.licenses).sort(sorter);
case 'user':
@ -237,6 +239,7 @@ tr {
'import-update': this.options.update,
'send-welcome': this.options.send_welcome,
'import-type': this.options.importType,
'run-backup': this.options.run_backup,
'column-mappings': this.columnMappings
}).then( ({body}) => {
// Success
@ -289,4 +292,4 @@ tr {
select2: require('../select2.vue')
}
}
</script>
</script>