51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
import { Component, OnInit, OnDestroy, Input } from '@angular/core';
|
|
import { MDBModalRef } from 'angular-bootstrap-md';
|
|
import { ProvisionsService } from '../services/provisions.service';
|
|
|
|
@Component({
|
|
selector: 'qmi-modalinfo',
|
|
templateUrl: './modalinfo.component.html',
|
|
styleUrls: ['./modalinfo.component.scss']
|
|
})
|
|
export class ModalInfoComponent implements OnInit, OnDestroy {
|
|
|
|
provisionId;
|
|
info;
|
|
events;
|
|
|
|
constructor( public modalRef: MDBModalRef, private _provisionsService: ProvisionsService ) {}
|
|
|
|
ngOnInit() {
|
|
|
|
this._provisionsService.getProvisionById(this.provisionId).subscribe( provision => {
|
|
this.info = provision;
|
|
this._provisionsService.getEvents(provision.user._id, provision._id).subscribe(res=> {
|
|
this.events = res.results;
|
|
});
|
|
});
|
|
}
|
|
|
|
ngOnDestroy() {
|
|
|
|
}
|
|
|
|
getOptionName(key){
|
|
console.log("getOptionName: ", key);
|
|
if ( this.info && this.info._scenarioDoc && this.info._scenarioDoc.availableProductVersions){
|
|
console.log("availableProductVersions", this.info._scenarioDoc.availableProductVersions);
|
|
var found = this.info._scenarioDoc.availableProductVersions.find(function(opt) {
|
|
return opt.index === key
|
|
});
|
|
console.log("found", found.length, found);
|
|
if (found.length){
|
|
return found[0].product? found[0].product : found[0].index;
|
|
} else {
|
|
return key;
|
|
}
|
|
} else {
|
|
return key;
|
|
}
|
|
}
|
|
|
|
}
|