IE / Edge |
Firefox |
Chrome |
Safari |
iOS Safari |
Opera |
---|---|---|---|---|---|
IE10, IE11, Edge | last 3 versions | last 3 versions | last 3 versions | last 3 versions | last 3 versions |
Dashboard's Angular app documentation overview.
- Download
git clone https://github.com/ambrosus/app-dashboard.git
- Start node server (dashboard API)
node server.js
- Run Angular app
npm run dev
Node API service for handling account management.
Database: /server/accounts.json
SIGNUP
Description:
Account registration. Creates an account for a user, where he can use email and password to login, instead of address and secret. Takes address and secret, encrypts it using users password and stores it as a token.
Request:
POST /api/auth/signup
Body | Type | Required |
---|---|---|
address | string | true |
secret | string | true |
string | true | |
password | string | true |
full_name | string | false |
company | string | false |
Responses:
200 Signup successful
401 Address is missing
401 Secret is missing
401 E-mail is missing
401 Password is missing
401 Account already exists
LOGIN
Description:
Takes email and password, decrypts the token using users password, if successful returns address and secret to the user.
Request:
POST /api/auth/login
Body | Type | Required |
---|---|---|
string | true | |
password | string | true |
Responses:
200
{
address,
secret
}
401 E-mail is missing
401 Password is missing
401 Password is incorrect
401 Account does not exists
RESET PASSWORD
Description:
Takes email, current password and new password, decrypts the token with the current password, then, address and secret are encrypted back with the new password and stored as token.
Request:
POST /api/auth/resetpassword
Body | Type | Required |
---|---|---|
string | true | |
oldPassword | string | true |
password | string | true |
Responses:
200 Reset password succesfull
401 Reset password failed
401 Password is incorrect
401 E-mail is missing
401 Old password is missing
401 Password is missing
401 Account does not exists
ACCOUNTS
Description:
Returns all of the accounts from accounts.json
Request:
GET /api/auth/accounts
Responses:
200
{
resultsCount: number,
data: [
{
full_name,
address
}
],
message: 'Success'
}
404 No accounts
ACCOUNT
Description:
Returns data of a specific account.
Request:
GET /api/auth/accounts/:address
Responses:
200
{
data: {
token,
full_name,
company,
email,
address
},
message: 'Success'
}
404 No account
CLEAN
Description:
Removes all accounts from /server/accounts.json
Request:
DELETE /api/auth/accounts
Responses:
200 Cleanup successful
400 Cleanup failed
404 No accounts
App is organized into modules and services.
Modules:
-
Core
In core module we import all providers and basically anything we would otherwise import in app.module. This is to keep app.module clean and organized. When we import core module to app.module, it just imports everything in it as we would have had imported it in app.module in the first place.
Contains globally used components: Not Found, About, Terms, Settings and Help. -
Shared
Shared module holds all componenets, pipes and directives that are to be reused across entire app, in any module.
e.g.<app-spinner>, <app-header>, <app-footer>
Everything that's created in this module and is declared, is also exported so it can be used in other modules.
In other modules we just import this module, and we can use it's shared components, directives and pipes. -
Auth
Handles authentication part of the app, has login, sign in and sign up components. -
Dash
Handles the core functionality of the dashboard.
Contains: assets, asset, event, asset-add, event-add and dashboard components.
Services
- Auth handles all processing related to authentication of the user.
- Storage wrap for any localStorage interaction.
- Assets handles all the processing regarding, getting, parsing and creating new assets and events, and interaction with Ambrosus SDK.
- Interceptor handles interception of http requests.
Adds the secret or token from localStorage in the headers.
- Dashboard angular app is converted to Angular PWA, which uses advance strategies for caching various assets and preloading them when possible.
- Lazy loading is setup as well, dash and auth modules are lazy loaded.
- dash options for user roles
option | owner | admin | editor | viewer |
---|---|---|---|---|
Manage admin roles | ✓ | |||
Deactivate company | ✓ | |||
Edit company info | ✓ | ✓ | ||
Create branding template | ✓ | ✓ | ||
Manage users | ✓ | ✓ | ||
Invite users | ✓ | ✓ | ||
Approve users | ✓ | ✓ | ||
Set preview app and logo | ✓ | ✓ | ||
Edit dash company theme | ✓ | ✓ | ||
POST requests | ✓ | ✓ | ✓ | |
GET requests | ✓ | ✓ | ✓ | ✓ |
Edit personal account | ✓ | ✓ | ✓ | ✓ |
Interceptor to control outgoing requests per user role.