aus Iflight soll jetzt CFlightProxy werden
This commit is contained in:
15
.vscode/launch.json
vendored
Normal file
15
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
// Verwendet IntelliSense zum Ermitteln möglicher Attribute.
|
||||||
|
// Zeigen Sie auf vorhandene Attribute, um die zugehörigen Beschreibungen anzuzeigen.
|
||||||
|
// Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "chrome",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Launch Chrome against localhost",
|
||||||
|
"url": "http://localhost:3000",
|
||||||
|
"webRoot": "${workspaceFolder}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -113,15 +113,15 @@ export interface IFlights {
|
|||||||
|
|
||||||
// Stores the currently-being-typechecked object for error messages.
|
// Stores the currently-being-typechecked object for error messages.
|
||||||
let obj: any = null;
|
let obj: any = null;
|
||||||
export class IFlightsProxy {
|
export class CFlightsProxy {
|
||||||
public readonly success: boolean;
|
public readonly success: boolean;
|
||||||
public readonly message: string;
|
public readonly message: string;
|
||||||
public readonly meta: MetaProxy;
|
public readonly meta: MetaProxy;
|
||||||
public readonly data: IFlightProxy[] | null;
|
public readonly data: IFlightProxy[] | null;
|
||||||
public static Parse(d: string): IFlightsProxy {
|
public static Parse(d: string): CFlightsProxy {
|
||||||
return IFlightsProxy.Create(JSON.parse(d));
|
return CFlightsProxy.Create(JSON.parse(d));
|
||||||
}
|
}
|
||||||
public static Create(d: any, field: string = 'root'): IFlightsProxy {
|
public static Create(d: any, field: string = 'root'): CFlightsProxy {
|
||||||
if (!field) {
|
if (!field) {
|
||||||
obj = d;
|
obj = d;
|
||||||
field = "root";
|
field = "root";
|
||||||
@ -139,13 +139,13 @@ export class IFlightsProxy {
|
|||||||
checkArray(d.data, field + ".data");
|
checkArray(d.data, field + ".data");
|
||||||
if (d.data) {
|
if (d.data) {
|
||||||
for (let i = 0; i < d.data.length; i++) {
|
for (let i = 0; i < d.data.length; i++) {
|
||||||
d.data[i] = IFlightProxy.Create(d.data[i], field + ".data" + "[" + i + "]");
|
d.data[i] = CFlightProxy.Create(d.data[i], field + ".data" + "[" + i + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (d.data === undefined) {
|
if (d.data === undefined) {
|
||||||
d.data = null;
|
d.data = null;
|
||||||
}
|
}
|
||||||
return new IFlightsProxy(d);
|
return new CFlightsProxy(d);
|
||||||
}
|
}
|
||||||
private constructor(d: any) {
|
private constructor(d: any) {
|
||||||
this.success = d.success;
|
this.success = d.success;
|
||||||
@ -180,7 +180,7 @@ export class MetaProxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class IFlightProxy {
|
export class CFlightProxy {
|
||||||
public readonly IDFlight: string;
|
public readonly IDFlight: string;
|
||||||
public readonly FKGliderCategory: string;
|
public readonly FKGliderCategory: string;
|
||||||
public readonly Category: string;
|
public readonly Category: string;
|
||||||
@ -277,8 +277,8 @@ export class IFlightProxy {
|
|||||||
public readonly TC: string;
|
public readonly TC: string;
|
||||||
public readonly US: string;
|
public readonly US: string;
|
||||||
public readonly TS: string;
|
public readonly TS: string;
|
||||||
public static Parse(d: string): IFlightProxy {
|
public static Parse(d: string): CFlightProxy {
|
||||||
return IFlightProxy.Create(JSON.parse(d));
|
return CFlightProxy.Create(JSON.parse(d));
|
||||||
}
|
}
|
||||||
public static Create(d: any, field: string = 'root'): IFlightProxy {
|
public static Create(d: any, field: string = 'root'): IFlightProxy {
|
||||||
if (!field) {
|
if (!field) {
|
||||||
@ -466,7 +466,7 @@ export class IFlightProxy {
|
|||||||
checkString(d.TC, false, field + ".TC");
|
checkString(d.TC, false, field + ".TC");
|
||||||
checkString(d.US, false, field + ".US");
|
checkString(d.US, false, field + ".US");
|
||||||
checkString(d.TS, false, field + ".TS");
|
checkString(d.TS, false, field + ".TS");
|
||||||
return new IFlightProxy(d);
|
return new CFlightProxy(d);
|
||||||
}
|
}
|
||||||
private constructor(d: any) {
|
private constructor(d: any) {
|
||||||
this.IDFlight = d.IDFlight;
|
this.IDFlight = d.IDFlight;
|
||||||
|
|||||||
@ -21,8 +21,8 @@ function Meter2Km(key: string, row: any, data: string | null)
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function FlightsTable(flightdata: IFlight[])
|
//export default function FlightsTable(flightdata: IFlight[])
|
||||||
//export default function FlightsTable(flightdata: any)
|
export default function FlightsTable(flightdata: any)
|
||||||
{
|
{
|
||||||
const headers: THeader[] = [
|
const headers: THeader[] = [
|
||||||
{ key: "IDFlight", label: "ID", visible: false },
|
{ key: "IDFlight", label: "ID", visible: false },
|
||||||
|
|||||||
@ -65,12 +65,12 @@ export default function SortableTable<T>({ headers, dataTbl }:
|
|||||||
if (!sortKey) return tableData;
|
if (!sortKey) return tableData;
|
||||||
|
|
||||||
const order = reverse ? 'asc': 'desc';
|
const order = reverse ? 'asc': 'desc';
|
||||||
// const reval: T[] = orderBy(tableData, [sortKey], [order]);
|
//const reval: any = orderBy(tableData, [sortKey], [order]);
|
||||||
const reval: T[] = tableData;
|
const reval: any[] = tableData;
|
||||||
return reval;
|
return reval;
|
||||||
}
|
}
|
||||||
|
|
||||||
function TableTd({ item, row_item, data } : {item: THeader, row_item: T, data: string | null})
|
function TableTd({ item, key, row_item, data } : {item: THeader, key: number, row_item: T, data: string | null})
|
||||||
{
|
{
|
||||||
var val_complete: JSX.Element = <></>;
|
var val_complete: JSX.Element = <></>;
|
||||||
if(item.visible === undefined || item.visible === true)
|
if(item.visible === undefined || item.visible === true)
|
||||||
@ -81,31 +81,58 @@ export default function SortableTable<T>({ headers, dataTbl }:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val_complete = (<td>{data}</td>);
|
val_complete = (<td key={key}>{data}</td>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return val_complete;
|
return val_complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
function TableTr(
|
function TableTr(
|
||||||
{headers,row_item}:
|
{headers, key, row_item}:
|
||||||
{
|
{
|
||||||
headers: THeader[],
|
headers: THeader[],
|
||||||
|
key: number,
|
||||||
row_item: T
|
row_item: T
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
return(
|
return(
|
||||||
<tr>
|
<tr key={key}>
|
||||||
{
|
{
|
||||||
headers.map((h_item) =>
|
headers.map((h_item, key) =>
|
||||||
{
|
{
|
||||||
var c: any = row_item; // workaround TS2322 TS7053
|
var c: any = row_item; // workaround TS2322 TS7053
|
||||||
return ( <TableTd item={h_item} row_item={row_item} data={c[h_item.key]}></TableTd> );
|
return ( <TableTd item={h_item} key={key} row_item={row_item} data={c[h_item.key]}></TableTd> );
|
||||||
})}
|
})}
|
||||||
</tr>
|
</tr>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dummy()
|
||||||
|
{
|
||||||
|
var val_complete: JSX.Element = <></>;
|
||||||
|
var a = 2+2;
|
||||||
|
return val_complete;
|
||||||
|
}
|
||||||
|
|
||||||
|
function tableBody(headers: THeader[], tableDataSorted : T[])
|
||||||
|
{
|
||||||
|
var body: JSX.Element[] = [];
|
||||||
|
const helpArr = tableDataSorted.toArray();
|
||||||
|
for(var flight of tableDataSorted)
|
||||||
|
{
|
||||||
|
var index: number = tableDataSorted.indexOf(flight);
|
||||||
|
body.push(
|
||||||
|
<TableTr headers={headers} key={index} row_item = {flight} />
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return(
|
||||||
|
<tbody>
|
||||||
|
{body}
|
||||||
|
</tbody>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function tableHeader(headers: THeader[])
|
function tableHeader(headers: THeader[])
|
||||||
{
|
{
|
||||||
@ -144,14 +171,9 @@ export default function SortableTable<T>({ headers, dataTbl }:
|
|||||||
{tableHeader(headers)}
|
{tableHeader(headers)}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
{
|
||||||
<tbody>
|
tableBody( headers, sortedData )
|
||||||
{sortedData.map((row_item) => {
|
}
|
||||||
return (
|
|
||||||
<TableTr headers={headers} row_item = {row_item} />
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
</table>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es7",
|
"target": "ES2015",
|
||||||
"lib": [
|
"lib": [
|
||||||
"dom",
|
"dom",
|
||||||
"dom.iterable",
|
"dom.iterable",
|
||||||
@ -18,7 +18,7 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"jsx": "preserve"
|
"jsx": "react-jsx"
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src",
|
"src",
|
||||||
|
|||||||
Reference in New Issue
Block a user