Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove notif #2603

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion shanoir-ng-front/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down Expand Up @@ -453,7 +454,8 @@ import { MetadataNodeComponent } from './datasets/tree/metadata-node.component';
StudyTreeComponent,
CoilNodeComponent,
DoubleAwesomeComponent,
MetadataNodeComponent
MetadataNodeComponent,
SizePipe
],
bootstrap: [AppComponent],
imports: [
Expand Down
11 changes: 10 additions & 1 deletion shanoir-ng-front/src/app/async-tasks/task.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -138,14 +139,22 @@ 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;
if (!this.creationDate && task.creationDate) this.creationDate = task.creationDate;
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;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
(chkbxChange)="selectedChange.emit()"
(firstOpen)="firstOpen()"
[hasChildren]="hasChildren()"
[dataLoading]="loading"
[title]="node.title + ' n°' + node.id">

<dropdown-menu [(openInput)]="menuOpened" *ngIf="menuOpened && withMenu && node.id != null">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Anesthetic>{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ExaminationAnesthetic>{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PreclinicalSubject>{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ContrastAgent>{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Examination>{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export class ExtraDataService extends EntityService<ExtraData>{
}

getExtraData(id:string): Promise<ExtraData> {
console.log('prout')
return this.http.get<ExtraData>(PreclinicalUtils.PRECLINICAL_API_EXAMINATION_URL+"/"+id)
.toPromise()
.then((entity) => this.toRealObject(entity));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Pathology>{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PathologyModel> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Therapy> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
.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; }
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<div class="cell">
<form #window class="window" [formGroup]="form">
<h2 class="header">Download Datasets</h2>
<div *ngIf="loading">
<i *ngIf="loading" class="fas fa-cog fa-spin"></i> Retrieving download informations...
<div *ngIf="loading" class="loading-msg">
<i class="fas fa-cog fa-spin"></i>
</div>
<div class="left-icon msg" *ngIf="totalSize">
<i class="fa-solid fa-circle-exclamation"></i>
<b>Total estimated size : {{totalSize | size}}</b>
<br/>You will download the whole study, make sure you have enough space available on your disk.
</div>
<fieldset class="body" disabled="loading">
<ol>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class DownloadSetupComponent implements OnInit, OnDestroy {
@Output() go: EventEmitter<DownloadSetup> = new EventEmitter();
@Output() close: EventEmitter<void> = new EventEmitter();
@Input() inputIds: DownloadInputIds;
@Input() totalSize?: number;
form: UntypedFormGroup;
loading: boolean;
loaded: boolean = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<void> {
return this.downloadByDatasets({examinationId: examinationId}, downloadState);
}
Expand All @@ -109,8 +115,8 @@ export class MassDownloadService {
/**
* This method is the generic entry to download multiple datasets.
*/
private downloadByDatasets(inputIds: DownloadInputIds, downloadState?: TaskState): Promise<void> {
return this.openModal(inputIds).then(ret => {
private downloadByDatasets(inputIds: DownloadInputIds, downloadState?: TaskState, totalSize?: number): Promise<void> {
return this.openModal(inputIds, totalSize).then(ret => {
if (ret != 'cancel') {
return this._downloadDatasets(ret, downloadState);
} else return Promise.resolve();
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -530,11 +537,12 @@ export class MassDownloadService {
return task;
}

private openModal(inputIds: DownloadInputIds): Promise<DownloadSetup | 'cancel'> {
private openModal(inputIds: DownloadInputIds, totalSize?: number): Promise<DownloadSetup | 'cancel'> {
// @ts-ignore
if (window.showDirectoryPicker) { // test compatibility
let modalRef: ComponentRef<DownloadSetupComponent> = 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);
Expand Down
Loading