| @ -0,0 +1,7 @@ | |||||
| root = true | |||||
| [*] | |||||
| charset = utf-8 | |||||
| indent_style = space | |||||
| indent_size = 2 | |||||
| @ -0,0 +1,18 @@ | |||||
| node_modules/ | |||||
| .DS_Store | |||||
| *.log | |||||
| .idea/ | |||||
| .metadata/ | |||||
| .vscode | |||||
| package-lock.json | |||||
| /trash/* | |||||
| .Trash | |||||
| *~* | |||||
| *#* | |||||
| config/_development.json | |||||
| config/_production.json | |||||
| @ -0,0 +1,3 @@ | |||||
| /* | |||||
| * Development dynamic configurations is here. | |||||
| */ | |||||
| @ -0,0 +1,3 @@ | |||||
| /* | |||||
| * Production dynamic configurations is here. | |||||
| */ | |||||
| @ -0,0 +1,41 @@ | |||||
| { | |||||
| "cron": {"jobs": []}, | |||||
| "settings": {"public": {}}, | |||||
| "cors": [{ | |||||
| "origins": ["*"], | |||||
| "enabled": true | |||||
| }], | |||||
| "smtp": {}, | |||||
| "name": "minha_app", | |||||
| "setup": { | |||||
| "schema": { | |||||
| "execution": true, | |||||
| "auto_create": true | |||||
| }, | |||||
| "scripts": {"execution": true}, | |||||
| "enabled": true | |||||
| }, | |||||
| "language": "pt_BR", | |||||
| "firebase": { | |||||
| "app_name": "", | |||||
| "database_url": "", | |||||
| "key_file": "", | |||||
| "listener_secret": "" | |||||
| }, | |||||
| "locale": "pt_BR", | |||||
| "remote": {}, | |||||
| "commands": [{ | |||||
| "path": "ui", | |||||
| "install": "npm install --force", | |||||
| "command": "npm run watch", | |||||
| "enabled": true | |||||
| }], | |||||
| "db": {"default": { | |||||
| "password": "4Ss8l70YhDflbOgL", | |||||
| "engine": "pg", | |||||
| "port": "5432", | |||||
| "host": "localhost", | |||||
| "name": "minha_app", | |||||
| "username": "minha_app" | |||||
| }} | |||||
| } | |||||
| @ -0,0 +1,13 @@ | |||||
| /** | |||||
| HERE YOUR CUSTOM CSS | |||||
| **/ | |||||
| .navbar, .navbar-inverse { | |||||
| background-color: #5b5ce1 !important; | |||||
| } | |||||
| .dev .navbar, .dev .navbar-inverse { | |||||
| background-color: #333333 !important; | |||||
| } | |||||
| @ -0,0 +1,22 @@ | |||||
| _config.set("_lang", _config.get("_lang:default")) | |||||
| if (_env.is("dev") | |||||
| && (_url.equals("/") || _url.equals("/Index.netuno"))) { | |||||
| _config | |||||
| .set("_login:user", "dev") | |||||
| .set("_login:pass", "dev") | |||||
| .set("_login:auto", _req.getString("action") != "logout") | |||||
| } | |||||
| /** | |||||
| * DISABLE BROWSER CACHE | |||||
| */ | |||||
| if (_url.download.isDownloadable()) { | |||||
| if (_env.is("dev") && _url.indexOf("/public/scripts/main.js") > 0) { | |||||
| _header.noCache() | |||||
| } else { | |||||
| _header.cache(2628000) | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,5 @@ | |||||
| /** | |||||
| * FIREBASE - Set your listeners | |||||
| */ | |||||
| // _firebase.listener("my-test", _header.baseURL() + "/services/firebase/listener/my-test.netuno") | |||||
| @ -0,0 +1,17 @@ | |||||
| if (!_out.isClosed()) { | |||||
| _out.print( | |||||
| "### SERVER ERROR ###" | |||||
| ) | |||||
| /* | |||||
| // Is insecure but the code below will print errors with more details... | |||||
| _out.print( | |||||
| "SERVER ERROR # " + | |||||
| _error.data().getString("file") | |||||
| +":"+ | |||||
| _error.data().getString("line") | |||||
| +" # "+ | |||||
| _error.data().getString("message") | |||||
| ) | |||||
| */ | |||||
| } | |||||
| @ -0,0 +1,2 @@ | |||||
| _config.set("_script:_request_end", true) | |||||
| @ -0,0 +1,14 @@ | |||||
| // _log.info(_url.url()) | |||||
| /** | |||||
| * ALLOW CORS | |||||
| */ | |||||
| /* | |||||
| _header.response.set("Access-Control-Allow-Origin", "https://www.netuno.org") | |||||
| _header.response.set("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE,OPTIONS") | |||||
| _header.response.set("Access-Control-Allow-Headers", "content-type,x-requested-with,authorization") | |||||
| _header.response.set("Access-Control-Allow-Credentials", true) | |||||
| */ | |||||
| _url.to(_url.request()) | |||||
| @ -0,0 +1,13 @@ | |||||
| /** | |||||
| * When service need public access... | |||||
| */ | |||||
| if (_env.is("dev")) { | |||||
| _service.allow() | |||||
| } | |||||
| /* | |||||
| if (_service.path == 'samples/my-service') { | |||||
| _service.allow() | |||||
| } | |||||
| */ | |||||
| @ -0,0 +1,5 @@ | |||||
| /* | |||||
| // Print error: | |||||
| _log.fatal("Service "+ _service.path, _error.data().get("throwable")) | |||||
| */ | |||||
| @ -0,0 +1,7 @@ | |||||
| { | |||||
| "name": "server", | |||||
| "version": "1.0.0", | |||||
| "description": "Server modules dependencies.", | |||||
| "author": "netuno.org", | |||||
| "license": "ISC" | |||||
| } | |||||
| @ -0,0 +1,6 @@ | |||||
| _out.json( | |||||
| _db.query( | |||||
| `SELECT uid, nome FROM marca` | |||||
| ) | |||||
| ) | |||||
| @ -0,0 +1,24 @@ | |||||
| const tipo = _req.getString('tipo') | |||||
| const marca = _req.getString('marca') | |||||
| const publica = _req.getBoolean('publica') | |||||
| const dados = _val.map() | |||||
| .set('tipo', tipo) | |||||
| .set('marca', marca) | |||||
| .set('publica', publica) | |||||
| _log.info( | |||||
| 'Dados Recebidos do Formulário:', | |||||
| dados | |||||
| ) | |||||
| _db.insert( | |||||
| 'tipo_marca', | |||||
| _val.map() | |||||
| .set('tipo', tipo) | |||||
| .set('marca', marca) | |||||
| .set('pode_publicar', publica) | |||||
| ) | |||||
| _template.output('salvar-resposta', dados) | |||||
| @ -0,0 +1,17 @@ | |||||
| const dbTipos = _db.query( | |||||
| `SELECT * FROM tipo` | |||||
| ) | |||||
| const tipos = _val.list() | |||||
| for (const dbTipo of dbTipos) { | |||||
| tipos.add( | |||||
| _val.map() | |||||
| .set('uid', dbTipo.getString('uid')) | |||||
| .set('nome', dbTipo.getString('nome')) | |||||
| .set('nome', dbTipo.getFile('datahora')) | |||||
| ) | |||||
| } | |||||
| _out.json(tipos) | |||||
| @ -0,0 +1,9 @@ | |||||
| _out.json( | |||||
| _db.query(` | |||||
| SELECT veiculo.uid, tipo.nome AS "tipo", marca.nome AS "marca" | |||||
| FROM veiculo | |||||
| INNER JOIN tipo ON veiculo.tipo_id = tipo.id | |||||
| INNER JOIN marca ON veiculo.marca_id = marca.id | |||||
| `) | |||||
| ) | |||||
| @ -0,0 +1,32 @@ | |||||
| const tipo = _req.getString('tipo') | |||||
| const marca = _req.getString('marca') | |||||
| const publica = _req.getBoolean('publica') | |||||
| const arquivo = _req.getFile('arquivo-upload') | |||||
| let dbTipo = _db.queryFirst( | |||||
| `SELECT * FROM tipo WHERE nome = ?`, | |||||
| tipo | |||||
| ) | |||||
| if (!dbTipo) { | |||||
| const dbTipoId = _db.insert('tipo', _val.map().set('nome', tipo)) | |||||
| dbTipo = _db.get('tipo', dbTipoId) | |||||
| } | |||||
| const dbMarcaId = _db.insertIfNotExists('marca', _val.map().set('nome', marca)) | |||||
| _db.insert( | |||||
| 'veiculo', | |||||
| _val.map() | |||||
| .set('tipo_id', dbTipo.getInt('id')) | |||||
| .set('marca_id', dbMarcaId) | |||||
| .set('pode_publicar', publica) | |||||
| ) | |||||
| _template.output( | |||||
| 'salvar-resposta', | |||||
| _val.map() | |||||
| .set('tipo', tipo) | |||||
| .set('marca', marca) | |||||
| .set('publica', publica) | |||||
| ) | |||||
| @ -0,0 +1,59 @@ | |||||
| /** | |||||
| * | |||||
| * CODE GENERATED AUTOMATICALLY | |||||
| * | |||||
| * THIS FILE SHOULD NOT BE EDITED BY HAND | |||||
| * | |||||
| */ | |||||
| _form.createIfNotExists( | |||||
| _val.init() | |||||
| .set("big", false) | |||||
| .set("control_active", true) | |||||
| .set("control_group", false) | |||||
| .set("control_user", false) | |||||
| .set("description", "") | |||||
| .set("displayname", "Marca") | |||||
| .set("export_id", false) | |||||
| .set("export_json", true) | |||||
| .set("export_lastchange", false) | |||||
| .set("export_uid", true) | |||||
| .set("export_xls", true) | |||||
| .set("export_xml", true) | |||||
| .set("firebase", "") | |||||
| .set("name", "marca") | |||||
| .set("reorder", 0) | |||||
| .set("report", false) | |||||
| .set("show_id", true) | |||||
| .set("uid", "28e91137-69d3-4bac-af92-7b208a6e6718") | |||||
| ) | |||||
| _form.createComponentIfNotExists( | |||||
| "28e91137-69d3-4bac-af92-7b208a6e6718", | |||||
| _val.init() | |||||
| .set("colspan", 0) | |||||
| .set("displayname", "Nome") | |||||
| .set("firebase", "") | |||||
| .set("group_id", 0) | |||||
| .set("height", 0) | |||||
| .set("max", 0) | |||||
| .set("min", 0) | |||||
| .set("name", "nome") | |||||
| .set("notnull", true) | |||||
| .set("primarykey", true) | |||||
| .set("properties", "{\"MASK_REVERSE\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"},\"MASK_SELECTONFOCUS\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"},\"MASK\":{\"default\":\"\",\"type\":\"STRING\",\"value\":\"\"}}") | |||||
| .set("rowspan", 0) | |||||
| .set("tdheight", 0) | |||||
| .set("tdwidth", 0) | |||||
| .set("type", "text") | |||||
| .set("uid", "e32e76c8-c700-4ffd-85ad-f03c549c6895") | |||||
| .set("user_id", 0) | |||||
| .set("whenedit", true) | |||||
| .set("whenexport", true) | |||||
| .set("whenfilter", true) | |||||
| .set("whennew", true) | |||||
| .set("whenresult", true) | |||||
| .set("whenview", true) | |||||
| .set("width", 0) | |||||
| .set("x", 1) | |||||
| .set("y", 1) | |||||
| ) | |||||
| @ -0,0 +1,60 @@ | |||||
| /** | |||||
| * | |||||
| * CODE GENERATED AUTOMATICALLY | |||||
| * | |||||
| * THIS FILE SHOULD NOT BE EDITED BY HAND | |||||
| * | |||||
| */ | |||||
| _form.createIfNotExists( | |||||
| _val.init() | |||||
| .set("big", false) | |||||
| .set("control_active", true) | |||||
| .set("control_group", false) | |||||
| .set("control_user", false) | |||||
| .set("description", "") | |||||
| .set("displayname", "Tipo") | |||||
| .set("export_id", false) | |||||
| .set("export_json", true) | |||||
| .set("export_lastchange", false) | |||||
| .set("export_uid", true) | |||||
| .set("export_xls", true) | |||||
| .set("export_xml", true) | |||||
| .set("firebase", "") | |||||
| .set("name", "tipo") | |||||
| .set("reorder", 0) | |||||
| .set("report", false) | |||||
| .set("show_id", true) | |||||
| .set("uid", "ed6c1e93-393a-4b49-b113-40bc9bcfa5a2") | |||||
| ) | |||||
| _form.createComponentIfNotExists( | |||||
| "ed6c1e93-393a-4b49-b113-40bc9bcfa5a2", | |||||
| _val.init() | |||||
| .set("colspan", 0) | |||||
| .set("description", "") | |||||
| .set("displayname", "Nome") | |||||
| .set("firebase", "") | |||||
| .set("group_id", 0) | |||||
| .set("height", 0) | |||||
| .set("max", 0) | |||||
| .set("min", 0) | |||||
| .set("name", "nome") | |||||
| .set("notnull", true) | |||||
| .set("primarykey", true) | |||||
| .set("properties", "{\"MASK_REVERSE\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"},\"MASK_SELECTONFOCUS\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"},\"MASK\":{\"default\":\"\",\"type\":\"STRING\",\"value\":\"\"}}") | |||||
| .set("rowspan", 0) | |||||
| .set("tdheight", 0) | |||||
| .set("tdwidth", 0) | |||||
| .set("type", "text") | |||||
| .set("uid", "91a6eaf5-127f-488f-9c67-a890389d33c2") | |||||
| .set("user_id", 0) | |||||
| .set("whenedit", true) | |||||
| .set("whenexport", true) | |||||
| .set("whenfilter", true) | |||||
| .set("whennew", true) | |||||
| .set("whenresult", true) | |||||
| .set("whenview", true) | |||||
| .set("width", 0) | |||||
| .set("x", 1) | |||||
| .set("y", 1) | |||||
| ) | |||||
| @ -0,0 +1,122 @@ | |||||
| /** | |||||
| * | |||||
| * CODE GENERATED AUTOMATICALLY | |||||
| * | |||||
| * THIS FILE SHOULD NOT BE EDITED BY HAND | |||||
| * | |||||
| */ | |||||
| _form.createIfNotExists( | |||||
| _val.init() | |||||
| .set("big", false) | |||||
| .set("control_active", true) | |||||
| .set("control_group", false) | |||||
| .set("control_user", false) | |||||
| .set("description", "") | |||||
| .set("displayname", "Ve\u00EDculo") | |||||
| .set("export_id", false) | |||||
| .set("export_json", true) | |||||
| .set("export_lastchange", false) | |||||
| .set("export_uid", true) | |||||
| .set("export_xls", true) | |||||
| .set("export_xml", true) | |||||
| .set("firebase", "") | |||||
| .set("name", "veiculo") | |||||
| .set("reorder", 0) | |||||
| .set("report", false) | |||||
| .set("show_id", true) | |||||
| .set("uid", "cdb46399-08bc-4607-9c83-02bab5f05ba8") | |||||
| ) | |||||
| _form.createComponentIfNotExists( | |||||
| "cdb46399-08bc-4607-9c83-02bab5f05ba8", | |||||
| _val.init() | |||||
| .set("colspan", 0) | |||||
| .set("description", "") | |||||
| .set("displayname", "Marca") | |||||
| .set("firebase", "") | |||||
| .set("group_id", 0) | |||||
| .set("height", 0) | |||||
| .set("max", 0) | |||||
| .set("min", 0) | |||||
| .set("name", "marca_id") | |||||
| .set("notnull", true) | |||||
| .set("primarykey", false) | |||||
| .set("properties", "{\"MAX_COLUMN_LENGTH\":{\"default\":\"0\",\"type\":\"INTEGER\",\"value\":\"0\"},\"COLUMN_SEPARATOR\":{\"default\":\" - \",\"type\":\"LINK_SEPARATOR\",\"value\":\" - \"},\"LINK\":{\"default\":\"\",\"type\":\"LINK\",\"value\":\"marca:nome\"},\"SERVICE\":{\"default\":\"com/Select.netuno\",\"type\":\"STRING\",\"value\":\"com/Select.netuno\"},\"ONLY_ACTIVES\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"}}") | |||||
| .set("rowspan", 0) | |||||
| .set("tdheight", 0) | |||||
| .set("tdwidth", 0) | |||||
| .set("type", "select") | |||||
| .set("uid", "bddc7385-35b4-46bd-b7ea-979c108780b4") | |||||
| .set("user_id", 0) | |||||
| .set("whenedit", true) | |||||
| .set("whenexport", true) | |||||
| .set("whenfilter", true) | |||||
| .set("whennew", true) | |||||
| .set("whenresult", true) | |||||
| .set("whenview", true) | |||||
| .set("width", 0) | |||||
| .set("x", 1) | |||||
| .set("y", 2) | |||||
| ) | |||||
| _form.createComponentIfNotExists( | |||||
| "cdb46399-08bc-4607-9c83-02bab5f05ba8", | |||||
| _val.init() | |||||
| .set("colspan", 0) | |||||
| .set("description", "") | |||||
| .set("displayname", "Pode Publicar") | |||||
| .set("firebase", "") | |||||
| .set("group_id", 0) | |||||
| .set("height", 0) | |||||
| .set("max", 0) | |||||
| .set("min", 0) | |||||
| .set("name", "pode_publicar") | |||||
| .set("notnull", false) | |||||
| .set("primarykey", false) | |||||
| .set("properties", "{\"DEFAULT\":{\"default\":\"true\",\"type\":\"BOOLEAN\",\"value\":\"true\"}}") | |||||
| .set("rowspan", 0) | |||||
| .set("tdheight", 0) | |||||
| .set("tdwidth", 0) | |||||
| .set("type", "checkbox") | |||||
| .set("uid", "faeb3e69-be79-46d2-b2ed-dfed09c163f1") | |||||
| .set("user_id", 0) | |||||
| .set("whenedit", true) | |||||
| .set("whenexport", true) | |||||
| .set("whenfilter", false) | |||||
| .set("whennew", true) | |||||
| .set("whenresult", true) | |||||
| .set("whenview", true) | |||||
| .set("width", 0) | |||||
| .set("x", 1) | |||||
| .set("y", 3) | |||||
| ) | |||||
| _form.createComponentIfNotExists( | |||||
| "cdb46399-08bc-4607-9c83-02bab5f05ba8", | |||||
| _val.init() | |||||
| .set("colspan", 0) | |||||
| .set("description", "") | |||||
| .set("displayname", "Tipo") | |||||
| .set("firebase", "") | |||||
| .set("group_id", 0) | |||||
| .set("height", 0) | |||||
| .set("max", 0) | |||||
| .set("min", 0) | |||||
| .set("name", "tipo_id") | |||||
| .set("notnull", true) | |||||
| .set("primarykey", false) | |||||
| .set("properties", "{\"MAX_COLUMN_LENGTH\":{\"default\":\"0\",\"type\":\"INTEGER\",\"value\":\"0\"},\"COLUMN_SEPARATOR\":{\"default\":\" - \",\"type\":\"LINK_SEPARATOR\",\"value\":\" - \"},\"LINK\":{\"default\":\"\",\"type\":\"LINK\",\"value\":\"tipo:nome\"},\"SERVICE\":{\"default\":\"com/Select.netuno\",\"type\":\"STRING\",\"value\":\"com/Select.netuno\"},\"ONLY_ACTIVES\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"}}") | |||||
| .set("rowspan", 0) | |||||
| .set("tdheight", 0) | |||||
| .set("tdwidth", 0) | |||||
| .set("type", "select") | |||||
| .set("uid", "85ec1548-692f-4099-9a33-ae2f67e6fda9") | |||||
| .set("user_id", 0) | |||||
| .set("whenedit", true) | |||||
| .set("whenexport", true) | |||||
| .set("whenfilter", true) | |||||
| .set("whennew", true) | |||||
| .set("whenresult", true) | |||||
| .set("whenview", true) | |||||
| .set("width", 0) | |||||
| .set("x", 1) | |||||
| .set("y", 1) | |||||
| ) | |||||
| @ -0,0 +1,24 @@ | |||||
| <div class="row"> | |||||
| <div class="col-lg-12"> | |||||
| <div class="with-form"> | |||||
| <h1 class="page-header"> | |||||
| _{&lang=netuno.main.dashboard.title} | |||||
| </h1> | |||||
| </div> | |||||
| <div class="no-form"> | |||||
| <h1 class="page-header"> | |||||
| _{&lang=netuno.main.dashboard.welcome_netuno} | |||||
| </h1> | |||||
| <p>_{&lang=netuno.main.dashboard.you_not_form}</p> | |||||
| <p>_{&lang=netuno.main.dashboard.you_can_start_by_clicking_top_bar}</p> | |||||
| <br> | |||||
| <img src="_{netuno-config=url-styles}/build-button-tutorial.png" height="80"> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| <div id="app-dashboard"></div> | |||||
| @ -0,0 +1,31 @@ | |||||
| <div class="row"> | |||||
| <div class="col-lg-12"> | |||||
| <div class="with-form"> | |||||
| <h1 class="page-header"> | |||||
| _{&lang=netuno.main.dashboard.title} | |||||
| </h1> | |||||
| <p>_{&lang=netuno.main.dashboard.description}</p> | |||||
| </div> | |||||
| <div class="no-form"> | |||||
| <h1 class="page-header"> | |||||
| _{&lang=netuno.main.dashboard.welcome_netuno} | |||||
| </h1> | |||||
| <p>_{&lang=netuno.dev.main.you_not_form}</p> | |||||
| <p>_{&lang=netuno.dev.main.you_can_start_by_clicking_top_bar}</p> | |||||
| <br> | |||||
| <img src="_{netuno-config=url-styles}/build-button-tutorial-dev.png" height="200"> | |||||
| </div> | |||||
| #macro(listFormItems $items) | |||||
| <ul> | |||||
| #foreach($item in $items) | |||||
| <li> | |||||
| <a href="#" netuno-dev-form="$item.getString('name')">$item.getString('text')</a> | |||||
| #listFormItems($item.get('items')) | |||||
| </li> | |||||
| #end | |||||
| </ul> | |||||
| #end | |||||
| #listFormItems($data.get('menu').get('forms')) | |||||
| </div> | |||||
| </div> | |||||
| @ -0,0 +1,16 @@ | |||||
| <!DOCTYPE html> | |||||
| <html> | |||||
| <head> | |||||
| <title>Salvar</title> | |||||
| <link rel="stylesheet" href="/styles/base.css" /> | |||||
| </head> | |||||
| <body> | |||||
| <h1>Salvo com Sucesso</h1> | |||||
| <p> | |||||
| É uma simulação com NETUNO com TEMPLATE. | |||||
| </p> | |||||
| <p>Tipo: _{&data=tipo}</p> | |||||
| <p>Marca: _{&data=marca}</p> | |||||
| <p>Pode publicar? _{&data=publica}</p> | |||||
| </body> | |||||
| </html> | |||||
| @ -0,0 +1 @@ | |||||
| <script src="_{netuno-config=url-app-scripts}/main.js?_{util=requestuuid}"></script> | |||||
| @ -0,0 +1 @@ | |||||
| <link href='_{netuno-config=url-app-styles}/main.css' rel='stylesheet' /> | |||||
| @ -0,0 +1 @@ | |||||
| <link href='_{netuno-config=url-app-styles}/main.css' rel='stylesheet' /> | |||||
| @ -0,0 +1,4 @@ | |||||
| Secure data files comes here... | |||||
| Only accessible for logged users! | |||||
| @ -0,0 +1,2 @@ | |||||
| Public storage files comes here... | |||||
| @ -0,0 +1,4 @@ | |||||
| Secure data files comes here... | |||||
| Only accessible through server side! | |||||
| @ -0,0 +1,9 @@ | |||||
| { | |||||
| "presets": [ | |||||
| "@babel/preset-env", | |||||
| "@babel/preset-react" | |||||
| ], | |||||
| "plugins": [ | |||||
| ["import", { "libraryName": "antd", "style": "less" } ] | |||||
| ] | |||||
| } | |||||
| @ -0,0 +1,18 @@ | |||||
| node_modules/ | |||||
| .DS_Store | |||||
| *.log | |||||
| .idea/ | |||||
| .metadata/ | |||||
| .vscode | |||||
| package-lock.json | |||||
| yarn.lock | |||||
| .Trash | |||||
| *~* | |||||
| *#* | |||||
| @ -0,0 +1,24 @@ | |||||
| ### Install Packages | |||||
| `npm install` | |||||
| ### Watch changes and auto recompile | |||||
| `npm run watch` | |||||
| ### Installation requirements | |||||
| On Windows with an Administrator terminal, run: | |||||
| ``` | |||||
| npm install --global --production windows-build-tools | |||||
| npm install --global node-gyp | |||||
| ``` | |||||
| With others Python version, then configure the Python 2.7 path: | |||||
| ``` | |||||
| node-gyp --python /path/to/python2.7 | |||||
| npm config set python /path/to/executable/python2.7 | |||||
| ``` | |||||
| @ -0,0 +1,37 @@ | |||||
| { | |||||
| "name": "ui", | |||||
| "version": "1.0.0", | |||||
| "description": "", | |||||
| "main": "src/index.js", | |||||
| "scripts": { | |||||
| "test": "echo \"Error: no test specified\" && exit 1", | |||||
| "build": "webpack --mode production", | |||||
| "watch": "webpack --mode development --watch" | |||||
| }, | |||||
| "keywords": [], | |||||
| "author": "", | |||||
| "license": "ISC", | |||||
| "devDependencies": { | |||||
| "@babel/core": "^7.17.5", | |||||
| "@babel/plugin-proposal-object-rest-spread": "^7.17.3", | |||||
| "@babel/preset-env": "^7.16.11", | |||||
| "@babel/preset-react": "^7.16.7", | |||||
| "babel-loader": "^8.2.3", | |||||
| "babel-plugin-import": "^1.13.3", | |||||
| "css-loader": "^6.7.0", | |||||
| "less": "^4.1.2", | |||||
| "less-loader": "^10.2.0", | |||||
| "prop-types": "^15.8.1", | |||||
| "style-loader": "^3.3.1", | |||||
| "webpack": "^5.70.0", | |||||
| "webpack-cli": "^4.9.2" | |||||
| }, | |||||
| "dependencies": { | |||||
| "@ant-design/icons": "^4.7.0", | |||||
| "@netuno/service-client": "^1.0.10", | |||||
| "@netuno/ws-client": "^1.0.8", | |||||
| "antd": "^4.18.9", | |||||
| "chart.js": "^3.7.1", | |||||
| "react-chartjs-2": "^4.0.1" | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,20 @@ | |||||
| import React from "react"; | |||||
| import PropTypes from "prop-types"; | |||||
| import { Button } from 'antd'; | |||||
| function MyButton({ text, onClick }) { | |||||
| return ( | |||||
| <div> | |||||
| <Button type="primary" onClick={ onClick }> | |||||
| { text } | |||||
| </Button> | |||||
| </div> | |||||
| ); | |||||
| }; | |||||
| MyButton.propTypes = { | |||||
| text: PropTypes.string.isRequired, | |||||
| onClick: PropTypes.func.isRequired | |||||
| }; | |||||
| export default MyButton; | |||||
| @ -0,0 +1,29 @@ | |||||
| import React, { useState, useEffect, useRef } from "react"; | |||||
| import MyButton from "../../components/MyButton"; | |||||
| import "./index.less"; | |||||
| function DashboardContainer() { | |||||
| const [counter, setCounter] = useState(0); | |||||
| const refButton = useRef(); | |||||
| useEffect(() => { | |||||
| $(refButton.current).fadeOut(250).fadeIn(250); | |||||
| }, [counter]); | |||||
| const onClick = () => { | |||||
| setCounter(counter + 1); | |||||
| }; | |||||
| return ( | |||||
| <div className="my-dashboard"> | |||||
| <div ref={refButton} className="my-dashboard__button"> | |||||
| <MyButton text={`ReactJS ⚡ Ant.Design 👉 Click me! ${counter}`} onClick={onClick} /> | |||||
| </div> | |||||
| </div> | |||||
| ); | |||||
| } | |||||
| export default DashboardContainer; | |||||
| @ -0,0 +1,8 @@ | |||||
| .my-dashboard { | |||||
| width: 100%; | |||||
| &__button { | |||||
| padding: 80px; | |||||
| text-align: center; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,45 @@ | |||||
| import React from "react"; | |||||
| import ReactDOM from "react-dom"; | |||||
| import _service from '@netuno/service-client'; | |||||
| import DashboardContainer from "./containers/DashboardContainer"; | |||||
| _service.config({ | |||||
| prefix: netuno.config.urlServices | |||||
| }); | |||||
| const dashboardDiv = document.getElementById("app-dashboard"); | |||||
| const dashboardContainer = dashboardDiv ? ReactDOM.render(<DashboardContainer />, dashboardDiv) : false; | |||||
| netuno.addNavigationLoad(() => { | |||||
| $('[netuno-navigation]').find('a').on('netuno:click', (e)=> { | |||||
| const link = $(e.target); | |||||
| if (dashboardContainer && link.is('[netuno-navigation-dashboard]')) { | |||||
| // Menu > Dashboard > Clicked! | |||||
| } | |||||
| }); | |||||
| }); | |||||
| netuno.addContentLoad((container) => { | |||||
| // When any content is loaded dinamically this is executed... | |||||
| if (container.is('[netuno-form-search="YOUR_FORM_NAME"]')) { | |||||
| // When search page is loaded... | |||||
| } else if (container.is('[netuno-form-edit="YOUR_FORM_NAME"]')) { | |||||
| // When form edit is loaded... | |||||
| } | |||||
| }); | |||||
| netuno.addPageLoad(() => { | |||||
| // When page is loaded... | |||||
| let modal = $('#app-dashboard-modal-form'); | |||||
| modal.on('hidden.bs.modal', ()=> { | |||||
| modal.find('[netuno-form-edit]').empty(); | |||||
| }); | |||||
| $('#app-dashboard-modal-form-button').on('click', ()=> { | |||||
| modal.modal('show'); | |||||
| netuno.loadFormEdit(modal.find('[netuno-form]')); | |||||
| }); | |||||
| modal.find('[netuno-form]').on('netuno:save', ()=> { | |||||
| modal.modal('hide'); | |||||
| }); | |||||
| }); | |||||
| @ -0,0 +1,4 @@ | |||||
| /*** GLOBAL CSS ***/ | |||||
| @import '~antd/dist/antd'; | |||||
| @ -0,0 +1,84 @@ | |||||
| const path = require('path'); | |||||
| module.exports = { | |||||
| entry: [ './src/index.js', './src/styles/main.less' ], | |||||
| devtool: "source-map", | |||||
| output: { | |||||
| path: __dirname +'/../public/scripts', | |||||
| filename: 'main.js' | |||||
| }, | |||||
| module: { | |||||
| rules: [ | |||||
| { | |||||
| test: /\.jsx$/, | |||||
| include: [ | |||||
| path.resolve(__dirname, 'src') | |||||
| ], | |||||
| exclude: [/node_modules/], | |||||
| use: [{ | |||||
| loader: 'babel-loader' | |||||
| }] | |||||
| }, | |||||
| { | |||||
| test: /\.js$/, | |||||
| include: [ | |||||
| path.resolve(__dirname, 'src') | |||||
| ], | |||||
| exclude: [/node_modules/], | |||||
| use: [{ | |||||
| loader: 'babel-loader' | |||||
| }] | |||||
| }, | |||||
| { | |||||
| test: /\.css$/, | |||||
| include: [ | |||||
| path.resolve(__dirname, 'src') | |||||
| ], | |||||
| exclude: [/node_modules/], | |||||
| use: [ | |||||
| 'style-loader', | |||||
| 'css-loader' | |||||
| ] | |||||
| }, | |||||
| { | |||||
| test: /\.less$/, | |||||
| include: [ | |||||
| path.resolve(__dirname, 'src') | |||||
| ], | |||||
| exclude: [/node_modules/], | |||||
| use: [ | |||||
| { | |||||
| loader: 'style-loader' // creates style nodes from JS strings | |||||
| }, | |||||
| { | |||||
| loader: 'css-loader', // translates CSS into CommonJ, | |||||
| options: { | |||||
| sourceMap: true | |||||
| /*, | |||||
| modules: { | |||||
| mode: 'local', | |||||
| localIdentName: "[local]___[hash:base64:5]", | |||||
| context: path.resolve(__dirname, 'src'), | |||||
| hashPrefix: 'app', | |||||
| }*/ | |||||
| } | |||||
| }, | |||||
| { | |||||
| loader: 'less-loader', // compiles Less to CSS | |||||
| options: { | |||||
| lessOptions: { | |||||
| modifyVars: { | |||||
| '@primary-color': '#5b5ce1', | |||||
| '@link-color': '#5b5ce1', | |||||
| '@border-radius-base': '5px' | |||||
| }, | |||||
| javascriptEnabled: true | |||||
| }, | |||||
| sourceMap: true | |||||
| } | |||||
| } | |||||
| ] | |||||
| } | |||||
| ] | |||||
| } | |||||
| }; | |||||