This repository has been archived on 2025-12-25. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
qmi-cloud/src/app/modals/modalinfo.component.ts
Manuel Romero c08db405f4 ui fixes
2022-11-18 13:49:47 +01:00

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;
}
}
}