Bug fixes.

- Change environment variables.
- Refactor http getter.
- Add custom error state matcher.
- Hide create account component.
This commit is contained in:
Spencer Ofwiti
2021-02-12 09:32:08 +03:00
parent 8dc0eb24d8
commit 0be8bcd51a
14 changed files with 2391 additions and 631 deletions

View File

@@ -0,0 +1,7 @@
import { CustomErrorStateMatcher } from './custom-error-state-matcher';
describe('CustomErrorStateMatcher', () => {
it('should create an instance', () => {
expect(new CustomErrorStateMatcher()).toBeTruthy();
});
});

View File

@@ -0,0 +1,9 @@
import {ErrorStateMatcher} from '@angular/material/core';
import {FormControl, FormGroupDirective, NgForm} from '@angular/forms';
export class CustomErrorStateMatcher implements ErrorStateMatcher{
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const isSubmitted = form && form.submitted;
return !!(control && control.invalid && (control.dirty || control.touched || isSubmitted));
}
}

View File

@@ -1,34 +1,19 @@
// function httpGetter(): any {
// }
//
// httpGetter().prototype.get = (filename: string) => new Promise((whohoo, doh) => {
// const xhr = new XMLHttpRequest();
// xhr.addEventListener('load', (e) => {
// if (xhr.status === 200) {
// whohoo(xhr.responseText);
// return;
// }
// doh('failed with status ' + xhr.status + ': ' + xhr.statusText);
// });
// xhr.open('GET', filename);
// xhr.send();
// });
//
// class HttpGetter {
// async get(filename: string): Promise<any> {
// const xhr = new XMLHttpRequest();
// xhr.addEventListener('load', (e) => {
// if (xhr.status === 200) {
// // whohoo(xhr.responseText);
// return;
// }
// // doh('failed with status ' + xhr.status + ': ' + xhr.statusText);
// });
// xhr.open('GET', filename);
// xhr.send();
// }
// }
// export {
// httpGetter,
// HttpGetter
// };
class HttpGetter {
async get(filename: string): Promise<any> {
const xhr = new XMLHttpRequest();
xhr.addEventListener('load', (e) => {
if (xhr.status === 200) {
console.log(xhr.responseText);
return;
}
console.log('failed with status ' + xhr.status + ': ' + xhr.statusText);
});
xhr.open('GET', filename);
xhr.send();
}
}
export {
HttpGetter
};

View File

@@ -2,3 +2,4 @@ export * from './mock-backend';
export * from './array-sum';
export * from './accountIndex';
export * from './custom-error-state-matcher';
export * from './http-getter';

View File

@@ -3,6 +3,7 @@ import {BehaviorSubject, Observable} from 'rxjs';
import {HttpClient, HttpParams} from '@angular/common/http';
import {environment} from '../../environments/environment';
import {first, map} from 'rxjs/operators';
import {} from '../../assets/js/cic-meta/sync';
@Injectable({
providedIn: 'root'
@@ -108,4 +109,8 @@ export class UserService {
return response;
}));
}
changeUserCredentials(): void {
}
}

View File

@@ -16,7 +16,7 @@ export class AppComponent implements OnInit {
private transactionService: TransactionService,
private blockSyncService: BlockSyncService
) {
// this.blockSyncService.blockSync();
this.blockSyncService.blockSync();
}
ngOnInit(): void {

View File

@@ -8,7 +8,7 @@ import {AccountDetailsComponent} from './account-details/account-details.compone
const routes: Routes = [
{ path: '', component: AccountsComponent },
{ path: 'create', component: CreateAccountComponent },
// { path: 'create', component: CreateAccountComponent },
{ path: 'export', component: ExportAccountsComponent },
{ path: ':id', component: AccountDetailsComponent },
{ path: '**', redirectTo: '', pathMatch: 'full' }

View File

@@ -33,10 +33,10 @@
<mat-option value="group">GROUPACCOUNT</mat-option>
</mat-select>
</mat-form-field>
<button mat-raised-button color="primary" routerLink="/accounts/create" type="button" class="btn btn-outline-primary ml-auto">
<mat-icon>add</mat-icon>
ADD NEW </button>
<button mat-raised-button color="primary" routerLink="/accounts/export" type="button" class="btn btn-outline-primary ml-2"> EXPORT </button>
<!-- <button mat-raised-button color="primary" routerLink="/accounts/create" type="button" class="btn btn-outline-primary ml-auto">-->
<!-- <mat-icon>add</mat-icon>-->
<!-- ADD NEW </button>-->
<button mat-raised-button color="primary" routerLink="/accounts/export" type="button" class="btn btn-outline-primary ml-auto"> EXPORT </button>
</div>
<div *ngIf="selection.selected.length" class="row card-header">
<p><strong> {{selection.selected.length}} selected </strong></p>