Name and File fields now called Artifact File URI.
Add Artifact To Implementation renamed to Add Artifact Details,
it was also added to localization.
Artifact File URI is made always visible,
and Add Artifact Details moved underneath it.
Issue-ID: SDC-3982
Signed-off-by: stasys10 <stasys.jurgaitis@est.tech>
Change-Id: I4cbe864347d156137a2ab4746500e5fd454a2b26
this.description = operation.description;
this.operationType = operation.operationType;
this.uniqueId = operation.uniqueId;
- this.inputParams = operation.inputParams;
- this.implementation = operation.implementation;
+ if (operation.inputParams && operation.inputParams.listToscaDataDefinition) {
+ const listToscaDataDefinition: InputOperationParameter[] = [];
+ operation.inputParams.listToscaDataDefinition.forEach(inputOperation => {
+ listToscaDataDefinition.push(new InputOperationParameter(inputOperation));
+ });
+ this.inputParams = <IOperationParamsList> {
+ 'listToscaDataDefinition': listToscaDataDefinition
+ };
+ }
+ if (operation.implementation) {
+ this.implementation = new ArtifactModel(operation.implementation);
+ }
}
}
if (!isArtifactChecked) {
let artifactName = interfaceOperationHandlerComponentInstance.artifactName;
artifactName = artifactName === undefined ? '' : artifactName;
- operationUpdated.implementation = new ArtifactModel({'artifactName': artifactName} as ArtifactModel);
+ operationUpdated.implementation = new ArtifactModel({'artifactName': artifactName, 'artifactVersion': ''} as ArtifactModel);
}
this.topologyTemplateService.updateComponentInstanceInterfaceOperation(
this.componentMetaData.uniqueId,
<div class="group-with-border content-row">
<label class="occurrences-label"> {{ 'INTERFACE_OPERATION_IMPLEMENTATION' | translate}}</label>
<div class="form-item">
- <checkbox [label]="'Add Artifact To Implementation'"
- [(checked)]="enableAddArtifactImplementation"
- (checkedChange)="onMarkToAddArtifactToImplementation($event)"
- [disabled]=isViewOnly>
- </checkbox>
- </div>
- <div class="form-item" *ngIf="!enableAddArtifactImplementation">
<sdc-input
- label="{{'INTERFACE_OPERATION_IMPLEMENTATION_NAME' | translate}}"
+ label="{{'INTERFACE_OPERATION_IMPLEMENTATION_ARTIFACT_URI' | translate}}"
testId="interface-operation-implementation-name"
[(value)]="artifactName"
- (valueChange)="onImplementationNameChange($event)"
+ (valueChange)="onURIChange($event)"
[disabled]=isViewOnly>
</sdc-input>
</div>
-
- <div class="side-by-side" *ngIf="enableAddArtifactImplementation">
- <div class="form-item" *ngIf="toscaArtifactTypes">
- <sdc-dropdown
- label="{{ 'TOSCA_ARTIFACT_TYPE' | translate }}"
- testId="selectToscaArtifactType"
- [required]="true"
- [selectedOption]="toscaArtifactTypeSelected"
- placeHolder="{{toscaArtifactTypeSelected != undefined ? toscaArtifactTypeSelected : 'Select...'}}"
- (changed)="onSelectToscaArtifactType($event)"
- [options]="toscaArtifactTypes"
- [disabled]=isViewOnly>
- </sdc-dropdown>
- </div>
- <div class="form-item" *ngIf="toscaArtifactTypeSelected && enableAddArtifactImplementation">
- <sdc-input
- label="{{ 'INTERFACE_OPERATION_IMPLEMENTATION_FILE' | translate }}"
- data-tests-id="artifactFile"
- [(value)]="artifactName"
- [required]="true"
- (valueChange)="onArtifactFileChange($event)"
- [disabled]=isViewOnly>
- </sdc-input>
- </div>
- <div class="form-item">
- <sdc-input
- label="{{ 'ARTIFACT_VERSION' | translate }}"
- data-tests-id="artifactVersion"
- [(value)]="artifactVersion"
- (valueChange)="onArtifactVersionChange($event)"
- [disabled]=isViewOnly>
- </sdc-input>
- </div>
+ <br>
+ <div class="form-item">
+ <checkbox [label]="'ADD_ARTIFACT_DETAILS' | translate"
+ [(checked)]="enableAddArtifactImplementation"
+ (checkedChange)="onMarkToAddArtifactToImplementation($event)"
+ [disabled]=isViewOnly>
+ </checkbox>
+ </div>
+ <div class="form-item" *ngIf="toscaArtifactTypes && enableAddArtifactImplementation">
+ <br>
+ <sdc-dropdown
+ label="{{ 'TOSCA_ARTIFACT_TYPE' | translate }}"
+ testId="selectToscaArtifactType"
+ [required]="true"
+ [selectedOption]="toscaArtifactTypeSelected"
+ placeHolder="{{toscaArtifactTypeSelected != undefined ? toscaArtifactTypeSelected : 'Select...'}}"
+ (changed)="onSelectToscaArtifactType($event)"
+ [options]="toscaArtifactTypes"
+ [disabled]=isViewOnly>
+ </sdc-dropdown>
+ </div>
+ <div class="form-item" *ngIf="enableAddArtifactImplementation">
+ <sdc-input
+ label="{{ 'ARTIFACT_VERSION' | translate }}"
+ data-tests-id="artifactVersion"
+ [(value)]="artifactVersion"
+ (valueChange)="onArtifactVersionChange($event)"
+ [disabled]=isViewOnly>
+ </sdc-input>
</div>
<div class="form-item" *ngIf="toscaArtifactTypeSelected && enableAddArtifactImplementation">
+ <br>
<input-list
*ngIf="artifactTypeProperties && dataTypeMap"
[title]="'ARTIFACT_PROPERTY_LIST_TITLE' | translate"
this.isViewOnly = this.input.isViewOnly;
this.isEdit = this.input.isEdit;
this.interfaceType = this.input.selectedInterface.type;
- this.operationToUpdate = this.input.selectedInterfaceOperation;
+ this.operationToUpdate = new InterfaceOperationModel(this.input.selectedInterfaceOperation);
this.operationToUpdate.interfaceId = this.input.selectedInterface.uniqueId;
this.operationToUpdate.interfaceType = this.input.selectedInterface.type;
this.modelName = this.input.modelName;
this.operationToUpdate.description = value;
}
- onImplementationNameChange(value: any) {
- this.readonly = true
- if (value || value === '') {
+ onURIChange(value: string | undefined) {
+ if(!this.operationToUpdate.implementation){
let artifact = new ArtifactModel();
- artifact.artifactName = value;
this.operationToUpdate.implementation = artifact;
- this.enableAddArtifactImplementation = false;
- this.readonly = false;
}
+ this.operationToUpdate.implementation.artifactName = value ? value : '';
}
onPropertyValueChange = (propertyValue) => {
this.emitter.emit(propertyValue);
}
- onMarkToAddArtifactToImplementation(event: any) {
+ onMarkToAddArtifactToImplementation(event: boolean) {
if (!event) {
this.toscaArtifactTypeSelected = undefined;
this.artifactVersion = undefined;
if (this.operationToUpdate.implementation.artifactType) {
this.operationToUpdate.implementation.artifactName = '';
- this.artifactName = undefined;
+ this.operationToUpdate.implementation.artifactVersion = '';
}
this.toscaArtifactTypeProperties = undefined;
this.artifactTypeProperties = undefined;
if (type) {
let toscaArtifactType = type.value;
let artifact = new ArtifactModel();
- this.artifactName = undefined;
- this.artifactVersion = undefined;
+ artifact.artifactName = this.operationToUpdate.implementation.artifactName;
+ artifact.artifactVersion = this.operationToUpdate.implementation.artifactVersion;
artifact.artifactType = toscaArtifactType.type;
artifact.properties = toscaArtifactType.properties;
this.toscaArtifactTypeProperties = artifact.properties;
this.validateRequiredField();
}
- onArtifactFileChange(value: any) {
- if (value) {
- this.operationToUpdate.implementation.artifactName = value;
- }
- this.validateRequiredField();
- }
-
- onArtifactVersionChange(value: any) {
- if (value) {
- this.operationToUpdate.implementation.artifactVersion = value;
- }
+ onArtifactVersionChange(value: string | undefined) {
+ this.operationToUpdate.implementation.artifactVersion = value ? value : '';
}
onAddInput(inputOperationParameter: InputOperationParameter) {
private getArtifactTypesSelected() {
if (this.operationToUpdate.implementation && this.operationToUpdate.implementation.artifactType) {
- this.artifactName = this.operationToUpdate.implementation.artifactName;
+ this.artifactName =
+ this.artifactName ? this.artifactName : this.operationToUpdate.implementation.artifactName;
this.toscaArtifactTypeSelected = this.operationToUpdate.implementation.artifactType;
- this.artifactVersion = this.operationToUpdate.implementation.artifactVersion;
+ this.artifactVersion =
+ this.artifactVersion ? this.artifactVersion : this.operationToUpdate.implementation.artifactVersion;
this.toscaArtifactTypeProperties = this.operationToUpdate.implementation.properties;
this.artifactTypeProperties = this.convertArtifactsPropertiesToInput();
this.enableAddArtifactImplementation = true;
import {ModalService} from 'app/ng2/services/modal.service';
import {
+ ArtifactModel,
ButtonModel,
CapabilitiesGroup,
InputBEModel,
constructor(operation: OperationModel) {
super(operation);
-
if (!operation.description) {
this.description = '';
}
}
private updateOperation = (): void => {
- let operationToUpdate = this.modalInstance.instance.dynamicContent.instance.operationToUpdate;
+ this.modalServiceNg2.currentModal.instance.dynamicContent.instance.isLoading = true;
+ const interfaceOperationHandlerComponentInstance: InterfaceOperationHandlerComponent = this.modalInstance.instance.dynamicContent.instance;
+ const operationToUpdate = this.modalInstance.instance.dynamicContent.instance.operationToUpdate;
+ const isArtifactChecked = interfaceOperationHandlerComponentInstance.enableAddArtifactImplementation;
+ if (!isArtifactChecked) {
+ const artifactName = interfaceOperationHandlerComponentInstance.artifactName ?
+ interfaceOperationHandlerComponentInstance.artifactName : '';
+ operationToUpdate.implementation = new ArtifactModel({'artifactName': artifactName, 'artifactVersion': ''} as ArtifactModel);
+ }
this.componentServiceNg2.updateComponentInterfaceOperation(this.component.uniqueId, operationToUpdate)
.subscribe((newOperation: InterfaceOperationModel) => {
let oldOpIndex;
}
});
});
- newOperation = this.handleEnableAddArtifactImplementation(newOperation);
oldInterf.operations.splice(oldOpIndex, 1);
oldInterf.operations.push(new InterfaceOperationModel(newOperation));
+ }, error => {
+ this.modalServiceNg2.currentModal.instance.dynamicContent.instance.isLoading = false;
+ }, () => {
+ this.sortInterfaces();
+ this.modalServiceNg2.currentModal.instance.dynamicContent.instance.isLoading = false;
+ this.modalServiceNg2.closeCurrentModal();
});
- this.modalServiceNg2.closeCurrentModal();
}
private createOperationCallback(): void {
+ this.modalServiceNg2.currentModal.instance.dynamicContent.instance.isLoading = true;
const operationToUpdate = this.modalInstance.instance.dynamicContent.instance.operationToUpdate;
console.log('createOperationCallback', operationToUpdate);
console.log('this.component', this.component);
uiInterfaceModel.operations.push(new UIOperationModel(new OperationModel(newOperation)));
this.interfaces.push(uiInterfaceModel);
}
+ }, error => {
+ this.modalServiceNg2.currentModal.instance.dynamicContent.instance.isLoading = false;
+ }, () => {
+ this.modalServiceNg2.currentModal.instance.dynamicContent.instance.isLoading = false;
+ this.modalServiceNg2.closeCurrentModal();
});
- this.modalServiceNg2.closeCurrentModal();
}
private handleEnableAddArtifactImplementation = (newOperation: InterfaceOperationModel): InterfaceOperationModel => {
"ARTIFACT_PROPERTY_LIST_EMPTY": "The artifact type has no properties",
"ARTIFACT_PROPERTY_LIST_TITLE": "Artifact properties",
"INTERFACE_OPERATION_IMPLEMENTATION": "Implementation",
- "INTERFACE_OPERATION_IMPLEMENTATION_NAME": "Name",
- "INTERFACE_OPERATION_IMPLEMENTATION_FILE": "File",
+ "INTERFACE_OPERATION_IMPLEMENTATION_ARTIFACT_URI": "Artifact File URI",
+ "ADD_ARTIFACT_DETAILS": "Add Artifact Details",
"ADD_INTERFACE_OPERATION_IMPLEMENTATION_ARTIFACT": "Enable add Artifact To Implementation",
"=========== PLUGIN NOT CONNECTED ===========": "",
"PLUGIN_NOT_CONNECTED_ERROR_MAIN": "The \"{{pluginName}}\" plugin is currently unavailable.",