|
|
@ -69,13 +69,17 @@ export class BikesComponent {
|
|
|
|
if (this.data[0]) {
|
|
|
|
if (this.data[0]) {
|
|
|
|
this.displayedColumns = [];
|
|
|
|
this.displayedColumns = [];
|
|
|
|
this.dataColumns = [];
|
|
|
|
this.dataColumns = [];
|
|
|
|
|
|
|
|
|
|
|
|
this.addColumnsFromObject('', this.data[0]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (let index in this.data) {
|
|
|
|
for (let index in this.data) {
|
|
|
|
this.data[index] = flatten(this.data[index]);
|
|
|
|
this.data[index] = flatten(this.data[index]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const prop in this.data[0]) {
|
|
|
|
|
|
|
|
if (!this.blacklistedColumns.includes(prop) && !prop.includes("__")) {
|
|
|
|
|
|
|
|
this.dataColumns.push(prop);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//sort, so the displayedColumns array is in the same order as the columnInfo
|
|
|
|
//sort, so the displayedColumns array is in the same order as the columnInfo
|
|
|
|
this.dataColumns.sort((columnA, columnB) => {
|
|
|
|
this.dataColumns.sort((columnA, columnB) => {
|
|
|
|
const indexA = this.columnInfo.findIndex((c) => c.name == columnA);
|
|
|
|
const indexA = this.columnInfo.findIndex((c) => c.name == columnA);
|
|
|
@ -110,17 +114,6 @@ export class BikesComponent {
|
|
|
|
clearInterval(this.relockingInterval);
|
|
|
|
clearInterval(this.relockingInterval);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
addColumnsFromObject(prefix: string, object: Object) {
|
|
|
|
|
|
|
|
for (const prop in object) {
|
|
|
|
|
|
|
|
let propName = prefix + prop;
|
|
|
|
|
|
|
|
if (typeof object[prop] === 'object') {
|
|
|
|
|
|
|
|
this.addColumnsFromObject(prefix + prop + '.', object[prop]);
|
|
|
|
|
|
|
|
} else if (!this.blacklistedColumns.includes(propName)) {
|
|
|
|
|
|
|
|
this.dataColumns.push(propName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getHeader(propertyName: string) {
|
|
|
|
getHeader(propertyName: string) {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
this.columnInfo.find((column) => column.name === propertyName)?.header ||
|
|
|
|
this.columnInfo.find((column) => column.name === propertyName)?.header ||
|
|
|
|