Skip to content
Snippets Groups Projects
Commit d0739249 authored by Julian Späth's avatar Julian Späth
Browse files

Merge branch 'intuitive-queue-position' into 'master'

Intuitive queue position

See merge request covid-19/frontend!80
parents 932c10af 6ddd5829
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,8 @@ export const DEGREE_CENTRALITY: Algorithm = {slug: 'degree', name: algorithmName ...@@ -28,6 +28,8 @@ export const DEGREE_CENTRALITY: Algorithm = {slug: 'degree', name: algorithmName
export const KEYPATHWAYMINER: Algorithm = {slug: 'keypathwayminer', name: algorithmNames.keypathwayminer}; export const KEYPATHWAYMINER: Algorithm = {slug: 'keypathwayminer', name: algorithmNames.keypathwayminer};
export const MULTISTEINER: Algorithm = {slug: 'multisteiner', name: algorithmNames.multisteiner}; export const MULTISTEINER: Algorithm = {slug: 'multisteiner', name: algorithmNames.multisteiner};
export const MAX_TASKS = 3;
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
...@@ -140,7 +142,7 @@ export class AnalysisService { ...@@ -140,7 +142,7 @@ export class AnalysisService {
async startQuickAnalysis() { async startQuickAnalysis() {
if (!this.canLaunchTask()) { if (!this.canLaunchTask()) {
toast({ 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, duration: 5000,
dismissible: true, dismissible: true,
pauseOnHover: true, pauseOnHover: true,
...@@ -177,7 +179,7 @@ export class AnalysisService { ...@@ -177,7 +179,7 @@ export class AnalysisService {
async startAnalysis(algorithm, target: 'drug' | 'drug-target', parameters) { async startAnalysis(algorithm, target: 'drug' | 'drug-target', parameters) {
if (!this.canLaunchTask()) { if (!this.canLaunchTask()) {
toast({ 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, duration: 5000,
dismissible: true, dismissible: true,
pauseOnHover: true, pauseOnHover: true,
...@@ -246,7 +248,7 @@ export class AnalysisService { ...@@ -246,7 +248,7 @@ export class AnalysisService {
} }
} }
}); });
this.canLaunchNewTask = queuedOrRunningTasks < 3; this.canLaunchNewTask = queuedOrRunningTasks < MAX_TASKS;
} else { } else {
this.canLaunchNewTask = true; this.canLaunchNewTask = true;
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<div *ngIf="!analysis.canLaunchTask()"> <div *ngIf="!analysis.canLaunchTask()">
<div class="notification is-warning warning"> <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>
</div> </div>
......
...@@ -4,7 +4,7 @@ import { ...@@ -4,7 +4,7 @@ import {
AlgorithmType, AlgorithmType,
AnalysisService, CLOSENESS_CENTRALITY, AnalysisService, CLOSENESS_CENTRALITY,
DEGREE_CENTRALITY, DEGREE_CENTRALITY,
KEYPATHWAYMINER, KEYPATHWAYMINER, MAX_TASKS,
MULTISTEINER, MULTISTEINER,
QuickAlgorithmType, QuickAlgorithmType,
TRUSTRANK TRUSTRANK
...@@ -55,6 +55,8 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { ...@@ -55,6 +55,8 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges {
public hasBaits; public hasBaits;
public maxTasks = MAX_TASKS;
constructor(public analysis: AnalysisService) { constructor(public analysis: AnalysisService) {
this.hasBaits = !!analysis.getSelection().find((i) => i.type === 'virus'); this.hasBaits = !!analysis.getSelection().find((i) => i.type === 'virus');
analysis.subscribe(() => { analysis.subscribe(() => {
......
...@@ -8,8 +8,15 @@ ...@@ -8,8 +8,15 @@
<span class="icon is-pulled-right"><i class="fas fa-pause" aria-hidden="true"></i></span> <span class="icon is-pulled-right"><i class="fas fa-pause" aria-hidden="true"></i></span>
</p> </p>
<p> <p>
<small *ngIf="task.stats.queueLength > 0">Queue position: {{task.stats.queuePosition}}/{{task.stats.queueLength}}</small> <small *ngIf="task.stats.queuePosition === 1">
<small *ngIf="task.stats.queueLength === 0">Execution imminent...</small> 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"> <a (click)="analysis.removeTask(task.token)" class="has-text-danger">
<span class="icon is-pulled-right"> <span class="icon is-pulled-right">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment