Skip to content

Commit 4a145a8

Browse files
Merge QAIsup (#179)
* add code from Tpankv4/QAIsup * fix linting errors * update readme --------- Co-authored-by: LaviniaStiliadou <[email protected]>
1 parent 9d2d15d commit 4a145a8

31 files changed

+1875
-13
lines changed

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@
2828
"@angular/router": "9.1.2",
2929
"@auth0/angular-jwt": "^4.0.0",
3030
"@covalent/text-editor": "3.0.0-beta.1-2",
31+
"@types/file-saver": "^2.0.5",
3132
"@ustutt/grapheditor-webcomponent": "0.5.4",
3233
"angular2-prettyjson": "3.0.1",
3334
"angular2-toaster": "8.0.0",
3435
"antlr4": "^4.8.0",
3536
"core-js": "2.6.3",
3637
"d3": "^5.9.2",
38+
"file-saver": "^2.0.5",
39+
"keyword-extractor": "0.0.25",
3740
"lodash": "^4.17.21",
3841
"madr": "2.1.2",
3942
"markdown-it": "10.0.0",
@@ -78,7 +81,8 @@
7881
"stylelint": "^13.5.0",
7982
"stylelint-config-sass-guidelines": "^7.0.0",
8083
"ts-node": "~8.0.1",
81-
"typescript": "~3.7.7"
84+
"typescript": "~3.7.7",
85+
"yarn-audit-fix": "^10.0.1"
8286
},
8387
"browser": {
8488
"fs": false

src/app/core/component/action-button-bar/action-button-bar.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
<span class="action-button-with-margin"><b>{{this.displayText}}</b></span>
88

99
<ng-content></ng-content>
10-
10+
1111
<button (click)="reloadButtonClicked()" *ngIf="reloadButton" class="action-button-with-margin" color="accent"
1212
mat-raised-button>
1313
<i class="material-icons">autorenew</i> Reload
1414
</button>
15-
15+
1616
<ng-container *patternAtlasUiShowOnFeature="UiFeatures.EDITING">
1717
<button (click)="addButtonClicked()" *ngIf="firstAddButton" class="action-button-with-margin" color="accent"
1818
mat-raised-button>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<button mat-icon-button class="close-button" [mat-dialog-close]="true">
2+
<mat-icon class="close-icon" >close</mat-icon>
3+
</button>
4+
<div mat-dialog-content>
5+
<mat-form-field>
6+
<mat-label>Algorithm Name</mat-label>
7+
<input matInput [(ngModel)]="name" cdkFocusInitial>
8+
</mat-form-field>
9+
<mat-form-field>
10+
<mat-label>Select Patterns</mat-label>
11+
<mat-select [(value)]="res" multiple>
12+
<mat-option *ngFor="let pattern of patterns" [value]="pattern">{{pattern.name}}</mat-option>
13+
</mat-select>
14+
</mat-form-field>
15+
<mat-form-field>
16+
<mat-label>Select Optional Patterns</mat-label>
17+
<mat-select [(value)]="opt" multiple>
18+
<mat-option *ngFor="let pattern of patterns" [value]="pattern">{{pattern.name}}</mat-option>
19+
</mat-select>
20+
</mat-form-field>
21+
<mat-form-field>
22+
<mat-label>href to PlanQK website</mat-label>
23+
<input matInput [(ngModel)]="planqkref">
24+
</mat-form-field>
25+
</div>
26+
<div mat-dialog-actions>
27+
<button class="action-button-with-margin" (click)="closeDialog()" color="accent" mat-raised-button>
28+
<i class="material-icons"></i> create Algorithm
29+
</button>
30+
<button mat-dialog-close class="action-button-with-margin" mat-raised-button >
31+
<i class="material-icons"></i> close
32+
</button>
33+
</div>
34+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.close-button {
2+
float: right;
3+
top: -24px;
4+
right: -24px;
5+
}
6+
7+
.close-button:hover {
8+
opacity: 0.9;
9+
color: #f00;
10+
cursor: pointer;
11+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { CreateAlgorithmComponent } from './create-algorithm.component';
4+
5+
describe('CreateAlgorithmComponent', () => {
6+
let component: CreateAlgorithmComponent;
7+
let fixture: ComponentFixture<CreateAlgorithmComponent>;
8+
9+
beforeEach(async(() => {
10+
TestBed.configureTestingModule({
11+
declarations: [ CreateAlgorithmComponent ]
12+
})
13+
.compileComponents();
14+
}));
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(CreateAlgorithmComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { Component, OnInit, ViewChild, Inject } from '@angular/core';
2+
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
3+
import { MatSelectModule } from '@angular/material/select';
4+
import { MatFormFieldModule } from '@angular/material/form-field';
5+
import { MatButtonModule } from '@angular/material/button';
6+
7+
import { HttpClient } from '@angular/common/http';
8+
9+
@Component({
10+
selector: 'pp-create-algorithm',
11+
templateUrl: './create-algorithm.component.html',
12+
styleUrls: ['./create-algorithm.component.scss']
13+
})
14+
export class CreateAlgorithmComponent implements OnInit {
15+
16+
patterns: any[];
17+
res = [];
18+
opt = [];
19+
name: string;
20+
planqkref: string;
21+
22+
infos: any;
23+
24+
25+
constructor(public dialogRef: MatDialogRef<CreateAlgorithmComponent>,
26+
private http: HttpClient,
27+
@Inject(MAT_DIALOG_DATA) public data) {
28+
this.patterns = data.patterns;
29+
}
30+
31+
ngOnInit(): void {
32+
33+
let href = 'https://platform.planqk.de/qc-catalog/algorithms/fae60bca-d2b6-4aa2-88b7-58caace34179';
34+
this.http.get(href).subscribe(data => {
35+
this.infos = data;
36+
});
37+
38+
}
39+
40+
closeDialog() {
41+
if(this.res.length > 0){
42+
const result = { name: this.name, patterns: this.res , optional: this.opt, href: this.planqkref };
43+
this.dialogRef.close(result);
44+
} else {
45+
alert('no patterns selected!');
46+
}
47+
}
48+
49+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<button mat-icon-button class="close-button" [mat-dialog-close]="true">
2+
<mat-icon class="close-icon" >close</mat-icon>
3+
</button>
4+
<div mat-dialog-content>
5+
<mat-form-field>
6+
<mat-label>Select algorithms to delete</mat-label>
7+
<mat-select [(value)]="res" multiple cdkFocusInitial>
8+
<mat-option *ngFor="let alg of algorithms" [value]="alg">{{alg.name}}</mat-option>
9+
</mat-select>
10+
</mat-form-field>
11+
</div>
12+
<div mat-dialog-actions>
13+
<button class="action-button-with-margin" (click)="closeDialog()" color="accent" mat-raised-button>
14+
<i class="material-icons"></i> delete Algorithm
15+
</button>
16+
<button mat-dialog-close class="action-button-with-margin" mat-raised-button >
17+
<i class="material-icons"></i> close
18+
</button>
19+
</div>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.close-button {
2+
float: right;
3+
top: -24px;
4+
right: -24px;
5+
}
6+
7+
.close-button:hover {
8+
opacity: 0.9;
9+
color: #f00;
10+
cursor: pointer;
11+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { DeleteAlgorithmComponent } from './delete-algorithm.component';
4+
5+
describe('DeleteAlgorithmComponent', () => {
6+
let component: DeleteAlgorithmComponent;
7+
let fixture: ComponentFixture<DeleteAlgorithmComponent>;
8+
9+
beforeEach(async(() => {
10+
TestBed.configureTestingModule({
11+
declarations: [ DeleteAlgorithmComponent ]
12+
})
13+
.compileComponents();
14+
}));
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(DeleteAlgorithmComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Component, OnInit, Inject } from '@angular/core';
2+
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
3+
import { MatSelectModule } from '@angular/material/select';
4+
import { MatFormFieldModule } from '@angular/material/form-field';
5+
import { MatButtonModule } from '@angular/material/button';
6+
7+
@Component({
8+
selector: 'pp-delete-algorithm',
9+
templateUrl: './delete-algorithm.component.html',
10+
styleUrls: ['./delete-algorithm.component.scss']
11+
})
12+
export class DeleteAlgorithmComponent implements OnInit {
13+
14+
algorithms: any[];
15+
res = [];
16+
17+
constructor(public dialogRef: MatDialogRef<DeleteAlgorithmComponent>,
18+
@Inject(MAT_DIALOG_DATA) public data) {
19+
this.algorithms = data.algorithms;
20+
}
21+
22+
ngOnInit(): void {
23+
}
24+
25+
closeDialog() {
26+
if(this.res.length > 0){
27+
const result = this.res;
28+
this.dialogRef.close(result);
29+
} else {
30+
alert('no algorithm selected!');
31+
}
32+
}
33+
34+
}

0 commit comments

Comments
 (0)