Store in GIT
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
.user, .plane {
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="page-header">
|
||||
<h1>F.R.A.U.D.S. <small>{{name}}</small> <span *ngIf=!loading><span *ngIf="flight.endtime == null"><button class="btn btn-danger pull-right" (click)="endFlight()"><i class="fa fa-plane" aria-hidden="true"></i> End flight</button></span></span></h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf=loading class="col-md-12">
|
||||
<span *ngIf=!error><i class="fa fa-circle-o-notch fa-spin fa-fw"></i> Loading....</span>
|
||||
<span *ngIf=error><i class="fa fa-cross fa-fw"></i> Error....</span>
|
||||
</div>
|
||||
|
||||
<div *ngIf=!loading class="col-md-12">
|
||||
|
||||
<b>Type:</b> {{flight.type}}<br>
|
||||
<span *ngIf="flight.comment"><b>Comment:</b> {{flight.comment}}<br></span>
|
||||
|
||||
<h3><i class="fa fa-clock-o"></i> Time</h3>
|
||||
<i class="fa fa-fw fa-caret-up"></i> <b>Takeoff: </b> {{flight.starttime | date:'yyyy-MM-dd HH:mm:ss'}}<br>
|
||||
<i class="fa fa-fw fa-caret-down"></i> <b>Touchdown:</b> {{flight.endtime | date:'yyyy-MM-dd HH:mm:ss'}}<br>
|
||||
|
||||
|
||||
<h3><i class="fa fa-plane"></i> Plane</h3>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4 col-sm-6 col-xs-12 plane">
|
||||
<div class="well well-sm" (click)="onClickPlane(flight.plane)">
|
||||
<h4><i class="fa fa-fw fa-plane"></i> {{flight.plane.name}}</h4>
|
||||
<i class="fa fa-fw fa-file-text"></i> {{flight.plane.registration}}<br>
|
||||
<i class="fa fa-fw fa-tag"></i> {{flight.plane.model}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<h3><i class="fa fa-user"></i> Users</h3>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div *ngFor="let user of flight.users" class="col-md-4 col-sm-6 col-xs-12 user">
|
||||
<div class="well well-sm" (click)="onClick(user)">
|
||||
<h4>{{user.name}}</h4>
|
||||
<i class="fa fa-fw fa-tag"></i> {{user.role}}<br>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,84 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var core_1 = require("@angular/core");
|
||||
var data_service_1 = require("./../../services/data.service");
|
||||
var router_1 = require("@angular/router");
|
||||
var IntervalObservable_1 = require("rxjs/observable/IntervalObservable");
|
||||
var flight_class_1 = require("./../../classes/flight.class");
|
||||
var FlightComponent = (function () {
|
||||
function FlightComponent(data, router, route) {
|
||||
this.data = data;
|
||||
this.router = router;
|
||||
this.route = route;
|
||||
this.loading = true;
|
||||
this.error = false;
|
||||
this.id = 0;
|
||||
this.flight = null;
|
||||
this.name = "Loading";
|
||||
}
|
||||
FlightComponent.prototype.getFlight = function (id) {
|
||||
var _this = this;
|
||||
this.data.load().then(function () {
|
||||
_this.data
|
||||
.flight(id)
|
||||
.subscribe(function (b) {
|
||||
var status = b.status_code;
|
||||
if (status != 200 && b.data.length != 1) {
|
||||
_this.loading = false;
|
||||
_this.error = true;
|
||||
}
|
||||
else {
|
||||
_this.flight = flight_class_1.Flight.toFlight(b.data[0]);
|
||||
_this.name = "Flight #" + _this.flight.id;
|
||||
_this.loading = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
FlightComponent.prototype.endFlight = function () {
|
||||
var _this = this;
|
||||
this.data.load().then(function () {
|
||||
_this.data.endFlight(_this.flight.id).subscribe(function (b) {
|
||||
console.log("flight ended");
|
||||
_this.flight.endtime = Date.now().toString();
|
||||
});
|
||||
});
|
||||
};
|
||||
FlightComponent.prototype.ngOnInit = function () {
|
||||
var _this = this;
|
||||
this.id = this.route.snapshot.params['id'];
|
||||
this.getFlight(this.id);
|
||||
this.subscription = IntervalObservable_1.IntervalObservable.create(5000).subscribe(function () {
|
||||
console.log("Reloading data...");
|
||||
_this.getFlight(_this.id);
|
||||
});
|
||||
};
|
||||
FlightComponent.prototype.ngOnDestroy = function () {
|
||||
this.subscription.unsubscribe();
|
||||
};
|
||||
FlightComponent.prototype.onClick = function (user) {
|
||||
this.router.navigate(['/user', user.id]);
|
||||
};
|
||||
FlightComponent.prototype.onClickPlane = function (plane) {
|
||||
this.router.navigate(['/plane', plane.id]);
|
||||
};
|
||||
return FlightComponent;
|
||||
}());
|
||||
FlightComponent = __decorate([
|
||||
core_1.Component({
|
||||
selector: 'app-flight',
|
||||
templateUrl: './flight.component.html',
|
||||
styleUrls: ['./flight.component.css']
|
||||
}),
|
||||
__metadata("design:paramtypes", [data_service_1.DataService, router_1.Router, router_1.ActivatedRoute])
|
||||
], FlightComponent);
|
||||
exports.FlightComponent = FlightComponent;
|
||||
//# sourceMappingURL=flight.component.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"flight.component.js","sourceRoot":"","sources":["flight.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAA6D;AAC7D,8DAA4D;AAC5D,0CAAmE;AACnE,yEAAwE;AAGxE,6DAAsD;AAUtD,IAAa,eAAe;IAY3B,yBAA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iB,uBAAc;GAZ/E,eAAe,CAqE3B;AArEY,0CAAe"}
|
||||
@@ -0,0 +1,86 @@
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { DataService } from './../../services/data.service';
|
||||
import { ActivatedRoute, Params, Router } from '@angular/router';
|
||||
import { IntervalObservable } from 'rxjs/observable/IntervalObservable';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
|
||||
import { Flight } from './../../classes/flight.class';
|
||||
import { User } from './../../classes/user.class';
|
||||
import { Plane } from './../../classes/plane.class';
|
||||
|
||||
@Component({
|
||||
selector: 'app-flight',
|
||||
templateUrl: './flight.component.html',
|
||||
styleUrls: ['./flight.component.css']
|
||||
})
|
||||
|
||||
export class FlightComponent implements OnInit, OnDestroy {
|
||||
|
||||
loading:boolean = true;
|
||||
error:boolean = false;
|
||||
|
||||
id:number = 0;
|
||||
|
||||
flight:Flight = null;
|
||||
name:string = "Loading";
|
||||
|
||||
public subscription:Subscription;
|
||||
|
||||
constructor(private data:DataService, private router: Router, private route: ActivatedRoute){}
|
||||
|
||||
getFlight(id:number): void {
|
||||
this.data.load().then(()=> {
|
||||
this.data
|
||||
.flight(id)
|
||||
.subscribe(b => {
|
||||
|
||||
var status = b.status_code;
|
||||
|
||||
if(status != 200 && b.data.length != 1)
|
||||
{
|
||||
this.loading = false;
|
||||
this.error = true;
|
||||
}
|
||||
else{
|
||||
this.flight = Flight.toFlight(b.data[0]);
|
||||
this.name = "Flight #" + this.flight.id;
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
endFlight():void {
|
||||
this.data.load().then(()=> {
|
||||
this.data.endFlight(this.flight.id).subscribe(b => {
|
||||
console.log("flight ended");
|
||||
this.flight.endtime = Date.now().toString();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.id = this.route.snapshot.params['id'];
|
||||
|
||||
this.getFlight(this.id);
|
||||
|
||||
this.subscription = IntervalObservable.create(5000).subscribe(() => {
|
||||
console.log("Reloading data...");
|
||||
this.getFlight(this.id);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.subscription.unsubscribe();
|
||||
}
|
||||
|
||||
onClick(user: User): void {
|
||||
this.router.navigate(['/user', user.id]);
|
||||
}
|
||||
|
||||
onClickPlane(plane: Plane): void {
|
||||
this.router.navigate(['/plane', plane.id]);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user