diff options
author | andre.schmid <andre.schmid@est.tech> | 2020-01-29 17:25:21 +0000 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-04-19 16:35:32 +0000 |
commit | cd6f933375c412c2f79a12e909821322d58a8499 (patch) | |
tree | 758ff2e742b514169bbc84a8433d68fe221ef5c9 /catalog-ui/src/app/ng2/pages | |
parent | dc56692a4a307f378c827f017d2efbf754c223e0 (diff) |
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 <andre.schmid@est.tech>
Diffstat (limited to 'catalog-ui/src/app/ng2/pages')
6 files changed, 43 insertions, 32 deletions
diff --git a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/artifacts-tab/artifact-tab.component.spec.ts b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/artifacts-tab/artifact-tab.component.spec.ts index 258f2295ab..9df3e38eb2 100644 --- a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/artifacts-tab/artifact-tab.component.spec.ts +++ b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/artifacts-tab/artifact-tab.component.spec.ts @@ -220,7 +220,7 @@ describe('artifact-tab component', () => { fixture.componentInstance.addOrUpdate(artifact); - expect(artifactsServiceMockService.openArtifactModal).toHaveBeenCalledWith(topologyTemplateId, topologyTemplateType, artifact, type, isViewOnly, component.uniqueId); + expect(artifactsServiceMockService.openArtifactModal).toHaveBeenCalledWith(topologyTemplateId, topologyTemplateType, artifact, type, isViewOnly, component.uniqueId, undefined); }); it ('on addOrUpdate -> openArtifactModal is being called from artifactService when isComponentInstanceSelected = false', () => { diff --git a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/artifacts-tab/artifacts-tab.component.ts b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/artifacts-tab/artifacts-tab.component.ts index 53a6c267e2..91664ce8e8 100644 --- a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/artifacts-tab/artifacts-tab.component.ts +++ b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/artifacts-tab/artifacts-tab.component.ts @@ -64,7 +64,7 @@ export class ArtifactsTabComponent { public addOrUpdate = (artifact: ArtifactModel): void => { if (this.isComponentInstanceSelected) { - this.artifactService.openArtifactModal(this.topologyTemplateId, this.topologyTemplateType, artifact, this.type, this.isViewOnly, this.component.uniqueId); + this.artifactService.openArtifactModal(this.topologyTemplateId, this.topologyTemplateType, artifact, this.type, this.isViewOnly, this.component.uniqueId, this.resourceType); } else { this.artifactService.openArtifactModal(this.topologyTemplateId, this.topologyTemplateType, artifact, this.type, this.isViewOnly); } 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 @@ <div class="env-artifact"></div> </div> <span sdc-tooltip [tooltip-text]="row.artifactDisplayName" [tooltip-placement]="3" [attr.data-tests-id]="'artifactDisplayName_' + row.artifactDisplayName">{{row.artifactDisplayName}}</span> - <span *ngIf="row.description.length > 0" class="info"> + <span *ngIf="row.description && row.description.length > 0" class="info"> <svg-icon [clickable]="true" [name]="'comment'" [mode]="'primary2'" (click)="openPopOver('Description',row.description,{x:$event.pageX , y:$event.pageY },'bottom')"></svg-icon> </span> </ng-template> </ngx-datatable-column> + <ngx-datatable-column [resizeable]="false" name="Filename" [flexGrow]="1"> + <ng-template ngx-datatable-cell-template let-row="row"> + <span sdc-tooltip [tooltip-text]="row.artifactName" [tooltip-placement]="3" [attr.data-tests-id]="'artifactName_' + row.artifactName">{{row.artifactName}}</span> + </ng-template> + </ngx-datatable-column> <ngx-datatable-column [resizeable]="false" name="Type" [flexGrow]="0.6"> <ng-template ngx-datatable-cell-template let-row="row"> <span sdc-tooltip [tooltip-text]="row.artifactType" [tooltip-placement]="3" [attr.data-tests-id]="'artifactType_' + row.artifactDisplayName">{{row.artifactType}}</span> 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<ArtifactModel[]>; 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 @@ </div> </ng-template> </ngx-datatable-column> + <ngx-datatable-column [resizeable]="false" name="Filename" [flexGrow]="1"> + <ng-template ngx-datatable-cell-template let-row="row"> + <span sdc-tooltip [tooltip-text]="row.artifactName" [tooltip-placement]="3" [attr.data-tests-id]="'artifactName_' + row.artifactName">{{row.artifactName}}</span> + </ng-template> + </ngx-datatable-column> <ngx-datatable-column [resizeable]="false" name="Type" [flexGrow]="1"> <ng-template ngx-datatable-cell-template let-row="row"> {{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<ArtifactModel[]>; public informationArtifactsAsButtons$: Observable<ArtifactModel[]>; @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 |