Skip to content

Commit

Permalink
adapt UI to select ArtifactType
Browse files Browse the repository at this point in the history
  • Loading branch information
lharzenetter committed Jun 3, 2020
1 parent d5c8990 commit 43f57ce
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export class AttributeMappingsComponent implements OnInit {

loading = true;
columns: Array<WineryTableColumn> = [
{ title: 'Id', name: 'id', sort: true },
{ title: 'Detector Node', name: 'detectorNode', sort: true },
{ title: 'Refinement Node', name: 'refinementNode', sort: true },
{ title: 'Type', name: 'type', sort: true },
Expand Down Expand Up @@ -71,7 +70,7 @@ export class AttributeMappingsComponent implements OnInit {

constructor(private service: RefinementMappingsService,
private notify: WineryNotificationService,
private sharedData: InstanceService,
public sharedData: InstanceService,
private modalService: BsModalService) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class DeploymentArtifactMapping extends RefinementMappings {

public static readonly idPrefix = 'artifactMap';

public artifactName: string;
public artifactType: string;

constructor(id: number) {
super(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@
(selected)="mapping.detectorNode = $event.id">
</ng-select>
</div>

<div class="form-group">
<label for="artifactName" class="control-label">Required DA Name</label>
<input type="text" id="artifactName" [(ngModel)]="mapping.artifactName" name="artifactName" class="form-control">
<label for="artifactType" class="control-label">Required DA Type</label>
<ng-select id="artifactType" [items]="artifactTypes"
(selected)="mapping.artifactType = $event.id">
</ng-select>
</div>

<div class="form-group">
<label for="refinementNode" class="control-label">Refinement Structure Node</label>
<ng-select id="refinementNode" [items]="refinementNodes" [textField]="'name'"
Expand All @@ -48,7 +50,7 @@
</winery-modal-body>
<winery-modal-footer [modalRef]="addModalRef"
[okButtonLabel]="'Add'"
[disableOkButton]="!mapping.detectorNode || !mapping.refinementNode"
[disableOkButton]="!mapping.detectorNode || !mapping.refinementNode || !mapping.artifactType"
(onOk)="onAddRelationMapping()">
</winery-modal-footer>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ export class DeploymentArtifactsMappingsComponent implements OnInit {

loading = true;
columns: Array<WineryTableColumn> = [
{ title: 'Id', name: 'id', sort: true },
{ title: 'Deployment Artifact Type', name: 'artifactType', sort: true },
{ title: 'Detector Element', name: 'detectorNode', sort: true },
{ title: 'Deployment Artifact Name', name: 'artifactName', sort: true },
{ title: 'Refinement Element', name: 'refinementNode', sort: true },
];

deploymentArtifactMappings: DeploymentArtifactMapping[];
detectorNodes: NodeTemplate[];
refinementNodes: NodeTemplate[];
artifactTypes: SelectData[];

mapping: DeploymentArtifactMapping;

Expand All @@ -61,6 +61,7 @@ export class DeploymentArtifactsMappingsComponent implements OnInit {
this.service.getDeploymentArtifactMappings(),
this.service.getDetectorNodeTemplates(),
this.service.getRefinementTopologyNodeTemplates(),
this.service.getArtifactTypes(),
).subscribe(
data => this.handleData(data),
error => this.handleError(error)
Expand Down Expand Up @@ -113,11 +114,12 @@ export class DeploymentArtifactsMappingsComponent implements OnInit {
this.notify.error(error.message);
}

private handleData(data: [DeploymentArtifactMapping[], NodeTemplate[], NodeTemplate[]]) {
private handleData(data: [DeploymentArtifactMapping[], NodeTemplate[], NodeTemplate[], SelectData[]]) {
this.loading = false;
this.deploymentArtifactMappings = data[0];
this.detectorNodes = data[1];
this.refinementNodes = data[2];
this.artifactTypes = data[3];
}

// endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ export class RefinementMappingsService {
return this.http.get<SelectData[]>(backendBaseURL + '/nodetypes/?grouped=angularSelect');
}

public getArtifactTypes(): Observable<SelectData[]> {
return this.http.get<SelectData[]>(backendBaseURL + '/artifacttypes/?grouped=angularSelect');
}

public getRelationshipMappings(): Observable<RelationMapping[]> {
return this.http.get<RelationMapping[]>(this.path + '/relationmappings');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export class RelationMappingsComponent implements OnInit {

loading = true;
columns: Array<WineryTableColumn> = [
{ title: 'Id', name: 'id', sort: true },
{ title: 'Direction', name: 'direction', sort: true },
{ title: 'Detector Node', name: 'detectorNode', sort: true },
{ title: 'Refinement Node', name: 'refinementNode', sort: true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { SelectData } from '../../../model/selectData';
import { InstanceService } from '../../instance.service';
import { PrmModelElementType, StayMapping } from './stayMapping';
import { forkJoin } from 'rxjs';
import { RelationMapping } from '../relationshipMappings/relationMapping';

@Component({
templateUrl: 'stayMappings.component.html',
Expand All @@ -38,7 +37,6 @@ export class StayMappingsComponent implements OnInit {
loading = true;
loadingElements = false;
columns: Array<WineryTableColumn> = [
{ title: 'Id', name: 'id', sort: true },
{ title: 'Element Type', name: 'modelElementType', sort: true },
{ title: 'Detector Element', name: 'detectorNode', sort: true },
{ title: 'Refinement Element', name: 'refinementNode', sort: true },
Expand Down

0 comments on commit 43f57ce

Please sign in to comment.