From 735f1e465b98b5178a93e1df6d8303af73968928 Mon Sep 17 00:00:00 2001 From: Max Ehrlicher-Schmidt Date: Thu, 3 Dec 2020 20:58:43 +0100 Subject: [PATCH 1/6] Fix errors and warnings on login/logout --- src/app/app.component.ts | 2 +- .../sidenav-profile.component.html | 2 +- .../sidenav-profile.component.scss | 4 + src/app/pages/login/login.component.html | 77 ++++++++++--------- src/app/pages/login/login.component.scss | 5 +- 5 files changed, 51 insertions(+), 39 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 18cb82e..e12be28 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -63,8 +63,8 @@ export class AppComponent { } logout() { + this.navService.closeNav(); this.authService.logout().subscribe().add(() => this.router.navigate(['login'])); - this.sideNav.close(); } ngAfterViewInit() { diff --git a/src/app/components/sidenav-profile/sidenav-profile.component.html b/src/app/components/sidenav-profile/sidenav-profile.component.html index 275b3cd..0164f65 100644 --- a/src/app/components/sidenav-profile/sidenav-profile.component.html +++ b/src/app/components/sidenav-profile/sidenav-profile.component.html @@ -1,4 +1,4 @@ -
+

{{name}}

{{email}}

diff --git a/src/app/components/sidenav-profile/sidenav-profile.component.scss b/src/app/components/sidenav-profile/sidenav-profile.component.scss index 59bf5b8..d210ece 100644 --- a/src/app/components/sidenav-profile/sidenav-profile.component.scss +++ b/src/app/components/sidenav-profile/sidenav-profile.component.scss @@ -5,4 +5,8 @@ height:100px; border-radius:50%; margin-top:10px; +} + +.sidenav-profile { + outline: none; } \ No newline at end of file diff --git a/src/app/pages/login/login.component.html b/src/app/pages/login/login.component.html index 29f2c04..8487c7b 100644 --- a/src/app/pages/login/login.component.html +++ b/src/app/pages/login/login.component.html @@ -1,41 +1,46 @@ -
+

fLotte Login

- - E-Mail-Adresse eingeben - - - Bitte geben Sie eine E-Mail-Adresse ein. - - - Bitte geben Sie eine valide E-Mail-Adresse ein. - - +
+ + E-Mail-Adresse eingeben + + + Bitte geben Sie eine E-Mail-Adresse ein. + + + Bitte geben Sie eine valide E-Mail-Adresse ein. + + - - Passwort eingeben - - - Bitte geben Sie Ihr Passwort ein. - - - - - + + Passwort eingeben + + + Bitte geben Sie Ihr Passwort ein. + + + +
+ +
diff --git a/src/app/pages/login/login.component.scss b/src/app/pages/login/login.component.scss index 5e33d01..cf656e5 100644 --- a/src/app/pages/login/login.component.scss +++ b/src/app/pages/login/login.component.scss @@ -1,4 +1,7 @@ -#login-form { +#login-wrapper { + #login-form { + display: contents; + } display: flex; flex-direction: column; max-width: 32em; From 968d5e70dbda71ec2e9c78008f58f7e66a5d0479 Mon Sep 17 00:00:00 2001 From: Max Ehrlicher-Schmidt Date: Thu, 3 Dec 2020 21:09:15 +0100 Subject: [PATCH 2/6] Fix loggedIn prop in AuthService --- src/app/services/auth.service.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index a77a8ba..d53810f 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -13,8 +13,6 @@ export class AuthService { private currentUserSubject: BehaviorSubject; public currentUser: Observable; public loggedIn: BehaviorSubject; - private readonly REQUEST_TOKEN = 'requestToken'; - private readonly REFRESH_TOKEN = 'refreshToken'; private readonly CURRENT_USER = 'currentUser'; constructor(private http: HttpClient) { @@ -38,7 +36,7 @@ export class AuthService { } private checkIfUserIsLoggedIn(): void { - this.loggedIn.next(!!this.getRequestToken()); + this.loggedIn.next(!!localStorage.getItem(this.CURRENT_USER)); } public getRequestToken(): string { @@ -74,6 +72,7 @@ export class AuthService { finalize(() => { this.removeTokens(); this.checkIfUserIsLoggedIn(); + }) ); } From 756faac527ed17a80e18bc64839c29751ebab70c Mon Sep 17 00:00:00 2001 From: Driton Dauti Date: Thu, 3 Dec 2020 21:39:46 +0100 Subject: [PATCH 3/6] added unit tests for angular --- .../cell/cell.component.spec.ts | 137 +++++++++++++++++ .../date-range-cell.component.spec.ts | 50 +++++++ .../number-range-cell.component.spec.ts | 139 ++++++++++++++++++ 3 files changed, 326 insertions(+) create mode 100644 src/app/components/tableComponents/cell/cell.component.spec.ts create mode 100644 src/app/components/tableComponents/date-range-cell/date-range-cell.component.spec.ts create mode 100644 src/app/components/tableComponents/number-range-cell/number-range-cell.component.spec.ts diff --git a/src/app/components/tableComponents/cell/cell.component.spec.ts b/src/app/components/tableComponents/cell/cell.component.spec.ts new file mode 100644 index 0000000..fee8bb2 --- /dev/null +++ b/src/app/components/tableComponents/cell/cell.component.spec.ts @@ -0,0 +1,137 @@ +import {async, TestBed} from '@angular/core/testing'; +import {CellComponent} from './cell.component'; +import {DatePipe} from '@angular/common'; + +describe('CellComponent', () => { + let fixture, cell; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [CellComponent], + providers: [DatePipe] + }); + + fixture = TestBed.createComponent(CellComponent); + cell = fixture.componentInstance; + }); + + it('should accept value true', async(() => { + cell._value = true; + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell._value).toBe(true); + }); + })); + + + it('should set value true', async(() => { + cell.value = true; + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell._value).toBe(true); + }); + })); + + it('should return value false', async(() => { + cell._value = false; + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell.value).toBe(false); + }); + })); + + it('should accept editable true', async(() => { + cell._editable = true; + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell._editable).toBe(true); + }); + })); + + it('should set editable false', async(() => { + cell.editable = false; + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell._editable).toBe(false); + }); + })); + + it('should return editable false', async(() => { + cell._editable = false; + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell.editable).toBe(false); + }); + })); + + + it('should accept input type String', async(() => { + cell._inputType = 'String'; + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell._inputType).toBe('String'); + }); + })); + + it('should set input type String', async(() => { + cell.inputType = 'String'; + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell._inputType).toBe('String'); + }); + })); + + it('should return input type String', async(() => { + cell._inputType = 'String'; + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell.inputType).toBe('String'); + }); + })); + + + it('should accept required true', async(() => { + cell._required = true; + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell._required).toBe(true); + }); + })); + + it('should set required false', async(() => { + cell.required = false; + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell._required).toBe(false); + }); + })); + + it('should return required true', async(() => { + cell._required = true; + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell.required).toBe(true); + }); + })); + + it('should return html input type text', async(() => { + cell.getHtmlInputType('String'); + expect(cell.htmlInputType).toBe('text'); + })); + + it('should return html input type enum', async(() => { + cell.getHtmlInputType('Enum'); + expect(cell.htmlInputType).toBe('enum'); + })); + + it('should return html input type number', async(() => { + cell.getHtmlInputType('Int'); + expect(cell.htmlInputType).toBe('number'); + })); + + it('should return html input type boolean', async(() => { + cell.getHtmlInputType('Boolean'); + expect(cell.htmlInputType).toBe('boolean'); + })); + +}); diff --git a/src/app/components/tableComponents/date-range-cell/date-range-cell.component.spec.ts b/src/app/components/tableComponents/date-range-cell/date-range-cell.component.spec.ts new file mode 100644 index 0000000..ce6ec4c --- /dev/null +++ b/src/app/components/tableComponents/date-range-cell/date-range-cell.component.spec.ts @@ -0,0 +1,50 @@ +import {async, TestBed} from "@angular/core/testing"; +import {CellComponent} from "../cell/cell.component"; +import {DatePipe} from "@angular/common"; +import {DateRangeCellComponent} from "./date-range-cell.component"; + +describe('DateRangeCellComponent', () => { + let fixture, daterangecell; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [DateRangeCellComponent], + providers: [DatePipe] + }); + fixture = TestBed.createComponent(DateRangeCellComponent); + daterangecell = fixture.componentInstance; + }); + + it('should set from date value', async(() => { + let event = { + value: '2020-11-23' + }; + daterangecell.startDateChange(event); + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(daterangecell.from).toBe('2020-11-23'); + }); + })); + + it('should set to date value', async(() => { + let event = { + value: '2020-11-23' + }; + daterangecell.endDateChange(event); + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(daterangecell.to).toBe('2020-11-23'); + }); + })); + + it('should transform 23-Nov-2020 to 2020-11.23', async(() => { + + expect(daterangecell.transformDate('23-Nov-2020')).toBe('2020-11-23'); + })); + + it('should return 2020-11-23 as 23.11.2020 ', async(() => { + expect(daterangecell.toLocaleDate('2020-11-23')).toBe('23.11.2020'); + })); + + +}); diff --git a/src/app/components/tableComponents/number-range-cell/number-range-cell.component.spec.ts b/src/app/components/tableComponents/number-range-cell/number-range-cell.component.spec.ts new file mode 100644 index 0000000..0a42c72 --- /dev/null +++ b/src/app/components/tableComponents/number-range-cell/number-range-cell.component.spec.ts @@ -0,0 +1,139 @@ +import {async, TestBed} from '@angular/core/testing'; +import {DatePipe} from '@angular/common'; +import {NumberRangeCellComponent} from './number-range-cell.component'; +import {FormControl, FormGroup} from '@angular/forms'; + +describe('NumberRangeCellComponent', () => { + let fixture, cell; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [NumberRangeCellComponent], + providers: [DatePipe] + }); + + fixture = TestBed.createComponent(NumberRangeCellComponent); + cell = fixture.componentInstance; + }); + + it('should set minimum value as 0', async(() => { + cell.min = 0; + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell._min).toBe(0); + }); + })); + + it('should return minimum value 0', async(() => { + cell._min = 0; + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell.min).toBe(0); + }); + })); + + it('should set max value as 100', async(() => { + cell.max = 100; + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell._max).toBe(100); + }); + })); + + it('should return max value 100', async(() => { + cell._max = 100; + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell.max).toBe(100); + }); + })); + + it('should set editable true', async(() => { + cell.editable = true; + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell._editable).toBe(true); + }); + })); + + it('should change min value, from event with value -5, to 5', async(() => { + const targ = { + value: -5 + }; + const event = { + target: targ + }; + let rangeForm = new FormGroup({ + minValue: new FormControl(), + maxValue: new FormControl(), + }); + cell.rangeForm = rangeForm; + cell.minValueChange(event); + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell.min).toBe(5); + }); + })); + + + it('should change max value, from event with value -100, to 100', async(() => { + const targ = { + value: -100 + }; + const event = { + target: targ + }; + let rangeForm = new FormGroup({ + minValue: new FormControl(), + maxValue: new FormControl(), + }); + cell.rangeForm = rangeForm; + cell.maxValueChange(event); + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(cell.max).toBe(100); + }); + })); + + it('should set rangeError at check for invalid range of min 50 and max 10', async(() => { + let rangeForm = new FormGroup({ + minValue: new FormControl(), + maxValue: new FormControl(), + }); + cell.rangeForm = rangeForm; + cell.min = 50; + cell.max = 10; + cell.checkIfRangeIsValid(); + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(rangeForm.controls['minValue'].errors.rangeError).toBe(true); + expect(rangeForm.controls['maxValue'].errors.rangeError).toBe(true); + + }); + })); + + it('should set rangeError for parameter true', async(() => { + let rangeForm = new FormGroup({ + minValue: new FormControl(), + maxValue: new FormControl(), + }); + cell.rangeForm = rangeForm; + cell.setRangeError(true); + fixture.detectChanges(); + fixture.whenStable().then(() => { + expect(rangeForm.controls['minValue'].errors.rangeError).toBe(true); + expect(rangeForm.controls['maxValue'].errors.rangeError).toBe(true); + + }); + })); + + it('should return 5 from string -5', async(() => { + expect(cell.toPositiveNumber('-5')).toBe(5); + })); + + it('should return null from string "" ', async(() => { + expect(cell.toPositiveNumber('')).toBe(null); + })); + + +}); From faf13916ed6fce4bb234f4df3caf227c9abdc900 Mon Sep 17 00:00:00 2001 From: Max Ehrlicher-Schmidt Date: Thu, 3 Dec 2020 22:05:48 +0100 Subject: [PATCH 4/6] Fix getTypeInformationFromGQLSchema --- src/app/services/schema.service.ts | 14 ++++-- src/generated/graphql.schema.json | 76 +++++++++++------------------- src/generated/graphql.ts | 24 +++++----- 3 files changed, 50 insertions(+), 64 deletions(-) diff --git a/src/app/services/schema.service.ts b/src/app/services/schema.service.ts index 82d9159..33a6af3 100644 --- a/src/app/services/schema.service.ts +++ b/src/app/services/schema.service.ts @@ -6,7 +6,7 @@ import jsonSchema from 'src/generated/graphql.schema.json'; }) export class SchemaService { /** expects startingObject and variablePath and returns its type e.g. cargoBike, security.name -> returns the type of the name variable */ - getPropertyTypeFromSchema( + /*getPropertyTypeFromSchema( startingObjectName: string, variable: string ): string { @@ -38,7 +38,7 @@ export class SchemaService { variablePath.slice(1).join('.') ); } - } + }*/ getEnumValuesFromSchema(typeName: string): string[] { const types = jsonSchema.__schema.types; @@ -67,7 +67,7 @@ export class SchemaService { if (!field) { return { isPartOfType: false, type: '', isRequired: false }; } - const type = field.type.name || field.type.ofType.name; + const type = this.getTypeNameFromTypeObject(field.type); if (variablePath.length === 1) { const isRequired = field.type.kind === 'NON_NULL'; if ( @@ -94,6 +94,14 @@ export class SchemaService { } } + private getTypeNameFromTypeObject(typeObject: any) { + let object =typeObject; + while (object.name == null && object.ofType != null) { + object = object.ofType; + } + return object.name; + } + filterObject(graphQLTypeName: string, object: object): any { let filteredObject; if (Array.isArray(object)) { diff --git a/src/generated/graphql.schema.json b/src/generated/graphql.schema.json index ead9c42..d09e75b 100644 --- a/src/generated/graphql.schema.json +++ b/src/generated/graphql.schema.json @@ -75,9 +75,13 @@ "description": "see column A in info tabelle", "args": [], "type": { - "kind": "ENUM", - "name": "Group", - "ofType": null + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "Group", + "ofType": null + } }, "isDeprecated": false, "deprecationReason": null @@ -2374,33 +2378,21 @@ "deprecationReason": null }, { - "name": "start", + "name": "dateRange", "description": null, "args": [], "type": { "kind": "NON_NULL", "name": null, "ofType": { - "kind": "SCALAR", - "name": "Date", + "kind": "OBJECT", + "name": "DateRange", "ofType": null } }, "isDeprecated": false, "deprecationReason": null }, - { - "name": "end", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "Date", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "contactInformation", "description": null, @@ -2610,22 +2602,16 @@ "fields": null, "inputFields": [ { - "name": "start", + "name": "dateRange", "description": "if not set, CURRENT_DATE will be used", "type": { - "kind": "SCALAR", - "name": "Date", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "end", - "description": null, - "type": { - "kind": "SCALAR", - "name": "Date", - "ofType": null + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "DateRangeInput", + "ofType": null + } }, "defaultValue": null }, @@ -2745,21 +2731,11 @@ "defaultValue": null }, { - "name": "start", - "description": "if not set, CURRENT_DATE will be used", - "type": { - "kind": "SCALAR", - "name": "Date", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "end", + "name": "dateRange", "description": null, "type": { - "kind": "SCALAR", - "name": "Date", + "kind": "INPUT_OBJECT", + "name": "DateRangeInput", "ofType": null }, "defaultValue": null @@ -3769,9 +3745,13 @@ "name": "dateRange", "description": null, "type": { - "kind": "INPUT_OBJECT", - "name": "DateRangeInput", - "ofType": null + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "DateRangeInput", + "ofType": null + } }, "defaultValue": null }, diff --git a/src/generated/graphql.ts b/src/generated/graphql.ts index bf95c5d..16ecf26 100644 --- a/src/generated/graphql.ts +++ b/src/generated/graphql.ts @@ -39,7 +39,7 @@ export type CargoBike = { __typename?: 'CargoBike'; id: Scalars['ID']; /** see column A in info tabelle */ - group?: Maybe; + group: Group; name: Scalars['String']; state?: Maybe; modelName?: Maybe; @@ -406,8 +406,7 @@ export enum Group { export type Participant = { __typename?: 'Participant'; id: Scalars['ID']; - start: Scalars['Date']; - end?: Maybe; + dateRange: DateRange; contactInformation: ContactInformation; usernamefLotte?: Maybe; usernameSlack?: Maybe; @@ -432,8 +431,7 @@ export type Participant = { export type ParticipantCreateInput = { /** if not set, CURRENT_DATE will be used */ - start?: Maybe; - end?: Maybe; + dateRange: DateRangeInput; /** must create contactinformation first, if you want to use new */ contactInformationId: Scalars['ID']; usernamefLotte?: Maybe; @@ -448,9 +446,7 @@ export type ParticipantCreateInput = { export type ParticipantUpdateInput = { id: Scalars['ID']; - /** if not set, CURRENT_DATE will be used */ - start?: Maybe; - end?: Maybe; + dateRange?: Maybe; /** must create contactinformation first, if you want to use new */ contactInformationId?: Maybe; usernamefLotte?: Maybe; @@ -562,7 +558,7 @@ export type Engagement = { export type EngagementCreateInput = { engagementTypeId: Scalars['ID']; - dateRange?: Maybe; + dateRange: DateRangeInput; participantId: Scalars['ID']; cargoBikeId: Scalars['ID']; }; @@ -2014,7 +2010,7 @@ export type DeleteEquipmentTypeMutation = { __typename?: 'Mutation', deleteEquip export type AddressFieldsFragment = { __typename?: 'Address', street: string, number: string, zip: string }; -export type CargoBikeFieldsForTableFragment = { __typename?: 'CargoBike', id: string, group?: Maybe, name: string, modelName?: Maybe, state?: Maybe, numberOfChildren?: Maybe, numberOfWheels?: Maybe, forCargo?: Maybe, forChildren?: Maybe, stickerBikeNameState?: Maybe, note?: Maybe, isLocked: boolean, isLockedByMe: boolean, lockedBy?: Maybe, lockedUntil?: Maybe, insuranceData?: Maybe<{ __typename?: 'InsuranceData', billing?: Maybe, hasFixedRate?: Maybe, name?: Maybe, benefactor?: Maybe, noPnP?: Maybe, maintenanceResponsible?: Maybe, maintenanceBenefactor?: Maybe, maintenanceAgreement?: Maybe, fixedRate?: Maybe, projectAllowance?: Maybe, notes?: Maybe }>, dimensionsAndLoad?: Maybe<{ __typename?: 'DimensionsAndLoad', bikeLength?: Maybe, bikeWeight?: Maybe, bikeHeight?: Maybe, bikeWidth?: Maybe, hasCoverBox?: Maybe, lockable?: Maybe, maxWeightBox?: Maybe, maxWeightLuggageRack?: Maybe, maxWeightTotal?: Maybe, boxHeightRange?: Maybe<{ __typename?: 'NumRange', max?: Maybe, min?: Maybe }>, boxLengthRange?: Maybe<{ __typename?: 'NumRange', min?: Maybe, max?: Maybe }>, boxWidthRange?: Maybe<{ __typename?: 'NumRange', min?: Maybe, max?: Maybe }> }>, security?: Maybe<{ __typename?: 'Security', frameNumber?: Maybe, adfcCoding?: Maybe, keyNumberAXAChain?: Maybe, keyNumberFrameLock?: Maybe, policeCoding?: Maybe }>, technicalEquipment?: Maybe<{ __typename?: 'TechnicalEquipment', bicycleShift?: Maybe, isEBike?: Maybe, hasLightSystem?: Maybe, specialFeatures?: Maybe }>, taxes?: Maybe<{ __typename?: 'Taxes', costCenter?: Maybe, organisationArea?: Maybe }>, provider?: Maybe<( +export type CargoBikeFieldsForTableFragment = { __typename?: 'CargoBike', id: string, group: Group, name: string, modelName?: Maybe, state?: Maybe, numberOfChildren?: Maybe, numberOfWheels?: Maybe, forCargo?: Maybe, forChildren?: Maybe, stickerBikeNameState?: Maybe, note?: Maybe, isLocked: boolean, isLockedByMe: boolean, lockedBy?: Maybe, lockedUntil?: Maybe, insuranceData?: Maybe<{ __typename?: 'InsuranceData', billing?: Maybe, hasFixedRate?: Maybe, name?: Maybe, benefactor?: Maybe, noPnP?: Maybe, maintenanceResponsible?: Maybe, maintenanceBenefactor?: Maybe, maintenanceAgreement?: Maybe, fixedRate?: Maybe, projectAllowance?: Maybe, notes?: Maybe }>, dimensionsAndLoad?: Maybe<{ __typename?: 'DimensionsAndLoad', bikeLength?: Maybe, bikeWeight?: Maybe, bikeHeight?: Maybe, bikeWidth?: Maybe, hasCoverBox?: Maybe, lockable?: Maybe, maxWeightBox?: Maybe, maxWeightLuggageRack?: Maybe, maxWeightTotal?: Maybe, boxHeightRange?: Maybe<{ __typename?: 'NumRange', max?: Maybe, min?: Maybe }>, boxLengthRange?: Maybe<{ __typename?: 'NumRange', min?: Maybe, max?: Maybe }>, boxWidthRange?: Maybe<{ __typename?: 'NumRange', min?: Maybe, max?: Maybe }> }>, security?: Maybe<{ __typename?: 'Security', frameNumber?: Maybe, adfcCoding?: Maybe, keyNumberAXAChain?: Maybe, keyNumberFrameLock?: Maybe, policeCoding?: Maybe }>, technicalEquipment?: Maybe<{ __typename?: 'TechnicalEquipment', bicycleShift?: Maybe, isEBike?: Maybe, hasLightSystem?: Maybe, specialFeatures?: Maybe }>, taxes?: Maybe<{ __typename?: 'Taxes', costCenter?: Maybe, organisationArea?: Maybe }>, provider?: Maybe<( { __typename?: 'Provider' } & ProviderFieldsGeneralFragment )>, lendingStation?: Maybe<( @@ -2116,7 +2112,7 @@ export type OrganisationFieldsGeneralFragment = { __typename?: 'Organisation', i & AddressFieldsFragment )> }; -export type ParticipantFieldsForBikePageFragment = { __typename?: 'Participant', id: string, start: any, end?: Maybe, usernamefLotte?: Maybe, usernameSlack?: Maybe, isLocked: boolean, isLockedByMe: boolean, lockedBy?: Maybe, lockedUntil?: Maybe, contactInformation: ( +export type ParticipantFieldsForBikePageFragment = { __typename?: 'Participant', id: string, usernamefLotte?: Maybe, usernameSlack?: Maybe, isLocked: boolean, isLockedByMe: boolean, lockedBy?: Maybe, lockedUntil?: Maybe, dateRange: { __typename?: 'DateRange', from: any, to?: Maybe }, contactInformation: ( { __typename?: 'ContactInformation' } & ContactInformationFieldsGeneralFragment ) }; @@ -2457,8 +2453,10 @@ export const ContactInformationFieldsGeneralFragmentDoc = gql` export const ParticipantFieldsForBikePageFragmentDoc = gql` fragment ParticipantFieldsForBikePage on Participant { id - start - end + dateRange { + from + to + } usernamefLotte usernameSlack contactInformation { From d7c332a501e74d5c1cd08acd59488d1cb0acec55 Mon Sep 17 00:00:00 2001 From: Max Ehrlicher-Schmidt Date: Thu, 3 Dec 2020 22:06:37 +0100 Subject: [PATCH 5/6] Add timeFrames to lendingStation page --- .../fragments/participant.graphql | 6 ++-- .../pages/dataPages/bike/bike.component.ts | 10 ++++-- .../lending-station.component.ts | 32 +++---------------- 3 files changed, 16 insertions(+), 32 deletions(-) diff --git a/src/app/graphqlOperations/fragments/participant.graphql b/src/app/graphqlOperations/fragments/participant.graphql index 2d9fc72..d82450d 100644 --- a/src/app/graphqlOperations/fragments/participant.graphql +++ b/src/app/graphqlOperations/fragments/participant.graphql @@ -1,7 +1,9 @@ fragment ParticipantFieldsForBikePage on Participant { id - start - end + dateRange { + from + to + } usernamefLotte usernameSlack contactInformation { diff --git a/src/app/pages/dataPages/bike/bike.component.ts b/src/app/pages/dataPages/bike/bike.component.ts index a9eda96..8ed87ea 100644 --- a/src/app/pages/dataPages/bike/bike.component.ts +++ b/src/app/pages/dataPages/bike/bike.component.ts @@ -226,10 +226,14 @@ export class BikeComponent implements OnInit { dataService: null, columnInfo: [ { dataPath: 'dateRange', translation: 'Zeitraum' }, - { dataPath: 'lendingStation.name', translation: 'Standort' }, + { + dataPath: 'lendingStation.name', + translation: 'Standort', + link: (row) => '/lendingStation/' + row["lendingStation.id"], + }, ], editableReferences: false, - linkToTable: (element) => '/table/timeFrames', + linkToTable: () => '/table/timeFrames', linkToTableParams: (bike) => { return { filter: bike.name }; }, @@ -237,7 +241,7 @@ export class BikeComponent implements OnInit { ]; headlineDataPath = 'name'; - headlineIconName = 'directions_bike' + headlineIconName = 'directions_bike'; pageDataGQLType: string = 'CargoBike'; pageDataGQLUpdateInputType: string = 'CargoBikeUpdateInput'; diff --git a/src/app/pages/dataPages/lending-station/lending-station.component.ts b/src/app/pages/dataPages/lending-station/lending-station.component.ts index b689c97..b2d6f76 100644 --- a/src/app/pages/dataPages/lending-station/lending-station.component.ts +++ b/src/app/pages/dataPages/lending-station/lending-station.component.ts @@ -115,26 +115,6 @@ export class LendingStationComponent implements OnInit { { dataPath: 'contactInformationExtern.note', translation: 'Anmerkung' }, ], }, - /* - { - type: 'ReferenceTable', - title: 'Equipment', - dataPath: 'equipment', - dataService: null, - columnInfo: [ - { dataPath: 'serialNo', translation: 'Seriennummer' }, - { dataPath: 'title', translation: 'Name' }, - { dataPath: 'description', translation: 'Beschreibung' }, - ], - nameToShowInSelection: (element) => { - return element.title + ' (' + element.serialNo + ')'; - }, - linkToTable: (element) => '/table/equipment', - linkToTableParams: (lendingStation) => { - return { filter: lendingStation.name }; - }, - propertyNameOfUpdateInput: 'equipmentIds', - }, { type: 'ReferenceTable', title: 'Zeitscheiben', @@ -142,14 +122,15 @@ export class LendingStationComponent implements OnInit { dataService: null, columnInfo: [ { dataPath: 'dateRange', translation: 'Zeitraum' }, - { dataPath: 'lendingStation.name', translation: 'Standort' }, + { dataPath: 'cargoBike.name', translation: 'Lastenrad', + link: (row) => '/bike/' + row["cargoBike.id"], }, ], editableReferences: false, - linkToTable: (element) => '/table/timeFrames', + linkToTable: () => '/table/timeFrames', linkToTableParams: (lendingStation) => { return { filter: lendingStation.name }; }, - },*/ + }, ]; headlineDataPath = 'name'; @@ -161,11 +142,8 @@ export class LendingStationComponent implements OnInit { constructor( private lendingStationsService: LendingStationsService, - private contactInformationService: ContactInformationService + private contactInformationService: ContactInformationService, ) { - /*this.propertiesInfo.find( - (prop) => prop.dataPath === 'equipmentType' - ).dataService = this.equipmentTypeService;*/ this.contactInformationService.loadTableData(); this.contactInformationService.tableData.subscribe((data) => { this.propertiesInfo.find( From 3f4a01e2a683ff806ab983ab496df7f49906d4d9 Mon Sep 17 00:00:00 2001 From: Max Ehrlicher-Schmidt Date: Thu, 3 Dec 2020 22:13:13 +0100 Subject: [PATCH 6/6] Add note to contactInformation select --- .../lending-station.component.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/app/pages/dataPages/lending-station/lending-station.component.ts b/src/app/pages/dataPages/lending-station/lending-station.component.ts index b2d6f76..3ecb516 100644 --- a/src/app/pages/dataPages/lending-station/lending-station.component.ts +++ b/src/app/pages/dataPages/lending-station/lending-station.component.ts @@ -43,7 +43,9 @@ export class LendingStationComponent implements OnInit { ' ' + contact.email + ' ' + - contact.phone + contact.phone + + ' ' + + contact.note ); }, propertyPrefixToOverwrite: 'contactInformationIntern', @@ -85,7 +87,9 @@ export class LendingStationComponent implements OnInit { ' ' + contact.email + ' ' + - contact.phone + contact.phone + + ' ' + + contact.note ); }, propertyPrefixToOverwrite: 'contactInformationExtern', @@ -122,8 +126,11 @@ export class LendingStationComponent implements OnInit { dataService: null, columnInfo: [ { dataPath: 'dateRange', translation: 'Zeitraum' }, - { dataPath: 'cargoBike.name', translation: 'Lastenrad', - link: (row) => '/bike/' + row["cargoBike.id"], }, + { + dataPath: 'cargoBike.name', + translation: 'Lastenrad', + link: (row) => '/bike/' + row['cargoBike.id'], + }, ], editableReferences: false, linkToTable: () => '/table/timeFrames', @@ -142,7 +149,7 @@ export class LendingStationComponent implements OnInit { constructor( private lendingStationsService: LendingStationsService, - private contactInformationService: ContactInformationService, + private contactInformationService: ContactInformationService ) { this.contactInformationService.loadTableData(); this.contactInformationService.tableData.subscribe((data) => {