Commit 159d0f54109bb76dc9d0e25312fb99d035ef844c
1 parent
b41ea1a414
Exists in
master
levantar sitio con gulp
Showing
4 changed files
with
36 additions
and
2 deletions
Show diff stats
gulpfile.js
| File was created | 1 | const gulp = require('gulp'); | |
| 2 | const pump = require('pump'); | ||
| 3 | const connect = require('gulp-connect'); | ||
| 4 | |||
| 5 | |||
| 6 | gulp.task('webserver', function() { | ||
| 7 | return pump [ | ||
| 8 | connect.server( | ||
| 9 | { | ||
| 10 | port: 8087, | ||
| 11 | host: '0.0.0.0', | ||
| 12 | livereload: true | ||
| 13 | } | ||
| 14 | ) | ||
| 15 | ] | ||
| 16 | }); | ||
| 17 | |||
| 18 | gulp.task('default', ['webserver']); | ||
| 19 |
package.json
| 1 | { | 1 | { |
| 2 | "name": "foca-gestion-terminales", | 2 | "name": "foca-gestion-terminales", |
| 3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
| 4 | "description": "Gestión de terminales", | 4 | "description": "Gestión de terminales", |
| 5 | "main": "index.html", | 5 | "main": "index.html", |
| 6 | "dependencies": { | 6 | "dependencies": { |
| 7 | "angular": "^1.7.7", | 7 | "angular": "^1.7.7", |
| 8 | "angular-ping": "0.0.0", | 8 | "angular-ping": "0.0.0", |
| 9 | "angular-route": "^1.7.7", | 9 | "angular-route": "^1.7.7", |
| 10 | "bootstrap": "^4.3.1", | 10 | "bootstrap": "^4.3.1", |
| 11 | "font-awesome": "^4.7.0", | 11 | "font-awesome": "^4.7.0", |
| 12 | "jquery": "^3.3.1" | 12 | "gulp": "^3.9.1", |
| 13 | "gulp-connect": "^5.7.0", | ||
| 14 | "jquery": "^3.3.1", | ||
| 15 | "pump": "^3.0.0" | ||
| 13 | }, | 16 | }, |
| 14 | "devDependencies": {}, | 17 | "devDependencies": {}, |
| 15 | "scripts": { | 18 | "scripts": { |
| 16 | "test": "echo \"Error: no test specified\" && exit 1" | 19 | "test": "echo \"Error: no test specified\" && exit 1" |
| 17 | }, | 20 | }, |
| 18 | "repository": { | 21 | "repository": { |
| 19 | "type": "git", | 22 | "type": "git", |
| 20 | "url": "http://git.focasoftware.com/npm/foca-gestion-terminales.git" | 23 | "url": "http://git.focasoftware.com/npm/foca-gestion-terminales.git" |
| 21 | }, | 24 | }, |
| 22 | "author": "Foca software", | 25 | "author": "Foca software", |
| 23 | "license": "ISC" | 26 | "license": "ISC" |
| 24 | } | 27 | } |
| 25 | 28 |
src/js/controller.js
| 1 | angular.module('focaGestionTerminal') | 1 | angular.module('focaGestionTerminal') |
| 2 | .controller('gestionTerminalController', | 2 | .controller('gestionTerminalController', |
| 3 | [ | 3 | [ |
| 4 | '$scope', | 4 | '$scope', |
| 5 | 'gestionTerminalService', | 5 | 'gestionTerminalService', |
| 6 | 'netTesting', | 6 | 'netTesting', |
| 7 | function($scope, gestionTerminalesService, netTesting) { | 7 | function($scope, gestionTerminalesService, netTesting) { |
| 8 | $scope.empresa = {}; | 8 | $scope.empresa = {}; |
| 9 | $scope.empresas = []; | 9 | $scope.empresas = []; |
| 10 | 10 | ||
| 11 | gestionTerminalesService.getEmpresas().then(function(res) { | 11 | gestionTerminalesService.getEmpresas().then(function(res) { |
| 12 | 12 | ||
| 13 | $scope.empresas = res.data; | 13 | $scope.empresas = res.data; |
| 14 | }); | 14 | }); |
| 15 | 15 | ||
| 16 | $scope.guardar = function() { | 16 | $scope.guardar = function() { |
| 17 | 17 | ||
| 18 | netTesting.ping($scope.empresa.url, function() { | 18 | netTesting.ping($scope.empresa.url, function() { |
| 19 | 19 | ||
| 20 | if (arguments[1] === 'disconnected') { | 20 | if (arguments[1] === 'disconnected') { |
| 21 | $scope.mensaje = "La url indicada no tiene conección"; | 21 | $scope.mensaje = "La url indicada no tiene conección"; |
| 22 | return; | 22 | return; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | gestionTerminalesService.insertEmpresa( | 25 | gestionTerminalesService.insertEmpresa( |
| 26 | { empresa: $scope.empresa}).then(function() { | 26 | { empresa: $scope.empresa}).then(function() { |
| 27 | 27 | ||
| 28 | $scope.mensaje = "Empresa guardada con éxito"; | 28 | $scope.mensaje = "Empresa guardada con éxito"; |
| 29 | $scope.empresas.push($scope.terminal); | 29 | $scope.empresas.push($scope.terminal); |
| 30 | $scope.empresa = {}; | 30 | $scope.empresa = {}; |
| 31 | $scope.empresaGuardada = true; | 31 | $scope.empresaGuardada = true; |
| 32 | 32 | ||
| 33 | }).catch(function() { | 33 | }).catch(function() { |
| 34 | 34 | ||
| 35 | $scope.mensaje = "Hubo un error al guardar la empresa"; | 35 | $scope.mensaje = "Hubo un error al guardar la empresa"; |
| 36 | }); | 36 | }); |
| 37 | 37 | ||
| 38 | }); | 38 | }); |
| 39 | }; | 39 | }; |
| 40 | 40 | ||
| 41 | $scope.eliminarEmpresa = function() { | ||
| 42 | if (confirm('¿Esta seguro que desa eliminar la empresa?')) { | ||
| 43 | alert('En desarrollo'); | ||
| 44 | return; | ||
| 45 | } | ||
| 46 | }; | ||
| 47 | |||
| 41 | }]); | 48 | }]); |
| 42 | 49 |
src/views/main.html
| 1 | <html> | 1 | <html> |
| 2 | <h3>Sistema de gestión de terminales</h3> | 2 | <h3>Sistema de gestión de terminales</h3> |
| 3 | 3 | ||
| 4 | <h5>Ingreso de nueva empresa</h5> | 4 | <h5>Ingreso de nueva empresa</h5> |
| 5 | 5 | ||
| 6 | <label | 6 | <label |
| 7 | class="bg-info text-white" | 7 | class="bg-info text-white" |
| 8 | ng-show="mensaje" | 8 | ng-show="mensaje" |
| 9 | ng-bind="mensaje"></label> | 9 | ng-bind="mensaje"></label> |
| 10 | 10 | ||
| 11 | <form name="formEmpresa"> | 11 | <form name="formEmpresa"> |
| 12 | <div class="row"> | 12 | <div class="row"> |
| 13 | 13 | ||
| 14 | <div class="col-3"> | 14 | <div class="col-3"> |
| 15 | <input | 15 | <input |
| 16 | class="form-control" | 16 | class="form-control" |
| 17 | placeholder="Nombre de empresa" | 17 | placeholder="Nombre de empresa" |
| 18 | ng-model="empresa.nombre" | 18 | ng-model="empresa.nombre" |
| 19 | ng-required="true"/> | 19 | ng-required="true"/> |
| 20 | </div> | 20 | </div> |
| 21 | 21 | ||
| 22 | <div class="col-4"> | 22 | <div class="col-4"> |
| 23 | <input | 23 | <input |
| 24 | class="form-control" | 24 | class="form-control" |
| 25 | placeholder="ID Empresa" | 25 | placeholder="ID Empresa" |
| 26 | ng-model="empresa.idEmpresaCliente" | 26 | ng-model="empresa.idEmpresaCliente" |
| 27 | ng-required="true"/> | 27 | ng-required="true"/> |
| 28 | </div> | 28 | </div> |
| 29 | 29 | ||
| 30 | <div class="col-4"> | 30 | <div class="col-4"> |
| 31 | <input | 31 | <input |
| 32 | class="form-control" | 32 | class="form-control" |
| 33 | placeholder="URL" | 33 | placeholder="URL" |
| 34 | ng-model="empresa.url" | 34 | ng-model="empresa.url" |
| 35 | ng-required="true"/> | 35 | ng-required="true"/> |
| 36 | </div> | 36 | </div> |
| 37 | 37 | ||
| 38 | <div class="col-1 text-center"> | 38 | <div class="col-1 text-center"> |
| 39 | <button | 39 | <button |
| 40 | type="button" | 40 | type="button" |
| 41 | class="btn btn-dark" | 41 | class="btn btn-dark" |
| 42 | ladda="guardando" | 42 | ladda="guardando" |
| 43 | ng-click="guardar()" | 43 | ng-click="guardar()" |
| 44 | ng-disabled="!formEmpresa.$valid">Guardar</button> | 44 | ng-disabled="!formEmpresa.$valid">Guardar</button> |
| 45 | </div> | 45 | </div> |
| 46 | </div> | 46 | </div> |
| 47 | </form> | 47 | </form> |
| 48 | 48 | ||
| 49 | <h5>Empresas configuradas</h5> | 49 | <h5>Empresas configuradas</h5> |
| 50 | <div class="row"> | 50 | <div class="row"> |
| 51 | <table class="table table-dark"> | 51 | <table class="table table-dark"> |
| 52 | <thead> | 52 | <thead> |
| 53 | <tr> | 53 | <tr> |
| 54 | <th>Nombre Empresa</th> | 54 | <th>Nombre Empresa</th> |
| 55 | <th>ID Empresa</th> | 55 | <th>ID Empresa</th> |
| 56 | <th>Url</th> | 56 | <th>Url</th> |
| 57 | <th></th> | ||
| 57 | </tr> | 58 | </tr> |
| 58 | </thead> | 59 | </thead> |
| 59 | <tbody> | 60 | <tbody> |
| 60 | <tr ng-repeat="empresa in empresas"> | 61 | <tr ng-repeat="(key, empresa) in empresas"> |
| 61 | <td ng-bind="empresa.nombre"></td> | 62 | <td ng-bind="empresa.nombre"></td> |
| 62 | <td ng-bind="empresa.idEmpresaCliente"></td> | 63 | <td ng-bind="empresa.idEmpresaCliente"></td> |
| 63 | <td ng-bind="empresa.url"></td> | 64 | <td ng-bind="empresa.url"></td> |
| 65 | <td> | ||
| 66 | <!-- <button class="btn btn-dark" ng-click="eliminarEmpresa(key)"> | ||
| 67 | <i class="fa fa-trash"></i> | ||
| 68 | </button> --> | ||
| 69 | </td> | ||
| 64 | </tr> | 70 | </tr> |
| 65 | </tbody> | 71 | </tbody> |
| 66 | </table> | 72 | </table> |
| 67 | </div> | 73 | </div> |
| 68 | 74 | ||
| 69 | </html> | 75 | </html> |
| 70 | 76 |