The main purpose of this part is to explain general notions and global concepts you need to know when working with Nodea Software.
In Nodea applications the concept of data entity is very important because it represents the majority of the elements of a generated application. Basically an entity is the representation of a table in database. In the application an entity is displayed as a menu in a module (See Glossary), coming with all the appropriate forms to create or update or display an instance of entity, coming also with a delete button.
First of all an entity represents in terms of UI a “menu” in a module (See Nodea Glossary), this menu owns two sub items:
And then it embeds different views and pages:
On the technical side, adding an entity to an application means a lot of things :
First of all, an entity is made of 3 fundamental elements of the MVC principle:
An entity exposes several URLs by default, let's list them:
URL (prefix by /entity) | METHOD | DESCRIPTION |
---|---|---|
list | GET | Redirection to the list.dust view of the entity |
datalist | POST (ajax) | This is the ajax request used by the NodeaTables (See NodeaTables) in order to retrieve the asked database data to display in the datalist. |
subdatalist | POST (ajax) | This is the ajax request used by the NodeaTables (See NodeaTables) in order to retrieve the asked database data to display in the datalist. This behaviour is only used in datalist that are in tabs of an entity (On the show page, see NodeaTabs) |
show | GET | Show page of an entity row. |
create_form | GET | Creation form of an entity. |
create | POST | Creation route from submitting the creation form. |
update_form | GET | Update form of an entity. |
update | POST | Update route from submitting the update form. |
loadtab | POST (ajax) | Ajax route to load tab content, see Ajax tabs working |
set_status | POST | When clicking on a new status bouton, see Component Status |
search | POST (ajax) | Search route for select2 plugin display, filter and pagination. |
fieldset_add | POST (ajax) | Route used by generated code from ‘has many existing’ instruction to add row. |
fieldset_remove | POST (ajax) | Route used by generated code from ‘has many existing’ instruction to remove row. |
destroy | POST | Deleting an entity row. |
Let's define what means the term subentity in Nodea.
This is a data entity depending on another entity and which, at the time of its generation, was not considered to be added in the sidebar of the module.
To illustrate this here is an instruction script that does not generate subentity:
- add application My Application
- add entity Source
- add entity Target
- entity Source has one Target
And then an instruction script that does generate a subentity:
- add application My Application
- add entity Source
- entity Source has one Target
As you can see the difference between these two scripts and that in the second there is no declaration add entity Target
. Then with the instruction entity Source has one Target
the Nodea generator finds that the Target entity does not exist.
It therefore considers that the Target entity only exists in the scope of the Source entity and so will generate this entity without adding it in the sidebar of your module.
Working in a Nodea environment means knowing how it's organized and which rules to follow in order to avoid difficulties.
The diagram below shows an entire Nodea environment. Studio, Cloud and Local are 3 different technical environments, each of them having their own objective.
The following diagram shows how you have to work with the generator as soon as you need to work both on local and online environment :
Important: To avoid any code conflict, it is necessary to follow these steps. In fact, if you modify the code of the application locally and at the same time on the studio, you will end up with conflicts to manage when the code is merged. So think about pushing your code and reloading on the studio side before executing any new instruction and vice versa.
After having generated your application on studio, you can get this application on your local environment and perform specific coding.
Connect to the studio, open “Build” / “Manage” menu and then click on the “Clone” button of the application you would like to get :
A popup will appear to give you all the information you need to clone the application on your local environment. If you want to clone in SSH, connect to gitlab with your account, and then add your SSH Key.
It will then be necessary to prepare a database and configure the config/database.js file accordingly.
In order to share the same content of database as the studio, you may export the studio database of your app (see Administration / BDD tools).
This can be useful for the status component for instance or for the access rights definition if you have already prepared and store them.
Now you can install node modules by executing this command:
npm install --no-optional
You can remove the --no-optional if you also want to install Cypress.
Then the only thing to do is to launch the server with this command:
node server
And the application should be launched on 127.0.0.1:1337 !