Fix public folder api path; Add Army Overview
parent
e7c6379bf1
commit
efd9dde6aa
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
#Operation Pandora Trigger Commandcenter
|
||||||
|
|
||||||
|
_RESTful API using express.js and mongoose with mongodb + Angular4 Frontend_
|
||||||
|
|
||||||
|
|
||||||
|
##Installation
|
||||||
|
|
||||||
|
##Development
|
||||||
|
|
||||||
|
##License Information
|
|
@ -1,8 +0,0 @@
|
||||||
|
|
||||||
#Operation Pandora Trigger Commandcenter RESTful API
|
|
||||||
|
|
||||||
_node.js project using express.js and mongoose with mongodb_
|
|
||||||
|
|
||||||
|
|
||||||
##Installation
|
|
||||||
|
|
|
@ -35,8 +35,8 @@ mongoose.Promise = global.Promise;
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
// Middlewares *************************************************
|
// Middlewares *************************************************
|
||||||
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
|
app.use(favicon(path.join(__dirname + '/..', 'public', 'favicon.ico')));
|
||||||
app.use(express.static(path.join(__dirname, 'public')));
|
app.use(express.static(path.join(__dirname + '/..', 'public')));
|
||||||
app.use(bodyParser.json());
|
app.use(bodyParser.json());
|
||||||
|
|
||||||
// logging
|
// logging
|
||||||
|
@ -63,7 +63,7 @@ app.use(urls.command, apiAuthenticationMiddleware, commandRouter);
|
||||||
|
|
||||||
// send index.html on all different paths
|
// send index.html on all different paths
|
||||||
app.use(function (req, res) {
|
app.use(function (req, res) {
|
||||||
res.sendFile("public/index.html", {root: __dirname});
|
res.sendFile("public/index.html", {root: __dirname + '/..'});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name cc.noarch.de;
|
server_name cc.noarch.de;
|
||||||
return 302 https://$server_name$request_uri;
|
return 302 https://$server_name$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
server_name cc.noarch.de;
|
server_name cc.noarch.de;
|
||||||
|
|
||||||
ssl on;
|
ssl on;
|
||||||
ssl_certificate /etc/letsencrypt/live/noarch.de/fullchain.pem;
|
ssl_certificate /etc/letsencrypt/live/noarch.de/fullchain.pem;
|
||||||
ssl_certificate_key /etc/letsencrypt/live/noarch.de/privkey.pem;
|
ssl_certificate_key /etc/letsencrypt/live/noarch.de/privkey.pem;
|
||||||
ssl_session_timeout 5m;
|
ssl_session_timeout 5m;
|
||||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||||
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
|
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
|
||||||
ssl_prefer_server_ciphers on;
|
ssl_prefer_server_ciphers on;
|
||||||
ssl_session_cache shared:SSL:10m;
|
ssl_session_cache shared:SSL:10m;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
gzip off;
|
gzip off;
|
||||||
proxy_set_header X-Forwarded-Ssl on;
|
proxy_set_header X-Forwarded-Ssl on;
|
||||||
client_max_body_size 5M;
|
client_max_body_size 5M;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection "upgrade";
|
proxy_set_header Connection "upgrade";
|
||||||
proxy_set_header Host $http_host;
|
proxy_set_header Host $http_host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
proxy_set_header X-Frame-Options SAMEORIGIN;
|
proxy_set_header X-Frame-Options SAMEORIGIN;
|
||||||
proxy_pass http://localhost:8091;
|
proxy_pass http://localhost:8091;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
<div class="collapse navbar-collapse" id="mynavbar">
|
<div class="collapse navbar-collapse" id="mynavbar">
|
||||||
|
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
|
<li *ngIf="loginService.isLoggedIn()" routerLinkActive="active">
|
||||||
|
<a routerLink='/cc-overview' class="link">Armeeübersicht</a>
|
||||||
|
</li>
|
||||||
<li *ngIf="loginService.isLoggedIn()" routerLinkActive="active">
|
<li *ngIf="loginService.isLoggedIn()" routerLinkActive="active">
|
||||||
<a routerLink='/cc-users' class="link">Teilnehmer</a>
|
<a routerLink='/cc-users' class="link">Teilnehmer</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -27,9 +30,6 @@
|
||||||
<li *ngIf="loginService.isLoggedIn()" routerLinkActive="active">
|
<li *ngIf="loginService.isLoggedIn()" routerLinkActive="active">
|
||||||
<a routerLink='/cc-ranks' class="link">Ränge</a>
|
<a routerLink='/cc-ranks' class="link">Ränge</a>
|
||||||
</li>
|
</li>
|
||||||
<!--<li routerLinkActive="active">-->
|
|
||||||
<!--<a routerLink='/settings' class="link">Einstellungen</a>-->
|
|
||||||
<!--</li>-->
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul class="nav navbar-nav" style="float: right">
|
<ul class="nav navbar-nav" style="float: right">
|
||||||
|
|
|
@ -10,6 +10,7 @@ export class AppConfig {
|
||||||
public readonly apiRankPath = '/ranks/';
|
public readonly apiRankPath = '/ranks/';
|
||||||
public readonly apiSquadPath = '/squads/';
|
public readonly apiSquadPath = '/squads/';
|
||||||
public readonly apiUserPath = '/users/';
|
public readonly apiUserPath = '/users/';
|
||||||
|
public readonly apiOverviewPath = '/overview';
|
||||||
|
|
||||||
public getAuthenticationHeader() :Headers {
|
public getAuthenticationHeader() :Headers {
|
||||||
let currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
let currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
||||||
|
|
|
@ -25,6 +25,7 @@ import {AppConfig} from "./app.config";
|
||||||
import {LoginGuard} from "./login/login.guard";
|
import {LoginGuard} from "./login/login.guard";
|
||||||
import {AwardingService} from "./services/awarding-service/awarding.service";
|
import {AwardingService} from "./services/awarding-service/awarding.service";
|
||||||
import {HttpClient} from "./services/http-client";
|
import {HttpClient} from "./services/http-client";
|
||||||
|
import {ArmyService} from "./services/army-service/army.service";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [BrowserModule, FormsModule, ReactiveFormsModule, appRouting, HttpModule],
|
imports: [BrowserModule, FormsModule, ReactiveFormsModule, appRouting, HttpModule],
|
||||||
|
@ -32,6 +33,7 @@ import {HttpClient} from "./services/http-client";
|
||||||
HttpClient,
|
HttpClient,
|
||||||
LoginService,
|
LoginService,
|
||||||
LoginGuard,
|
LoginGuard,
|
||||||
|
ArmyService,
|
||||||
UserService,
|
UserService,
|
||||||
UserStore,
|
UserStore,
|
||||||
SquadService,
|
SquadService,
|
||||||
|
|
|
@ -6,10 +6,13 @@ import {usersRoutes, usersRoutingComponents} from "./users/users.routing";
|
||||||
import {squadsRoutes, squadsRoutingComponents} from "./squads/squads.routing";
|
import {squadsRoutes, squadsRoutingComponents} from "./squads/squads.routing";
|
||||||
import {decorationsRoutes, decorationsRoutingComponents} from "./decorations/decoration.routing";
|
import {decorationsRoutes, decorationsRoutingComponents} from "./decorations/decoration.routing";
|
||||||
import {ranksRoutes, ranksRoutingComponents} from "./ranks/ranks.routing";
|
import {ranksRoutes, ranksRoutingComponents} from "./ranks/ranks.routing";
|
||||||
|
import {ArmyComponent} from "./army/army.component";
|
||||||
|
|
||||||
|
|
||||||
export const appRoutes: Routes = [
|
export const appRoutes: Routes = [
|
||||||
|
|
||||||
|
{path: 'cc-overview', component: ArmyComponent},
|
||||||
|
|
||||||
{path: 'login', component: LoginComponent},
|
{path: 'login', component: LoginComponent},
|
||||||
{path: 'cc-users', children: usersRoutes, canActivate: [LoginGuard]},
|
{path: 'cc-users', children: usersRoutes, canActivate: [LoginGuard]},
|
||||||
{path: '', redirectTo: '/cc-users', pathMatch: 'full'},
|
{path: '', redirectTo: '/cc-users', pathMatch: 'full'},
|
||||||
|
@ -18,18 +21,14 @@ export const appRoutes: Routes = [
|
||||||
{path: 'cc-decorations', children: decorationsRoutes, canActivate: [LoginGuard]},
|
{path: 'cc-decorations', children: decorationsRoutes, canActivate: [LoginGuard]},
|
||||||
{path: 'cc-ranks', children: ranksRoutes, canActivate: [LoginGuard]},
|
{path: 'cc-ranks', children: ranksRoutes, canActivate: [LoginGuard]},
|
||||||
|
|
||||||
|
|
||||||
/** Redirect Konfigurationen **/
|
/** Redirect Konfigurationen **/
|
||||||
|
|
||||||
|
|
||||||
{path: '404', component: NotFoundComponent},
|
{path: '404', component: NotFoundComponent},
|
||||||
|
|
||||||
{path: '**', redirectTo: '/404'}, // immer als letztes konfigurieren - erste Route die matched wird angesteuert
|
{path: '**', redirectTo: '/404'}, // immer als letztes konfigurieren - erste Route die matched wird angesteuert
|
||||||
];
|
];
|
||||||
|
|
||||||
export const appRouting = RouterModule.forRoot(appRoutes);
|
export const appRouting = RouterModule.forRoot(appRoutes);
|
||||||
|
|
||||||
export const routingComponents = [LoginComponent, NotFoundComponent, ...usersRoutingComponents,
|
export const routingComponents = [LoginComponent, ArmyComponent, NotFoundComponent, ...usersRoutingComponents,
|
||||||
...squadsRoutingComponents, ...decorationsRoutingComponents, ...ranksRoutingComponents];
|
...squadsRoutingComponents, ...decorationsRoutingComponents, ...ranksRoutingComponents];
|
||||||
|
|
||||||
export const routingProviders = [LoginGuard];
|
export const routingProviders = [LoginGuard];
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
h1 {
|
||||||
|
width: 920px;
|
||||||
|
float: left;
|
||||||
|
margin-bottom: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
img{
|
||||||
|
margin-top: 10px;
|
||||||
|
padding-right: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.div-table {
|
||||||
|
display: table;
|
||||||
|
border-radius: 10px;
|
||||||
|
margin-left: 1%;
|
||||||
|
width: auto;
|
||||||
|
background-color: rgba(240, 248, 255, 0.29);
|
||||||
|
border-spacing: 5px; /* cellspacing:poor IE support for this */
|
||||||
|
}
|
||||||
|
|
||||||
|
.div-table-row {
|
||||||
|
display: table-row;
|
||||||
|
width: auto;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div-table-col {
|
||||||
|
float: left; /* fix for buggy browsers */
|
||||||
|
display: table-column;
|
||||||
|
padding: 5px 15px 5px 15px;
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
<h1>Übersicht über alle Spieler, Squads und Armeen</h1>
|
||||||
|
|
||||||
|
<div style="width: 1000px;">
|
||||||
|
|
||||||
|
<div class="div-table" style="width: 490px; float:left">
|
||||||
|
<h3 style="color: darkslateblue; font-weight: bolder; text-align: center;">NATO</h3>
|
||||||
|
<div *ngFor="let squad of army.NATO.squads">
|
||||||
|
<div class="div-table-row">
|
||||||
|
|
||||||
|
<div class="div-table-col">
|
||||||
|
<img src="resource/squad/{{squad._id}}.png">
|
||||||
|
</div>
|
||||||
|
<div class="div-table-col">
|
||||||
|
<div class=" div-table-row">
|
||||||
|
<h4>{{squad.name}}</h4>
|
||||||
|
</div>
|
||||||
|
<div class=" div-table-row">
|
||||||
|
<div *ngFor="let member of squad.members">
|
||||||
|
<div>{{member.rank}} {{member.username}}</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
Mitglieder: {{squad.memberCount}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<div style="padding-left: 80px">Armeemitglieder: {{army.NATO.memberCount}}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="div-table" style="width: 490px; float:right">
|
||||||
|
<h3 style="color: firebrick; font-weight: bolder; text-align: center">CSAT</h3>
|
||||||
|
<div *ngFor="let squad of army.CSAT.squads">
|
||||||
|
<div class="div-table-row">
|
||||||
|
|
||||||
|
<div class="div-table-col">
|
||||||
|
<img src="resource/squad/{{squad._id}}.png">
|
||||||
|
</div>
|
||||||
|
<div class="div-table-col">
|
||||||
|
<div class=" div-table-row">
|
||||||
|
<h4>{{squad.name}}</h4>
|
||||||
|
</div>
|
||||||
|
<div class=" div-table-row">
|
||||||
|
<div *ngFor="let member of squad.members">
|
||||||
|
<div>{{member.rank}} {{member.username}}</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
Mitglieder: {{squad.memberCount}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<div style="padding-left: 80px">Armeemitglieder: {{army.CSAT.memberCount}}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
|
@ -0,0 +1,26 @@
|
||||||
|
import {Component} from "@angular/core";
|
||||||
|
import {Army} from "../models/model-interfaces";
|
||||||
|
import {ArmyService} from "../services/army-service/army.service";
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'army',
|
||||||
|
templateUrl: './army.component.html',
|
||||||
|
styleUrls: ['./army.component.css']
|
||||||
|
})
|
||||||
|
export class ArmyComponent {
|
||||||
|
|
||||||
|
army: Army = {NATO: {squads: [], memberCount: 0}, CSAT: {squads: [], memberCount:0}};
|
||||||
|
|
||||||
|
constructor(private armyService: ArmyService) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.armyService.getArmy()
|
||||||
|
.subscribe(army => {
|
||||||
|
this.army = army;
|
||||||
|
console.log(army)
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
|
@ -39,6 +39,35 @@ export interface Decoration {
|
||||||
isMedal?: boolean;
|
isMedal?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface Army {
|
||||||
|
NATO: {
|
||||||
|
squads: {
|
||||||
|
_id,
|
||||||
|
name,
|
||||||
|
memberCount,
|
||||||
|
members: {
|
||||||
|
_id,
|
||||||
|
username,
|
||||||
|
rank
|
||||||
|
}[],
|
||||||
|
}[],
|
||||||
|
memberCount
|
||||||
|
},
|
||||||
|
CSAT: {
|
||||||
|
squads: {
|
||||||
|
_id,
|
||||||
|
name,
|
||||||
|
memberCount,
|
||||||
|
members: {
|
||||||
|
_id,
|
||||||
|
username,
|
||||||
|
rank
|
||||||
|
}[],
|
||||||
|
}[],
|
||||||
|
memberCount
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
export interface Tag {
|
export interface Tag {
|
||||||
label: string;
|
label: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
import {Injectable} from "@angular/core";
|
||||||
|
import {AppConfig} from "../../app.config";
|
||||||
|
import {Http} from "@angular/http";
|
||||||
|
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class ArmyService {
|
||||||
|
|
||||||
|
constructor(private http: Http,
|
||||||
|
private config: AppConfig) {
|
||||||
|
}
|
||||||
|
|
||||||
|
getArmy() {
|
||||||
|
return this.http.get(this.config.apiUrl + this.config.apiOverviewPath)
|
||||||
|
.map(res => res.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue