this.modalServiceNg2.currentModal.instance.dynamicContent.instance.isLoading = true;
const interfaceOperationHandlerComponentInstance: InterfaceOperationHandlerComponent = this.modalInstance.instance.dynamicContent.instance;
const operationUpdated: InterfaceOperationModel = interfaceOperationHandlerComponentInstance.operationToUpdate;
+ let timeout = null;
+ if (operationUpdated.implementation && operationUpdated.implementation.timeout != null) {
+ timeout = operationUpdated.implementation.timeout;
+ }
const isArtifactChecked = interfaceOperationHandlerComponentInstance.enableAddArtifactImplementation;
if (!isArtifactChecked) {
let artifactName = interfaceOperationHandlerComponentInstance.artifactName;
artifactName = artifactName === undefined ? '' : artifactName;
operationUpdated.implementation = new ArtifactModel({'artifactName': artifactName, 'artifactVersion': ''} as ArtifactModel);
}
+ if (timeout != null) {
+ operationUpdated.implementation.timeout = timeout;
+ }
this.topologyTemplateService.updateComponentInstanceInterfaceOperation(
this.componentMetaData.uniqueId,
this.componentMetaData.componentType,
* ============LICENSE_END=========================================================
*/
import {Component, EventEmitter, Output, ViewChild} from '@angular/core';
+import { FormControl } from '@angular/forms';
import {UIInterfaceModel} from "../interface-operations.component";
import {InputOperationParameter, InterfaceOperationModel, IOperationParamsList} from "../../../../../models/interfaceOperation";
import {TranslateService} from "../../../../shared/translator/translate.service";
enableAddArtifactImplementation: boolean;
propertyValueValid: boolean = true;
inputTypeOptions: any[];
+ timeoutValue = new FormControl('');
+ timeoutType = new FormControl('');
constructor(private dataTypeService: DataTypeService,
private componentServiceNg2: ComponentServiceNg2,
this.operationToUpdate.interfaceId = this.input.selectedInterface.uniqueId;
this.operationToUpdate.interfaceType = this.input.selectedInterface.type;
this.modelName = this.input.modelName;
+ this.timeoutType.setValue('sec');
+ if (this.operationToUpdate.implementation && this.operationToUpdate.implementation.timeout != null) {
+ this.timeoutValue.setValue(this.operationToUpdate.implementation.timeout);
+ let timeout = this.timeoutValue.value / 3600;
+ if (Number.isInteger(timeout)) {
+ if (timeout > 23 && Number.isInteger(timeout / 24)) {
+ this.timeoutValue.setValue(timeout / 24);
+ this.timeoutType.setValue("day");
+ } else {
+ this.timeoutValue.setValue(timeout);
+ this.timeoutType.setValue("hour");
+ }
+ } else if (Number.isInteger(timeout / 24)) {
+ this.timeoutValue.setValue(timeout / 24);
+ this.timeoutType.setValue("day");
+ }
+ }
this.initCustomToscaFunctions();
this.initInputs();
this.removeImplementationQuote();
this.inputs.splice(index, 1);
}
+ timeoutConversion = (): void => {
+ let timeout = this.timeoutValue.value;
+ if (timeout != null) {
+ if (this.timeoutType.value == null || this.timeoutType.value == 'sec') {
+ this.operationToUpdate.implementation.timeout = timeout;
+ return;
+ }
+ if (this.timeoutType.value == 'hour') {
+ this.operationToUpdate.implementation.timeout = timeout * 3600;
+ } else if (this.timeoutType.value == 'day') {
+ this.operationToUpdate.implementation.timeout = (timeout * 24) * 3600;
+ }
+ }
+ }
+
private removeImplementationQuote(): void {
if (this.operationToUpdate.implementation) {
if (!this.operationToUpdate.implementation
this.modalServiceNg2.currentModal.instance.dynamicContent.instance.isLoading = true;
const interfaceOperationHandlerComponentInstance: InterfaceOperationHandlerComponent = this.modalInstance.instance.dynamicContent.instance;
const operationToUpdate = this.modalInstance.instance.dynamicContent.instance.operationToUpdate;
+ let timeout = null;
+ if (operationToUpdate.implementation && operationToUpdate.implementation.timeout != null) {
+ timeout = operationToUpdate.implementation.timeout;
+ }
const isArtifactChecked = interfaceOperationHandlerComponentInstance.enableAddArtifactImplementation;
if (!isArtifactChecked) {
const artifactName = interfaceOperationHandlerComponentInstance.artifactName ?
interfaceOperationHandlerComponentInstance.artifactName : '';
operationToUpdate.implementation = new ArtifactModel({'artifactName': artifactName, 'artifactVersion': ''} as ArtifactModel);
}
+ if (timeout != null) {
+ operationToUpdate.implementation.timeout = timeout;
+ }
this.componentServiceNg2.updateComponentInterfaceOperation(this.component.uniqueId, operationToUpdate)
.subscribe((newOperation: InterfaceOperationModel) => {
let oldOpIndex;