-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from nishchayp/frontend
Frontend
- Loading branch information
Showing
65 changed files
with
1,132 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 10 additions & 8 deletions
18
angular-src/src/app/admin/components/access-requests/access-requests.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<div class="data-item" *ngFor="let accessRequest of accessRequests; let i = index"> | ||
<div class="data">{{ accessRequest?.name }}</div> | ||
<div class="data">{{ accessRequest?.message }}</div> | ||
<div class="items-right"> | ||
<div class="view-btn" (click)="view(accessRequest, i)">View</div> | ||
<main> | ||
<div class="data-item" *ngFor="let accessRequest of accessRequests; let i = index"> | ||
<div class="data">{{ accessRequest?.name }}</div> | ||
<div class="data">{{ accessRequest?.message }}</div> | ||
<div class="items-right"> | ||
<div class="view-btn" (click)="view(accessRequest, i)">View</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="no-content" *ngIf="!!accessRequests && !accessRequests.length">Nothing to show</div> | ||
<div class="no-content" *ngIf="!accessRequests">Loading</div> | ||
<div class="no-content" *ngIf="!!accessRequests && !accessRequests.length">Nothing to show</div> | ||
<div class="no-content" *ngIf="!accessRequests">Loading</div> | ||
</main> |
18 changes: 10 additions & 8 deletions
18
angular-src/src/app/admin/components/accesses/accesses.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<div class="data-item" *ngFor="let access of accesses; let i = index"> | ||
<div class="data">{{ access.name }}</div> | ||
<div class="data">{{ access.ip }}</div> | ||
<div class="items-right"> | ||
<div class="view-btn" (click)="view(access, i)">View</div> | ||
<main> | ||
<div class="data-item" *ngFor="let access of accesses; let i = index"> | ||
<div class="data">{{ access.name }}</div> | ||
<div class="data">{{ access.ip }}</div> | ||
<div class="items-right"> | ||
<div class="view-btn" (click)="view(access, i)">View</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="no-content" *ngIf="!!accesses && !accesses.length">Nothing to show</div> | ||
<div class="no-content" *ngIf="!accesses">Loading</div> | ||
<div class="no-content" *ngIf="!!accesses && !accesses.length">Nothing to show</div> | ||
<div class="no-content" *ngIf="!accesses">Loading</div> | ||
</main> |
22 changes: 12 additions & 10 deletions
22
angular-src/src/app/admin/components/admin-requests/admin-requests.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
<div class="data-item" *ngFor="let adminRequest of adminRequests; let i = index"> | ||
<div class="data">{{ adminRequest.name }}</div> | ||
<div class="data">{{ adminRequest.email }}</div> | ||
<div class="items-right"> | ||
<div class="data-option-btn"> | ||
<button (click)="accept(adminRequest.admin_request_id, i)">Accept</button> | ||
<button (click)="reject(adminRequest.admin_request_id, i)">Reject</button> | ||
<main> | ||
<div class="data-item" *ngFor="let adminRequest of adminRequests; let i = index"> | ||
<div class="data">{{ adminRequest.name }}</div> | ||
<div class="data">{{ adminRequest.email }}</div> | ||
<div class="items-right"> | ||
<div class="data-option-btn"> | ||
<button (click)="accept(adminRequest.admin_request_id, i)">Accept</button> | ||
<button (click)="reject(adminRequest.admin_request_id, i)">Reject</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="no-content" *ngIf="!!adminRequests && !adminRequests.length">Nothing to show</div> | ||
<div class="no-content" *ngIf="!adminRequests">Loading</div> | ||
<div class="no-content" *ngIf="!!adminRequests && !adminRequests.length">Nothing to show</div> | ||
<div class="no-content" *ngIf="!adminRequests">Loading</div> | ||
</main> |
22 changes: 12 additions & 10 deletions
22
angular-src/src/app/admin/components/admins/admins.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
<div class="data-item" *ngFor="let admin of admins; let i = index"> | ||
<div class="data">{{ admin.name }}</div> | ||
<div class="data">{{ admin.email }}</div> | ||
<div class="items-right"> | ||
<div class="data-option-btn"> | ||
<button (click)="revoke(admin.admin_id, i)">Revoke</button> | ||
</div> | ||
<main> | ||
<div class="data-item" *ngFor="let admin of admins; let i = index"> | ||
<div class="data">{{ admin.name }}</div> | ||
<div class="data">{{ admin.email }}</div> | ||
<div class="items-right"> | ||
<div class="data-option-btn"> | ||
<button (click)="revoke(admin.admin_id, i)">Revoke</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="no-content" *ngIf="!!admins && !admins.length">Nothing to show</div> | ||
<div class="no-content" *ngIf="!admins">Loading</div> | ||
<div class="no-content" *ngIf="!!admins && !admins.length">Nothing to show</div> | ||
<div class="no-content" *ngIf="!admins">Loading</div> | ||
</main> |
2 changes: 1 addition & 1 deletion
2
angular-src/src/app/admin/components/heading/heading.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<div class="heading">{{ heading }}</div> | ||
<h2 class="heading">{{ heading }}</h2> |
5 changes: 5 additions & 0 deletions
5
angular-src/src/app/admin/components/indicator/indicator.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.indicator { | ||
background-color: #777; | ||
color: #fff; | ||
padding: 10px; | ||
} |
1 change: 1 addition & 0 deletions
1
angular-src/src/app/admin/components/indicator/indicator.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<div class="indicator" *ngIf="online === false">You are working offline</div> |
25 changes: 25 additions & 0 deletions
25
angular-src/src/app/admin/components/indicator/indicator.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { IndicatorComponent } from './indicator.component'; | ||
|
||
describe('IndicatorComponent', () => { | ||
let component: IndicatorComponent; | ||
let fixture: ComponentFixture<IndicatorComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ IndicatorComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(IndicatorComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
30 changes: 30 additions & 0 deletions
30
angular-src/src/app/admin/components/indicator/indicator.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
import { NetworkStatusService } from '../../services/network-status.service'; | ||
import { Subscription } from 'rxjs/Subscription'; | ||
|
||
@Component({ | ||
selector: 'admin-indicator', | ||
templateUrl: './indicator.component.html', | ||
styleUrls: ['./indicator.component.css'] | ||
}) | ||
export class IndicatorComponent implements OnInit { | ||
|
||
online: boolean; | ||
subscription: Subscription; | ||
|
||
constructor( | ||
private networkStatusService: NetworkStatusService | ||
) { } | ||
|
||
ngOnInit() { | ||
this.online = navigator.onLine; | ||
window.addEventListener('online', () => {this.networkStatusService.setStatus(true)}); | ||
window.addEventListener('offline', () => {this.networkStatusService.setStatus(false)}); | ||
this.subscription = this.networkStatusService.getStatus().subscribe(() => { | ||
this.online = this.networkStatusService.online; | ||
}); | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
angular-src/src/app/admin/components/navbar/navbar.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
<div [class.open]="navOpen" (click)="toggleNav()" id="burger-container"> | ||
<div [class.open]="navOpen" [class.burger-no-network]="online === false" (click)="toggleNav()" id="burger-container"> | ||
<div id="burger"> | ||
<span> </span> | ||
<span> </span> | ||
<span> </span> | ||
</div> | ||
</div> | ||
<nav [class.navClosed]="!navOpen" class="nav"> | ||
<div (click)="closeNav()" class="nav-links" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact: true}" [routerLink]="['/accesses']">Accesses</div> | ||
<div (click)="closeNav()" class="nav-links" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact: true}" [routerLink]="['/accessrequests']">Access Requests</div> | ||
<div (click)="closeNav()" class="nav-links" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact: true}" [routerLink]="['/admins']">Admins</div> | ||
<div (click)="closeNav()" class="nav-links" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact: true}" [routerLink]="['/adminrequests']">Admin Requests</div> | ||
<h2 (click)="closeNav()" class="nav-links" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact: true}" [routerLink]="['/accesses']">Accesses</h2> | ||
<h2 (click)="closeNav()" class="nav-links" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact: true}" [routerLink]="['/accessrequests']">Access Requests</h2> | ||
<h2 (click)="closeNav()" class="nav-links" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact: true}" [routerLink]="['/admins']">Admins</h2> | ||
<h2 (click)="closeNav()" class="nav-links" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact: true}" [routerLink]="['/adminrequests']">Admin Requests</h2> | ||
<div (click)="closeNav()" class="logout-container"> | ||
<div><a href="/"><i class="fa home-icon"></i></a></div> | ||
<div><a href="/logout" class="logout-button">Logout</a></div> | ||
<div><a href="/logout" class="logout-button" [class.disabled]="online === false">Logout</a></div> | ||
</div> | ||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
angular-src/src/app/admin/services/network-status.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { TestBed, inject } from '@angular/core/testing'; | ||
|
||
import { NetworkStatusService } from './network-status.service'; | ||
|
||
describe('NetworkStatusService', () => { | ||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
providers: [NetworkStatusService] | ||
}); | ||
}); | ||
|
||
it('should be created', inject([NetworkStatusService], (service: NetworkStatusService) => { | ||
expect(service).toBeTruthy(); | ||
})); | ||
}); |
26 changes: 26 additions & 0 deletions
26
angular-src/src/app/admin/services/network-status.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Observable } from 'rxjs'; | ||
import { Subject } from 'rxjs/Subject'; | ||
|
||
@Injectable() | ||
export class NetworkStatusService { | ||
|
||
online: boolean; | ||
private statusSubject = new Subject<any>(); | ||
|
||
constructor() { } | ||
|
||
setStatus(status) { | ||
this.online = status; | ||
this.sendStatus(); | ||
} | ||
|
||
private sendStatus() { | ||
this.statusSubject.next(); | ||
} | ||
|
||
getStatus(): Observable<any> { | ||
return this.statusSubject.asObservable(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
<app-indicator></app-indicator> | ||
<router-outlet></router-outlet> | ||
<app-snackbar></app-snackbar> |
Oops, something went wrong.