From 65bc305649ec79fd9e7f3780ff82a999963533eb Mon Sep 17 00:00:00 2001 From: Max Ehrlicher-Schmidt Date: Mon, 16 Nov 2020 09:33:21 +0100 Subject: [PATCH] Fix Int --- .../tableComponents/cell/cell.component.html | 8 +++--- .../tableComponents/cell/cell.component.ts | 26 ++++++++++++++++--- src/app/graphqlOperations/bikes.graphql | 2 +- src/generated/graphql.schema.json | 1 - src/generated/graphql.ts | 2 +- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/app/components/tableComponents/cell/cell.component.html b/src/app/components/tableComponents/cell/cell.component.html index 6b65664..9560b20 100644 --- a/src/app/components/tableComponents/cell/cell.component.html +++ b/src/app/components/tableComponents/cell/cell.component.html @@ -1,4 +1,4 @@ -
+
-
+
@@ -20,11 +20,11 @@
-
+
diff --git a/src/app/components/tableComponents/cell/cell.component.ts b/src/app/components/tableComponents/cell/cell.component.ts index 475b000..7b09c47 100644 --- a/src/app/components/tableComponents/cell/cell.component.ts +++ b/src/app/components/tableComponents/cell/cell.component.ts @@ -1,4 +1,10 @@ -import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy } from '@angular/core'; +import { + Component, + Input, + Output, + EventEmitter, + ChangeDetectionStrategy, +} from '@angular/core'; @Component({ selector: 'app-cell', @@ -16,18 +22,30 @@ export class CellComponent { enumValues = []; + htmlInputType: string = 'string'; + ngOnChanges() { + this.getHtmlInputType(this.inputType); + } + + getHtmlInputType(type: string) { if (this.inputType.split('//')[0] === 'Enum') { this.enumValues = this.inputType.split('//').slice(1); + this.htmlInputType = 'enum'; } else if (this.inputType === 'Int' || this.inputType === 'Float') { - this.inputType = 'number'; + this.htmlInputType = 'number'; } else if (this.inputType === 'ID' || this.inputType === 'String') { - this.inputType = 'text'; + this.htmlInputType = 'text'; + } else if (this.inputType === 'Boolean') { + this.htmlInputType = 'boolean'; } } change(newValue) { - this.value = this.inputType === 'number' ? +newValue : newValue; + if (this.inputType === "Int") { + newValue = newValue.toString().replace('.', ''); + } + this.value = this.htmlInputType === 'number' ? +newValue : newValue; this.valueChange.emit(this.value); } } diff --git a/src/app/graphqlOperations/bikes.graphql b/src/app/graphqlOperations/bikes.graphql index 05b0c3b..eff799c 100644 --- a/src/app/graphqlOperations/bikes.graphql +++ b/src/app/graphqlOperations/bikes.graphql @@ -1,5 +1,5 @@ query GetCargoBikes { - cargoBikes(limit: 100, offset: 0) { + cargoBikes(limit: 1000, offset: 0) { ...CargoBikeFields } } diff --git a/src/generated/graphql.schema.json b/src/generated/graphql.schema.json index 66a8651..d623fb0 100644 --- a/src/generated/graphql.schema.json +++ b/src/generated/graphql.schema.json @@ -1,6 +1,5 @@ { "__schema": { - "description": null, "queryType": { "name": "Query" }, diff --git a/src/generated/graphql.ts b/src/generated/graphql.ts index 15bd29f..c976396 100644 --- a/src/generated/graphql.ts +++ b/src/generated/graphql.ts @@ -2022,7 +2022,7 @@ export const UnlockCargoBikeDocument = gql` } export const GetCargoBikesDocument = gql` query GetCargoBikes { - cargoBikes(limit: 100, offset: 0) { + cargoBikes(limit: 1000, offset: 0) { ...CargoBikeFields } }