Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Commit

Permalink
Merge branch 'release/v0.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
osahner committed Dec 14, 2017
2 parents 76e5902 + 932338a commit 97a7080
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: node_js
sudo: required
dist: trusty
node_js:
- 'v8.9.1'
- 'v8.9.3'
before_install:
- export CHROME_BIN=/usr/bin/google-chrome
- export DISPLAY=:99.0
Expand Down
2 changes: 1 addition & 1 deletion .yo-rc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"generator-angular2-library": {
"promptValues": {
"gitRepositoryUrl": "https://github.com/username/repo"
"gitRepositoryUrl": "https://github.com/osahner/ngx-httpclient-busy"
}
}
}
35 changes: 35 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ngx-httpclient-busy

[![Build Status](https://travis-ci.org/osahner/ngx-httpclient-busy.svg?branch=master)](https://travis-ci.org/osahner/ngx-httpclient-busy)

## Installation

To install this library, run:
Expand All @@ -8,6 +10,39 @@ To install this library, run:
$ npm install ngx-httpclient-busy --save
```

and then from your Angular `AppModule`:

```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
import { AppComponent } from './app.component';

import { CounterService, HttpClientBusyInterceptor, HttpClientBusyModule } from 'ngx-httpclient-busy';

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
HttpClientBusyModule.forRoot()
],
providers: [
CounterService,
{ provide: HTTP_INTERCEPTORS, useClass: HttpClientBusyInterceptor, multi: true }
],
bootstrap: [AppComponent]
})
export class AppModule { }
```

Simple Working Gear [FontAwesome](http://fontawesome.io/) Icon

```xml
<i aria-hidden="true" class="fa fa-cog fa-fw fa-2x fa-spin text-muted loading-spinner fade" httpClientBusy></i>
```

## License

MIT © [Oliver Sahner](mailto:[email protected])
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-httpclient-busy",
"version": "0.1.0",
"version": "0.1.1",
"scripts": {
"build": "gulp build",
"build:watch": "gulp",
Expand All @@ -16,7 +16,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/username/repo"
"url": "https://github.com/osahner/ngx-httpclient-busy"
},
"author": {
"name": "Oliver Sahner",
Expand Down
4 changes: 2 additions & 2 deletions playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/4.0.0-beta.2/united/bootstrap.min.css" rel="stylesheet"
integrity="sha384-lZV2BQHhlIeSX0KKlcV52T0RM5GEd+q4DbVOu45FyIjjgDGbbaHaVMkUMviDDeOU" crossorigin="anonymous">
<style>
.http-client-busy {
transition: all 0.15s linear;
.transition {
transition: all 0.25s linear;
}
</style>
</head>
Expand Down
33 changes: 16 additions & 17 deletions playground/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@ import { CounterService, HttpClientBusyInterceptor, HttpClientBusyModule } from

@Component({
selector: 'app',
template: `FontAwesome:
<i aria-hidden="true" class="fa fa-cog fa-fw fa-2x fa-spin text-muted loading-spinner http-client-busy fade" httpClientBusy></i>
<br>
Alert:
<div class="alert alert-info" role="alert" httpClientBusy>
httpClientBusy
</div>
Alert (with class):
<div class="alert alert-primary" role="alert" [httpClientBusy]="{idle: 'alert-primary', busy: 'alert-success'}">
httpClientBusy: idle: 'alert-primary', busy: 'alert-success'
</div>
<hr>
<button class="btn btn-outline-primary" (click)="ping()">Ping</button>
template: `Icon
<i aria-hidden="true" class="fa fa-cog fa-fw fa-2x fa-spin text-muted loading-spinner fade" httpClientBusy></i>
<br>
<div class="alert alert-info transition" role="alert" httpClientBusy>
httpClientBusy
</div>
<div class="alert alert-success transition" role="alert"
[httpClientBusy]="{idle: 'alert-success', busy: 'alert-info'}">
httpClientBusy Config <code>idle: 'alert-success', busy: 'alert-info'</code>
</div>
<hr>
<button class="btn btn-outline-primary" (click)="ping()">Ping</button>
`
})
class AppComponent implements OnInit {
Expand All @@ -44,7 +43,7 @@ class AppComponent implements OnInit {
return Observable.throw('An error occurred');
})
.subscribe(() => {
console.log('longrunning done');
console.log('longrunning request done');
});
this.http
.put<Array<any>>('https://www.mocky.io/v2/5185415ba171ea3a00704eed?mocky-delay=100ms', {
Expand All @@ -54,19 +53,19 @@ class AppComponent implements OnInit {
return Observable.throw('An error occurred');
})
.subscribe(() => {
console.log('shortrunning done');
console.log('shortrunning request done');
});

this.http
.put<Array<any>>('http://www.mocky.io/v2/5a2fae752d00009614a83b2f', {
headers: new HttpHeaders().set('Accept', 'application/json')
})
.catch((error: any) => {
console.log('error done');
console.log('error request done');
return Observable.throw('An error occurred');
})
.subscribe(() => {
console.log('error done');
console.log('never happens');
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/http-client-busy.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class HttpClientBusyDirective implements OnInit, OnDestroy {
}

ngOnInit() {
this._renderer.addClass(this._el.nativeElement, 'http-client-busy');
// this._renderer.addClass(this._el.nativeElement, 'http-client-busy');
this._httpClientBusyConfig.idle = this.httpClientBusy.idle || 'fade';
this._httpClientBusyConfig.busy = this.httpClientBusy.busy || '';
this._updateStatus(0);
Expand Down
9 changes: 5 additions & 4 deletions src/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "ngx-httpclient-busy",
"version": "0.1.0",
"version": "0.1.1",
"repository": {
"type": "git",
"url": "https://github.com/username/repo"
"url": "https://github.com/osahner/ngx-httpclient-busy"
},
"author": {
"name": "Oliver Sahner",
Expand All @@ -14,14 +14,15 @@
],
"license": "MIT",
"bugs": {
"url": "https://github.com/username/repo/issues"
"url": "https://github.com/osahner/ngx-httpclient-busy/issues"
},
"homepage": "https://github.com/osahner/ngx-httpclient-busy#readme",
"main": "ngx-httpclient-busy.umd.js",
"module": "ngx-httpclient-busy.js",
"jsnext:main": "ngx-httpclient-busy.js",
"typings": "ngx-httpclient-busy.d.ts",
"peerDependencies": {
"@angular/core": "^4.0.0",
"@angular/core": "^4.2.4 || ^5.0.0",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
}
Expand Down

0 comments on commit 97a7080

Please sign in to comment.