Skip to content

Commit

Permalink
Trying to fix unit tests and added readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ucswift committed Feb 22, 2022
1 parent b8ad2fb commit b2ac9d3
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ jobs:
working-directory: ./projects/ngx-resgrid-apps-shared
- run: npm build --if-present
working-directory: ./projects/ngx-resgrid-apps-shared
- run: npm test
- run: npm testci
working-directory: ./projects/ngx-resgrid-apps-shared
108 changes: 108 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# `Ngx-ResgridLib` - Angular Library for the Resgrid API

Ngx-ResgridLib is an Angular library used by Resgrid in all of our mobile applications and web applications to interact with the Resgrid API. This library is a **foundational element** to all of our applications and contains a large cross-section of code used in building our mobile applications which are written in [Ionic Framework](https://ionicframework.com/) and [Capacitor](https://capacitorjs.com/).

About Resgrid
-------------
Resgrid is an open-source Computer Aided Dispatch (CAD) solution for first responders, businesses and industrial environments.

[Sign up for your free Resgrid Account Today!](https://resgrid.com)


# Features
- **V4 API** compatible with the v4 version of the [Resgrid API](https://api.resgrid.com/index.html?urls.primaryName=Resgrid%20API%20V4)
- **RxJS** Services for each API utilizing RxJS
- **Authentication** Library handles the auth flow and storing of the refresh token

# Installation

```bash
# Install the library
npm install @resgrid/ngx-resgridlib --save

```

# Getting Started

```ts
import { NgxResgridLibModule } from '@resgrid/ngx-resgridlib';

let getBaseUrl = (): string => {
return 'http://localhost:8081';
}

@NgModule({
declarations: [
AppComponent
],
imports: [
... ,

NgxResgridLibModule.forRoot({
baseApiUrl: getBaseUrl,
apiVersion: 'v4',
clientId: 'test',
googleApiKey: '',
channelUrl: '',
channelHubName: '',
logLevel: 0
}),
],
providers: [],
bootstrap: [ AppComponent ]
})

export class AppModule { }
```

### NgxResgridLibModule Options
<table>
<tr>
<th>Setting</th>
<th>Description</th>
</tr>
<tr>
<td>baseApiUrl</td>
<td>
The base URL to talk to the Resgrid API (Services) for our hosted production system this is "https://api.resgrid.com". This is a function that should return the string url to the api without nothing past the hostname and/or port.
</td>
</tr>
<tr>
<td>apiVersion</td>
<td>
Version of the API to call, currently only `v4` is supported
</td>
</tr>
<tr>
<td>clientId</td>
<td>
Just a name to give to your application using this library
</td>
</tr>
<td>googleApiKey</td>
<td>
Your Google Map account API key
</td>
</tr>
<tr>
<td>channelUrl</td>
<td>
The URL to connect to the SignalR hub for our hosted production system this is "https://api.resgrid.com/signalr"
</td>
</tr>
<tr>
<td>channelHubName</td>
<td>
The SignalR hub name to connect to receive events for
</td>
</tr>
<tr>
<td>logLevel</td>
<td>
Log level for the library 0 = Debug and above, 1 = Warn and above, 2 = Error only, -1 = Off
</td>
</tr>
</table>

## License ##
[Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
8 changes: 7 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ module.exports = function (config) {
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
browsers: ['Chrome', 'ChromeHeadless', 'ChromeHeadlessCI'],
customLaunchers: {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
singleRun: false,
restartOnFileChange: true
});
Expand Down
22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
{
"name": "resgrid-app-shared",
"version": "0.0.0-development",
"author": "Resgrid, LLC.",
"homepage": "https://resgrid.com",
"description": "Angular 10+ library for interacting with the v4 Resgrid api",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/Resgrid/ngxresgridlib.git"
},
"bugs": {
"url": "https://github.com/Resgrid/ngxresgridlib/issues"
},
"keywords": [
"angular",
"resgrid",
"cad",
"dispatch",
"police",
"firefighter",
"ems",
"emergency",
"avl"
],
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
8 changes: 7 additions & 1 deletion projects/ngx-resgrid-apps-shared/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ module.exports = function (config) {
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
browsers: ['Chrome', 'ChromeHeadless', 'ChromeHeadlessCI'],
customLaunchers: {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
singleRun: false,
restartOnFileChange: true
});
Expand Down
23 changes: 23 additions & 0 deletions projects/ngx-resgrid-apps-shared/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
{
"name": "@resgrid/ngx-resgridlib",
"version": "0.0.0-development",
"author": "Resgrid, LLC.",
"homepage": "https://resgrid.com",
"description": "Angular 10+ library for interacting with the v4 Resgrid api",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/Resgrid/ngxresgridlib.git"
},
"bugs": {
"url": "https://github.com/Resgrid/ngxresgridlib/issues"
},
"keywords": [
"angular",
"resgrid",
"cad",
"dispatch",
"police",
"firefighter",
"ems",
"emergency",
"avl"
],
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"testci": "ng test -- --no-watch --no-progress --browsers=ChromeHeadlessCI",
"lint": "ng lint",
"e2e": "ng e2e",
"semantic-release": "semantic-release"
Expand Down

0 comments on commit b2ac9d3

Please sign in to comment.