mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Add laravel routes to javascript (#4092)
* Add laravel routes to javascript This will clean up a lot of passing of urls. Adds a route() helper and everything... This commit also moves the customfield fetching to only be fetched once and shared with each file, rather than once for each file. * Try to fix travis unit test things. * Downgrade doctrine/inflector for php5 * Attempt to occasional seeder issues on travis if the asset does not generate validatable data. * Update sql dump for functional tests. * Try to fix api tests.
This commit is contained in:
parent
23ca2d9a0b
commit
c2616412c0
|
@ -43,7 +43,7 @@ before_script:
|
|||
# use the $DB env variable to determine the phpunit.xml to use
|
||||
# script: ./vendor/bin/codecept run --env testing-ci
|
||||
script:
|
||||
- ./vendor/bin/codecept run unit --env testing-ci
|
||||
- ./vendor/bin/codecept run unit
|
||||
# - ./vendor/bin/codecept run acceptance --env=testing-ci
|
||||
- ./vendor/bin/codecept run functional --env=functional-travis
|
||||
#script: ./vendor/bin/codecept run
|
||||
|
|
|
@ -29,7 +29,6 @@ class ImportsTransformer
|
|||
'header_row' => $import->header_row,
|
||||
'first_row' => $import->first_row,
|
||||
'field_map' => $import->field_map,
|
||||
'process_url'=> route('api.imports.importFile', $import->id),
|
||||
];
|
||||
|
||||
return $array;
|
||||
|
|
File diff suppressed because one or more lines are too long
6880
build/css/app.css
6880
build/css/app.css
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,23 +1,8 @@
|
|||
{
|
||||
"/build/vue.js": "/build/vue.js",
|
||||
"/mix.js": "/mix.js",
|
||||
"/build/app.css": "/build/app.535d8af1016a2377e449920c617f0197.css",
|
||||
"/build/AdminLTE.css": "/build/AdminLTE.3d8a2b2e33baa060b1b324363ad5e1c2.css",
|
||||
"/build/overrides.css": "/build/overrides.617623c6a96be3e0cbd11c5d4039ec10.css",
|
||||
"/css/all.css": "/css/all.css",
|
||||
"/js/all.js": "/js/all.js",
|
||||
"/css/app.css": "/css/app.css",
|
||||
"/css/dist/all.css": "/css/dist/all.css",
|
||||
"/js/dist/all.js": "/js/dist/all.js",
|
||||
"/css/AdminLTE.css": "/css/AdminLTE.css",
|
||||
"/css/overrides.css": "/css/overrides.css",
|
||||
"/css/skin-blue.css": "/css/skin-blue.css",
|
||||
"/vue.js": "/vue.js",
|
||||
"/vue.js.map": "/vue.js.map",
|
||||
"/mix.js.map": "/mix.js.map",
|
||||
"/css/AdminLTE.css.map": "/css/AdminLTE.css.map",
|
||||
"/css/app.css.map": "/css/app.css.map",
|
||||
"/css/overrides.css.map": "/css/overrides.css.map",
|
||||
"public/css/dist/all.css": "public/css/dist/all.css",
|
||||
"public/js/dist/all.js": "public/js/dist/all.js"
|
||||
"/vue.js": "/vue.js",
|
||||
"/css/AdminLTE.css": "/css/AdminLTE.css",
|
||||
"/css/app.css": "/css/app.css",
|
||||
"/css/overrides.css": "/css/overrides.css",
|
||||
"/public/css/dist/all.css": "/public/css/dist/all.css",
|
||||
"/public/js/dist/all.js": "/public/js/dist/all.js"
|
||||
}
|
52888
build/vue.js
52888
build/vue.js
File diff suppressed because one or more lines are too long
|
@ -11,6 +11,8 @@
|
|||
"doctrine/cache": "^1.6",
|
||||
"doctrine/common": "^2.7",
|
||||
"doctrine/dbal": "v2.5.13",
|
||||
"doctrine/inflector": "1.1.*",
|
||||
"doctrine/instantiator": "1.0.*",
|
||||
"erusev/parsedown": "^1.6",
|
||||
"fideloper/proxy": "^3.1",
|
||||
"intervention/image": "^2.3",
|
||||
|
@ -27,10 +29,11 @@
|
|||
"schuppo/password-strength": "~1.5",
|
||||
"spatie/laravel-backup": "^3.0.0",
|
||||
"tecnickcom/tc-lib-barcode": "^1.15",
|
||||
"tightenco/ziggy": "^0.4.1",
|
||||
"unicodeveloper/laravel-password": "^1.0",
|
||||
"watson/validating": "^3.0",
|
||||
"doctrine/instantiator": "1.0.*",
|
||||
"doctrine/inflector": "1.2.*"
|
||||
"phpspec/prophecy": "1.6.2",
|
||||
"phpdocumentor/reflection-docblock": "3.2.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"fzaninotto/faker": "~1.4",
|
||||
|
|
1064
composer.lock
generated
1064
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -255,7 +255,7 @@ return [
|
|||
Laravel\Tinker\TinkerServiceProvider::class,
|
||||
Unicodeveloper\DumbPassword\DumbPasswordServiceProvider::class,
|
||||
Schuppo\PasswordStrength\PasswordStrengthServiceProvider::class,
|
||||
|
||||
Tightenco\Ziggy\ZiggyServiceProvider::class, // Laravel routes in vue
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
|
|
|
@ -19,12 +19,14 @@ $factory->defineAs(Actionlog::class, 'asset-checkout', function (Faker\Generator
|
|||
$company = factory(App\Models\Company::class)->create();
|
||||
$user = factory(App\Models\User::class)->create(['company_id' => $company->id]);
|
||||
$target = factory(App\Models\User::class)->create(['company_id' => $company->id]);
|
||||
// $item = factory(App\Models\Asset::class)->create(['company_id' => $company->id]);
|
||||
do {
|
||||
$item = factory(App\Models\Asset::class)->create(['company_id' => $company->id]);
|
||||
} while (!$item->isValid());
|
||||
// dd($item);
|
||||
return [
|
||||
'user_id' => $user->id,
|
||||
'action_type' => 'checkout',
|
||||
'item_id' => factory(App\Models\Asset::class)->create(['company_id' => $company->id])->id,
|
||||
'item_id' => $item->id,
|
||||
'item_type' => App\Models\Asset::class,
|
||||
'target_id' => $target->id,
|
||||
'target_type' => get_class($target),
|
||||
|
|
BIN
public/css/dist/all.css
vendored
BIN
public/css/dist/all.css
vendored
Binary file not shown.
BIN
public/js/dist/all.js
vendored
BIN
public/js/dist/all.js
vendored
Binary file not shown.
|
@ -67,7 +67,7 @@ tr {
|
|||
|
||||
<script>
|
||||
export default {
|
||||
props: ['file', 'customFieldUrl'],
|
||||
props: ['file', 'customFields'],
|
||||
data() {
|
||||
return {
|
||||
activeFile: this.file,
|
||||
|
@ -130,14 +130,13 @@ tr {
|
|||
{id: 'jobtitle', text: 'Job Title' },
|
||||
{id: 'phone_number', text: 'Phone Number' },
|
||||
],
|
||||
customFields: [],
|
||||
customFields: this.customFields,
|
||||
},
|
||||
columnMappings: this.file.field_map || {},
|
||||
activeColumn: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchCustomFields();
|
||||
window.eventHub.$on('showDetails', this.toggleExtendedDisplay)
|
||||
this.populateSelect2ActiveItems();
|
||||
},
|
||||
|
@ -155,21 +154,9 @@ tr {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
fetchCustomFields() {
|
||||
this.$http.get(this.customFieldUrl)
|
||||
.then( ({data}) => {
|
||||
data = data.rows;
|
||||
data.forEach((item) => {
|
||||
this.columnOptions.customFields.push({
|
||||
'id': item.db_column_name,
|
||||
'text': item.name,
|
||||
})
|
||||
})
|
||||
});
|
||||
},
|
||||
postSave() {
|
||||
this.statusText = "Processing...";
|
||||
this.$http.post(this.file.process_url, {
|
||||
this.$http.post(route('api.imports.importFile', this.file.id), {
|
||||
'import-update': this.options.update,
|
||||
'import-type': this.options.importType,
|
||||
'column-mappings': this.columnMappings
|
||||
|
|
|
@ -11,8 +11,6 @@ th {
|
|||
<script>
|
||||
require('blueimp-file-upload');
|
||||
export default {
|
||||
|
||||
props: ['importUrl'],
|
||||
/*
|
||||
* The component's data.
|
||||
*/
|
||||
|
@ -32,13 +30,15 @@ th {
|
|||
currentPercent: "0",
|
||||
statusText: '',
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
customFields: [],
|
||||
};
|
||||
},
|
||||
|
||||
mounted() {
|
||||
window.eventHub.$on('importErrors', this.updateImportErrors);
|
||||
this.fetchFiles();
|
||||
this.fetchCustomFields();
|
||||
let vm = this;
|
||||
$('#fileupload').fileupload({
|
||||
dataType: 'json',
|
||||
|
@ -71,7 +71,7 @@ th {
|
|||
|
||||
methods: {
|
||||
fetchFiles() {
|
||||
this.$http.get(this.importUrl)
|
||||
this.$http.get(route('api.imports.index'))
|
||||
.then( ({data}) => this.files = data, // Success
|
||||
//Fail
|
||||
(response) => {
|
||||
|
@ -80,8 +80,20 @@ th {
|
|||
this.alert.message="Something went wrong fetching files...";
|
||||
});
|
||||
},
|
||||
fetchCustomFields() {
|
||||
this.$http.get(route('api.customfields.index'))
|
||||
.then( ({data}) => {
|
||||
data = data.rows;
|
||||
data.forEach((item) => {
|
||||
this.customFields.push({
|
||||
'id': item.db_column_name,
|
||||
'text': item.name,
|
||||
})
|
||||
})
|
||||
});
|
||||
},
|
||||
deleteFile(file, key) {
|
||||
this.$http.delete(this.importUrl+"/"+file.id)
|
||||
this.$http.delete(route('api.imports.destroy', file.id))
|
||||
.then((response) => this.files.splice(key, 1), // Success, remove file from array.
|
||||
(response) => {// Fail
|
||||
this.alert.type="danger";
|
||||
|
@ -98,7 +110,7 @@ th {
|
|||
},
|
||||
updateImportErrors(errors) {
|
||||
this.importErrors = errors;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
{{-- Page content --}}
|
||||
@section('content')
|
||||
<div id="app">
|
||||
<importer inline-template import-url="{{route('api.imports.index')}}" v-cloak>
|
||||
<importer inline-template v-cloak>
|
||||
<div class="row">
|
||||
<alert v-show="alert.visible" :alert-type="alert.type" v-on:hide="alert.visible = false">@{{ alert.message }}</alert>
|
||||
<errors :errors="importErrors"></errors>
|
||||
|
@ -65,7 +65,7 @@
|
|||
<import-file
|
||||
:key="currentFile.id"
|
||||
:file="currentFile"
|
||||
customFieldUrl="{{route('api.customfields.index')}}"
|
||||
:custom-fields="customFields"
|
||||
@alert="updateAlert(alert)">
|
||||
</import-file>
|
||||
</template>
|
||||
|
|
|
@ -27,13 +27,11 @@
|
|||
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
window.Laravel = { csrfToken: '{{ csrf_token() }}' };
|
||||
</script>
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
window.Laravel = { csrfToken: '{{ csrf_token() }}' };
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<style nonce="{{ csrf_token() }}">
|
||||
<style nonce="{{ csrf_token() }}">
|
||||
@if ($snipeSettings)
|
||||
@if ($snipeSettings->header_color)
|
||||
.main-header .navbar, .main-header .logo {
|
||||
|
@ -68,16 +66,15 @@
|
|||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
window.snipeit = {
|
||||
settings: {
|
||||
"per_page": {{ $snipeSettings->per_page }}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
</script>
|
||||
<!-- Add laravel route sinto javascript Primarily useful for vue.-->
|
||||
@routes
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
-- MySQL dump 10.13 Distrib 5.7.18, for Linux (x86_64)
|
||||
-- MySQL dump 10.13 Distrib 5.7.19, for Linux (x86_64)
|
||||
--
|
||||
-- Host: localhost Database: snipeittests
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 5.7.18-0ubuntu0.16.10.1
|
||||
-- Server version 5.7.19-0ubuntu0.17.04.1
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
|
@ -1347,7 +1347,7 @@ CREATE TABLE `users` (
|
|||
PRIMARY KEY (`id`),
|
||||
KEY `users_activation_code_index` (`activation_code`),
|
||||
KEY `users_reset_password_code_index` (`reset_password_code`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
|
@ -1392,4 +1392,4 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2017-05-22 20:08:33
|
||||
-- Dump completed on 2017-10-01 15:36:56
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
<?php
|
||||
namespace Helper;
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
// here you can define custom actions
|
||||
// all public methods declared in helper class will be available in $I
|
||||
|
||||
class Api extends \Codeception\Module
|
||||
{
|
||||
|
||||
public function setupDatabase()
|
||||
{
|
||||
Artisan::call('migrate');
|
||||
Artisan::call('db:seed');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,3 +11,4 @@ modules:
|
|||
environment_file: .env.testing
|
||||
disable_middleware: true
|
||||
cleanup: true
|
||||
|
||||
|
|
|
@ -9,15 +9,16 @@ class ApiAssetsCest
|
|||
|
||||
public function _before(ApiTester $I)
|
||||
{
|
||||
$I->setupDatabase();
|
||||
$this->faker = \Faker\Factory::create();
|
||||
$this->user = \App\Models\User::find(1);
|
||||
|
||||
$I->amBearerAuthenticated($I->getToken($this->user));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function indexAssets(ApiTester $I)
|
||||
{
|
||||
|
||||
$I->wantTo('Get a list of assets');
|
||||
|
||||
// setup
|
||||
|
|
Loading…
Reference in a new issue