diff --git a/shanoir-ng-front/src/app/app.module.ts b/shanoir-ng-front/src/app/app.module.ts index a20b71e4ef..94aca5d40c 100644 --- a/shanoir-ng-front/src/app/app.module.ts +++ b/shanoir-ng-front/src/app/app.module.ts @@ -275,6 +275,7 @@ import { TreeService } from './studies/study/tree.service'; import { CoilNodeComponent } from './coils/coil/tree/coil-node.component'; import { DoubleAwesomeComponent } from './shared/double-awesome/double-awesome.component'; import { MetadataNodeComponent } from './datasets/tree/metadata-node.component'; +import { SizePipe } from './shared/utils/size.pipe'; @NgModule({ declarations: [ @@ -453,7 +454,8 @@ import { MetadataNodeComponent } from './datasets/tree/metadata-node.component'; StudyTreeComponent, CoilNodeComponent, DoubleAwesomeComponent, - MetadataNodeComponent + MetadataNodeComponent, + SizePipe ], bootstrap: [AppComponent], imports: [ diff --git a/shanoir-ng-front/src/app/async-tasks/task.model.ts b/shanoir-ng-front/src/app/async-tasks/task.model.ts index 9e5183e6fc..a0c75af480 100644 --- a/shanoir-ng-front/src/app/async-tasks/task.model.ts +++ b/shanoir-ng-front/src/app/async-tasks/task.model.ts @@ -53,6 +53,7 @@ export class Task extends Entity { hasReport: boolean; sessionId: string; _idAsString: string; + hideFromMenu: boolean; private readonly FIELDS: string[] = ['id', 'creationDate', 'lastUpdate','_status','_message', '_progress', '_eventType', 'eventLabel', 'objectId', 'route', 'report', 'sessionId', '_idAsString']; set eventType(eventType: string) { @@ -138,7 +139,7 @@ export class Task extends Entity { return true; } - updateWith(task: Task) { + updateWith(task: Task): Task { if (task.status != undefined) this.status = task.status; if (task.progress != undefined) this.progress = task.progress; if (task.lastUpdate) this.lastUpdate = task.lastUpdate; @@ -146,6 +147,14 @@ export class Task extends Entity { if (task.report) this.report = task.report; if (task.message) this.message = task.message; if (task.idAsString) this.idAsString = task.idAsString; + if (task.hideFromMenu != undefined) this.hideFromMenu = task.hideFromMenu; + if (task.sessionId) this.sessionId = task.sessionId; + if (task.eventLabel) this.eventLabel = task.eventLabel; + if (task.debugTs) this.debugTs = task.debugTs; + if (task.objectId) this.objectId = task.objectId; + if (task.route) this.route = task.route; + if (task.hasReport != undefined) this.hasReport = task.hasReport; + return this; } } diff --git a/shanoir-ng-front/src/app/examinations/tree/examination-node.component.html b/shanoir-ng-front/src/app/examinations/tree/examination-node.component.html index abe5ed3a31..f46e6c5bd8 100644 --- a/shanoir-ng-front/src/app/examinations/tree/examination-node.component.html +++ b/shanoir-ng-front/src/app/examinations/tree/examination-node.component.html @@ -28,6 +28,7 @@ (chkbxChange)="selectedChange.emit()" (firstOpen)="firstOpen()" [hasChildren]="hasChildren()" + [dataLoading]="loading" [title]="node.title + ' n°' + node.id"> diff --git a/shanoir-ng-front/src/app/preclinical/anesthetics/anesthetic/edit/anesthetic-form.component.ts b/shanoir-ng-front/src/app/preclinical/anesthetics/anesthetic/edit/anesthetic-form.component.ts index a671f2c7a3..cbdd523014 100644 --- a/shanoir-ng-front/src/app/preclinical/anesthetics/anesthetic/edit/anesthetic-form.component.ts +++ b/shanoir-ng-front/src/app/preclinical/anesthetics/anesthetic/edit/anesthetic-form.component.ts @@ -41,7 +41,6 @@ import { Option } from '../../../../shared/select/select.component'; selector: 'anesthetic-form', templateUrl: 'anesthetic-form.component.html', styleUrls: ['anesthetic-form.component.css'], - providers: [AnestheticService, AnestheticIngredientService], animations: [slideDown], standalone: false }) diff --git a/shanoir-ng-front/src/app/preclinical/anesthetics/anesthetic/list/anesthetic-list.component.ts b/shanoir-ng-front/src/app/preclinical/anesthetics/anesthetic/list/anesthetic-list.component.ts index bc494fd3c2..0a3e159eeb 100644 --- a/shanoir-ng-front/src/app/preclinical/anesthetics/anesthetic/list/anesthetic-list.component.ts +++ b/shanoir-ng-front/src/app/preclinical/anesthetics/anesthetic/list/anesthetic-list.component.ts @@ -31,7 +31,6 @@ import { AnestheticService } from '../shared/anesthetic.service'; selector: 'anesthetic-list', templateUrl: 'anesthetic-list.component.html', styleUrls: ['anesthetic-list.component.css'], - providers: [AnestheticService], standalone: false }) export class AnestheticsListComponent extends BrowserPaginEntityListComponent{ diff --git a/shanoir-ng-front/src/app/preclinical/anesthetics/examination_anesthetic/edit/examinationAnesthetic-form.component.ts b/shanoir-ng-front/src/app/preclinical/anesthetics/examination_anesthetic/edit/examinationAnesthetic-form.component.ts index 4aa7009d6f..08b17d393c 100644 --- a/shanoir-ng-front/src/app/preclinical/anesthetics/examination_anesthetic/edit/examinationAnesthetic-form.component.ts +++ b/shanoir-ng-front/src/app/preclinical/anesthetics/examination_anesthetic/edit/examinationAnesthetic-form.component.ts @@ -33,7 +33,6 @@ import { EntityService } from 'src/app/shared/components/entity/entity.abstract. @Component({ selector: 'examination-anesthetic-form', templateUrl: 'examinationAnesthetic-form.component.html', - providers: [ExaminationAnestheticService, ReferenceService, AnestheticService], standalone: false }) @ModesAware diff --git a/shanoir-ng-front/src/app/preclinical/anesthetics/examination_anesthetic/list/examinationAnesthetic-list.component.ts b/shanoir-ng-front/src/app/preclinical/anesthetics/examination_anesthetic/list/examinationAnesthetic-list.component.ts index e90b84f5b2..23b4d8de1e 100644 --- a/shanoir-ng-front/src/app/preclinical/anesthetics/examination_anesthetic/list/examinationAnesthetic-list.component.ts +++ b/shanoir-ng-front/src/app/preclinical/anesthetics/examination_anesthetic/list/examinationAnesthetic-list.component.ts @@ -25,7 +25,6 @@ import { EntityService } from 'src/app/shared/components/entity/entity.abstract. selector: 'examination-anesthetics-list', templateUrl: 'examinationAnesthetic-list.component.html', styleUrls: ['examinationAnesthetic-list.component.css'], - providers: [ExaminationAnestheticService], standalone: false }) export class ExaminationAnestheticsListComponent extends BrowserPaginEntityListComponent{ diff --git a/shanoir-ng-front/src/app/preclinical/anesthetics/ingredients/edit/anestheticIngredient-form.component.ts b/shanoir-ng-front/src/app/preclinical/anesthetics/ingredients/edit/anestheticIngredient-form.component.ts index 5fea6dcb67..2296719dc1 100644 --- a/shanoir-ng-front/src/app/preclinical/anesthetics/ingredients/edit/anestheticIngredient-form.component.ts +++ b/shanoir-ng-front/src/app/preclinical/anesthetics/ingredients/edit/anestheticIngredient-form.component.ts @@ -35,7 +35,6 @@ import { EntityService } from 'src/app/shared/components/entity/entity.abstract. @Component({ selector: 'anesthetic-ingredient-form', templateUrl: 'anestheticIngredient-form.component.html', - providers: [AnestheticIngredientService, ReferenceService], animations: [slideDown], standalone: false }) diff --git a/shanoir-ng-front/src/app/preclinical/anesthetics/ingredients/list/anestheticIngredient-list.component.ts b/shanoir-ng-front/src/app/preclinical/anesthetics/ingredients/list/anestheticIngredient-list.component.ts index 1090e357f6..4c9578c889 100644 --- a/shanoir-ng-front/src/app/preclinical/anesthetics/ingredients/list/anestheticIngredient-list.component.ts +++ b/shanoir-ng-front/src/app/preclinical/anesthetics/ingredients/list/anestheticIngredient-list.component.ts @@ -36,7 +36,6 @@ export type Mode = "view" | "edit" | "create"; selector: 'ingredients-list', templateUrl: 'anestheticIngredient-list.component.html', styleUrls: ['anestheticIngredient-list.component.css'], - providers: [AnestheticIngredientService], standalone: false }) diff --git a/shanoir-ng-front/src/app/preclinical/animalSubject/edit/animalSubject-form.component.ts b/shanoir-ng-front/src/app/preclinical/animalSubject/edit/animalSubject-form.component.ts index c6173b438a..4416dfe89f 100644 --- a/shanoir-ng-front/src/app/preclinical/animalSubject/edit/animalSubject-form.component.ts +++ b/shanoir-ng-front/src/app/preclinical/animalSubject/edit/animalSubject-form.component.ts @@ -54,7 +54,6 @@ import { MassDownloadService } from 'src/app/shared/mass-download/mass-download. selector: 'animalSubject-form', templateUrl: 'animalSubject-form.component.html', styleUrls: ['../../../subjects/subject/subject.component.css', 'animalSubject-form.component.css'], - providers: [AnimalSubjectService, ReferenceService, PathologyService, SubjectPathologyService, SubjectTherapyService], animations: [slideDown, preventInitialChildAnimations], standalone: false }) diff --git a/shanoir-ng-front/src/app/preclinical/animalSubject/list/animalSubject-list.component.ts b/shanoir-ng-front/src/app/preclinical/animalSubject/list/animalSubject-list.component.ts index b0fe26a3dd..577961054d 100644 --- a/shanoir-ng-front/src/app/preclinical/animalSubject/list/animalSubject-list.component.ts +++ b/shanoir-ng-front/src/app/preclinical/animalSubject/list/animalSubject-list.component.ts @@ -30,7 +30,6 @@ import {PreclinicalSubject} from '../shared/preclinicalSubject.model'; selector: 'animalSubject-list', templateUrl: 'animalSubject-list.component.html', styleUrls: ['animalSubject-list.component.css'], - providers: [AnimalSubjectService], standalone: false }) export class AnimalSubjectsListComponent extends BrowserPaginEntityListComponent{ diff --git a/shanoir-ng-front/src/app/preclinical/contrastAgent/edit/contrastAgent-form.component.ts b/shanoir-ng-front/src/app/preclinical/contrastAgent/edit/contrastAgent-form.component.ts index 775abc488e..7287d586e3 100644 --- a/shanoir-ng-front/src/app/preclinical/contrastAgent/edit/contrastAgent-form.component.ts +++ b/shanoir-ng-front/src/app/preclinical/contrastAgent/edit/contrastAgent-form.component.ts @@ -32,7 +32,6 @@ import { EntityService } from 'src/app/shared/components/entity/entity.abstract. selector: 'contrast-agent-form', templateUrl: 'contrastAgent-form.component.html', styleUrls: ['contrastAgent-form.component.css'], - providers: [ContrastAgentService, ReferenceService], animations: [slideDown], standalone: false }) diff --git a/shanoir-ng-front/src/app/preclinical/contrastAgent/list/contrastAgent-list.component.ts b/shanoir-ng-front/src/app/preclinical/contrastAgent/list/contrastAgent-list.component.ts index 494e9ec905..24d7fc4534 100644 --- a/shanoir-ng-front/src/app/preclinical/contrastAgent/list/contrastAgent-list.component.ts +++ b/shanoir-ng-front/src/app/preclinical/contrastAgent/list/contrastAgent-list.component.ts @@ -27,7 +27,6 @@ import { EntityService } from 'src/app/shared/components/entity/entity.abstract. selector: 'contrast-agent-list', templateUrl: 'contrastAgent-list.component.html', styleUrls: ['contrastAgent-list.component.css'], - providers: [ContrastAgentService], standalone: false }) export class ContrastAgentsListComponent extends BrowserPaginEntityListComponent{ diff --git a/shanoir-ng-front/src/app/preclinical/examination/list/animal-examination-list.component.ts b/shanoir-ng-front/src/app/preclinical/examination/list/animal-examination-list.component.ts index e5cc1a2149..1c7845416e 100644 --- a/shanoir-ng-front/src/app/preclinical/examination/list/animal-examination-list.component.ts +++ b/shanoir-ng-front/src/app/preclinical/examination/list/animal-examination-list.component.ts @@ -32,7 +32,6 @@ import { ExaminationService } from '../../../examinations/shared/examination.ser @Component({ selector: 'animal-examination-list', templateUrl: 'animal-examination-list.component.html', - providers: [ExaminationService], standalone: false }) export class AnimalExaminationListComponent extends EntityListComponent{ diff --git a/shanoir-ng-front/src/app/preclinical/extraData/bloodGasData/add/bloodGasData-form.component.ts b/shanoir-ng-front/src/app/preclinical/extraData/bloodGasData/add/bloodGasData-form.component.ts index 46475d4dbd..cf84aa6f01 100644 --- a/shanoir-ng-front/src/app/preclinical/extraData/bloodGasData/add/bloodGasData-form.component.ts +++ b/shanoir-ng-front/src/app/preclinical/extraData/bloodGasData/add/bloodGasData-form.component.ts @@ -31,7 +31,6 @@ import { ExtraData } from '../../extraData/shared/extradata.model'; @Component({ selector: 'bloodgas-data-upload-form', templateUrl: 'bloodGasData-form.component.html', - providers: [ExtraDataService], animations: [slideDown], standalone: false }) diff --git a/shanoir-ng-front/src/app/preclinical/extraData/extraData/shared/extradata.service.ts b/shanoir-ng-front/src/app/preclinical/extraData/extraData/shared/extradata.service.ts index fd230bef09..3388c79b6c 100644 --- a/shanoir-ng-front/src/app/preclinical/extraData/extraData/shared/extradata.service.ts +++ b/shanoir-ng-front/src/app/preclinical/extraData/extraData/shared/extradata.service.ts @@ -39,7 +39,6 @@ export class ExtraDataService extends EntityService{ } getExtraData(id:string): Promise { - console.log('prout') return this.http.get(PreclinicalUtils.PRECLINICAL_API_EXAMINATION_URL+"/"+id) .toPromise() .then((entity) => this.toRealObject(entity)); diff --git a/shanoir-ng-front/src/app/preclinical/extraData/physiologicalData/add/physiologicalData-form.component.ts b/shanoir-ng-front/src/app/preclinical/extraData/physiologicalData/add/physiologicalData-form.component.ts index 6d413b5158..d0de2c422b 100644 --- a/shanoir-ng-front/src/app/preclinical/extraData/physiologicalData/add/physiologicalData-form.component.ts +++ b/shanoir-ng-front/src/app/preclinical/extraData/physiologicalData/add/physiologicalData-form.component.ts @@ -33,7 +33,6 @@ import { EntityService } from 'src/app/shared/components/entity/entity.abstract. @Component({ selector: 'physiological-data-upload-form', templateUrl: 'physiologicalData-form.component.html', - providers: [ExtraDataService], animations: [slideDown], standalone: false }) diff --git a/shanoir-ng-front/src/app/preclinical/pathologies/pathology/edit/pathology-form.component.ts b/shanoir-ng-front/src/app/preclinical/pathologies/pathology/edit/pathology-form.component.ts index 3d803a504b..f190f2ec04 100644 --- a/shanoir-ng-front/src/app/preclinical/pathologies/pathology/edit/pathology-form.component.ts +++ b/shanoir-ng-front/src/app/preclinical/pathologies/pathology/edit/pathology-form.component.ts @@ -25,7 +25,6 @@ import { EntityService } from 'src/app/shared/components/entity/entity.abstract. @Component({ selector: 'pathology-form', templateUrl: 'pathology-form.component.html', - providers: [PathologyService], standalone: false }) @ModesAware diff --git a/shanoir-ng-front/src/app/preclinical/pathologies/pathology/list/pathology-list.component.ts b/shanoir-ng-front/src/app/preclinical/pathologies/pathology/list/pathology-list.component.ts index c52196b0e2..c19c5c0ae3 100644 --- a/shanoir-ng-front/src/app/preclinical/pathologies/pathology/list/pathology-list.component.ts +++ b/shanoir-ng-front/src/app/preclinical/pathologies/pathology/list/pathology-list.component.ts @@ -33,7 +33,6 @@ import { EntityService } from 'src/app/shared/components/entity/entity.abstract. selector: 'pathology-list', templateUrl: 'pathology-list.component.html', styleUrls: ['pathology-list.component.css'], - providers: [PathologyService], standalone: false }) export class PathologiesListComponent extends BrowserPaginEntityListComponent{ diff --git a/shanoir-ng-front/src/app/preclinical/pathologies/pathologyModel/edit/pathologyModel-form.component.ts b/shanoir-ng-front/src/app/preclinical/pathologies/pathologyModel/edit/pathologyModel-form.component.ts index 2bba07b9a5..9576e16a20 100644 --- a/shanoir-ng-front/src/app/preclinical/pathologies/pathologyModel/edit/pathologyModel-form.component.ts +++ b/shanoir-ng-front/src/app/preclinical/pathologies/pathologyModel/edit/pathologyModel-form.component.ts @@ -30,7 +30,6 @@ import { EntityService } from 'src/app/shared/components/entity/entity.abstract. @Component({ selector: 'pathologyModel-form', templateUrl: 'pathologyModel-form.component.html', - providers: [PathologyModelService, PathologyService], animations: [slideDown], standalone: false }) diff --git a/shanoir-ng-front/src/app/preclinical/pathologies/pathologyModel/list/pathologyModel-list.component.ts b/shanoir-ng-front/src/app/preclinical/pathologies/pathologyModel/list/pathologyModel-list.component.ts index 6033ccbdf4..3c686a15ef 100644 --- a/shanoir-ng-front/src/app/preclinical/pathologies/pathologyModel/list/pathologyModel-list.component.ts +++ b/shanoir-ng-front/src/app/preclinical/pathologies/pathologyModel/list/pathologyModel-list.component.ts @@ -30,7 +30,6 @@ import { EntityService } from 'src/app/shared/components/entity/entity.abstract. selector: 'pathologyModel-list', templateUrl: 'pathologyModel-list.component.html', styleUrls: ['pathologyModel-list.component.css'], - providers: [PathologyModelService], standalone: false }) export class PathologyModelsListComponent extends BrowserPaginEntityListComponent { diff --git a/shanoir-ng-front/src/app/preclinical/pathologies/subjectPathology/edit/subjectPathology-form.component.ts b/shanoir-ng-front/src/app/preclinical/pathologies/subjectPathology/edit/subjectPathology-form.component.ts index 425c00379f..63f8b79056 100644 --- a/shanoir-ng-front/src/app/preclinical/pathologies/subjectPathology/edit/subjectPathology-form.component.ts +++ b/shanoir-ng-front/src/app/preclinical/pathologies/subjectPathology/edit/subjectPathology-form.component.ts @@ -33,7 +33,6 @@ import { EntityService } from 'src/app/shared/components/entity/entity.abstract. @Component({ selector: 'subject-pathology-form', templateUrl: 'subjectPathology-form.component.html', - providers: [SubjectPathologyService, PathologyModelService, PathologyService, ReferenceService], animations: [slideDown], standalone: false }) diff --git a/shanoir-ng-front/src/app/preclinical/reference/edit/reference-form.component.ts b/shanoir-ng-front/src/app/preclinical/reference/edit/reference-form.component.ts index 2b88218f0f..d91f99a8f3 100644 --- a/shanoir-ng-front/src/app/preclinical/reference/edit/reference-form.component.ts +++ b/shanoir-ng-front/src/app/preclinical/reference/edit/reference-form.component.ts @@ -28,7 +28,6 @@ import { EntityService } from 'src/app/shared/components/entity/entity.abstract. selector: 'reference-form', templateUrl: 'reference-form.component.html', styleUrls: ['reference-form.component.css'], - providers: [ReferenceService], animations: [slideDown], standalone: false }) diff --git a/shanoir-ng-front/src/app/preclinical/reference/list/reference-list.component.ts b/shanoir-ng-front/src/app/preclinical/reference/list/reference-list.component.ts index 9bf3bc3617..51c08769c7 100644 --- a/shanoir-ng-front/src/app/preclinical/reference/list/reference-list.component.ts +++ b/shanoir-ng-front/src/app/preclinical/reference/list/reference-list.component.ts @@ -25,7 +25,6 @@ import { EntityService } from 'src/app/shared/components/entity/entity.abstract. selector: 'reference-list', templateUrl: 'reference-list.component.html', styleUrls: ['reference-list.component.css'], - providers: [ReferenceService], standalone: false }) diff --git a/shanoir-ng-front/src/app/preclinical/therapies/subjectTherapy/edit/subjectTherapy-form.component.ts b/shanoir-ng-front/src/app/preclinical/therapies/subjectTherapy/edit/subjectTherapy-form.component.ts index b6599fa993..a30db84337 100644 --- a/shanoir-ng-front/src/app/preclinical/therapies/subjectTherapy/edit/subjectTherapy-form.component.ts +++ b/shanoir-ng-front/src/app/preclinical/therapies/subjectTherapy/edit/subjectTherapy-form.component.ts @@ -36,7 +36,6 @@ import { EntityService } from 'src/app/shared/components/entity/entity.abstract. @Component({ selector: 'subject-therapy-form', templateUrl: 'subjectTherapy-form.component.html', - providers: [SubjectTherapyService, TherapyService, ReferenceService], animations: [slideDown], standalone: false }) diff --git a/shanoir-ng-front/src/app/preclinical/therapies/therapy/edit/therapy-form.component.ts b/shanoir-ng-front/src/app/preclinical/therapies/therapy/edit/therapy-form.component.ts index cd282f4a34..8b5c605d69 100644 --- a/shanoir-ng-front/src/app/preclinical/therapies/therapy/edit/therapy-form.component.ts +++ b/shanoir-ng-front/src/app/preclinical/therapies/therapy/edit/therapy-form.component.ts @@ -29,7 +29,6 @@ import { TherapyService } from '../shared/therapy.service'; @Component({ selector: 'therapy-form', templateUrl: 'therapy-form.component.html', - providers: [TherapyService, ReferenceService], animations: [slideDown], standalone: false }) diff --git a/shanoir-ng-front/src/app/preclinical/therapies/therapy/list/therapy-list.component.ts b/shanoir-ng-front/src/app/preclinical/therapies/therapy/list/therapy-list.component.ts index b003cf8636..1abbfc6e89 100644 --- a/shanoir-ng-front/src/app/preclinical/therapies/therapy/list/therapy-list.component.ts +++ b/shanoir-ng-front/src/app/preclinical/therapies/therapy/list/therapy-list.component.ts @@ -32,7 +32,6 @@ import { EntityService } from 'src/app/shared/components/entity/entity.abstract. selector: 'therapy-list', templateUrl: 'therapy-list.component.html', styleUrls: ['therapy-list.component.css'], - providers: [TherapyService], standalone: false }) export class TherapiesListComponent extends BrowserPaginEntityListComponent { diff --git a/shanoir-ng-front/src/app/shared/mass-download/download-setup/download-setup.component.css b/shanoir-ng-front/src/app/shared/mass-download/download-setup/download-setup.component.css index bd7062568f..b79140b4f8 100644 --- a/shanoir-ng-front/src/app/shared/mass-download/download-setup/download-setup.component.css +++ b/shanoir-ng-front/src/app/shared/mass-download/download-setup/download-setup.component.css @@ -9,4 +9,9 @@ input[type="number"] { width: 52px; } .warning { margin-left: 10px; color: var(--color-error); vertical-align: inherit; } .warning i { margin-right: 2px; } -.format-preview { position: absolute; top: 0; right: 0; width: 220px; } \ No newline at end of file +.format-preview { position: absolute; top: 0; right: 0; width: 220px; } + +.msg { max-width: 600px; color: blue; line-height: 20px; text-align: left; background-color: lightsteelblue; padding: 10px 20px; border-radius: 2px; } +.msg i { font-size: 20px; color: blue; opacity: 0.5; } +.msg a { cursor: pointer; } +.loading-msg { position: absolute; top: 0; right: 0; padding: 10px; font-size: 20px; } \ No newline at end of file diff --git a/shanoir-ng-front/src/app/shared/mass-download/download-setup/download-setup.component.html b/shanoir-ng-front/src/app/shared/mass-download/download-setup/download-setup.component.html index 42d5927bec..2541eb1bcb 100644 --- a/shanoir-ng-front/src/app/shared/mass-download/download-setup/download-setup.component.html +++ b/shanoir-ng-front/src/app/shared/mass-download/download-setup/download-setup.component.html @@ -1,8 +1,13 @@

Download Datasets

-
- Retrieving download informations... +
+ +
+
+ + Total estimated size : {{totalSize | size}} +
You will download the whole study, make sure you have enough space available on your disk.
    diff --git a/shanoir-ng-front/src/app/shared/mass-download/download-setup/download-setup.component.ts b/shanoir-ng-front/src/app/shared/mass-download/download-setup/download-setup.component.ts index 0aa71ef7f7..f84b64e0ce 100644 --- a/shanoir-ng-front/src/app/shared/mass-download/download-setup/download-setup.component.ts +++ b/shanoir-ng-front/src/app/shared/mass-download/download-setup/download-setup.component.ts @@ -35,6 +35,7 @@ export class DownloadSetupComponent implements OnInit, OnDestroy { @Output() go: EventEmitter = new EventEmitter(); @Output() close: EventEmitter = new EventEmitter(); @Input() inputIds: DownloadInputIds; + @Input() totalSize?: number; form: UntypedFormGroup; loading: boolean; loaded: boolean = false; diff --git a/shanoir-ng-front/src/app/shared/mass-download/mass-download.service.ts b/shanoir-ng-front/src/app/shared/mass-download/mass-download.service.ts index 96933094a2..1a9c0663b4 100644 --- a/shanoir-ng-front/src/app/shared/mass-download/mass-download.service.ts +++ b/shanoir-ng-front/src/app/shared/mass-download/mass-download.service.ts @@ -78,6 +78,8 @@ export class MassDownloadService { readonly BROWSER_COMPAT_ERROR_MSG: string = 'browser not compatible'; readonly REPORT_FILENAME: string = 'downloadReport.json'; winOs: boolean; + // @ts-ignore + public advancedDownloadCompat: boolean = !!window.showDirectoryPicker; constructor( private datasetService: DatasetService, @@ -90,6 +92,10 @@ export class MassDownloadService { this.winOs = deviceInformationService.getDeviceInfo()?.os?.toLocaleLowerCase().includes('windows'); } + downloadAllByStudyId(studyId: number, totalSize: number, downloadState?: TaskState) { + return this.downloadByDatasets({studyId: studyId}, downloadState, totalSize); + } + downloadAllByExaminationId(examinationId: number, downloadState?: TaskState): Promise { return this.downloadByDatasets({examinationId: examinationId}, downloadState); } @@ -109,8 +115,8 @@ export class MassDownloadService { /** * This method is the generic entry to download multiple datasets. */ - private downloadByDatasets(inputIds: DownloadInputIds, downloadState?: TaskState): Promise { - return this.openModal(inputIds).then(ret => { + private downloadByDatasets(inputIds: DownloadInputIds, downloadState?: TaskState, totalSize?: number): Promise { + return this.openModal(inputIds, totalSize).then(ret => { if (ret != 'cancel') { return this._downloadDatasets(ret, downloadState); } else return Promise.resolve(); @@ -253,6 +259,7 @@ export class MassDownloadService { task.report = JSON.stringify(report, null, 4); if (report.nbError > 0) { task.status = 3; + task.progress = 1; const tab: string = '- '; task.message = (report.nbSuccess > 0 ? 'download partially succeed in ' : 'download failed in ') + report.duration + 'ms.\n' + tab + report.nbSuccess + ' datasets were successfully downloaded\n' @@ -530,11 +537,12 @@ export class MassDownloadService { return task; } - private openModal(inputIds: DownloadInputIds): Promise { + private openModal(inputIds: DownloadInputIds, totalSize?: number): Promise { // @ts-ignore if (window.showDirectoryPicker) { // test compatibility let modalRef: ComponentRef = ServiceLocator.rootViewContainerRef.createComponent(DownloadSetupComponent); modalRef.instance.inputIds = inputIds; + modalRef.instance.totalSize = totalSize; return this.waitForEnd(modalRef); } else { return Promise.reject(this.BROWSER_COMPAT_ERROR_MSG); diff --git a/shanoir-ng-front/src/app/shared/notifications/notifications.service.ts b/shanoir-ng-front/src/app/shared/notifications/notifications.service.ts index dfdaa66603..66aa990203 100644 --- a/shanoir-ng-front/src/app/shared/notifications/notifications.service.ts +++ b/shanoir-ng-front/src/app/shared/notifications/notifications.service.ts @@ -105,24 +105,26 @@ export class NotificationsService { task.message = 'interrupted'; } } - if (task.status == -1 && task.lastUpdate) { - let freshError: boolean = !this.freshCompletedTasks?.find(t => t.id == task.id && t.status == -1) && !!this.tasksInProgress.find(tip => task.id == tip.id) || (Date.now() - new Date(task.lastUpdate).getTime()) <= (this.readInterval); - if (freshError) { + if (!task.hideFromMenu) { + if (task.status == -1 && task.lastUpdate) { + let freshError: boolean = !this.freshCompletedTasks?.find(t => t.id == task.id && t.status == -1) && !!this.tasksInProgress.find(tip => task.id == tip.id) || (Date.now() - new Date(task.lastUpdate).getTime()) <= (this.readInterval); + if (freshError) { + this.freshTimeouts[task.id]?.triggerNow(); + this.pushToFreshError(task); + } + } else if (task.status == 1 || task.status == 3) { + let freshDone: boolean = !this.freshCompletedTasks?.find(t => t.id == task.id && (t.status == 1 || t.status == 3)) && !!this.tasksInProgress.find(tip => task.id == tip.id) || (Date.now() - new Date(task.lastUpdate).getTime()) <= (this.readInterval); + if (freshDone) { + this.freshTimeouts[task.id]?.triggerNow(); + this.pushToFreshCompleted(task); + } + } else if (task.status == 2 || task.status == 5) { this.freshTimeouts[task.id]?.triggerNow(); - this.pushToFreshError(task); - } - } else if (task.status == 1 || task.status == 3) { - let freshDone: boolean = !this.freshCompletedTasks?.find(t => t.id == task.id && (t.status == 1 || t.status == 3)) && !!this.tasksInProgress.find(tip => task.id == tip.id) || (Date.now() - new Date(task.lastUpdate).getTime()) <= (this.readInterval); - if (freshDone) { + tmpTasksInProgress.push(task); + } else if (task.status == 4) { this.freshTimeouts[task.id]?.triggerNow(); - this.pushToFreshCompleted(task); + tmpTasksInWait.push(task); } - } else if (task.status == 2 || task.status == 5) { - this.freshTimeouts[task.id]?.triggerNow(); - tmpTasksInProgress.push(task); - } else if (task.status == 4) { - this.freshTimeouts[task.id]?.triggerNow(); - tmpTasksInWait.push(task); } } this.tasksInProgress = tmpTasksInProgress; @@ -136,7 +138,7 @@ export class NotificationsService { this.nbNew++; // remove after 30min this.freshTimeouts[task.id] = new SuperTimeout(() => { - this.freshCompletedTasks = this.freshCompletedTasks.filter(tip => tip.id != task.id); + this.removeTaskFromFreshCompleted(task); }, this.persistenceTime); } @@ -147,10 +149,26 @@ export class NotificationsService { this.nbNewError++; // remove after 30min this.freshTimeouts[task.id] = new SuperTimeout(() => { - this.freshCompletedTasks = this.freshCompletedTasks.filter(tip => tip.id != task.id); + this.removeTaskFromFreshCompleted(task); }, this.persistenceTime); } + isFreshCompleted(task: Task): boolean { + return !!this.freshCompletedTasks.find(tip => tip.id == task.id); + } + + removeTaskFromFreshCompleted(task: Task) { + this.freshCompletedTasks = this.freshCompletedTasks.filter(tip => tip.id != task.id); + } + + removeTaskFromFresh(task: Task) { + this.removeTaskFromFreshCompleted(task); + this.tasksInProgress = this.tasksInProgress.filter(tip => tip.id != task.id); + this.tasksInWait = this.tasksInWait.filter(tip => tip.id != task.id); + task.hideFromMenu = true; + + } + private connectToServer() { this.keycloakService.getToken().then(token => { this.source = new EventSourcePolyfill(AppUtils.BACKEND_API_UPDATE_TASKS_URL, { @@ -187,8 +205,12 @@ export class NotificationsService { } private createOrUpdateTask(task: Task) { - this.newLocalTasksQueue = this.newLocalTasksQueue.filter(t => t.id != task.id); - this.newLocalTasksQueue.push(task); + let existingTask: Task = this.newLocalTasksQueue.find(t => t.id == task.id); + if (existingTask) { + existingTask.updateWith(task); + } else { + this.newLocalTasksQueue.push(task); + } if (!this.writeLocalStorageConnection) { this.connectWriteSessionToLocalStorage(); } @@ -217,13 +239,26 @@ export class NotificationsService { return task.eventType != 'downloadFile.event' || task.sessionId == this.sessionService.sessionId; }); } + storageTasks.forEach(stTask => { + let existingTask: Task = this.localTasks.find(t => t.id == stTask.id); + if (existingTask) { + stTask.updateWith(existingTask); + } + }); this.localTasks = storageTasks; } private updateLocalStorage() { this.readLocalTasks(); let tmpTasks: Task[] = this.localTasks.filter(lt => !this.newLocalTasksQueue.find(nlt => lt.id == nlt.id)); - tmpTasks = tmpTasks.concat(this.newLocalTasksQueue); + tmpTasks = tmpTasks.concat(this.newLocalTasksQueue.map(nlt => { + let existing: Task = this.localTasks.find(lt => lt.id == nlt.id); + if (existing) { + return existing.updateWith(nlt); + } else { + return nlt; + } + })); tmpTasks.sort((a, b) => (a.lastUpdate?.getTime() || a.creationDate?.getDate()) - (b.lastUpdate?.getTime() || b.creationDate?.getDate())); let tmpTasksStr: string = this.serializeTasks(tmpTasks); // check the size limit diff --git a/shanoir-ng-front/src/app/shared/side-menu/side-menu.component.css b/shanoir-ng-front/src/app/shared/side-menu/side-menu.component.css index 21fdb26196..c9c931ed7a 100644 --- a/shanoir-ng-front/src/app/shared/side-menu/side-menu.component.css +++ b/shanoir-ng-front/src/app/shared/side-menu/side-menu.component.css @@ -80,3 +80,4 @@ progress-bar >>> .text, progress-bar >>> .left-text { line-height: 14px; } .notif.error { color: #ff1900; } .menu-link {width: 100%; display: inline-block; } +.remove-task { position: absolute; left: 7px; padding-top: 1px; } diff --git a/shanoir-ng-front/src/app/shared/side-menu/side-menu.component.html b/shanoir-ng-front/src/app/shared/side-menu/side-menu.component.html index 2afbe21d03..a91c0df957 100644 --- a/shanoir-ng-front/src/app/shared/side-menu/side-menu.component.html +++ b/shanoir-ng-front/src/app/shared/side-menu/side-menu.component.html @@ -68,6 +68,9 @@