diff --git a/src/app/analysis.service.ts b/src/app/analysis.service.ts index 55306456abd94a12b74600b93f2d85855ac00335..ff11a2bd7a7719ded9fd34711bad0b4a623090b1 100644 --- a/src/app/analysis.service.ts +++ b/src/app/analysis.service.ts @@ -28,6 +28,8 @@ export const DEGREE_CENTRALITY: Algorithm = {slug: 'degree', name: algorithmName export const KEYPATHWAYMINER: Algorithm = {slug: 'keypathwayminer', name: algorithmNames.keypathwayminer}; export const MULTISTEINER: Algorithm = {slug: 'multisteiner', name: algorithmNames.multisteiner}; +export const MAX_TASKS = 3; + @Injectable({ providedIn: 'root' }) @@ -140,7 +142,7 @@ export class AnalysisService { async startQuickAnalysis() { if (!this.canLaunchTask()) { toast({ - message: 'You can only run 3 tasks at once. Please wait for one of them to finish or delete it from the task list.', + message: `You can only run ${MAX_TASKS} tasks at once. Please wait for one of them to finish or delete it from the task list.`, duration: 5000, dismissible: true, pauseOnHover: true, @@ -177,7 +179,7 @@ export class AnalysisService { async startAnalysis(algorithm, target: 'drug' | 'drug-target', parameters) { if (!this.canLaunchTask()) { toast({ - message: 'You can only run 3 tasks at once. Please wait for one of them to finish or delete it from the task list.', + message: `You can only run ${MAX_TASKS} tasks at once. Please wait for one of them to finish or delete it from the task list.`, duration: 5000, dismissible: true, pauseOnHover: true, @@ -246,7 +248,7 @@ export class AnalysisService { } } }); - this.canLaunchNewTask = queuedOrRunningTasks < 3; + this.canLaunchNewTask = queuedOrRunningTasks < MAX_TASKS; } else { this.canLaunchNewTask = true; } diff --git a/src/app/components/launch-analysis/launch-analysis.component.html b/src/app/components/launch-analysis/launch-analysis.component.html index fa30c15b84bfd1ccf864887c35284ffcf7331fbc..a9be25dc2e6760ba809f46be558432d8fc0c5c40 100644 --- a/src/app/components/launch-analysis/launch-analysis.component.html +++ b/src/app/components/launch-analysis/launch-analysis.component.html @@ -30,7 +30,7 @@ <div *ngIf="!analysis.canLaunchTask()"> <div class="notification is-warning warning"> - You can only run 3 tasks at once. Please wait for one of them to finish or delete it from the task list. + You can only run {{maxTasks}} tasks at once. Please wait for one of them to finish or delete it from the task list. </div> </div> diff --git a/src/app/components/launch-analysis/launch-analysis.component.ts b/src/app/components/launch-analysis/launch-analysis.component.ts index 7afca91c5693304426f827f17f78806bbdb85742..8939eaa3419ef6ffec8eff878fa3c9f191c1b53b 100644 --- a/src/app/components/launch-analysis/launch-analysis.component.ts +++ b/src/app/components/launch-analysis/launch-analysis.component.ts @@ -4,7 +4,7 @@ import { AlgorithmType, AnalysisService, CLOSENESS_CENTRALITY, DEGREE_CENTRALITY, - KEYPATHWAYMINER, + KEYPATHWAYMINER, MAX_TASKS, MULTISTEINER, QuickAlgorithmType, TRUSTRANK @@ -55,6 +55,8 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { public hasBaits; + public maxTasks = MAX_TASKS; + constructor(public analysis: AnalysisService) { this.hasBaits = !!analysis.getSelection().find((i) => i.type === 'virus'); analysis.subscribe(() => { diff --git a/src/app/components/task-list/task-list.component.html b/src/app/components/task-list/task-list.component.html index 1ee860b26482d5a673495abed4b252a0ad405d61..2b659a547b66fc0c514b36c99360f4a184043414 100644 --- a/src/app/components/task-list/task-list.component.html +++ b/src/app/components/task-list/task-list.component.html @@ -8,8 +8,15 @@ <span class="icon is-pulled-right"><i class="fas fa-pause" aria-hidden="true"></i></span> </p> <p> - <small *ngIf="task.stats.queueLength > 0">Queue position: {{task.stats.queuePosition}}/{{task.stats.queueLength}}</small> - <small *ngIf="task.stats.queueLength === 0">Execution imminent...</small> + <small *ngIf="task.stats.queuePosition === 1"> + Queued: 1 other task to finish + </small> + <small *ngIf="task.stats.queuePosition > 1"> + Queued: {{task.stats.queuePosition}} other tasks to finish + </small> + <small *ngIf="task.stats.queuePosition === 0"> + Execution imminent... + </small> <a (click)="analysis.removeTask(task.token)" class="has-text-danger"> <span class="icon is-pulled-right"> <i class="fa fa-trash"></i>