Skip to content

Commit

Permalink
feat(workflow): MAUS and EMU-webApp can be skipped
Browse files Browse the repository at this point in the history
Closes #4
  • Loading branch information
julianpoemp committed Jun 3, 2018
1 parent f3f3f0b commit dca41ef
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 22 deletions.
19 changes: 19 additions & 0 deletions src/app/components/proceedings/proceedings.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,23 @@ table thead tr th:hover {

.table-striped .tool-selected {
background-color: lightyellow;
}

.subTableHeader th {
border-top: none;
padding: 3px;
}

.subTableHeader {
border-top: none;
}

.tableHeaderTop {
border-bottom: none;
padding-bottom: 0;
}

.tableHeaderTop th {
border-bottom: none;
padding-bottom: 0;
}
25 changes: 20 additions & 5 deletions src/app/components/proceedings/proceedings.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
</ng-container>
</ng-container>
<ng-container *ngIf="popover.operation === null && popover.task !== null && popover.task !== undefined">
{{popover.y}}
<ng-container *ngIf="popover.task.state === 'FINISHED'">
<!-- <a [href]="getMailToLink(popover.task)">Share results <i class="fa fa-envelope" aria-hidden="true"
style="color:cornflowerblue;"></i></a> -->
Expand All @@ -93,7 +92,7 @@
<!-- Big proceedings table -->
<table class="table table-striped">
<thead>
<tr>
<tr class="tableHeaderTop">
<th>File</th>
<ng-container *ngFor="let operation of operations; let i = index" style="text-align: center;">
<th style="padding-left:3px;padding-right:3px;" [title]="operation.name">
Expand Down Expand Up @@ -121,13 +120,29 @@
</ng-template>
</div>
</div>
<input *ngIf="operation.name === 'OCTRA' || operation.name === 'ASR'" type="checkbox"
class="header-checkbox"
[checked]="operation.enabled" (click)="deactivateOperation(operation, i)"/>
</div>
</th>
</ng-container>
</tr>
<tr class="subTableHeader">
<th></th>
<ng-container *ngFor="let operation of operations; let i = index" style="text-align: center;">
<th *ngIf="operation.name === 'OCTRA' || operation.name === 'ASR'">
<input type="checkbox"
class="header-checkbox"
[checked]="operation.enabled" (click)="deactivateOperation(operation, i)"/>
</th>
<th *ngIf="operation.name === 'MAUS'" colspan="2" style="position: relative">
<img src="assets/directory.png" style="height:25px;left:0;position:absolute"/>
<input type="checkbox"
class="header-checkbox"
[checked]="operation.enabled" (click)="deactivateOperation(operation, i)"/>
<img src="assets/directory.png"
style="height:25px;-webkit-transform: scaleX(-1); transform: scaleX(-1);right:0;position:absolute"/>
</th>
<th *ngIf="i === 0"></th>
</ng-container>
</tr>
</thead>
<tbody (contextmenu)="onContextMenu($event)">
<ng-container *ngFor="let entry of taskList.entries; let i = index;">
Expand Down
17 changes: 17 additions & 0 deletions src/app/components/proceedings/proceedings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {ASROperation} from '../../obj/tasks/asr-operation';
import {QueueItem} from '../../obj/preprocessor';
import {FilePreviewModalComponent} from '../../modals/file-preview-modal/file-preview-modal.component';
import {DownloadModalComponent} from '../../modals/download-modal/download-modal.component';
import {G2pMausOperation} from '../../obj/tasks/g2p-maus-operation';

declare var window: any;

Expand Down Expand Up @@ -469,6 +470,7 @@ export class ProceedingsComponent implements OnInit, OnDestroy {
}

deactivateOperation(operation: Operation, index: number) {
// TODO improve code!
let tasks = this.taskList.getAllTasks().filter((a) => {
return a.state === TaskState.QUEUED || a.state === TaskState.PENDING;
});
Expand Down Expand Up @@ -511,6 +513,21 @@ export class ProceedingsComponent implements OnInit, OnDestroy {
}
}
}
} else if (operation instanceof G2pMausOperation) {
next.enabled = !next.enabled;

for (let i = 0; i < tasks.length; i++) {
const task = tasks[i];
const task_operation = task.operations[index + 1];
const currOperation = task.operations[index];

if (task_operation.state === TaskState.PENDING) {
task_operation.enabled = next.enabled;
}
if (currOperation.state === TaskState.PENDING) {
currOperation.enabled = operation.enabled;
}
}
}

this.updateEnableState();
Expand Down
43 changes: 31 additions & 12 deletions src/app/modals/queue-modal/queue-modal.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ <h4 class="modal-title">Queue</h4>
</div>
<table class="table table-responsive-md table-striped">
<thead>
<th>File</th>
<th>Language</th>
<th *ngFor="let operation of operations; let i = index">
<div>
<tr>
<th>File</th>
<th>Language</th>
<th *ngFor="let operation of operations; let i = index">
<div>
<span *ngIf="operation.icon === ''; else showIcon" style="display:block;"
(click)="openContentModal(operation)">
<ng-container *ngIf="shortstyle">
Expand All @@ -56,14 +57,32 @@ <h4 class="modal-title">Queue</h4>
{{operation.name}}
</ng-container>
</span>
<ng-template #showIcon>
<div [innerHTML]="operation.icon" (click)="openContentModal(operation)"></div>
</ng-template>
<input *ngIf="operation.name === 'OCTRA' || operation.name === 'ASR'" type="checkbox"
class="header-checkbox"
[checked]="operation.enabled" (click)="deactivateOperation(operation, i)"/>
</div>
</th>
<ng-template #showIcon>
<div [innerHTML]="operation.icon"></div>
</ng-template>
</div>
</th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
<ng-container *ngFor="let operation of operations; let i = index">
<th *ngIf="operation.name === 'OCTRA' || operation.name === 'ASR'">
<input type="checkbox"
class="header-checkbox"
[checked]="operation.enabled" (click)="deactivateOperation(operation, i)"/>
</th>
<th *ngIf="operation.name === 'MAUS'" colspan="2" style="position: relative">
<img src="assets/directory.png" style="height:25px;left:0;position:absolute"/>
<input type="checkbox"
class="header-checkbox"
[checked]="operation.enabled" (click)="deactivateOperation(operation, i)"/>
<img src="assets/directory.png"
style="height:25px;-webkit-transform: scaleX(-1); transform: scaleX(-1);right:0;position:absolute"/>
</th>
</ng-container>
</tr>
</thead>
<tbody>
<ng-container *ngFor="let task of tasks">
Expand Down
16 changes: 16 additions & 0 deletions src/app/modals/queue-modal/queue-modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {ASROperation} from '../../obj/tasks/asr-operation';
import {OCTRAOperation} from '../../obj/tasks/octra-operation';
import {StorageService} from '../../storage.service';
import {isNullOrUndefined} from 'util';
import {G2pMausOperation} from '../../obj/tasks/g2p-maus-operation';

@Component({
selector: 'app-queue-modal',
Expand Down Expand Up @@ -143,6 +144,21 @@ export class QueueModalComponent implements OnInit {
}
}
}
} else if (operation instanceof G2pMausOperation) {
next.enabled = !next.enabled;

for (let i = 0; i < tasks.length; i++) {
const task = tasks[i];
const task_operation = task.operations[index + 1];
const currOperation = task.operations[index];

if (task_operation.state === TaskState.PENDING) {
task_operation.enabled = next.enabled;
}
if (currOperation.state === TaskState.PENDING) {
currOperation.enabled = operation.enabled;
}
}
}

this.updateEnableState();
Expand Down
19 changes: 14 additions & 5 deletions src/app/obj/tasks/task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ export class TaskService implements OnDestroy {
this._taskList.addEntry(taskDir);
}
}
this.protocolURL = this.updateProtocolURL();
this.updateProtocolURL().then((url) => {
this.protocolURL = url;
});
}
if (!isNullOrUndefined(results[1])) {
// read userSettings
Expand Down Expand Up @@ -343,7 +345,10 @@ export class TaskService implements OnDestroy {
this.state = TaskState.READY;
}
this.storage.saveTask(task);
this.protocolURL = this.updateProtocolURL();

this.updateProtocolURL().then((url) => {
this.protocolURL = url;
});
}));
}

Expand Down Expand Up @@ -438,7 +443,10 @@ export class TaskService implements OnDestroy {

task.statechange.subscribe((obj) => {
this.storage.saveTask(task);
this.protocolURL = this.updateProtocolURL();

this.updateProtocolURL().then((url) => {
this.protocolURL = url;
});
});
this.storage.saveTask(task);
task.start(this.httpclient);
Expand Down Expand Up @@ -495,11 +503,12 @@ export class TaskService implements OnDestroy {
};

this.protocolFileName = 'oh_portal_' + Date.now() + '.json';
const file = new File([JSON.stringify(json)], this.protocolFileName, {
const file = new File([JSON.stringify(json, null, 2)], this.protocolFileName, {
'type': 'text/plain'
});

resolve(this.sanitizer.bypassSecurityTrustResourceUrl(URL.createObjectURL(file)));
const url = URL.createObjectURL(file);
resolve(this.sanitizer.bypassSecurityTrustResourceUrl(url));
}).catch((error) => {
reject(error);
});
Expand Down

0 comments on commit dca41ef

Please sign in to comment.