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
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;
}
......
......@@ -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>
......
......@@ -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(() => {
......
......@@ -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>
......
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