From 6e75f3c9ce8e7cba8934d9cefe1258a043efdf3b Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Thu, 10 Oct 2019 15:38:17 +0200
Subject: [PATCH] FEAT #11271 TIME 0:05 fix if no model

---
 src/frontend/app/indexation/indexation.component.ts  | 11 +++++++----
 src/frontend/app/viewer/document-viewer.component.ts |  1 +
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/frontend/app/indexation/indexation.component.ts b/src/frontend/app/indexation/indexation.component.ts
index 410da1f210b..d47c9b8646e 100644
--- a/src/frontend/app/indexation/indexation.component.ts
+++ b/src/frontend/app/indexation/indexation.component.ts
@@ -65,11 +65,14 @@ export class IndexationComponent implements OnInit {
             this.http.get("../../rest/indexingModels").pipe(
                 tap((data: any) => {
                     this.indexingModels = data.indexingModels;
-                    this.currentIndexingModel = this.indexingModels.filter(model => model.default === true)[0];
-                    if (this.currentIndexingModel === undefined) {
-                        this.currentIndexingModel = this.indexingModels[0];
-                        this.notify.error(this.lang.noDefaultIndexingModel);
+                    if(this.indexingModels.length > 0) {
+                        this.currentIndexingModel = this.indexingModels.filter(model => model.default === true)[0];
+                        if (this.currentIndexingModel === undefined) {
+                            this.currentIndexingModel = this.indexingModels[0];
+                            this.notify.error(this.lang.noDefaultIndexingModel);
+                        }
                     }
+                    
                     if (this.appService.getViewMode()) {
                         setTimeout(() => {
                             this.sidenavLeft.open();
diff --git a/src/frontend/app/viewer/document-viewer.component.ts b/src/frontend/app/viewer/document-viewer.component.ts
index 240e41e8ed6..aeba12b19bf 100644
--- a/src/frontend/app/viewer/document-viewer.component.ts
+++ b/src/frontend/app/viewer/document-viewer.component.ts
@@ -18,6 +18,7 @@ import { PDFProgressData } from 'ng2-pdf-viewer';
     templateUrl: "document-viewer.component.html",
     styleUrls: [
         'document-viewer.component.scss',
+        '../indexation/indexing-form/indexing-form.component.scss',
     ],
     providers: [NotificationService, AppService, SortPipe]
 })
-- 
GitLab