Commit 90b17a3ef854534ccd233f3398b6b539615cd16c
1 parent
397c5dae42
Exists in
master
interceptor work with local sqlite
Showing
4 changed files
with
133 additions
and
53 deletions
Show diff stats
gulpfile.js
| 1 | const gulp = require('gulp'); | 1 | const gulp = require('gulp'); |
| 2 | const sass = require('gulp-sass'); | 2 | const sass = require('gulp-sass'); |
| 3 | const concat = require('gulp-concat'); | 3 | const concat = require('gulp-concat'); |
| 4 | const rename = require('gulp-rename'); | 4 | const rename = require('gulp-rename'); |
| 5 | const uglify = require('gulp-uglify'); | 5 | const uglify = require('gulp-uglify'); |
| 6 | const pump = require('pump'); | 6 | const pump = require('pump'); |
| 7 | const jshint = require('gulp-jshint'); | 7 | const jshint = require('gulp-jshint'); |
| 8 | const replace = require('gulp-replace'); | 8 | const replace = require('gulp-replace'); |
| 9 | const connect = require('gulp-connect'); | 9 | const connect = require('gulp-connect'); |
| 10 | const watch = require('gulp-watch'); | 10 | const watch = require('gulp-watch'); |
| 11 | 11 | ||
| 12 | var paths = { | 12 | var paths = { |
| 13 | srcHTML : 'src/views/*.html', | 13 | srcHTML : 'src/views/*.html', |
| 14 | srcJS : 'src/js/*.js', | 14 | srcJS : 'src/js/*.js', |
| 15 | confJS : 'src/etc/develop.js', | 15 | confJS : 'src/etc/develop.js', |
| 16 | dist : 'dist/', | 16 | dist : 'dist/', |
| 17 | distHTML : 'dist/views/' | 17 | distHTML : 'dist/views/' |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | gulp.task('uglify', function() { | 20 | gulp.task('uglify', function() { |
| 21 | pump( | 21 | pump( |
| 22 | [ | 22 | [ |
| 23 | gulp.src([paths.srcJS, paths.confJS]), | 23 | gulp.src([paths.srcJS, paths.confJS]), |
| 24 | concat('wrapper-demo.js'), | 24 | concat('wrapper-demo.js'), |
| 25 | replace('/src/', '/dist/'), | 25 | replace('/src/', '/dist/'), |
| 26 | gulp.dest(paths.dist), | 26 | gulp.dest(paths.dist), |
| 27 | rename('wrapper-demo.min.js'), | 27 | rename('wrapper-demo.min.js'), |
| 28 | uglify(), | ||
| 29 | gulp.dest(paths.dist) | 28 | gulp.dest(paths.dist) |
| 30 | ] | 29 | ] |
| 31 | ); | 30 | ); |
| 32 | }); | 31 | }); |
| 33 | 32 | ||
| 34 | gulp.task('html', function() { | 33 | gulp.task('html', function() { |
| 35 | pump([ | 34 | pump([ |
| 36 | gulp.src('index.html'), | 35 | gulp.src('index.html'), |
| 37 | replace(/\<!\-\- BUILD \-\-\>.*\<!\-\- \/BUILD \-\-\>/sgm, '<script src="wrapper-demo.min.js"></script>'), | 36 | replace(/\<!\-\- BUILD \-\-\>.*\<!\-\- \/BUILD \-\-\>/sgm, '<script src="wrapper-demo.min.js"></script>'), |
| 38 | gulp.dest(paths.dist) | 37 | gulp.dest(paths.dist) |
| 39 | ]); | 38 | ]); |
| 40 | pump([ | 39 | pump([ |
| 41 | gulp.src(paths.srcHTML), | 40 | gulp.src(paths.srcHTML), |
| 42 | gulp.dest(paths.distHTML) | 41 | gulp.dest(paths.distHTML) |
| 43 | ]); | 42 | ]); |
| 44 | }) | 43 | }) |
| 45 | 44 | ||
| 46 | gulp.task('sass', function() { | 45 | gulp.task('sass', function() { |
| 47 | return gulp.src('src/sass/*.scss') | 46 | return gulp.src('src/sass/*.scss') |
| 48 | .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError)) | 47 | .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError)) |
| 49 | .pipe(gulp.dest('css')); | 48 | .pipe(gulp.dest('css')); |
| 50 | }); | 49 | }); |
| 51 | 50 | ||
| 52 | gulp.task('pre-install', function() { | 51 | gulp.task('pre-install', function() { |
| 53 | pump([ | 52 | pump([ |
| 54 | gulp.src('package.json'), | 53 | gulp.src('package.json'), |
| 55 | replace('ssh://git@debonline.dyndns.org:', 'http://git.focasoftware.com/'), | 54 | replace('ssh://git@debonline.dyndns.org:', 'http://git.focasoftware.com/'), |
| 56 | gulp.dest('') | 55 | gulp.dest('') |
| 57 | ]); | 56 | ]); |
| 58 | }) | 57 | }) |
| 59 | 58 | ||
| 60 | gulp.task('post-install', function() { | 59 | gulp.task('post-install', function() { |
| 61 | pump([ | 60 | pump([ |
| 62 | gulp.src('package.json'), | 61 | gulp.src('package.json'), |
| 63 | replace('http://git.focasoftware.com/', 'ssh://git@debonline.dyndns.org:'), | 62 | replace('http://git.focasoftware.com/', 'ssh://git@debonline.dyndns.org:'), |
| 64 | gulp.dest('') | 63 | gulp.dest('') |
| 65 | ]); | 64 | ]); |
| 66 | }) | 65 | }) |
| 67 | 66 | ||
| 68 | gulp.task('pre-commit', function() { | 67 | gulp.task('pre-commit', function() { |
| 69 | pump( | 68 | pump( |
| 70 | [ | 69 | [ |
| 71 | gulp.src(paths.srcJS), | 70 | gulp.src(paths.srcJS), |
| 72 | jshint('.jshintrc'), | 71 | jshint('.jshintrc'), |
| 73 | jshint.reporter('default'), | 72 | jshint.reporter('default'), |
| 74 | jshint.reporter('fail') | 73 | jshint.reporter('fail') |
| 75 | ] | 74 | ] |
| 76 | ); | 75 | ); |
| 77 | gulp.start('uglify'); | 76 | gulp.start('uglify'); |
| 78 | gulp.start('sass'); | 77 | gulp.start('sass'); |
| 79 | }); | 78 | }); |
| 80 | 79 | ||
| 81 | gulp.task('webserver', function() { | 80 | gulp.task('webserver', function() { |
| 82 | pump [ | 81 | pump [ |
| 83 | connect.server( | 82 | connect.server( |
| 84 | { | 83 | { |
| 85 | port: 8086, | 84 | port: 8086, |
| 86 | host: '0.0.0.0', | 85 | host: '0.0.0.0', |
| 87 | livereload: true | 86 | livereload: true |
| 88 | } | 87 | } |
| 89 | ) | 88 | ) |
| 90 | ] | 89 | ] |
| 91 | }); | 90 | }); |
| 92 | 91 | ||
| 93 | gulp.task('watch', function() { | 92 | gulp.task('watch', function() { |
| 94 | gulp.watch([paths.srcJS], ['uglify']); | 93 | gulp.watch([paths.srcJS], ['uglify']); |
| 95 | gulp.watch('src/sass/*.scss', ['sass']); | 94 | gulp.watch('src/sass/*.scss', ['sass']); |
| 96 | }) | 95 | }) |
| 97 | 96 | ||
| 98 | gulp.task('reload'), function() { | 97 | gulp.task('reload'), function() { |
| 99 | connect.reload(); | 98 | connect.reload(); |
| 100 | } | 99 | } |
| 101 | 100 | ||
| 102 | gulp.task('livereload', function() { | 101 | gulp.task('livereload', function() { |
| 103 | gulp.watch('css/*.css', ['reload']); | 102 | gulp.watch('css/*.css', ['reload']); |
| 104 | gulp.watch('js/dist/*.js', ['reload']); | 103 | gulp.watch('js/dist/*.js', ['reload']); |
| 105 | gulp.watch('vistas/**/*.html', ['reload']); | 104 | gulp.watch('vistas/**/*.html', ['reload']); |
| 106 | gulp.watch('index.html', ['reload']); | 105 | gulp.watch('index.html', ['reload']); |
| 107 | }); | 106 | }); |
| 108 | 107 | ||
| 109 | gulp.task('default', ['webserver', 'livereload', 'watch']); | 108 | gulp.task('default', ['webserver', 'livereload', 'watch']); |
| 110 | 109 |
package.json
| 1 | { | 1 | { |
| 2 | "name": "wrapper-demo", | 2 | "name": "wrapper-demo", |
| 3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
| 4 | "description": "", | 4 | "description": "", |
| 5 | "main": "main.js", | 5 | "main": "main.js", |
| 6 | "scripts": { | 6 | "scripts": { |
| 7 | "initdev": "npm install gulp --global && npm install && npm install -g jshint", | 7 | "initdev": "npm install gulp --global && npm install && npm install -g jshint", |
| 8 | "gulp-pre-commit": "gulp pre-commit", | 8 | "gulp-pre-commit": "gulp pre-commit", |
| 9 | "compile": "gulp uglify && gulp sass", | 9 | "compile": "gulp uglify && gulp sass", |
| 10 | "actualizar": "git pull origin master", | 10 | "actualizar": "git pull origin master", |
| 11 | "install-dev": "gulp pre-install && npm install && gulp post-install" | 11 | "install-dev": "gulp pre-install && npm install && gulp post-install" |
| 12 | }, | 12 | }, |
| 13 | "pre-commit": [ | 13 | "pre-commit": [ |
| 14 | "gulp-pre-commit" | 14 | "gulp-pre-commit" |
| 15 | ], | 15 | ], |
| 16 | "repository": { | 16 | "repository": { |
| 17 | "type": "git", | 17 | "type": "git", |
| 18 | "url": "git@debonline.dyndns.org:npm/wrapper-demo.git" | 18 | "url": "git+http://git.focasoftware.com/npm/wrapper-mobile.git" |
| 19 | }, | 19 | }, |
| 20 | "author": "Foca Software", | 20 | "author": "Foca Software", |
| 21 | "license": "ISC", | 21 | "license": "ISC", |
| 22 | "dependencies": { | 22 | "dependencies": { |
| 23 | "angular": "^1.7.8", | 23 | "angular": "^1.7.8", |
| 24 | "angular-chart.js": "1.1.1", | 24 | "angular-chart.js": "1.1.1", |
| 25 | "angular-cookies": "^1.7.8", | 25 | "angular-cookies": "^1.7.8", |
| 26 | "angular-i18n": "^1.7.8", | 26 | "angular-i18n": "^1.7.8", |
| 27 | "angular-ladda": "^0.4.3", | 27 | "angular-ladda": "^0.4.3", |
| 28 | "angular-md5": "^0.1.10", | 28 | "angular-md5": "^0.1.10", |
| 29 | "angular-route": "^1.7.8", | 29 | "angular-route": "^1.7.8", |
| 30 | "angular-sanitize": "^1.7.8", | 30 | "angular-sanitize": "^1.7.8", |
| 31 | "angular-ui-swiper": "^2.3.8", | 31 | "angular-ui-swiper": "^2.3.8", |
| 32 | "bootstrap": "^4.3.1", | 32 | "bootstrap": "^4.3.1", |
| 33 | "chart.js": "2.7.3", | 33 | "chart.js": "2.7.3", |
| 34 | "foca-abm-chofer": "git+http://git.focasoftware.com/npm/foca-abm-chofer.git", | 34 | "foca-abm-chofer": "git+http://git.focasoftware.com/npm/foca-abm-chofer.git#develop", |
| 35 | "foca-abm-plazo-pago": "git+http://git.focasoftware.com/npm/foca-abm-plazo-pago.git", | 35 | "foca-abm-plazo-pago": "git+http://git.focasoftware.com/npm/foca-abm-plazo-pago.git#develop", |
| 36 | "foca-abm-precios-condiciones": "git+http://git.focasoftware.com/npm/foca-abm-precios-condiciones.git", | 36 | "foca-abm-precios-condiciones": "git+http://git.focasoftware.com/npm/foca-abm-precios-condiciones.git#develop", |
| 37 | "foca-abm-sectores": "git+http://git.focasoftware.com/npm/foca-abm-sectores.git", | 37 | "foca-abm-vehiculo": "git+http://git.focasoftware.com/npm/foca-abm-vehiculo.git#develop", |
| 38 | "foca-abm-vehiculo": "git+http://git.focasoftware.com/npm/foca-abm-vehiculo.git", | 38 | "foca-abm-vendedor-cobrador": "git+http://git.focasoftware.com/npm/foca-abm-vendedor-cobrador.git#develop", |
| 39 | "foca-abm-vendedor-cobrador": "git+http://git.focasoftware.com/npm/foca-abm-vendedor-cobrador.git", | 39 | "foca-activar-hoja-ruta": "git+http://git.focasoftware.com/npm/foca-activar-hoja-ruta.git#develop", |
| 40 | "foca-activar-hoja-ruta": "git+http://git.focasoftware.com/npm/foca-activar-hoja-ruta.git", | 40 | "foca-admin-seguimiento": "git+http://git.focasoftware.com/npm/foca-admin-seguimiento.git#develop", |
| 41 | "foca-admin-seguimiento": "git+http://git.focasoftware.com/npm/foca-admin-seguimiento.git", | 41 | "foca-botonera-facturador": "git+http://git.focasoftware.com/npm/foca-botonera-facturador.git#develop", |
| 42 | "foca-botonera-facturador": "git+http://git.focasoftware.com/npm/foca-botonera-facturador.git", | 42 | "foca-botonera-lateral": "git+http://git.focasoftware.com/npm/foca-botonera-lateral.git#develop", |
| 43 | "foca-botonera-lateral": "git+http://git.focasoftware.com/npm/foca-botonera-lateral.git", | 43 | "foca-botonera-principal": "git+http://git.focasoftware.com/npm/foca-botonera-principal.git#develop", |
| 44 | "foca-botonera-principal": "git+http://git.focasoftware.com/npm/foca-botonera-principal.git", | 44 | "foca-busqueda-cliente": "git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git#develop", |
| 45 | "foca-busqueda-cliente": "git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git", | 45 | "foca-cabecera-facturador": "git+http://git.focasoftware.com/npm/foca-cabecera-facturador.git#develop", |
| 46 | "foca-cabecera-facturador": "git+http://git.focasoftware.com/npm/foca-cabecera-facturador.git", | 46 | "foca-configuracion": "git+http://git.focasoftware.com/npm/foca-configuracion.git#develop", |
| 47 | "foca-configuracion": "git+http://git.focasoftware.com/npm/foca-configuracion.git", | 47 | "foca-crear-cobranza": "git+http://git.focasoftware.com/npm/foca-crear-cobranza.git#develop", |
| 48 | "foca-crear-cobranza": "git+http://git.focasoftware.com/npm/foca-crear-cobranza.git", | 48 | "foca-crear-hoja-ruta": "git+http://git.focasoftware.com/npm/foca-crear-hoja-ruta.git#develop", |
| 49 | "foca-crear-hoja-ruta": "git+http://git.focasoftware.com/npm/foca-crear-hoja-ruta.git", | 49 | "foca-crear-login": "git+http://git.focasoftware.com/npm/foca-crear-login.git#develop", |
| 50 | "foca-crear-login": "git+http://git.focasoftware.com/npm/foca-crear-login.git", | ||
| 51 | "foca-crear-nota-pedido": "git+http://git.focasoftware.com/npm/foca-crear-nota-pedido.git#develop", | 50 | "foca-crear-nota-pedido": "git+http://git.focasoftware.com/npm/foca-crear-nota-pedido.git#develop", |
| 52 | "foca-crear-remito": "git+http://git.focasoftware.com/npm/foca-crear-remito.git", | 51 | "foca-crear-remito": "git+http://git.focasoftware.com/npm/foca-crear-remito.git#develop", |
| 53 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", | 52 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git#develop", |
| 54 | "foca-estado-cisternas": "git+http://git.focasoftware.com/npm/foca-estado-cisternas.git", | 53 | "foca-estado-cisternas": "git+http://git.focasoftware.com/npm/foca-estado-cisternas.git#develop", |
| 55 | "foca-filtros": "git+http://git.focasoftware.com/npm/foca-filtros.git", | 54 | "foca-filtros": "git+http://git.focasoftware.com/npm/foca-filtros.git#develop", |
| 56 | "foca-hoja-ruta": "git+http://git.focasoftware.com/npm/foca-hoja-ruta.git", | 55 | "foca-hoja-ruta": "git+http://git.focasoftware.com/npm/foca-hoja-ruta.git#develop", |
| 57 | "foca-login": "git+http://git.focasoftware.com/npm/foca-login.git", | 56 | "foca-login": "git+http://git.focasoftware.com/npm/foca-login.git#develop", |
| 58 | "foca-logistica-pedido-ruta": "git+http://git.focasoftware.com/npm/foca-logistica-pedido-ruta.git", | 57 | "foca-logistica-pedido-ruta": "git+http://git.focasoftware.com/npm/foca-logistica-pedido-ruta.git#develop", |
| 59 | "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", | 58 | "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git#develop", |
| 60 | "foca-modal-busqueda-productos": "git+http://git.focasoftware.com/npm/foca-modal-busqueda-productos.git", | 59 | "foca-modal-busqueda-productos": "git+http://git.focasoftware.com/npm/foca-modal-busqueda-productos.git#develop", |
| 61 | "foca-modal-cheque": "git+http://git.focasoftware.com/npm/foca-modal-cheque.git", | 60 | "foca-modal-cheque": "git+http://git.focasoftware.com/npm/foca-modal-cheque.git#develop", |
| 62 | "foca-modal-cobranza": "git+http://git.focasoftware.com/npm/foca-modal-cobranza.git", | 61 | "foca-modal-cobranza": "git+http://git.focasoftware.com/npm/foca-modal-cobranza.git#develop", |
| 63 | "foca-modal-cotizacion": "git+http://git.focasoftware.com/npm/foca-modal-cotizacion.git", | 62 | "foca-modal-cotizacion": "git+http://git.focasoftware.com/npm/foca-modal-cotizacion.git#develop", |
| 64 | "foca-modal-detalle-hoja-ruta": "git+http://git.focasoftware.com/npm/foca-modal-detalle-hoja-ruta.git", | 63 | "foca-modal-detalle-hoja-ruta": "git+http://git.focasoftware.com/npm/foca-modal-detalle-hoja-ruta.git#develop", |
| 65 | "foca-modal-detalles": "git+http://git.focasoftware.com/npm/foca-modal-detalles.git", | 64 | "foca-modal-detalles": "git+http://git.focasoftware.com/npm/foca-modal-detalles.git#develop", |
| 66 | "foca-modal-domicilio": "git+http://git.focasoftware.com/npm/foca-modal-domicilio.git", | 65 | "foca-modal-domicilio": "git+http://git.focasoftware.com/npm/foca-modal-domicilio.git#develop", |
| 67 | "foca-modal-efectivo": "git+http://git.focasoftware.com/npm/foca-modal-efectivo.git", | 66 | "foca-modal-efectivo": "git+http://git.focasoftware.com/npm/foca-modal-efectivo.git#develop", |
| 68 | "foca-modal-factura": "git+http://git.focasoftware.com/npm/foca-modal-factura.git", | 67 | "foca-modal-factura": "git+http://git.focasoftware.com/npm/foca-modal-factura.git#develop", |
| 69 | "foca-modal-factura-detalle": "git+http://git.focasoftware.com/npm/foca-modal-factura-detalle.git", | 68 | "foca-modal-factura-detalle": "git+http://git.focasoftware.com/npm/foca-modal-factura-detalle.git#develop", |
| 70 | "foca-modal-flete": "git+http://git.focasoftware.com/npm/foca-modal-flete.git", | 69 | "foca-modal-flete": "git+http://git.focasoftware.com/npm/foca-modal-flete.git#develop", |
| 71 | "foca-modal-lista-precio": "git+http://git.focasoftware.com/npm/foca-modal-lista-precio.git", | 70 | "foca-modal-lista-precio": "git+http://git.focasoftware.com/npm/foca-modal-lista-precio.git#develop", |
| 72 | "foca-modal-login": "git+http://git.focasoftware.com/npm/foca-modal-login.git", | 71 | "foca-modal-login": "git+http://git.focasoftware.com/npm/foca-modal-login.git#develop", |
| 73 | "foca-modal-nota-pedido": "git+http://git.focasoftware.com/npm/foca-modal-nota-pedido.git", | 72 | "foca-modal-nota-pedido": "git+http://git.focasoftware.com/npm/foca-modal-nota-pedido.git#develop", |
| 74 | "foca-modal-precio-condiciones": "git+http://git.focasoftware.com/npm/foca-modal-precio-condiciones.git", | 73 | "foca-modal-precio-condiciones": "git+http://git.focasoftware.com/npm/foca-modal-precio-condiciones.git#develop", |
| 75 | "foca-modal-punto-descarga": "git+http://git.focasoftware.com/npm/foca-modal-punto-descarga.git", | 74 | "foca-modal-punto-descarga": "git+http://git.focasoftware.com/npm/foca-modal-punto-descarga.git#develop", |
| 76 | "foca-modal-remito": "git+http://git.focasoftware.com/npm/foca-modal-remito.git", | 75 | "foca-modal-remito": "git+http://git.focasoftware.com/npm/foca-modal-remito.git#develop", |
| 77 | "foca-modal-resumen-cuenta": "git+http://git.focasoftware.com/npm/foca-modal-resumen-cuenta.git", | 76 | "foca-modal-resumen-cuenta": "git+http://git.focasoftware.com/npm/foca-modal-resumen-cuenta.git#develop", |
| 78 | "foca-modal-tarifa-flete": "git+http://git.focasoftware.com/npm/foca-modal-tarifa-flete.git", | 77 | "foca-modal-tarifa-flete": "git+http://git.focasoftware.com/npm/foca-modal-tarifa-flete.git#develop", |
| 79 | "foca-modal-unidad-medida": "git+http://git.focasoftware.com/npm/foca-modal-unidad-medida.git", | 78 | "foca-modal-unidad-medida": "git+http://git.focasoftware.com/npm/foca-modal-unidad-medida.git#develop", |
| 80 | "foca-nombre-empresa": "git+http://git.focasoftware.com/npm/foca-nombre-empresa.git", | 79 | "foca-nombre-empresa": "git+http://git.focasoftware.com/npm/foca-nombre-empresa.git#develop", |
| 81 | "foca-seguimiento": "git+http://git.focasoftware.com/npm/foca-seguimiento.git", | 80 | "foca-seguimiento": "git+http://git.focasoftware.com/npm/foca-seguimiento.git#develop", |
| 82 | "foca-sqlite": "git+http://git.focasoftware.com/npm/foca-sqlite.git", | 81 | "foca-sqlite": "git+http://git.focasoftware.com/npm/foca-sqlite.git#develop", |
| 83 | "foca-teclado": "git+http://git.focasoftware.com/npm/foca-teclado.git", | 82 | "foca-teclado": "git+http://git.focasoftware.com/npm/foca-teclado.git#develop", |
| 84 | "font-awesome": "^4.7.0", | 83 | "font-awesome": "^4.7.0", |
| 85 | "gulp-angular-templatecache": "^2.2.1", | 84 | "gulp-angular-templatecache": "^2.2.1", |
| 86 | "gulp-htmlmin": "^5.0.1", | 85 | "gulp-htmlmin": "^5.0.1", |
| 87 | "gulp-sequence": "^1.0.0", | 86 | "gulp-sequence": "^1.0.0", |
| 88 | "gulp-uglify-es": "^1.0.4", | 87 | "gulp-uglify-es": "^1.0.4", |
| 89 | "jquery": "^3.3.1", | 88 | "jquery": "^3.3.1", |
| 90 | "ladda": "1.0.6", | 89 | "ladda": "1.0.6", |
| 91 | "leaflet": "1.3.4", | 90 | "leaflet": "1.3.4", |
| 92 | "moment": "2.23.0", | 91 | "moment": "2.23.0", |
| 93 | "ngstorage": "^0.3.11", | 92 | "ngstorage": "^0.3.11", |
| 94 | "node-sass": "^4.10.0", | 93 | "node-sass": "^4.10.0", |
| 95 | "uglify": "^0.1.5", | 94 | "uglify": "^0.1.5", |
| 96 | "ui-bootstrap4": "^3.0.6" | 95 | "ui-bootstrap4": "^3.0.6" |
| 97 | }, | 96 | }, |
| 98 | "devDependencies": { | 97 | "devDependencies": { |
| 99 | "gulp": "3.9.1", | 98 | "gulp": "3.9.1", |
| 100 | "gulp-clean": "^0.4.0", | 99 | "gulp-clean": "^0.4.0", |
| 101 | "gulp-concat": "^2.6.1", | 100 | "gulp-concat": "^2.6.1", |
| 102 | "gulp-connect": "^5.6.1", | 101 | "gulp-connect": "^5.6.1", |
| 103 | "gulp-jshint": "^2.1.0", | 102 | "gulp-jshint": "^2.1.0", |
| 104 | "gulp-rename": "^1.4.0", | 103 | "gulp-rename": "^1.4.0", |
| 105 | "gulp-replace": "^1.0.0", | 104 | "gulp-replace": "^1.0.0", |
| 106 | "gulp-sass": "^4.0.1", | 105 | "gulp-sass": "^4.0.1", |
| 107 | "gulp-uglify": "^3.0.2", | 106 | "gulp-uglify": "^3.0.2", |
| 108 | "gulp-watch": "^5.0.1", | 107 | "gulp-watch": "^5.0.1", |
| 109 | "jasmine-core": "^3.2.1", | 108 | "jasmine-core": "^3.4.0", |
| 110 | "jshint": "^2.10.2", | 109 | "jshint": "^2.10.2", |
| 111 | "pre-commit": "^1.2.2", | 110 | "pre-commit": "^1.2.2", |
| 112 | "pump": "^3.0.0" | 111 | "pump": "^3.0.0" |
| 113 | } | 112 | } |
| 114 | } | 113 | } |
| 115 | 114 |
src/js/interceptor.js
| File was created | 1 | angular.module('focaConfiguracion') | |
| 2 | .factory("RequestHeadersInterceptor", [ '$injector', | ||
| 3 | function($injector) { | ||
| 4 | |||
| 5 | function reintentarRequest(httpConfig) { | ||
| 6 | |||
| 7 | var $timeout = $injector.get('$timeout'); | ||
| 8 | |||
| 9 | $timeout(function() { | ||
| 10 | |||
| 11 | var $http = $injector.get('$http'); | ||
| 12 | return $http(httpConfig.config); | ||
| 13 | }, 5000); | ||
| 14 | |||
| 15 | return getDataSqlite(httpConfig); | ||
| 16 | } | ||
| 17 | |||
| 18 | function updateDataSqlite(request) { | ||
| 19 | |||
| 20 | var sqliteService = $injector.get('focaSqliteService'); | ||
| 21 | |||
| 22 | sqliteService.updateQuery( | ||
| 23 | request.config.url, | ||
| 24 | JSON.stringify(request.config.data), | ||
| 25 | request.config.method, | ||
| 26 | JSON.stringify(request.data)) | ||
| 27 | } | ||
| 28 | |||
| 29 | function getDataSqlite(request) { | ||
| 30 | return new Promise(function(resolve) { | ||
| 31 | |||
| 32 | var sqliteService = $injector.get('focaSqliteService'); | ||
| 33 | |||
| 34 | sqliteService.getQuery( | ||
| 35 | request.config.url, | ||
| 36 | JSON.stringify(request.config.data), | ||
| 37 | request.config.method, | ||
| 38 | respuesta); | ||
| 39 | |||
| 40 | function respuesta(config) { | ||
| 41 | |||
| 42 | var request = { | ||
| 43 | data: JSON.parse(config), | ||
| 44 | status: 200 | ||
| 45 | }; | ||
| 46 | |||
| 47 | console.log(request); | ||
| 48 | |||
| 49 | if (config) { | ||
| 50 | resolve(request); | ||
| 51 | } | ||
| 52 | } | ||
| 53 | }); | ||
| 54 | } | ||
| 55 | |||
| 56 | var request = { | ||
| 57 | responseError: async function(config) { | ||
| 58 | |||
| 59 | if (config.status === -1) { | ||
| 60 | |||
| 61 | var data = await reintentarRequest(config); | ||
| 62 | |||
| 63 | config.data = data.data; | ||
| 64 | |||
| 65 | return config; | ||
| 66 | |||
| 67 | } else { | ||
| 68 | return config; | ||
| 69 | } | ||
| 70 | }, | ||
| 71 | response: function(response) { | ||
| 72 | |||
| 73 | if (typeof response.data !== 'string') { | ||
| 74 | updateDataSqlite(response); | ||
| 75 | } | ||
| 76 | return response; | ||
| 77 | } | ||
| 78 | } | ||
| 79 | |||
| 80 | return request; | ||
| 81 | } | ||
| 82 | ]); | ||
| 83 |
src/js/service.js
| 1 | angular.module('appWrapperDemo') | 1 | angular.module('appWrapperDemo') |
| 2 | .factory('API_ENDPOINT', [ | 2 | .factory('API_ENDPOINT', [ |
| 3 | '$http', | 3 | '$http', |
| 4 | '$localStorage', | 4 | '$localStorage', |
| 5 | 'ENDPOINT_BASE', | 5 | 'ENDPOINT_BASE', |
| 6 | function($http, $localStorage, ENDPOINT_BASE) { | 6 | function($http, $localStorage, ENDPOINT_BASE) { |
| 7 | return { | 7 | return { |
| 8 | URL: 'http://localhost:9900', | 8 | URL: 'http://debonline.dyndns.org:9900', |
| 9 | ENDPOINT_BASE: ENDPOINT_BASE, | 9 | ENDPOINT_BASE: ENDPOINT_BASE, |
| 10 | setUrl: function(url) { | 10 | setUrl: function(url) { |
| 11 | this.URL = url; | 11 | this.URL = url; |
| 12 | $localStorage.urlEndPoint = url; | 12 | $localStorage.urlEndPoint = url; |
| 13 | }, | 13 | }, |
| 14 | getUrl: function() { | 14 | getUrl: function() { |
| 15 | return $http.get(this.ENDPOINT_BASE + '/terminal/consultar'); | 15 | return $http.get(this.ENDPOINT_BASE + '/terminal/consultar'); |
| 16 | } | 16 | } |
| 17 | }; | 17 | }; |
| 18 | }]); | 18 | }]); |
| 19 | 19 |