mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-28 23:19:33 +00:00
2.2 KiB
2.2 KiB
GUI quickstart guide
This guide is a quickstart to get up and running for GUI development
- Make sure to have node.js installed
- Run
npm installto install all the dependencies - Before making changes to any page make sure to run
npm run watchso that changes are displayed after every file save - After having made changes please build with the appropriate command.
npm run build:ntopng.jsto compile js only. If CSS changes have not been donenpm run build:ntopng.jsto compile css only. If JS changes have not been donenpm run buildto compile all the changes
Project structure
The folder http_src/ contains all the webpages scripts.
http_src/vuecontains single vue components that are imported in desired pageshttp_src/utilitiescontains all utility functionshttp_src/ntopng.jscontains all global imports that will be visible inside single componentspages/is found inhttpdocs/templates/pages/httpdocs/is the folder for GUI data, dist folder is present inside ittemplate.render("pages/vue_page.template", { vue_page_name = "PageSNMPDevices", page_context = json_context })some .lua pages render vue components. The name of the component is the value ofvue_page_name, in this case the component isPageSNMPDevices. This is the name of the component importend in the scripthttp_src/vue/ntop_vue.js. This is the import:import { default as PageSNMPDevices } from "./page-snmp-devices.vue"where PageSNMPDevices is the name of the vue component imported and displayed on the webpage and the component is found in the file page-snmp-devices.vue
Webpage structure
Pages are rendered lua side, rendering .vue components inside of the pages that need them.
- How to find .vue components that are used on a page?
- take the path of the current webpage and the .lua file that renders it is found
- prepend
scipts/to the page path and the file is opened template.render("VUE-COMPONENT-PATH", { vue_page_name = "PAGE-NAME", page_context = json_context })this function renders VUE-COMPONENT-PATH vue component
- Each page has a
page=*parameter where * is the name of the page. * is used to route each page and have conditional rendering lua side