diff --git a/src/app/components/quick-drug-target/quick-drug-target.component.html b/src/app/components/quick-drug-target/quick-drug-target.component.html index f42186f0a538b216d1ca71137af9ae5aa8ee764e..d5ccda51ed986c090859def27e5adbebb367d0f1 100644 --- a/src/app/components/quick-drug-target/quick-drug-target.component.html +++ b/src/app/components/quick-drug-target/quick-drug-target.component.html @@ -32,7 +32,7 @@ <div class="control"> <div style="display: flex; justify-content: center"> <button - (click)="analysis.startQuickAnalysis(true, 'connect')" + (click)="runQuickAnalysis(true, 'connect')" [disabled]="analysis.isLaunchingQuick()" [ngClass]="{ 'text-small': drugstoneConfig.smallStyle @@ -64,7 +64,7 @@ </div> <div style="display: flex; justify-content: center"> <button - (click)="analysis.startQuickAnalysis(false, 'connectSelected')" + (click)="runQuickAnalysis(false, 'connectSelected')" [disabled]=" analysis.getCount() === 0 || analysis.isLaunchingQuick() " diff --git a/src/app/components/quick-drug-target/quick-drug-target.component.ts b/src/app/components/quick-drug-target/quick-drug-target.component.ts index a0f65ce2acf43d1078398ffc1fd015d9d372b2e4..82186a915bcce7ba806d371612d0df19de1e4113 100644 --- a/src/app/components/quick-drug-target/quick-drug-target.component.ts +++ b/src/app/components/quick-drug-target/quick-drug-target.component.ts @@ -1,6 +1,6 @@ -import { Component, OnInit } from '@angular/core'; -import { AnalysisService } from 'src/app/services/analysis/analysis.service'; -import { DrugstoneConfigService } from 'src/app/services/drugstone-config/drugstone-config.service'; +import {Component, EventEmitter, OnInit, Output} from '@angular/core'; +import {AnalysisService} from 'src/app/services/analysis/analysis.service'; +import {DrugstoneConfigService} from 'src/app/services/drugstone-config/drugstone-config.service'; @Component({ selector: 'app-quick-drug-target', @@ -8,14 +8,22 @@ import { DrugstoneConfigService } from 'src/app/services/drugstone-config/drugst styleUrls: ['./quick-drug-target.component.scss'] }) export class QuickDrugTargetComponent implements OnInit { + @Output() + public taskEvent = new EventEmitter<object>(); constructor( public drugstoneConfig: DrugstoneConfigService, - public analysis: AnalysisService) { } + public analysis: AnalysisService) { + } public collapseQuickConnect = false; ngOnInit(): void { } + public async runQuickAnalysis(isSuper, algorithm) { + const object = await this.analysis.startQuickAnalysis(isSuper, algorithm); + this.taskEvent.emit(object); + } + } diff --git a/src/app/components/quick-drug/quick-drug.component.html b/src/app/components/quick-drug/quick-drug.component.html index 356077c03b3665c0712a10d09a0f258e3ffcec2b..29224841b25316ba17f63b2ecec8cf2b544f24f7 100644 --- a/src/app/components/quick-drug/quick-drug.component.html +++ b/src/app/components/quick-drug/quick-drug.component.html @@ -32,7 +32,7 @@ <div class="control"> <div style="display: flex; justify-content: center"> <button - (click)="analysis.startQuickAnalysis(true, 'super')" + (click)="runQuickAnalysis(true, 'super')" [disabled]="analysis.isLaunchingQuick()" [ngClass]="{ 'text-small': drugstoneConfig.smallStyle @@ -68,7 +68,7 @@ <div style="display: flex; justify-content: center"> <button - (click)="analysis.startQuickAnalysis(false, 'quick')" + (click)="runQuickAnalysis(false, 'quick')" [disabled]=" analysis.getCount() === 0 || analysis.isLaunchingQuick() " diff --git a/src/app/components/quick-drug/quick-drug.component.ts b/src/app/components/quick-drug/quick-drug.component.ts index 185e0e2184e1f60a2c046b7b065e7a2caaa1b06e..f3eda0b79efd0e4ec40a5fd6c03f3b9d4f77332e 100644 --- a/src/app/components/quick-drug/quick-drug.component.ts +++ b/src/app/components/quick-drug/quick-drug.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, EventEmitter, OnInit, Output} from '@angular/core'; import { AnalysisService } from 'src/app/services/analysis/analysis.service'; import { DrugstoneConfigService } from 'src/app/services/drugstone-config/drugstone-config.service'; @@ -8,6 +8,8 @@ import { DrugstoneConfigService } from 'src/app/services/drugstone-config/drugst styleUrls: ['./quick-drug.component.scss'] }) export class QuickDrugComponent implements OnInit { + @Output() + public taskEvent = new EventEmitter<object>(); constructor( public drugstoneConfig: DrugstoneConfigService, @@ -17,4 +19,9 @@ export class QuickDrugComponent implements OnInit { ngOnInit(): void { } + + public async runQuickAnalysis(isSuper, algorithm) { + const object = await this.analysis.startQuickAnalysis(isSuper, algorithm); + this.taskEvent.emit(object); + } } diff --git a/src/app/pages/explorer-page/explorer-page.component.html b/src/app/pages/explorer-page/explorer-page.component.html index 87d08badacf8dcc83bf1c651b4254e45c86270df..16ad5120d298bc10963e0149fc7470188d023d9e 100644 --- a/src/app/pages/explorer-page/explorer-page.component.html +++ b/src/app/pages/explorer-page/explorer-page.component.html @@ -190,9 +190,9 @@ </div> </div> - <app-quick-drug-target *ngIf="drugstoneConfig.config.showConnectGenes"></app-quick-drug-target> + <app-quick-drug-target *ngIf="drugstoneConfig.config.showConnectGenes" (taskEvent)="emitTaskEvent($event)"></app-quick-drug-target> - <app-quick-drug *ngIf="drugstoneConfig.config.showSimpleAnalysis"></app-quick-drug> + <app-quick-drug *ngIf="drugstoneConfig.config.showSimpleAnalysis" (taskEvent)="emitTaskEvent($event)"></app-quick-drug> <div *ngIf="drugstoneConfig.config.showAdvAnalysis" diff --git a/src/app/services/analysis/analysis.service.ts b/src/app/services/analysis/analysis.service.ts index 6dc4122af83f861a1fddb59c324cb74a97ad4cad..0b7e031536f281de9d1008b814c7def57f5981ef 100644 --- a/src/app/services/analysis/analysis.service.ts +++ b/src/app/services/analysis/analysis.service.ts @@ -274,6 +274,7 @@ export class AnalysisService { position: 'top-center', animate: {in: 'fadeIn', out: 'fadeOut'} }); + return { taskId: resp.token, algorithm: algorithm, target: target, params: parameters } } async startAnalysis(algorithm, target: 'drug' | 'drug-target', parameters) { diff --git a/src/index.html b/src/index.html index 698f37521eeb39d905ac660f2336550da42ee2f8..7569b4e2fafc8d6ba191416310df563dd3838282 100644 --- a/src/index.html +++ b/src/index.html @@ -146,7 +146,7 @@ } function initTaskEventListener(){ - document.getElementsByTagName("network-expander")[0].addEventListener("taskEvent",(event)=>{console.log(event.detail)}) + document.getElementsByTagName("drugst-one")[0].addEventListener("taskEvent",(event)=>{console.log(event.detail)}) } diff --git a/src/index_static.html b/src/index_static.html index 414593aedd1c7da677bcd815bd1f34f46f60ab4c..0288fe378a742e5299720bc46ae810889c909880 100644 --- a/src/index_static.html +++ b/src/index_static.html @@ -143,7 +143,7 @@ } function initTaskEventListener(){ - document.getElementsByTagName("network-expander")[0].addEventListener("taskEvent",(event)=>{console.log(event.detail)}) + document.getElementsByTagName("drugst-one")[0].addEventListener("taskEvent",(event)=>{console.log(event.detail)}) } function applyDataset(){