From cd6f933375c412c2f79a12e909821322d58a8499 Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Wed, 29 Jan 2020 17:25:21 +0000 Subject: Configure a new Artifact Type Centralizes artifact configuration in one yaml entry. Allow the configuration of a new artifact type without the need of code changes. The configuration file now is used as a source of artifacts types instead the artifact type enum. The enum will be used as a source of base artifact types and also in hard coded business rules. Change-Id: Id0383d9fca9bce0519a4d52a4ecb3a68c8713f0f Issue-ID: SDC-2754 Signed-off-by: andre.schmid --- .../deployment-artifacts-page.component.html | 7 +++- .../deployment-artifacts-page.component.ts | 45 +++++++++++----------- .../information-artifact-page.component.html | 5 +++ .../information-artifact-page.component.ts | 14 +++---- 4 files changed, 41 insertions(+), 30 deletions(-) (limited to 'catalog-ui/src/app/ng2/pages/workspace') diff --git a/catalog-ui/src/app/ng2/pages/workspace/deployment-artifacts/deployment-artifacts-page.component.html b/catalog-ui/src/app/ng2/pages/workspace/deployment-artifacts/deployment-artifacts-page.component.html index 1df318e4a5..3ed2173b15 100644 --- a/catalog-ui/src/app/ng2/pages/workspace/deployment-artifacts/deployment-artifacts-page.component.html +++ b/catalog-ui/src/app/ng2/pages/workspace/deployment-artifacts/deployment-artifacts-page.component.html @@ -16,11 +16,16 @@
{{row.artifactDisplayName}} - + + + + {{row.artifactName}} + + {{row.artifactType}} diff --git a/catalog-ui/src/app/ng2/pages/workspace/deployment-artifacts/deployment-artifacts-page.component.ts b/catalog-ui/src/app/ng2/pages/workspace/deployment-artifacts/deployment-artifacts-page.component.ts index 53b21b34b6..ec30cd15aa 100644 --- a/catalog-ui/src/app/ng2/pages/workspace/deployment-artifacts/deployment-artifacts-page.component.ts +++ b/catalog-ui/src/app/ng2/pages/workspace/deployment-artifacts/deployment-artifacts-page.component.ts @@ -1,23 +1,22 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; -import { Select, Store } from '@ngxs/store'; -import { ArtifactModel } from 'app/models'; +import {Component, OnInit, ViewChild} from '@angular/core'; +import {Select, Store} from '@ngxs/store'; +import {ArtifactModel} from 'app/models'; import * as _ from 'lodash'; -import { SdcUiCommon, SdcUiComponents, SdcUiServices } from 'onap-ui-angular'; -import { Observable } from 'rxjs/index'; -import { map } from 'rxjs/operators'; -import { GabConfig } from '../../../../models/gab-config'; -import { PathsAndNamesDefinition } from '../../../../models/paths-and-names'; -import { GenericArtifactBrowserComponent } from '../../../../ng2/components/logic/generic-artifact-browser/generic-artifact-browser.component'; -import { ArtifactGroupType, ArtifactType } from '../../../../utils/constants'; -import { ArtifactsService } from '../../../components/forms/artifacts-form/artifacts.service'; -import { PopoverContentComponent } from '../../../components/ui/popover/popover-content.component'; -import { CacheService } from '../../../services/cache.service'; -import { TranslateService } from '../../../shared/translator/translate.service'; -import { GetArtifactsByTypeAction } from '../../../store/actions/artifacts.action'; -import { ArtifactsState } from '../../../store/states/artifacts.state'; -import { WorkspaceState, WorkspaceStateModel } from '../../../store/states/workspace.state'; -import { WorkspaceService } from '../workspace.service'; -import { ModalService } from 'app/ng2/services/modal.service'; +import {SdcUiCommon, SdcUiServices} from 'onap-ui-angular'; +import {Observable} from 'rxjs'; +import {map} from 'rxjs/operators'; +import {GabConfig} from '../../../../models/gab-config'; +import {PathsAndNamesDefinition} from '../../../../models/paths-and-names'; +import {GenericArtifactBrowserComponent} from '../../../components/logic/generic-artifact-browser/generic-artifact-browser.component'; +import {ArtifactGroupType, ArtifactType} from '../../../../utils/constants'; +import {ArtifactsService} from '../../../components/forms/artifacts-form/artifacts.service'; +import {PopoverContentComponent} from '../../../components/ui/popover/popover-content.component'; +import {CacheService} from '../../../services/cache.service'; +import {TranslateService} from '../../../shared/translator/translate.service'; +import {GetArtifactsByTypeAction} from '../../../store/actions/artifacts.action'; +import {ArtifactsState} from '../../../store/states/artifacts.state'; +import {WorkspaceState, WorkspaceStateModel} from '../../../store/states/workspace.state'; +import {WorkspaceService} from '../workspace.service'; export interface IPoint { x: number; @@ -33,6 +32,7 @@ export class DeploymentArtifactsPageComponent implements OnInit { public componentId: string; public componentType: string; + public resourceType: string; public deploymentArtifacts$: Observable; public isComponentInstanceSelected: boolean; @@ -68,11 +68,12 @@ export class DeploymentArtifactsPageComponent implements OnInit { } }); return sortedArtifacts; - }) + }); ngOnInit(): void { this.componentId = this.workspaceService.metadata.uniqueId; this.componentType = this.workspaceService.metadata.componentType; + this.resourceType = this.workspaceService.metadata.resourceType; this.store.dispatch(new GetArtifactsByTypeAction({ componentType: this.componentType, @@ -91,8 +92,8 @@ export class DeploymentArtifactsPageComponent implements OnInit { } public addOrUpdateArtifact = (artifact: ArtifactModel, isViewOnly: boolean) => { - this.artifactsService.openArtifactModal(this.componentId, this.componentType, artifact, ArtifactGroupType.DEPLOYMENT, isViewOnly); - } + this.artifactsService.openArtifactModal(this.componentId, this.componentType, artifact, ArtifactGroupType.DEPLOYMENT, isViewOnly, null, this.resourceType); + }; public deleteArtifact = (artifactToDelete) => { this.artifactsService.deleteArtifact(this.componentType, this.componentId, artifactToDelete); diff --git a/catalog-ui/src/app/ng2/pages/workspace/information-artifact/information-artifact-page.component.html b/catalog-ui/src/app/ng2/pages/workspace/information-artifact/information-artifact-page.component.html index cff33258ae..b1f610a653 100644 --- a/catalog-ui/src/app/ng2/pages/workspace/information-artifact/information-artifact-page.component.html +++ b/catalog-ui/src/app/ng2/pages/workspace/information-artifact/information-artifact-page.component.html @@ -28,6 +28,11 @@ + + + {{row.artifactName}} + + {{row.artifactType}} diff --git a/catalog-ui/src/app/ng2/pages/workspace/information-artifact/information-artifact-page.component.ts b/catalog-ui/src/app/ng2/pages/workspace/information-artifact/information-artifact-page.component.ts index a6804a43c6..981e00bf40 100644 --- a/catalog-ui/src/app/ng2/pages/workspace/information-artifact/information-artifact-page.component.ts +++ b/catalog-ui/src/app/ng2/pages/workspace/information-artifact/information-artifact-page.component.ts @@ -1,13 +1,11 @@ import {Component, OnInit, ViewChild} from "@angular/core"; import {WorkspaceService} from "../workspace.service"; -import {SdcUiCommon, SdcUiComponents, SdcUiServices} from "onap-ui-angular"; -import {TopologyTemplateService} from "../../../services/component-services/topology-template.service"; import * as _ from "lodash"; import {ArtifactGroupType, ArtifactType} from "../../../../utils/constants"; import {ArtifactsService} from "../../../components/forms/artifacts-form/artifacts.service"; -import {DeleteArtifactAction, GetArtifactsByTypeAction} from "../../../store/actions/artifacts.action"; +import {GetArtifactsByTypeAction} from "../../../store/actions/artifacts.action"; import {Select, Store} from "@ngxs/store"; -import {Observable} from "rxjs/index"; +import {Observable} from "rxjs"; import {ArtifactsState} from "../../../store/states/artifacts.state"; import {map} from "rxjs/operators"; import {WorkspaceState} from "../../../store/states/workspace.state"; @@ -22,6 +20,7 @@ export class InformationArtifactPageComponent implements OnInit { public componentId: string; public componentType: string; + public resourceType: string; public informationArtifacts$: Observable; public informationArtifactsAsButtons$: Observable; @Select(WorkspaceState.isViewOnly) isViewOnly$: boolean; @@ -35,6 +34,7 @@ export class InformationArtifactPageComponent implements OnInit { ngOnInit(): void { this.componentId = this.workspaceService.metadata.uniqueId; this.componentType = this.workspaceService.metadata.componentType; + this.resourceType = this.workspaceService.metadata.resourceType; this.store.dispatch(new GetArtifactsByTypeAction({ componentType: this.componentType, @@ -59,11 +59,11 @@ export class InformationArtifactPageComponent implements OnInit { } public addOrUpdateArtifact = (artifact: ArtifactModel, isViewOnly?: boolean) => { - this.artifactsService.openArtifactModal(this.componentId, this.componentType, artifact, ArtifactGroupType.INFORMATION, isViewOnly); - } + this.artifactsService.openArtifactModal(this.componentId, this.componentType, artifact, ArtifactGroupType.INFORMATION, isViewOnly, null, this.resourceType); + }; public deleteArtifact = (artifactToDelete) => { this.artifactsService.deleteArtifact(this.componentType, this.componentId, artifactToDelete) - } + }; } \ No newline at end of file -- cgit 1.2.3-korg