feature/823 Add in application entry point dynamic deep liking
This commit is contained in:
parent
99bd8118b7
commit
18bd696641
|
@ -10,7 +10,8 @@
|
|||
<span title="Complete task and return to task list" class="material-icons md-20 blue">check</span>
|
||||
</button>
|
||||
<button type="button" data-toggle="dropdown" aria-expanded="true" class="btn btn-default dropdown-toggle">
|
||||
<span title="Transfer task to another workbasket" class="material-icons md-20 blue">transfer_within_a_station</span>
|
||||
<span title="Transfer task to another workbasket"
|
||||
class="material-icons md-20 blue">transfer_within_a_station</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li *ngFor="let workbasket of workbaskets">
|
||||
|
@ -38,19 +39,19 @@
|
|||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="task-note" class="control-label">Note</label>
|
||||
<input type="text" disabled class="form-control" id="task-note" placeholder="Task has no Note" [(ngModel)]="task.note"
|
||||
name="task.note">
|
||||
<input type="text" disabled class="form-control" id="task-note" placeholder="Task has no Note"
|
||||
[(ngModel)]="task.note" name="task.note">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="task-due" class="control-label">Due Date</label>
|
||||
<input type="text" disabled class="form-control" id="task-due" placeholder="No deadline set" [(ngModel)]="task.due"
|
||||
name="task.due">
|
||||
<input type="text" disabled class="form-control" id="task-due" placeholder="No deadline set"
|
||||
[(ngModel)]="task.due" name="task.due">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="row">
|
||||
<iframe class="col-xs-12" [src]="link"></iframe>
|
||||
<iframe class="col-xs-12" *ngIf="link" [src]="link"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -13,6 +13,7 @@ import { DomainService } from 'app/services/domain/domain.service';
|
|||
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
|
||||
import { SelectedRouteService } from 'app/services/selected-route/selected-route';
|
||||
import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
|
||||
import { ClassificationsService } from 'app/services/classifications/classifications.service';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-dummy-detail',
|
||||
|
@ -35,7 +36,7 @@ xdescribe('TaskComponent', () => {
|
|||
imports: [FormsModule, HttpClientModule, RouterTestingModule.withRoutes(routes)],
|
||||
declarations: [TaskComponent, SpinnerComponent, DummyDetailComponent],
|
||||
providers: [TaskService, HttpClient, WorkbasketService, DomainService, RequestInProgressService,
|
||||
SelectedRouteService, GeneralModalService]
|
||||
SelectedRouteService, GeneralModalService, ClassificationsService]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
import {Component, OnDestroy, OnInit} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {Task} from 'app/workplace/models/task';
|
||||
import {Workbasket} from 'app/models/workbasket';
|
||||
import {DomSanitizer, SafeResourceUrl} from '@angular/platform-browser';
|
||||
import {TaskService} from 'app/workplace/services/task.service';
|
||||
import {WorkbasketService} from 'app/services/workbasket/workbasket.service';
|
||||
import {Subscription} from 'rxjs';
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Task } from 'app/workplace/models/task';
|
||||
import { Workbasket } from 'app/models/workbasket';
|
||||
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
|
||||
import { TaskService } from 'app/workplace/services/task.service';
|
||||
import { WorkbasketService } from 'app/services/workbasket/workbasket.service';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { ClassificationsService } from 'app/services/classifications/classifications.service';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -18,18 +19,20 @@ export class TaskComponent implements OnInit, OnDestroy {
|
|||
routeSubscription: Subscription;
|
||||
requestInProgress = false;
|
||||
|
||||
address = 'https://bing.com';
|
||||
link: SafeResourceUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.address);
|
||||
regex = /\${(.*?)}/g
|
||||
address = 'https://bing.com/';
|
||||
link: SafeResourceUrl;
|
||||
|
||||
task: Task = null;
|
||||
workbaskets: Workbasket[];
|
||||
|
||||
|
||||
constructor(private taskService: TaskService,
|
||||
private workbasketService: WorkbasketService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private sanitizer: DomSanitizer) {
|
||||
private workbasketService: WorkbasketService,
|
||||
private classificationService: ClassificationsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private sanitizer: DomSanitizer) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -39,15 +42,16 @@ export class TaskComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
}
|
||||
|
||||
getTask(id: string) {
|
||||
async getTask(id: string) {
|
||||
this.requestInProgress = true;
|
||||
this.taskService.getTask(id).subscribe(
|
||||
task => {
|
||||
this.requestInProgress = false;
|
||||
this.task = task;
|
||||
this.link = this.sanitizer.bypassSecurityTrustResourceUrl(`${this.address}/?q=${this.task.name}`);
|
||||
this.getWorkbaskets();
|
||||
});
|
||||
this.task = await this.taskService.getTask(id).toPromise()
|
||||
const classification = await this.classificationService.getClassification
|
||||
(this.task.classificationSummaryResource.classificationId).toPromise();
|
||||
this.address = this.extractUrl(classification.applicationEntryPoint) || `${this.address}/?q=${this.task.name}`;
|
||||
this.link = this.sanitizer.bypassSecurityTrustResourceUrl(this.address);
|
||||
this.getWorkbaskets();
|
||||
this.requestInProgress = false;
|
||||
|
||||
}
|
||||
|
||||
getWorkbaskets() {
|
||||
|
@ -90,7 +94,26 @@ export class TaskComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
navigateBack() {
|
||||
this.router.navigate([{outlets: {detail: `taskdetail/${this.task.taskId}`}}], {relativeTo: this.route.parent});
|
||||
this.router.navigate([{ outlets: { detail: `taskdetail/${this.task.taskId}` } }], { relativeTo: this.route.parent });
|
||||
}
|
||||
|
||||
private extractUrl(url: string): string {
|
||||
const me = this;
|
||||
const extractedExpressions = url.match(this.regex);
|
||||
if (!extractedExpressions) { return url; }
|
||||
extractedExpressions.forEach(expression => {
|
||||
const parameter = expression.substring(2, expression.length - 1);
|
||||
let objectValue: any = me;
|
||||
parameter.split('.').forEach(property => {
|
||||
objectValue = this.getReflectiveProperty(objectValue, property);
|
||||
})
|
||||
url = url.replace(expression, objectValue);
|
||||
})
|
||||
return url;
|
||||
}
|
||||
|
||||
private getReflectiveProperty(scope: any, property: string) {
|
||||
return Reflect.get(scope, property)
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
|
|
Loading…
Reference in New Issue