Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a6d30ba
fix css for info icon
Nov 2, 2020
ef82456
use ids for navigation to patterns
Nov 2, 2020
bad4cf9
make navigating by id the default
Nov 2, 2020
283ed12
use eslint for formatting
Nov 2, 2020
0ee3709
show view relations in expansion panel
Nov 3, 2020
2cab6ad
Fixing add new pattern issue from issue#74
mbeisel Nov 25, 2020
07a7893
Fixing bidirectional relationship display target, stylingchanges, fix…
mbeisel Nov 26, 2020
b3f14b3
Fixed Spacing in Add relation dialog and adjusted dialog logic
mbeisel Dec 1, 2020
cc73c91
Fixing graphview sidebarsize bug #73
mbeisel Dec 1, 2020
46d69a3
Fixing connection and arrow rendering for drag & drop and via add lin…
mbeisel Dec 1, 2020
9e107a0
Adding regex to remove comments and other disturbing html content for…
mbeisel Dec 2, 2020
f33b60c
Adjusting create process for MAP Patterns, and adding "keep empty lin…
mbeisel Dec 2, 2020
8593af0
Adding functionality to delete pattern relations within the graph, ad…
mbeisel Dec 21, 2020
d8cdff3
Adding edit-url-dialog
mbeisel Jan 5, 2021
0138e2a
Fixing critical error while loading patterns that have relations
mbeisel Jan 5, 2021
87cd3ef
Adding ReadTheDocs files, Adding Icon and name edit function, Added G…
mbeisel Jan 7, 2021
9588189
Adding missing delete-confirmation-dialog.component
mbeisel Jan 8, 2021
9f9835d
Refactoring and importfixes
mbeisel Jan 8, 2021
630eaa4
Moving readthedocs to seperate repo
mbeisel Jan 8, 2021
3fda191
Add functionality to editing relations via the graph and graph sideba…
mbeisel Jan 8, 2021
638cdc1
Refactoring, Commenting, Fixing bug in patternview component
mbeisel Jan 13, 2021
8217206
Refactoring
mbeisel Jan 19, 2021
715d563
Linting and refactoring
mbeisel Jan 19, 2021
dc978bd
Fixing Typo, removing unused imports, Fixing Relations in patterndeta…
mbeisel Jan 20, 2021
0375b21
Adding Functionality to keep card view in Pattern View Component up t…
mbeisel Jan 20, 2021
2c48c6a
Bugfixing Add relations (inc. Pattern ) functionality, fixing linkcou…
mbeisel Jan 22, 2021
d293713
Refactoring and removing unnecessary method
mbeisel Jan 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<mat-toolbar>
<pp-navigate-back *ngIf="goBackButton"></pp-navigate-back>

<span></span>
<img class="image-with-margin" mat-card-image (click)=iconEditButtonClicked() *ngIf="iconUrl" [src]="iconUrl">

<span class="action-button-with-margin"><b>{{this.displayText}}</b></span>

<ng-content></ng-content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,15 @@
margin-right: 10px;
margin-left: 10px;
}

.mat-card-image {
width: auto;
height: 50px;
cursor: pointer;
}

.image-with-margin {
margin-right: 5px;
margin-left: 15px;
}

Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ export class ActionButtonBarComponent implements OnInit {
@Output() add2Clicked = new EventEmitter<void>();
@Output() reloadClicked = new EventEmitter<void>();
@Output() changedText = new EventEmitter<void>();
@Output() iconEditClicked = new EventEmitter<void>();
@Input() addButtonText: string;
@Input() reloadButton = false;
@Input() goBackButton = true;
@Input() secondAddButton: boolean;
@Input() firstAddButton = true;
@Input() secondAddButtonText: string;
@Input() iconEdit = false;
@Input() iconUrl: string;

@Input() displayText: string;

Expand All @@ -38,4 +41,8 @@ export class ActionButtonBarComponent implements OnInit {
secondAddButtonClicked() {
this.add2Clicked.emit();
}

iconEditButtonClicked() {
this.iconEditClicked.emit();
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
<h1 mat-dialog-title>Add a relation to another pattern</h1>
<h1 *ngIf="isDelete" mat-dialog-title>Edit or Delete the selected Relation</h1>
<h1 *ngIf="!isDelete" mat-dialog-title>Add a Relation to another Pattern</h1>
<div mat-dialog-content [formGroup]="relationForm">
<mat-form-field *ngIf="data.firstPattern; else chooseFirstPattern">
<input type="text" matInput [value]="data.firstPattern.name" readonly/>
</mat-form-field>
<ng-template #chooseFirstPattern>
<mat-form-field *ngIf="relationForm.get('secondPattern').value != null; else chooseFirstPatternWithEmptyForm">
<mat-select formControlName="firstPattern">
<div *ngFor="let pattern of data.patterns">
<mat-option *ngIf="pattern.name != relationForm.get('secondPattern').value.name "
[value]="pattern">
{{pattern.name}}
</mat-option>
</div>
</mat-select>
</mat-form-field>
</ng-template>
<ng-template #chooseFirstPatternWithEmptyForm>
<mat-form-field>
<mat-select formControlName="firstPattern">
<mat-option *ngFor="let pattern of data.patterns"
Expand Down Expand Up @@ -42,6 +55,18 @@ <h1 mat-dialog-title>Add a relation to another pattern</h1>
<input type="text" matInput [value]="data.secondPattern.name" readonly/>
</mat-form-field>
<ng-template #chooseSecondPattern>
<mat-form-field *ngIf="relationForm.get('firstPattern').value != null; else chooseSecondPatternWithEmptyForm">
<mat-select formControlName="secondPattern">
<div *ngFor="let pattern of data.patterns">
<mat-option *ngIf=" pattern.name != relationForm.get('firstPattern').value.name"
[value]="pattern">
{{pattern.name}}
</mat-option>
</div>
</mat-select>
</mat-form-field>
</ng-template>
<ng-template #chooseSecondPatternWithEmptyForm>
<mat-form-field>
<mat-select formControlName="secondPattern">
<mat-option *ngFor="let pattern of data.patterns"
Expand All @@ -56,8 +81,13 @@ <h1 mat-dialog-title>Add a relation to another pattern</h1>
</mat-form-field>
</div>
<div mat-dialog-actions>
<button mat-button [mat-dialog-close]="null">Close</button>
<button mat-button [mat-dialog-close]="mapDialogDataToEdge(relationForm.value)" [disabled]="!relationForm?.valid">
Save
<button mat-raised-button [mat-dialog-close]="null">Close</button>
<button *ngIf="isDelete" (click)="deleteLink()" [mat-dialog-close]="data" class="pattern-button" mat-raised-button color="warn">
<i class="material-icons">delete</i> Delete
</button>

<button mat-raised-button style="margin-left: auto; margin-right: 0;" color="primary"
[mat-dialog-close]="mapDialogDataToEdge(relationForm.value)" [disabled]="!relationForm?.valid"><i
class="material-icons">save</i> Save
</button>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
.mat-form-field {
margin-left: 2.5rem !important;
}

.mat-input-element {
height: 1.125em;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,18 @@ import { Observable } from 'rxjs';
styleUrls: ['./create-pattern-relation.component.scss']
})


/**
* This dialog is getting used to
* 1. Create new relations
* 2. Edit existing relations (isDelete = true)
* 3. Delete existing relations (isDelete = true)
*/
export class CreatePatternRelationComponent implements OnInit {

constructor(public dialogRef: MatDialogRef<CreatePatternRelationComponent>, @Inject(MAT_DIALOG_DATA) public data: DialogData, private fb: FormBuilder) {
}

isDelete: boolean;
directionEnum = PatternRelationDescriptorDirection;
patterns: Pattern[];
directionTypes = [
Expand Down Expand Up @@ -54,14 +60,17 @@ export class CreatePatternRelationComponent implements OnInit {
} catch (e) {
}

if(this.data.description === undefined){
this.data.description = '';
}
this.isDelete =this.data.isDelete; // set view to delete/edit instead of create
this.relationForm = this.fb.group({
firstPattern: [this.data.firstPattern, [Validators.required]],
secondPattern: [this.data.secondPattern, [Validators.required]],
direction: [preselectedEdgeDirection, [Validators.required]],
relationType: ['', [Validators.required]],
description: ['', []],
relationType: [this.data.relationType, [Validators.required]],
description: [this.data.description, []],
});

if (this.data.relationTypes) {
this.subscriptionRefs.push(this.data.relationTypes.subscribe(relationTypes => this.relationTypes = relationTypes));
}
Expand Down Expand Up @@ -94,16 +103,26 @@ export class CreatePatternRelationComponent implements OnInit {

}

/**
* called when delete button is pressed --> delete Link
*/
deleteLink() {
this.data.deleteLink = true;
}
}

export interface DialogData {
relationType: string;
description: string;
firstPattern?: Pattern;
secondPattern?: Pattern;
preselectedEdgeDirection?: PatternRelationDescriptorDirection;
patterns: Pattern[];
patternLanguage: PatternLanguage;
patternContainer: PatternContainer;
relationTypes?: Observable<string[]>;
isDelete: boolean; // delete button toggle
deleteLink: boolean; // set true if delete button pressed
}

export interface PatternRelationDirection {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<h1 mat-dialog-title>Edit or Delete Relation</h1>
<div mat-dialog-actions>
<button mat-button (click)="onNoClick()">Cancle</button>
<button [mat-dialog-close]="data" class="pattern-button" mat-raised-button color="warn">
<i class="material-icons">delete</i>
</button>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { DeleteConfirmationDialogComponent } from './delete-confirmation-dialog.component';

describe('DeleteConfirmationDialogComponent', () => {
let component: DeleteConfirmationDialogComponent;
let fixture: ComponentFixture<DeleteConfirmationDialogComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DeleteConfirmationDialogComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(DeleteConfirmationDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';

@Component({
selector: 'pp-delete-confirmation-dialog',
templateUrl: './delete-confirmation-dialog.component.html',
styleUrls: ['./delete-confirmation-dialog.component.scss']
})
export class DeleteConfirmationDialogComponent {

constructor(
public dialogRef: MatDialogRef<DeleteConfirmationDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data) {
}

onNoClick(): void {
this.dialogRef.close();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<button class="close" mat-button (click)="close()">X</button>
<h1 mat-dialog-title>Delete a relation</h1>
<h1 mat-dialog-title *ngIf="this.data.type == 'ingoing'" >View incoming Edges</h1>
<h1 mat-dialog-title *ngIf="this.data.type == 'outgoing'" >View outgoing Edges</h1>
<h1 mat-dialog-title *ngIf="this.data.type !== 'ingoing' && this.data.type !== 'outgoing'" >View undirected Edges</h1>
<div mat-dialog-content>
<div *ngIf="this.data.type == 'ingoing' || this.data.type == 'outgoing'; then directedEdgeModel else undirectedEdgeModel"></div>
<ng-template #directedEdgeModel>
Expand All @@ -14,12 +16,9 @@ <h1 mat-dialog-title>Delete a relation</h1>
<b>Source Pattern:</b> {{edge.edge.sourcePatternName}}<br/>
<b>Relation Type:</b> {{edge.edge.type}} <br/>
<b>Target Pattern:</b> {{edge.edge.targetPatternName}}
<div *ngIf="edge.description"><b>Description:</b> {{edge.description}}</div>
<div *ngIf="edge.edge.description"><b>Description:</b> {{edge.edge.description}}</div>
<br/>
</div>
<button class="delete-icon" mat-button (click)="deleteEdge(edge)">
<mat-icon (click)="deleteEdge(edge)" [inline]="true">delete</mat-icon>
</button>
</mat-expansion-panel>
</mat-accordion>
</ng-template>
Expand All @@ -35,12 +34,9 @@ <h1 mat-dialog-title>Delete a relation</h1>
<b>Pattern 1:</b> {{edge.edge.pattern1Name}}<br/>
<b>Relation Type:</b> {{edge.edge.type}} <br/>
<b>Pattern 2:</b> {{edge.edge.pattern2Name}}
<div *ngIf="edge.description"><b>Description:</b> {{edge.description}}</div>
<div *ngIf="edge.edge.description"><b>Description:</b> {{edge.edge.description}}</div>
<br/>
</div>
<button class="delete-icon" mat-button (click)="deleteEdge(edge)">
<mat-icon (click)="deleteEdge(edge)" [inline]="true">delete</mat-icon>
</button>
</mat-expansion-panel>
</mat-accordion>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,50 @@ import { HalLink } from '../../model/hal/hal-link.interface';
@Component({
selector: 'pp-delete-pattern-relation',
templateUrl: './delete-pattern-relation.component.html',
styleUrls: ['./delete-pattern-relation.component.scss']
styleUrls: [ './delete-pattern-relation.component.scss' ]
})
export class DeletePatternRelationComponent implements OnInit {

currentEdges: Array<EdgeWithType> = [];
currentEdges: Array<EdgeWithType> = [];

constructor(public dialogRef: MatDialogRef<CreatePatternRelationComponent>,
@Inject(MAT_DIALOG_DATA) public data: DeleteRelationDialogData,
private patternRelationDescriptorService: PatternRelationDescriptorService,
private patternViewService: PatternViewService, private toasterService: ToasterService) {
this.getEdgesForPattern();
}
constructor(public dialogRef: MatDialogRef<CreatePatternRelationComponent>,
@Inject(MAT_DIALOG_DATA) public data: DeleteRelationDialogData,
private patternRelationDescriptorService: PatternRelationDescriptorService,
private patternViewService: PatternViewService, private toasterService: ToasterService) {
this.getEdgesForPattern();
}

ngOnInit() {
}
ngOnInit() {
}

close(): void {
this.dialogRef.close();
}

close(): void {
this.dialogRef.close();
}

deleteEdge(edge: EdgeWithType): void {
console.log(edge);
this.patternViewService.deleteLink(edge.edge._links.self.href).subscribe(
(res) => {
this.currentEdges = this.currentEdges.filter(item => item.edge.id !== edge.edge.id);
this.toasterService.pop('success', 'Relation removed');
if (this.currentEdges.length === 0) {
this.dialogRef.close();
}
private getEdgesForPattern(): void {
let links = [];
if (!this.data.edges.length) {
links[0] = this.data.edges;
} else {
links = this.data.edges;
}
for (const link of links) {
this.patternRelationDescriptorService.getUndirectedEdgeByUrl(link.href).subscribe(
data => {
const edgeWithType: EdgeWithType = new EdgeWithType();
edgeWithType.edge = data;
edgeWithType.type = data.type;
this.currentEdges.push(edgeWithType);
}
);
}

private getEdgesForPattern(): void {
let links = [];
if (!this.data.edges.length) {
links[0] = this.data.edges;
} else {
links = this.data.edges;
}
for (const link of links) {
this.patternRelationDescriptorService.getUndirectedEdgeByUrl(link.href).subscribe(
data => {
const edgeWithType: EdgeWithType = new EdgeWithType();
edgeWithType.edge = data;
edgeWithType.type = data.type;
this.currentEdges.push(edgeWithType);
}
);
}
}
}

}

export interface DeleteRelationDialogData {
edges: HalLink[];
type: string;
deleteEdge: EdgeWithType;
edges: HalLink[];
type: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<h1 mat-dialog-title>Edit Title or Icon for {{data.pattern.name}}</h1>
<div mat-dialog-content>
<mat-form-field>
<mat-label>Adjust Pattern Name</mat-label>
<input matInput placeholder={{data.pattern.name}} [(ngModel)]="data.name" >
</mat-form-field>
<mat-form-field>
<mat-label>Adjust Icon URL</mat-label>
<input matInput placeholder={{data.pattern.iconUrl}} [(ngModel)]="data.icon" >
</mat-form-field>
</div>
<mat-dialog-actions align="end">
<button mat-button (click)="onNoClick()">Cancle</button>
<button mat-button [mat-dialog-close]="data" cdkFocusInitial>Ok</button>
</mat-dialog-actions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.mat-form-field{
width: 100%;
}
Loading