Welcome to the Talk2PowerSystem_UI project!
This document provides an overview of the development environment, project structure, and important guidelines for working with the codebase.
Below are the initial steps to set up the project:
-
Clone the this repository.
git clone https://github.com/statnett/Talk2PowerSystem_UI.git
-
Install all dependencies
npm install
-
Build projects
Run the following command to build all project artefacts:
npm run build
-
Starting a development server
A development server can be run by executing the
npm run startcommand. This will run a simple web server and deploy a sample web page with thetalk-2-power-systemartefacts inside.
The server supports a watch mode, and a live reload of the web browser.
During the build process, the file located at:
src/assets/data/questions.json
is automatically copied to the distribution folder:
dist/assets/data/questions.json
This file contains the list of questions shown in the left-side panel of the application.
If you need to change the list of questions, you can do so in one of two ways:
- During development – Edit the source file at
src/assets/data/questions.json, then rebuild the project usingnpm run build. - After deployment – Edit the file directly in the deployed location (
dist/assets/data/questions.json) without rebuilding the entire application.
This allows for easy updates to the guide content even post-deployment.
This project is built using AngularJS (version 1.8.3), a structural framework for dynamic web applications.
The source code is organized under the src/ directory, alongside several key application-level files:
scripts
└── generate-project-info.js # Script that generates project-info
src/
├── assets/ # Static assets like images, fonts, icons, and data files
│ └── data/
│ └── questions.json # Contains the questions shown in the left-side panel
├── directives/ # Custom AngularJS directives
├── models/ # Model definitions used for application data
├── services/ # AngularJS services and factories
├── styles/ # Global CSS/SCSS styles
├── vendor/ # Manually included third-party libraries
├── views/ # View-specific templates and controllers
├── layout.html # Root HTML layout of the application
├── app.js # Main AngularJS module declaration and bootstrap logic
├── main.controller.js # Main controller for managing root-level app state
└── routes.js # Application routes and lazy-loaded view configuration
Views in the application are lazy-loaded via AngularJS routing defined in src/routes.js.
Each view must be registered with the following structure:
{
path: '/chat',
controller: 'chatCtrl',
template: './views/chat/chat.html',
lazyModule: './views/chat/chat.controller.js',
}pathdefines the route segment (used in the URL).controlleris the AngularJS controller to be used for this view.templatepoints to the HTML template file.lazyModuleis the controller or module file that will be dynamically loaded when the view is activated.
This lazy-loading mechanism helps improve initial load time and keeps the application modular.
The left-side panel displays context-sensitive questions that are loaded from:
src/assets/data/questions.json
This file contains a structured list of questions used within the questions component. Make sure the format remains consistent when updating the content.
The generate-porject-info.js script generates a project-info.js file that contains project metadata, framework and runtime information, and a list of all dependencies. The output is structured as an object and is imported and used in the application.
The script must be run whenever project dependencies change — for example:
- After installing a new package;
- After updating an existing dependency
- After removing a dependency
Running the script ensures that project-info.js reflects the exact versions used in the project.
npm run generate-project-info