Skip to content

Commit 45f0d84

Browse files
fix: multiple issues detected by Sentry
* fix: issues detected by Sentry * add additional tests in code * fix issue with invalid end of json * update version of chartjs --------- Co-authored-by: Antoine Hurard <[email protected]>
1 parent 1564923 commit 45f0d84

File tree

23 files changed

+41
-44
lines changed

23 files changed

+41
-44
lines changed

apps/back-office/src/app/application/pages/add-page/add-page.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ export class AddPageComponent
316316
private updateValues(data: GetFormsQueryResponse, loading: boolean) {
317317
this.cachedForms = updateQueryUniqueValues(
318318
this.cachedForms,
319-
data.forms.edges.map((x) => x.node),
319+
data.forms?.edges?.map((x) => x.node),
320320
'id'
321321
);
322322
this.forms.next(this.cachedForms);

apps/back-office/src/app/application/pages/workflow/components/add-step/add-step.component.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
ContentType,
1010
CONTENT_TYPES,
1111
Form,
12-
SafeAuthService,
1312
SafeUnsubscribeComponent,
1413
SafeWorkflowService,
1514
} from '@oort-front/safe';
@@ -64,18 +63,16 @@ export class AddStepComponent
6463
* @param formBuilder Angular form builder
6564
* @param dialog Dialog service
6665
* @param snackBar Shared snackbar service
67-
* @param authService Shared authentication service
6866
* @param apollo Apollo service
69-
* @param workflowServive Shared workflow service
67+
* @param workflowService Shared workflow service
7068
*/
7169
constructor(
7270
private route: ActivatedRoute,
7371
private formBuilder: UntypedFormBuilder,
7472
public dialog: Dialog,
7573
private snackBar: SnackbarService,
76-
private authService: SafeAuthService,
7774
private apollo: Apollo,
78-
private workflowServive: SafeWorkflowService
75+
private workflowService: SafeWorkflowService
7976
) {
8077
super();
8178
}
@@ -147,7 +144,7 @@ export class AddStepComponent
147144
* Submit form to workflow service
148145
*/
149146
onSubmit(): void {
150-
this.workflowServive.addStep(this.stepForm.value, this.route);
147+
this.workflowService.addStep(this.stepForm.value, this.route);
151148
}
152149

153150
/**
@@ -296,7 +293,7 @@ export class AddStepComponent
296293
private updateValues(data: GetFormsQueryResponse, loading: boolean) {
297294
this.cachedForms = updateQueryUniqueValues(
298295
this.cachedForms,
299-
data.forms.edges.map((x) => x.node)
296+
data.forms?.edges?.map((x) => x.node)
300297
);
301298
this.forms.next(this.cachedForms);
302299
this.pageInfo = data.forms.pageInfo;

apps/back-office/src/app/dashboard/pages/dashboard/dashboard.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export class DashboardComponent
222222
* @returns boolean of observable of boolean
223223
*/
224224
canDeactivate(): Observable<boolean> | boolean {
225-
if (!this.widgetGridComponent.canDeactivate) {
225+
if (this.widgetGridComponent && !this.widgetGridComponent?.canDeactivate) {
226226
const dialogRef = this.confirmService.openConfirmModal({
227227
title: this.translateService.instant('pages.dashboard.update.exit'),
228228
content: this.translateService.instant(

apps/back-office/src/app/dashboard/pages/form-builder/form-builder.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ export class FormBuilderComponent implements OnInit {
444444
formStructureChange(event: any): void {
445445
this.hasChanges = !isEqual(
446446
JSON.parse(event),
447-
JSON.parse(this.form?.structure || '')
447+
JSON.parse(this.form?.structure || '{}')
448448
);
449449
localStorage.setItem(`form:${this.id}`, event);
450450
this.authService.canLogout.next(!this.hasChanges);

apps/back-office/src/app/dashboard/pages/forms/forms.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ export class FormsComponent extends SafeUnsubscribeComponent implements OnInit {
328328
* @param loading Loading state
329329
*/
330330
private updateValues(data: GetFormsQueryResponse, loading: boolean): void {
331-
const mappedValues = data.forms.edges.map((x) => x.node);
331+
const mappedValues = data.forms?.edges?.map((x) => x.node);
332332
this.cachedForms = updateQueryUniqueValues(this.cachedForms, mappedValues);
333333
this.forms = mappedValues;
334334
this.pageInfo.length = data.forms.totalCount;

apps/back-office/src/app/dashboard/pages/resources/resources.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ export class ResourcesComponent
316316
* @param loading loading status
317317
*/
318318
updateValues(data: GetResourcesQueryResponse, loading: boolean) {
319-
const mappedValues = data.resources.edges.map((x) => x.node);
319+
const mappedValues = data.resources?.edges?.map((x) => x.node);
320320
this.cachedResources = updateQueryUniqueValues(
321321
this.cachedResources,
322322
mappedValues

apps/front-office/src/app/dashboard/pages/dashboard/dashboard.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export class DashboardComponent
150150
* @returns boolean of observable of boolean
151151
*/
152152
canDeactivate(): Observable<boolean> | boolean {
153-
if (!this.widgetGridComponent.canDeactivate) {
153+
if (this.widgetGridComponent && !this.widgetGridComponent?.canDeactivate) {
154154
const dialogRef = this.confirmService.openConfirmModal({
155155
title: this.translate.instant('pages.dashboard.update.exit'),
156156
content: this.translate.instant('pages.dashboard.update.exitMessage'),

libs/safe/src/lib/components/aggregation/aggregation-grid/aggregation-grid.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,15 @@ export class SafeAggregationGridComponent
145145
allGqlFields
146146
?.filter((x) => this.aggregation.sourceFields.includes(x.name))
147147
.map((field: any) => {
148-
if (field.type.kind !== 'SCALAR') {
148+
if (field.type?.kind !== 'SCALAR') {
149149
field.fields = this.queryBuilder
150150
.getFieldsFromType(
151-
field.type.kind === 'OBJECT'
151+
field.type?.kind === 'OBJECT'
152152
? field.type.name
153153
: field.type.ofType.name
154154
)
155155
.filter(
156-
(y) => y.type.name !== 'ID' && y.type.kind === 'SCALAR'
156+
(y) => y.type.name !== 'ID' && y.type?.kind === 'SCALAR'
157157
);
158158
}
159159
return field;

libs/safe/src/lib/components/application-dropdown/application-dropdown.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export class SafeApplicationDropdownComponent
145145
e.target.scrollHeight - (e.target.clientHeight + e.target.scrollTop) <
146146
50
147147
) {
148-
if (!this.loading && this.pageInfo.hasNextPage) {
148+
if (!this.loading && this.pageInfo?.hasNextPage) {
149149
this.loading = true;
150150
this.applicationsQuery
151151
.fetchMore({

libs/safe/src/lib/components/form-modal/form-modal.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ export class SafeFormModalComponent
167167
this.record = data.record;
168168
this.modifiedAt = this.isMultiEdition
169169
? null
170-
: this.record.modifiedAt || null;
170+
: this.record?.modifiedAt || null;
171171
if (!this.data.template) {
172-
this.form = this.record.form;
172+
this.form = this.record?.form;
173173
}
174174
})
175175
);

0 commit comments

Comments
 (0)