This repository contains IdraPortal UI Template. This template is built starting from NGX-Admin, an open source dashboard based on Angular, Nebular with Eva Design System.
To properly install and start the template, the following tools should be installed:
- Git
- Npm
- Angular CLI
To properly install the template, follow these steps:
$ git clone https://github.com/OPSILab/IdraPortal-ngx.git
$ cd IdraPortal-ngx
$ npm install
To build and deploy the template, follow these steps:
$ cd IdraPortal-ngx
$ ng build --prod
This command generates a dist folder within the IdraPortal-ngx folder. To properly deploy the application, the content of the dist folder should be placed within a server for instance: Nginx or Apache HTTP Server.
Please, refer to the official documentation for furhter details:
Build docker image:
$ cd IdraPortal-ngx
$ docker build -t <repo>/<imageName> .
Run docker image:
$ cd IdraPortal-ngx
$ docker run -it -p 80:80 <repo>/<imageName>
The provided docker-compose.yml build and deploy the application with an instance of the IDM (Keycloak).
Run the following command to use the docker-compose:
$ cd IdraPortal-ngx
$ docker-compose up
This section summarizes the basic commands and configurations needed to integrate a new tool into the IdraPortal-ngx.
It is suggested to fork the repository or to create a specific branch for any new tool to be integrated.
An Angular module should be created, for any new tool to be integrated. To properly create a new module, execute the following command:
$ cd IdraPortal-ngx
$ ng generate module pages/<MODULE_NAME> --routing
Replace <MODULE_NAME> with the name of the new module.
This command will generate a new folder within the pages folder with the specific module and routing files. The routing file is mandatory if the new module is expected to contain more than one components.
An Angular component manages the views. At least a component should be created for any new tool to be integrated. To create a new component, execute the following command:
$ cd IdraPortal-ngx
$ ng generate component pages/<MODULE_FOLDER>/<COMPONENT_NAME>
Replace <MODULE_FOLDER> with the path of the folder to the new module. Replace <COMPONENT_NAME> with the name of the new component. This command will generate a new folder within the pages/<MODULE_FOLDER> folder with the component details.
An Angular service is used, for instance, to build a REST client. To create a new service, execute the following command:
$ cd IdraPortal-ngx
$ ng generate service pages/<MODULE_FOLDER>/<SERVICE_NAME>
Replace <MODULE_FOLDER> with the path of the folder to the new module. Replace <SERVICE_NAME> with the name of the new service.
Please, refer to the angular official documentation to build a REST client.
To visualize the content for any new module the developer needs to manage routing. In the IdraPortal-ngx there are two levels of routing:
Refer to the official routing documentation for additional details.
To allow the a module to be accessed, the developer should open the IdraPortal-ngx/src/app/pages/pages-routing.module.ts file with the configured IDE and add the following entry:
const routes: Routes = [{
path: '',
component: PagesComponent,
children: [
{
path: 'home',
loadChildren: () => import('./home/home.module')
.then(m => m.HomeModule),
},
...
{
path: '<module>',
loadChildren: () => import('./<MODULE_FOLDER>/<MODULE_NAME>.module')
.then(m => m.<MODULE_NAME>),
},
...
The path represents how the module will be accessible through the browser url. Replace <MODULE_FOLDER> and <MODULE_NAME> with the specific values.
To allow to access the components defined within each module, the developer should open and edit the IdraPortal-ngx/src/app/pages/<MODULE_FOLDER>/<MODULE_ROUTING>.module.ts
Please, replace <MODULE_FOLDER> and <MODULE_ROUTING> with the corresponding paths.
const routes: Routes = [{
path: '',
children: [{
path: '<COMPONENT_1_URL>',
component: <COMPONENT_1>,
},
{
path: '<COMPONENT_2_URL>',
component: <COMPONENT_2>,
},
...
],
}];
Each path, of the above, represents how the component will be accessible through the browser url. The component is the component name created within the module.
To add a sidebar entry, the developer should open and edit the IdraPortal-ngx/src/app/pages/pages-menu.ts and add the following entry:
export const MENU_ITEMS: NbMenuItem[] = [
{
title: 'SERVICES',
group: true,
},
{
title: 'Home',
icon: 'home-outline',
link: "/pages/home",
data:{
name:"home"
}
},
...
{
title: '<MODULE_TITLE>',
icon: '<MODULE_ICON>',
link: "/pages/<MODULE>",
data:{
name:"<MODULE>"
}
},
...
The title is the label that would be added to the sidebar. Replace in the link and in the name the value defined for the path variable on IdraPortal-ngx routing. About the icon, please select an icon among the following and put its identifier.
To start the application, follow these steps:
cd IdraPortal-ngx
ng serve
The application will be available at http://localhost:4200