Commit 360215e77e257e9b9b6fe5c973a586a6885c9275
1 parent
2e4a50a2d4
Exists in
master
commit init
Showing
8 changed files
with
183 additions
and
0 deletions
Show diff stats
.gitignore
File was created | 1 | ||
2 | node_modules/ | ||
3 | tmp/ | ||
4 | |||
5 | package-lock\.json | ||
6 | |||
7 | dist/ | ||
8 |
.jshintrc
File was created | 1 | { | |
2 | /* | ||
3 | * ENVIRONMENTS | ||
4 | * ================= | ||
5 | */ | ||
6 | |||
7 | // Define globals exposed by modern browsers. | ||
8 | "browser": true, | ||
9 | |||
10 | // Define globals exposed by jQuery. | ||
11 | "jquery": true, | ||
12 | |||
13 | // Define globals exposed by Node.js. | ||
14 | "node": true, | ||
15 | |||
16 | // Allow ES6. | ||
17 | "esversion": 6, | ||
18 | |||
19 | /* | ||
20 | * ENFORCING OPTIONS | ||
21 | * ================= | ||
22 | */ | ||
23 | |||
24 | // Force all variable names to use either camelCase style or UPPER_CASE | ||
25 | // with underscores. | ||
26 | "camelcase": true, | ||
27 | |||
28 | // Prohibit use of == and != in favor of === and !==. | ||
29 | "eqeqeq": true, | ||
30 | |||
31 | // Enforce tab width of 2 spaces. | ||
32 | "indent": 4, | ||
33 | |||
34 | // Prohibit use of a variable before it is defined. | ||
35 | "latedef": true, | ||
36 | |||
37 | // Enforce line length to 100 characters | ||
38 | "maxlen": 100, | ||
39 | |||
40 | // Require capitalized names for constructor functions. | ||
41 | "newcap": true, | ||
42 | |||
43 | // Enforce use of single quotation marks for strings. | ||
44 | "quotmark": "single", | ||
45 | |||
46 | // Enforce placing 'use strict' at the top function scope | ||
47 | "strict": false, | ||
48 | |||
49 | // Prohibit use of explicitly undeclared variables. | ||
50 | "undef": true, | ||
51 | |||
52 | // Warn when variables are defined but never used. | ||
53 | "unused": true, | ||
54 | |||
55 | // Para que funcione en angular | ||
56 | "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe"], | ||
57 | /* | ||
58 | * RELAXING OPTIONS | ||
59 | * ================= | ||
60 | */ | ||
61 | |||
62 | // Suppress warnings about == null comparisons. | ||
63 | "eqnull": true | ||
64 | } | ||
65 |
gulpfile.js
File was created | 1 | const gulp = require('gulp'); | |
2 | const concat = require('gulp-concat'); | ||
3 | const rename = require('gulp-rename'); | ||
4 | const uglify = require('gulp-uglify'); | ||
5 | const pump = require('pump'); | ||
6 | const jshint = require('gulp-jshint'); | ||
7 | const replace = require('gulp-replace'); | ||
8 | |||
9 | var paths = { | ||
10 | srcHTML : 'src/views/*.html', | ||
11 | srcJS : 'src/js/*.js', | ||
12 | confJS : 'src/etc/develop.js', | ||
13 | dist : 'dist/', | ||
14 | temp : 'tmp/', | ||
15 | distHTML : 'dist/views/' | ||
16 | }; | ||
17 | |||
18 | gulp.task('uglify', function() { | ||
19 | pump( | ||
20 | [ | ||
21 | gulp.src([paths.srcJS, paths.confJS]), | ||
22 | concat('foca-configuracion.js'), | ||
23 | replace('/src/', '/dist/'), | ||
24 | gulp.dest(paths.temp), | ||
25 | rename('foca-configuracion.min.js'), | ||
26 | uglify(), | ||
27 | gulp.dest(paths.dist) | ||
28 | ] | ||
29 | ); | ||
30 | }); | ||
31 | |||
32 | gulp.task('pre-commit', function() { | ||
33 | pump( | ||
34 | [ | ||
35 | gulp.src(paths.srcJS), | ||
36 | jshint('.jshintrc'), | ||
37 | jshint.reporter('default'), | ||
38 | jshint.reporter('fail') | ||
39 | ] | ||
40 | ); | ||
41 | gulp.start('uglify'); | ||
42 | }); | ||
43 | |||
44 | gulp.task('default', ['uglify']); | ||
45 |
package.json
File was created | 1 | { | |
2 | "name": "foca-configuracion", | ||
3 | "version": "0.0.1", | ||
4 | "description": "", | ||
5 | "main": "index.js", | ||
6 | "scripts": { | ||
7 | "test": "echo \"Error: no test specified\" && exit 1" | ||
8 | }, | ||
9 | "repository": { | ||
10 | "type": "git", | ||
11 | "url": "https://debo.suite.repo/modulos-npm/foca-configuracion.git" | ||
12 | }, | ||
13 | "author": "Nicolás Guarnieri", | ||
14 | "license": "ISC", | ||
15 | "dependencies": { | ||
16 | "angular": "^1.7.5", | ||
17 | "angular-cookies": "^1.7.5", | ||
18 | "angular-route": "^1.7.5", | ||
19 | "gulp": "^3.9.1", | ||
20 | "gulp-angular-templatecache": "^2.2.3", | ||
21 | "gulp-clean": "^0.4.0", | ||
22 | "gulp-concat": "^2.6.1", | ||
23 | "gulp-jshint": "^2.1.0", | ||
24 | "gulp-rename": "^1.4.0", | ||
25 | "gulp-replace": "^1.0.0", | ||
26 | "gulp-uglify": "^3.0.1", | ||
27 | "jquery": "^3.3.1", | ||
28 | "jshint": "^2.9.6", | ||
29 | "pre-commit": "^1.2.2", | ||
30 | "pump": "^3.0.0" | ||
31 | } | ||
32 | } | ||
33 |
src/js/app.js
File was created | 1 | angular.module('focaConfiguracion', []) | |
2 | .run(['$cookies', 'focaConfiguracionService', function($cookies, focaConfiguracionService) { | ||
3 | if (!$cookies.get("terminalKey")) { | ||
4 | focaConfiguracionService.getHashTerminal().then(function(res) { | ||
5 | $cookies.put('terminalKey', res.data); | ||
6 | }); | ||
7 | } | ||
8 | }]); |
src/js/config.js
File was created | 1 | angular.module('focaConfiguracion') | |
2 | .config(['$httpProvider', function($httpProvider) { | ||
3 | $httpProvider.interceptors.push('RequestHeadersInterceptor'); | ||
4 | }]); |
src/js/requestHeadersInterceptor.js
File was created | 1 | angular.module('focaConfiguracion') | |
2 | .factory("RequestHeadersInterceptor", [ | ||
3 | '$cookies', function($cookies) { | ||
4 | var request = { | ||
5 | request: function(config) { | ||
6 | config.headers["X-Terminal-Key"] = $cookies.get("terminalKey"); | ||
7 | return config; | ||
8 | } | ||
9 | } | ||
10 | |||
11 | return request; | ||
12 | } | ||
13 | ]); |
src/js/service.js
File was created | 1 | angular.module('focaConfiguracion') | |
2 | .factory("focaConfiguracionService", [ | ||
3 | '$http', '$cookies', '$q', 'API_ENDPOINT', | ||
4 | function($http, $cookies, $q, API_ENDPOINT) { | ||
5 | return { | ||
6 | getHashTerminal: function() { | ||
7 | return $http.get(API_ENDPOINT.URL + '/config/terminal'); | ||
8 | } | ||
9 | } | ||
10 | } | ||
11 | ]); |