Skip to content
Snippets Groups Projects
Commit 17a5984f authored by Julian Matschinske's avatar Julian Matschinske
Browse files

Add super quick button

parent 2369d456
No related branches found
No related tags found
No related merge requests found
import {Wrapper, Task, getWrapperFromProtein, getWrapperFromViralProtein, Protein, ViralProtein} from './interfaces';
import {Wrapper, Task, getWrapperFromProtein, getWrapperFromViralProtein, Protein, ViralProtein, Dataset} from './interfaces';
import {Subject} from 'rxjs';
import {HttpClient} from '@angular/common/http';
import {environment} from '../environments/environment';
......@@ -14,7 +14,8 @@ export const algorithmNames = {
multisteiner: 'Multi-Steiner',
closeness: 'Closeness Centrality',
degree: 'Degree Centrality',
quick: 'Quick-Find Drugs',
quick: 'Quick-Find Drugs (custom)',
super: 'Quick-Find Drugs',
};
export interface Algorithm {
......@@ -43,7 +44,7 @@ export class AnalysisService {
public tasks: Task[] = [];
private intervalId: any;
private canLaunchNewTask = false;
private canLaunchNewTask = true;
private launchingQuick = false;
......@@ -150,7 +151,7 @@ export class AnalysisService {
});
}
async startQuickAnalysis(dataset: string) {
async startQuickAnalysis(isSuper: boolean, dataset: Dataset) {
if (!this.canLaunchTask()) {
toast({
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.`,
......@@ -167,11 +168,12 @@ export class AnalysisService {
this.launchingQuick = true;
const resp = await this.http.post<any>(`${environment.backend}task/`, {
algorithm: 'quick',
algorithm: isSuper ? 'super' : 'quick',
target: 'drug',
parameters: {
strain: dataset,
seeds: this.getSelection().map((i) => i.backendId),
strain: dataset.backendId,
datasets: dataset.data,
seeds: isSuper ? [] : this.getSelection().map((i) => i.backendId),
},
}).toPromise();
this.tokens.push(resp.token);
......
......@@ -230,6 +230,25 @@
<div class="card-content quick-find">
<div class="field">
<div class="control">
<div class="tile notification is-danger">
<div class="align-vmiddle">
<div class="digit"><i class="fa fa-fast-forward"></i></div>
<button (click)="analysis.startQuickAnalysis(true, selectedDataset)"
[disabled]="analysis.isLaunchingQuick()"
class="button is-white is-rounded">
<span class="icon">
<i class="fa fa-capsules" *ngIf="!analysis.isLaunchingQuick()"></i>
<i class="fa fa-spin fa-spinner" *ngIf="analysis.isLaunchingQuick()"></i>
</span>
<span>
Quick Find
</span>
</button>
</div>
</div>
<div class="divisor-rapid">
&mdash; or &mdash;
</div>
<div class="tile notification is-info">
<div class="align-vmiddle">
<div class="digit" *ngIf="analysis.getCount() == 0">1</div>
......@@ -242,7 +261,7 @@
<div class="tile notification is-info">
<div class="align-vmiddle">
<div class="digit">2</div>
<button (click)="analysis.startQuickAnalysis(selectedDataset.backendId)"
<button (click)="analysis.startQuickAnalysis(false, selectedDataset)"
[disabled]="analysis.getCount() === 0 || analysis.isLaunchingQuick()"
class="button is-white is-rounded">
<span class="icon">
......
......@@ -13,6 +13,12 @@
font-weight: bold;
}
}
.divisor-rapid {
margin-top: -10px;
margin-bottom: 10px;
text-align: center;
}
}
.align-vmiddle {
......
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