summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app
diff options
context:
space:
mode:
authorimamSidero <imam.hussain@est.tech>2023-07-18 11:04:25 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2023-07-28 14:58:32 +0000
commit4cbd35c09d849b29f2981ab18b8ef44b9c31a949 (patch)
treee59968b54c0d2c0ba96cd8afb1b5836a684f4966 /catalog-ui/src/app
parent3858b54b0dbc432ee5848f56a7baf87f406f6639 (diff)
Provide timeout field in interface operation implementation
Timeout field with timeout type is provided in interface operation implementation Issue-ID: SDC-4575 Signed-off-by: Imam hussain <imam.hussain@est.tech> Change-Id: I7cde19b933f71f3ef45ff7130a8df704b2aacbdc
Diffstat (limited to 'catalog-ui/src/app')
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/interface-operatons/interface-operations.component.ts7
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.html9
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.less13
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.ts35
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.module.ts2
-rw-r--r--catalog-ui/src/app/ng2/pages/interface-definition/interface-definition.page.component.ts7
6 files changed, 73 insertions, 0 deletions
diff --git a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/interface-operations.component.ts b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/interface-operations.component.ts
index 2c1497ee2f..04210ae39c 100644
--- a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/interface-operations.component.ts
+++ b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/interface-operations.component.ts
@@ -289,12 +289,19 @@ export class InterfaceOperationsComponent {
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,
diff --git a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.html b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.html
index cf9a04ae0a..0b42f756b3 100644
--- a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.html
+++ b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.html
@@ -146,5 +146,14 @@
>
</app-add-input>
</div>
+ <div class="group-with-border content-row">
+ <label class="sdc-timeout-label">Timeout : </label>
+ <input class="sdc-timeout" type="number" [formControl]="timeoutValue" oninput="this.value = this.valueAsNumber" [ngClass]="{'disabled':isViewOnly}" (change)="timeoutConversion()"/>
+ <select class="sdc-timeout-select" [formControl]="timeoutType" (change)="timeoutConversion()" [ngClass]="{'disabled':isViewOnly}">
+ <option value="sec">Seconds</option>
+ <option value="hour">Hours</option>
+ <option value="day">Days</option>
+ </select>
+ </div>
</form>
</div>
diff --git a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.less b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.less
index 5edf97f33c..7c333ce692 100644
--- a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.less
+++ b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.less
@@ -228,3 +228,16 @@
.operation-handler::-webkit-scrollbar-track {
border: 0;
}
+
+.sdc-timeout-label {
+ width: 100%;
+}
+
+.sdc-timeout {
+ box-sizing : border-box;
+ padding : 0 10px;
+ width : 10%;
+ border: solid 1px #d2d2d2;
+ border-radius : 2px;
+ color: #5a5a5a;
+}
diff --git a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.ts b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.ts
index 4a68de26bc..5c5ec1be34 100644
--- a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.ts
+++ b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.ts
@@ -19,6 +19,7 @@
* ============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";
@@ -89,6 +90,8 @@ export class InterfaceOperationHandlerComponent {
enableAddArtifactImplementation: boolean;
propertyValueValid: boolean = true;
inputTypeOptions: any[];
+ timeoutValue = new FormControl('');
+ timeoutType = new FormControl('');
constructor(private dataTypeService: DataTypeService,
private componentServiceNg2: ComponentServiceNg2,
@@ -105,6 +108,23 @@ export class InterfaceOperationHandlerComponent {
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();
@@ -259,6 +279,21 @@ export class InterfaceOperationHandlerComponent {
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
diff --git a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.module.ts b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.module.ts
index b4fc9d1bdb..3fa20ab624 100644
--- a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.module.ts
+++ b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.module.ts
@@ -23,6 +23,7 @@ import {NgModule} from "@angular/core";
import {CommonModule} from "@angular/common";
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
+import {BrowserModule} from '@angular/platform-browser';
import {FormElementsModule} from "app/ng2/components/ui/form-components/form-elements.module";
import {TranslateModule} from "app/ng2/shared/translator/translate.module";
import {AddInputComponent} from './add-input/add-input.component';
@@ -46,6 +47,7 @@ import {ToscaFunctionModule} from '../../../properties-assignment/tosca-function
imports: [
CommonModule,
SdcUiComponentsModule,
+ BrowserModule,
FormsModule,
FormElementsModule,
TranslateModule,
diff --git a/catalog-ui/src/app/ng2/pages/interface-definition/interface-definition.page.component.ts b/catalog-ui/src/app/ng2/pages/interface-definition/interface-definition.page.component.ts
index f4706b91b9..90d6a6cfde 100644
--- a/catalog-ui/src/app/ng2/pages/interface-definition/interface-definition.page.component.ts
+++ b/catalog-ui/src/app/ng2/pages/interface-definition/interface-definition.page.component.ts
@@ -279,12 +279,19 @@ export class InterfaceDefinitionComponent {
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;