Store in GIT
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<!-- Trigger the modal with a button -->
|
||||
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#editModal"><i class="fa fa-pencil" aria-hidden="true"></i></button>
|
||||
|
||||
<!-- Modal -->
|
||||
<div id="editModal" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<form id="myForm" #editForm="ngForm" (ngSubmit)="onSubmit()">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Edit {{plmodel.name}}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="name">Name</label>
|
||||
<input type="text" class="form-control" id="name" required [(ngModel)]="plane.name" name="name" #name="ngModel" ngModel>
|
||||
<div [hidden]="name.valid || name.pristine" class="alert alert-danger">
|
||||
Name is required
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="registration">Registration</label>
|
||||
<input type="text" class="form-control" id="registration" required [(ngModel)]="plane.registration" name="registration" #registration="ngModel" ngModel>
|
||||
<div [hidden]="registration.valid || registration.pristine" class="alert alert-danger">
|
||||
Registration is required
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="model">Model</label>
|
||||
<input type="text" class="form-control" id="model" required [(ngModel)]="plane.model" name="model" #model="ngModel" ngModel>
|
||||
<div [hidden]="model.valid || model.pristine" class="alert alert-danger">
|
||||
Model is required
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="comment">Comment</label>
|
||||
<input type="text" class="form-control" id="comment" [(ngModel)]="plane.comment" name="comment" #comment="ngModel" ngModel>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-success" form="myForm" data-dismiss="modal" (click)="onSubmit()" [disabled]="!editForm.form.valid">Edit Plane</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,48 @@
|
||||
"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 plane_class_1 = require("../../../classes/plane.class");
|
||||
var data_service_1 = require("./../../../services/data.service");
|
||||
var EditPlaneFormComponent = (function () {
|
||||
function EditPlaneFormComponent(data) {
|
||||
this.data = data;
|
||||
this.submitted = false;
|
||||
}
|
||||
EditPlaneFormComponent.prototype.ngOnInit = function () {
|
||||
this.plane = new plane_class_1.Plane(this.plmodel.id, this.plmodel.name, this.plmodel.registration, this.plmodel.model, this.plmodel.comment);
|
||||
};
|
||||
EditPlaneFormComponent.prototype.onSubmit = function () {
|
||||
var _this = this;
|
||||
this.plmodel.name = this.plane.name;
|
||||
this.plmodel.registration = this.plane.registration;
|
||||
this.plmodel.model = this.plane.model;
|
||||
this.plmodel.comment = this.plmodel.comment;
|
||||
this.submitted = true;
|
||||
this.data.load().then(function () {
|
||||
_this.data.editPlane(_this.plmodel).subscribe(function (b) { return _this.temp = JSON.stringify(b); });
|
||||
console.log(_this.temp);
|
||||
});
|
||||
};
|
||||
return EditPlaneFormComponent;
|
||||
}());
|
||||
__decorate([
|
||||
core_1.Input(),
|
||||
__metadata("design:type", plane_class_1.Plane)
|
||||
], EditPlaneFormComponent.prototype, "plmodel", void 0);
|
||||
EditPlaneFormComponent = __decorate([
|
||||
core_1.Component({
|
||||
selector: 'edit-plane-form',
|
||||
templateUrl: './edit-plane-form.component.html'
|
||||
}),
|
||||
__metadata("design:paramtypes", [data_service_1.DataService])
|
||||
], EditPlaneFormComponent);
|
||||
exports.EditPlaneFormComponent = EditPlaneFormComponent;
|
||||
//# sourceMappingURL=edit-plane-form.component.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"edit-plane-form.component.js","sourceRoot":"","sources":["edit-plane-form.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAAwD;AACxD,4DAAmD;AACnD,iEAA6D;AAQ7D,IAAa,sBAAsB;IAMjC,gCAAoB,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;QAKrC,cAAS,GAAG,KAAK,CAAC;IAHlB,CAAC;IAKD,yCAAQ,GAAR;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,mBAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAClI,CAAC;IAED,yCAAQ,GAAR;QAAA,iBAWC;QAVC,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QACpC,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;QACpD,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QACtC,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QAE5C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;YACpB,KAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAI,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,UAAA,CAAC,IAAI,OAAA,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAA7B,CAA6B,CAAC,CAAC;YAChF,OAAO,CAAC,GAAG,CAAC,KAAI,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC,CAAA;IACJ,CAAC;IACH,6BAAC;AAAD,CAAC,AA7BD,IA6BC;AA3BS;IAAP,YAAK,EAAE;8BAAQ,mBAAK;uDAAC;AAFX,sBAAsB;IALlC,gBAAS,CAAC;QACT,QAAQ,EAAE,iBAAiB;QAC3B,WAAW,EAAE,kCAAkC;KAChD,CAAC;qCAQ0B,0BAAW;GAN1B,sBAAsB,CA6BlC;AA7BY,wDAAsB"}
|
||||
@@ -0,0 +1,40 @@
|
||||
import {Component, Input, OnInit } from '@angular/core';
|
||||
import {Plane} from "../../../classes/plane.class";
|
||||
import {DataService} from './../../../services/data.service';
|
||||
import {NgForm} from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'edit-plane-form',
|
||||
templateUrl: './edit-plane-form.component.html'
|
||||
})
|
||||
|
||||
export class EditPlaneFormComponent implements OnInit{
|
||||
|
||||
@Input()plmodel:Plane;
|
||||
|
||||
plane:Plane;
|
||||
|
||||
constructor(private data: DataService) {
|
||||
|
||||
}
|
||||
|
||||
temp: string;
|
||||
submitted = false;
|
||||
|
||||
ngOnInit(){
|
||||
this.plane = new Plane(this.plmodel.id, this.plmodel.name, this.plmodel.registration, this.plmodel.model, this.plmodel.comment);
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.plmodel.name = this.plane.name;
|
||||
this.plmodel.registration = this.plane.registration;
|
||||
this.plmodel.model = this.plane.model;
|
||||
this.plmodel.comment = this.plmodel.comment;
|
||||
|
||||
this.submitted = true;
|
||||
this.data.load().then(() => {
|
||||
this.data.editPlane(this.plmodel).subscribe(b => this.temp = JSON.stringify(b));
|
||||
console.log(this.temp);
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="page-header">
|
||||
<h1>F.R.A.U.D.S. <small>{{name}}</small> <small><div *ngIf=!loading class="pull-right"><edit-plane-form [plmodel]="plane"></edit-plane-form></div></small></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">
|
||||
<i class="fa fa-fw fa-plane"></i> <b>Name:</b> {{plane.name}}<br>
|
||||
<i class="fa fa-fw fa-file-text"></i> <b>Registration:</b> {{plane.registration}}<br>
|
||||
<i class="fa fa-fw fa-tag"></i> <b>Model:</b> {{plane.model}}<br>
|
||||
<i class="fa fa-fw fa-tag"></i> <b>Comment:</b> {{plane.comment}}<br>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,68 @@
|
||||
"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 IntervalObservable_1 = require("rxjs/observable/IntervalObservable");
|
||||
var plane_class_1 = require("./../../classes/plane.class");
|
||||
var router_1 = require("@angular/router");
|
||||
var PlaneComponent = (function () {
|
||||
function PlaneComponent(route, data) {
|
||||
this.route = route;
|
||||
this.data = data;
|
||||
this.loading = true;
|
||||
this.error = false;
|
||||
this.name = "Loading";
|
||||
this.id = 0;
|
||||
this.plane = new plane_class_1.Plane(0, "Loading", "Loading", "Loading", "Loading");
|
||||
}
|
||||
PlaneComponent.prototype.getPlane = function (id) {
|
||||
var _this = this;
|
||||
this.data.load().then(function () {
|
||||
_this.data
|
||||
.plane(id)
|
||||
.subscribe(function (b) {
|
||||
var status = b.status_code;
|
||||
if (status != 200 && b.data.length != 1) {
|
||||
_this.loading = false;
|
||||
_this.error = true;
|
||||
}
|
||||
else {
|
||||
_this.plane = plane_class_1.Plane.toPlane(b.data[0]);
|
||||
_this.name = _this.plane.name;
|
||||
_this.loading = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
PlaneComponent.prototype.ngOnInit = function () {
|
||||
var _this = this;
|
||||
this.id = this.route.snapshot.params['id'];
|
||||
this.getPlane(this.id);
|
||||
this.subscription = IntervalObservable_1.IntervalObservable.create(5000).subscribe(function () {
|
||||
console.log("Reloading data...");
|
||||
_this.getPlane(_this.id);
|
||||
});
|
||||
};
|
||||
PlaneComponent.prototype.ngOnDestroy = function () {
|
||||
this.subscription.unsubscribe();
|
||||
};
|
||||
return PlaneComponent;
|
||||
}());
|
||||
PlaneComponent = __decorate([
|
||||
core_1.Component({
|
||||
selector: 'app-plane',
|
||||
templateUrl: './plane.component.html',
|
||||
styleUrls: ['./plane.component.css']
|
||||
}),
|
||||
__metadata("design:paramtypes", [router_1.ActivatedRoute, data_service_1.DataService])
|
||||
], PlaneComponent);
|
||||
exports.PlaneComponent = PlaneComponent;
|
||||
//# sourceMappingURL=plane.component.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"plane.component.js","sourceRoot":"","sources":["plane.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAA6D;AAC7D,8DAA4D;AAC5D,yEAAwE;AAGxE,2DAAoD;AACpD,0CAAyD;AASzD,IAAa,cAAc;IAW1B,wBAAoB,KAAqB,EAAU,IAAgB;QAA/C,UAAK,GAAL,KAAK,CAAgB;QAAU,SAAI,GAAJ,IAAI,CAAY;QATnE,YAAO,GAAW,IAAI,CAAC;QACvB,UAAK,GAAW,KAAK,CAAC;QACtB,SAAI,GAAU,SAAS,CAAC;QACxB,OAAE,GAAU,CAAC,CAAC;QAEP,UAAK,GAAS,IAAI,mBAAK,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IAIT,CAAC;IAGtE,iCAAQ,GAAR,UAAS,EAAS;QAAlB,iBAsBC;QArBA,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;YACrB,KAAI,CAAC,IAAI;iBACH,KAAK,CAAC,EAAE,CAAC;iBACT,SAAS,CAAC,UAAA,CAAC;gBAEX,IAAI,MAAM,GAAG,CAAC,CAAC,WAAW,CAAC;gBAE3B,EAAE,CAAA,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,CACvC,CAAC;oBACA,KAAI,CAAC,OAAO,GAAG,KAAK,CAAC;oBACrB,KAAI,CAAC,KAAK,GAAG,IAAI,CAAC;gBACnB,CAAC;gBACD,IAAI,CAAA,CAAC;oBAEJ,KAAI,CAAC,KAAK,GAAG,mBAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBACtC,KAAI,CAAC,IAAI,GAAG,KAAI,CAAC,KAAK,CAAC,IAAI,CAAC;oBAC5B,KAAI,CAAC,OAAO,GAAG,KAAK,CAAC;gBACtB,CAAC;YAEF,CAAC,CAAC,CAAC;QACT,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,iCAAQ,GAAR;QAAA,iBASC;QARA,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAExC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEpB,IAAI,CAAC,YAAY,GAAG,uCAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;YAC7D,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;YAC9B,KAAI,CAAC,QAAQ,CAAC,KAAI,CAAC,EAAE,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACV,CAAC;IAED,oCAAW,GAAX;QACI,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC;IAEF,qBAAC;AAAD,CAAC,AArDD,IAqDC;AArDY,cAAc;IAN1B,gBAAS,CAAC;QACT,QAAQ,EAAE,WAAW;QACrB,WAAW,EAAE,wBAAwB;QACrC,SAAS,EAAE,CAAC,uBAAuB,CAAC;KACrC,CAAC;qCAa0B,uBAAc,EAAe,0BAAW;GAXvD,cAAc,CAqD1B;AArDY,wCAAc"}
|
||||
@@ -0,0 +1,69 @@
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { DataService } from './../../services/data.service';
|
||||
import { IntervalObservable } from 'rxjs/observable/IntervalObservable';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
|
||||
import { Plane } from "./../../classes/plane.class";
|
||||
import { Params, ActivatedRoute } from '@angular/router';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-plane',
|
||||
templateUrl: './plane.component.html',
|
||||
styleUrls: ['./plane.component.css']
|
||||
})
|
||||
|
||||
export class PlaneComponent implements OnInit, OnDestroy {
|
||||
|
||||
loading:boolean = true;
|
||||
error:boolean = false;
|
||||
name:string = "Loading";
|
||||
id:number = 0;
|
||||
|
||||
public plane:Plane = new Plane(0, "Loading", "Loading", "Loading", "Loading");
|
||||
|
||||
public subscription:Subscription;
|
||||
|
||||
constructor(private route: ActivatedRoute, private data:DataService){}
|
||||
|
||||
|
||||
getPlane(id:number): void {
|
||||
this.data.load().then(()=> {
|
||||
this.data
|
||||
.plane(id)
|
||||
.subscribe(b => {
|
||||
|
||||
var status = b.status_code;
|
||||
|
||||
if(status != 200 && b.data.length != 1)
|
||||
{
|
||||
this.loading = false;
|
||||
this.error = true;
|
||||
}
|
||||
else{
|
||||
|
||||
this.plane = Plane.toPlane(b.data[0]);
|
||||
this.name = this.plane.name;
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.id = this.route.snapshot.params['id'];
|
||||
|
||||
this.getPlane(this.id);
|
||||
|
||||
this.subscription = IntervalObservable.create(5000).subscribe(() => {
|
||||
console.log("Reloading data...");
|
||||
this.getPlane(this.id);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.subscription.unsubscribe();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user