Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
michameiu committed Aug 21, 2024
0 parents commit 62da90d
Show file tree
Hide file tree
Showing 447 changed files with 246,805 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# For IE 9-11 support, please uncomment the last line of the file and adjust as needed
> 0.5%
last 2 versions
Firefox ESR
not dead
# IE 9-11
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
42 changes: 42 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
name: MoE Kenya Web Dash Build
runs-on: node

strategy:
matrix:
node-version: [14.15.5]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"

# - name: Adding to Known Hosts
# run: |
# ssh-keygen -R "[domain.com]:22" || true
# ssh-keyscan -T 100 -t rsa -4 domain.com >> ~/.ssh/known_hosts || true

- name: Install Packages
run: npm ci

- name: Build
run: npm run build-prod

# - name: Deploy to RequestAfrica
# run: rsync -av -e ssh -r dist/* [email protected]:/usr/www/html/dash
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp

# dependencies
/node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.angular/cache
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log
/typings

# e2e
/e2e/*.js
/e2e/*.map

#System Files
.DS_Store
Thumbs.db
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM nginx:1.15
COPY dist/ /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
151 changes: 151 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# Digital Attendance Dashboard v2

## Introduction

Digital Attendance is an open-source project supported by UNICEF Kenya through a collaboration with [Sisitech](hhttps://sisitech.com). The platform allows tracking of individual attendance of students in schools.

It is comprised of three components
- API - Django Rest Framework
- Dashboard - Angular Web Application (this)
- Application - Ionic Hybrid Application


## User Manual
- [Onekana User Manual](https://sisitech.github.io/OnekanaDocs/)



# Set up

## 1. Prerequisites

Before starting, ensure the following are installed:

- **Node.js** (v14.x or above) - [Download here](https://nodejs.org/en/download/)
- **Angular CLI** (v12.x or above) - [Installation guide](https://angular.io/cli)
- Configure `.npmrc`

Additionally, ensure the backend API is already set up and browsable, eg `http://localhost:8000` or `https://api.domain.com/`.

---

### Updating .npmrc
#### Generating a GitHub Token

1. **Log in to GitHub**
Go to [GitHub](https://github.com) and log in to your account.

2. **Navigate to Personal Access Tokens:**
- Click on your profile icon in the upper-right corner and select **Settings**.
- On the left-hand sidebar, click **Developer settings**.
- Under **Personal access tokens**, click on **Tokens (classic)**.
- Click on **Generate new token**.

3. **Configure the Token:**
- Add a descriptive note (e.g., “npm access token for SisiTech packages”).
- Set the token expiration according to your security policy.
- Under **Select scopes**, choose:
- `repo` (for accessing private repositories)
- `read:packages` (for reading package metadata)

4. **Generate and Copy the Token:**
- After configuring the scopes, click **Generate token**.
- Copy the generated token. **Make sure to store it securely,** as it won’t be displayed again.

#### Updating the `.npmrc` File

To authenticate npm to use your GitHub token:

- **Create or Update the `.npmrc` File in Your Project:**

Navigate to your project’s root directory and either create or update the `.npmrc` file with the following configuration:

```ini
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN
@sisitech:registry=https://npm.pkg.github.com/
```

Replace `YOUR_GITHUB_TOKEN` with the token you copied earlier.

This setup tells npm to use the GitHub Packages registry for all `@sisitech` scoped packages and authenticate using your token.

- **Verify the Configuration:**
After saving the `.npmrc` file, it should look like this:

```ini
//npm.pkg.github.com/:_authToken=ghp_XXXXXXXXXXXXXXXXXXXX
@sisitech:registry=https://npm.pkg.github.com/
```

Make sure the token is correctly placed, and the scope `@sisitech` points to the GitHub Packages registry.

If the packages installs without any errors, your configuration is successful otherwise you will get a `401` error.

---

## 2. Cloning the Project

Begin by cloning the project repository:

```bash
git clone [email protected]:unicefkenya/da-dashboard-v2.git
cd da-dashboard-v2
```

---

## 3. Installing Node Modules

Run the following command to install the required Node modules:

```bash
npm install --force
```

This command will install all the dependencies defined in the `package.json` file.

---

## 4. Configuring Environment Variables

The project’s environment configuration is stored in the `src/environments/environment.ts` file. Before running the application, make sure to update the environment variables. Here is an example configuration:

```typescript
export const environment = {
production: true,
APIEndpoint: 'https://api.domain.com/',
APIEndpointNoSlash: 'https://api.domain.com',
APIv1Endpoint: 'https://api.domain.com/api/v1/',
APIClientID: 'CLIENT_ID_FROM_API'
};
```

---

## 5. Generating Client ID in Django Admin

To obtain the `APIClientID`, follow these steps:

1. Log in to your Django-admin panel: [https://api.domain.com/admin](https://api.domain.com/admin).
2. Navigate to the **API Clients** section (assuming you have set this up).
3. Create a new client or view existing ones.
4. Copy the `Client ID` and paste it into the `APIClientID` field in the environment configuration.

For more details on setting up API clients in Django, you can refer to the [Django OAuth Toolkit documentation](https://django-oauth-toolkit.readthedocs.io/en/latest/).

---

## 6. Running the Application

After configuring the environment, you can start the Angular application using:

```bash
ng serve
```

The application will be accessible at `http://localhost:4200/`.

---

## 7. Learn More
- [Angular Documentation](https://angular.io/docs)
Loading

0 comments on commit 62da90d

Please sign in to comment.