From 2c25cbab17de51f9b9a688644be92d0afdb2fa42 Mon Sep 17 00:00:00 2001 From: Piotr Darosz Date: Wed, 27 Mar 2019 15:25:50 +0100 Subject: Generic Artifact Browser SDC UI Introduce Generic Artifact Browser SDC UI in VF -> Deployment Artifacts view. Change-Id: I312c6c9d77f42ad2d073a8ad21c983ede39dfd0b Issue-ID: SDC-2211 Signed-off-by: Piotr Darosz --- .../deployment-artifacts-view-model.ts | 40 ++++++++++++++++++++-- .../deployment-artifacts-view.html | 5 +++ 2 files changed, 43 insertions(+), 2 deletions(-) (limited to 'catalog-ui/src/app/view-models') diff --git a/catalog-ui/src/app/view-models/workspace/tabs/deployment-artifacts/deployment-artifacts-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/deployment-artifacts/deployment-artifacts-view-model.ts index c652da4eab..73273e04d5 100644 --- a/catalog-ui/src/app/view-models/workspace/tabs/deployment-artifacts/deployment-artifacts-view-model.ts +++ b/catalog-ui/src/app/view-models/workspace/tabs/deployment-artifacts/deployment-artifacts-view-model.ts @@ -3,6 +3,7 @@ * SDC * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nokia. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +27,10 @@ import {ArtifactModel, ArtifactGroupModel, Resource} from "app/models"; import {ArtifactsUtils, ModalsHandler, ValidationUtils} from "app/utils"; import {ComponentServiceNg2} from "app/ng2/services/component-services/component.service"; import {ComponentGenericResponse} from "../../../../ng2/services/responses/component-generic-response"; +import {GenericArtifactBrowserComponent} from "../../../../ng2/components/logic/generic-artifact-browser/generic-artifact-browser.component"; +import {PathsAndNamesDefinition} from "../../../../models/paths-and-names"; +import {ModalService as ModalServiceSdcUI} from "sdc-ui/lib/angular/modals/modal.service"; +import {IModalConfig} from "sdc-ui/lib/angular/modals/models/modal-config"; interface IDeploymentArtifactsViewModelScope extends IWorkspaceViewModelScope { tableHeadersList:Array; @@ -64,7 +69,8 @@ export class DeploymentArtifactsViewModel { 'ValidationUtils', 'ArtifactsUtils', 'ModalsHandler', - 'ComponentServiceNg2' + 'ComponentServiceNg2', + 'ModalServiceSdcUI' ]; constructor(private $scope:IDeploymentArtifactsViewModelScope, @@ -73,7 +79,8 @@ export class DeploymentArtifactsViewModel { private validationUtils:ValidationUtils, private artifactsUtils:ArtifactsUtils, private ModalsHandler:ModalsHandler, - private ComponentServiceNg2: ComponentServiceNg2) { + private ComponentServiceNg2: ComponentServiceNg2, + private ModalServiceSdcUI: ModalServiceSdcUI) { this.initScope(); } @@ -270,6 +277,35 @@ export class DeploymentArtifactsViewModel { } }; + this.$scope.openGenericArtifactBrowserModal = (artifact:ArtifactModel):void => { + let modalConfig: IModalConfig = { + size: 'xl', + title: 'Generic Artifact Browser', + type: 'custom', + buttons: [{ + id: 'okButton', + text: 'OK', + size: "'x-small'", + closeModal: true + }, + {text: "Cancel", size: "'x-small'", closeModal: true}] + }; + + let pathsandnames: PathsAndNamesDefinition[] = [ + {friendlyName: 'Action', path: 'event.action[2]'}, + {friendlyName: 'Comment', path: 'event.comment'}, + {friendlyName: 'Alarm Additional Information', + path: 'event.structure.faultFields.structure.alarmAdditionalInformation.comment'}]; + + let modalInputs = { + pathsandnames: pathsandnames, + artifactid: artifact.esId, + resourceid: this.$scope.component.uniqueId + }; + + this.ModalServiceSdcUI.openCustomModal(modalConfig, GenericArtifactBrowserComponent, modalInputs); + }; + this.$scope.openEditEnvParametersModal = (artifact:ArtifactModel):void => { this.ModalsHandler.openEditEnvParametersModal(artifact, this.$scope.component).then(()=> { this.initArtifacts(true); diff --git a/catalog-ui/src/app/view-models/workspace/tabs/deployment-artifacts/deployment-artifacts-view.html b/catalog-ui/src/app/view-models/workspace/tabs/deployment-artifacts/deployment-artifacts-view.html index 279f5baa81..a26bcdeccd 100644 --- a/catalog-ui/src/app/view-models/workspace/tabs/deployment-artifacts/deployment-artifacts-view.html +++ b/catalog-ui/src/app/view-models/workspace/tabs/deployment-artifacts/deployment-artifacts-view.html @@ -1,5 +1,6 @@