| @ -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,13 @@ | |||||
| /** | |||||
| HERE YOUR CUSTOM CSS | |||||
| **/ | |||||
| .navbar, .navbar-inverse { | |||||
| background-color: #5b5ce1 !important; | |||||
| } | |||||
| .dev .navbar, .dev .navbar-inverse { | |||||
| background-color: #333333 !important; | |||||
| } | |||||
| @ -0,0 +1 @@ | |||||
| .my-dashboard{width:100%}.my-dashboard__button{padding:80px;text-align:center} | |||||
| @ -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,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 @@ | |||||
| <script src="_{netuno-config=url-app-scripts}/ui.js?_{util=requestuuid}"></script> | |||||
| @ -0,0 +1,2 @@ | |||||
| <link href='_{netuno-config=url-app-styles}/ui.css?_{util=requestuuid}' rel='stylesheet' /> | |||||
| <link href='_{netuno-config=url-app-styles}/main.css?_{util=requestuuid}' 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,15 @@ | |||||
| node_modules/ | |||||
| .DS_Store | |||||
| *.log | |||||
| .idea/ | |||||
| .metadata/ | |||||
| .vscode | |||||
| package-lock.json | |||||
| yarn.lock | |||||
| .Trash | |||||
| *~* | |||||
| *#* | |||||
| @ -0,0 +1,8 @@ | |||||
| ### Install Packages | |||||
| `npm install` | |||||
| ### Watch changes and auto recompile | |||||
| `npm run watch` | |||||
| @ -0,0 +1,35 @@ | |||||
| { | |||||
| "name": "ui", | |||||
| "private": true, | |||||
| "version": "1.0.0", | |||||
| "type": "module", | |||||
| "scripts": { | |||||
| "dev": "vite", | |||||
| "build": "vite build ", | |||||
| "watch": "vite build --watch", | |||||
| "lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0", | |||||
| "preview": "vite preview" | |||||
| }, | |||||
| "dependencies": { | |||||
| "antd": "^5.5.2", | |||||
| "less": "4.1.3", | |||||
| "react": "^18.2.0", | |||||
| "react-dom": "^18.2.0", | |||||
| "@ant-design/icons": "^5.1.4", | |||||
| "@netuno/service-client": "^1.1.0", | |||||
| "@netuno/ws-client": "^1.0.8", | |||||
| "json-loader": "^0.5.7" | |||||
| }, | |||||
| "devDependencies": { | |||||
| "@types/react": "^18.0.37", | |||||
| "@types/react-dom": "^18.0.11", | |||||
| "@vitejs/plugin-react-swc": "^3.0.0", | |||||
| "eslint": "^8.38.0", | |||||
| "eslint-plugin-react": "^7.32.2", | |||||
| "eslint-plugin-react-hooks": "^4.6.0", | |||||
| "eslint-plugin-react-refresh": "^0.3.4", | |||||
| "prop-types": "^15.8.1", | |||||
| "vite": "^4.3.9", | |||||
| "vite-plugin-imp": "^2.4.0" | |||||
| } | |||||
| } | |||||
| @ -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,78 @@ | |||||
| import React from "react"; | |||||
| import ReactDOM from "react-dom/client"; | |||||
| import _service from '@netuno/service-client'; | |||||
| import DashboardContainer from "./containers/DashboardContainer"; | |||||
| import { ConfigProvider, theme } from "antd"; | |||||
| import antLocale_enGB from "antd/lib/locale/en_GB"; | |||||
| import antLocale_enUS from "antd/lib/locale/en_US"; | |||||
| import antLocale_esES from "antd/lib/locale/es_ES"; | |||||
| import antLocale_ptBR from "antd/lib/locale/pt_BR"; | |||||
| import antLocale_ptPT from "antd/lib/locale/pt_PT"; | |||||
| _service.config({ | |||||
| prefix: netuno.config.urlServices | |||||
| }); | |||||
| const dashboardDiv = document.getElementById("app-dashboard"); | |||||
| const dashboardContainer = dashboardDiv ? ReactDOM.createRoot(dashboardDiv) : false; | |||||
| if (dashboardContainer) { | |||||
| dashboardContainer.render( | |||||
| <ConfigProvider | |||||
| theme={{ | |||||
| token: { | |||||
| colorPrimary: '#5b5ce1', | |||||
| colorLink: '#5b5ce1', | |||||
| borderRadius: 5, | |||||
| }, | |||||
| algorithm: theme.darkAlgorithm | |||||
| }} | |||||
| locale={ | |||||
| { | |||||
| 'en_us': antLocale_enUS, | |||||
| 'en_gb': antLocale_enGB, | |||||
| 'es_es': antLocale_esES, | |||||
| 'pt_br': antLocale_ptBR, | |||||
| 'pt_pt': antLocale_ptPT | |||||
| }[netuno.config.langCode] | |||||
| } | |||||
| > | |||||
| <DashboardContainer/> | |||||
| </ConfigProvider> | |||||
| ); | |||||
| } | |||||
| 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,3 @@ | |||||
| /*** GLOBAL CSS ***/ | |||||
| @ -0,0 +1,39 @@ | |||||
| import { defineConfig } from 'vite' | |||||
| import react from '@vitejs/plugin-react-swc' | |||||
| // https://vitejs.dev/config/ | |||||
| /** | |||||
| * Library Mode | |||||
| * https://vitejs.dev/guide/build.html#library-mode | |||||
| */ | |||||
| export default defineConfig({ | |||||
| plugins: [ | |||||
| react() | |||||
| ], | |||||
| build: { | |||||
| sourcemap: true, | |||||
| rollupOptions: { | |||||
| input: 'src/index.jsx', | |||||
| output: { | |||||
| dir: './../public', | |||||
| entryFileNames: 'scripts/ui.js', | |||||
| assetFileNames: (assetInfo) => { | |||||
| const info = assetInfo.name.split("."); | |||||
| let extType = info[info.length - 1]; | |||||
| if (/png|jpe?g|svg|gif|tiff|bmp|ico/i.test(extType)) { | |||||
| return `images/[name][extname]`; | |||||
| } else if (/css/i.test(extType)) { | |||||
| return `styles/ui[extname]`; | |||||
| } else { | |||||
| return `[name][extname]`; | |||||
| } | |||||
| }, | |||||
| chunkFileNames: "ui-chunk.js", | |||||
| manualChunks: undefined, | |||||
| } | |||||
| } | |||||
| } | |||||
| }) | |||||