Commit 4392d977 authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

ui updates and new pipeline to add a requirement

parent e5d4a803
...@@ -43,7 +43,7 @@ export class AddBoilerplateComponent implements OnInit { ...@@ -43,7 +43,7 @@ export class AddBoilerplateComponent implements OnInit {
response => { response => {
this.notifier.notify("success",(JSON.stringify(response))); this.notifier.notify("success",(JSON.stringify(response)));
this.submitted = true; this.submitted = true;
this.router.navigate(['/groupboilerplates/'+this.route.snapshot.params.gb+'/boilerplates']); this.router.navigate(['/groupboilerplates/'+this.route.snapshot.params.gb+'/boilerplates/details/'+response.id]);
}, },
error => { error => {
console.log(error); console.log(error);
......
...@@ -17,9 +17,20 @@ ...@@ -17,9 +17,20 @@
[(ngModel)]="groupboilerplate.title_bgroup" [(ngModel)]="groupboilerplate.title_bgroup"
name="title_bgroup" name="title_bgroup"
/> />
</div>
<div class="form-group">
<label for="description">Description of project</label>
<textarea
type="text"
class="form-control"
id="description"
required
[(ngModel)]="groupboilerplate.description"
name="description"
></textarea>
</div>
<button (click)="saveBoilerplate()" class="btn btn-success" >Submit</button> <button (click)="saveBoilerplate()" class="btn btn-success" >Submit</button>
</div>
</div> </div>
\ No newline at end of file
...@@ -13,6 +13,7 @@ export class AddGroupboilComponent implements OnInit { ...@@ -13,6 +13,7 @@ export class AddGroupboilComponent implements OnInit {
groupboilerplate: GroupBoilerplate = { groupboilerplate: GroupBoilerplate = {
title_bgroup: "", title_bgroup: "",
description: "",
}; };
submitted = false; submitted = false;
private readonly notifier: NotifierService; private readonly notifier: NotifierService;
...@@ -26,6 +27,7 @@ export class AddGroupboilComponent implements OnInit { ...@@ -26,6 +27,7 @@ export class AddGroupboilComponent implements OnInit {
saveBoilerplate(): void { saveBoilerplate(): void {
const data = { const data = {
title_bgroup: this.groupboilerplate.title_bgroup, title_bgroup: this.groupboilerplate.title_bgroup,
description: this.groupboilerplate.description,
}; };
this.boilerplatelService.creategroupboil(data) this.boilerplatelService.creategroupboil(data)
...@@ -45,6 +47,7 @@ export class AddGroupboilComponent implements OnInit { ...@@ -45,6 +47,7 @@ export class AddGroupboilComponent implements OnInit {
this.submitted = false; this.submitted = false;
this.groupboilerplate = { this.groupboilerplate = {
title_bgroup: "", title_bgroup: "",
description: "",
}; };
} }
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
value=" Update Boilerplate" value=" Update Boilerplate"
(click)="updateBoilerplate()"/> (click)="updateBoilerplate()"/>
</div> </div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="start"> <div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<input class="btn btn-warning" <input class="btn btn-warning"
type="button" type="button"
value="Delete Boilerplate" value="Delete Boilerplate"
......
...@@ -75,7 +75,7 @@ export class BoilerplateDetailsComponent implements OnInit { ...@@ -75,7 +75,7 @@ export class BoilerplateDetailsComponent implements OnInit {
.subscribe( .subscribe(
response => { response => {
this.notifier.notify("success",(JSON.stringify("Requirement " + this.currentboilerplate.title + " updated"))); this.notifier.notify("success",(JSON.stringify("Requirement " + this.currentboilerplate.title + " updated")));
this.router.navigate(['/groupboilerplates/'+this.route.snapshot.params.gb+'/boilerplates']); //this.router.navigate(['/groupboilerplates/'+this.route.snapshot.params.gb+'/boilerplates']);
}, },
error => { error => {
this.notifier.notify("warning",(JSON.stringify(error))); this.notifier.notify("warning",(JSON.stringify(error)));
...@@ -108,16 +108,6 @@ export class BoilerplateDetailsComponent implements OnInit { ...@@ -108,16 +108,6 @@ export class BoilerplateDetailsComponent implements OnInit {
}); });
} }
checkeven(i:any): any {
if (i%2 == 0){ return true}
return false
}
checkthree(i:any): any {
if (i%3 == 0){ return true}
return false
}
checklen(i:any): any { checklen(i:any): any {
if (i.length>1){ return true} if (i.length>1){ return true}
return false return false
......
...@@ -34,23 +34,26 @@ ...@@ -34,23 +34,26 @@
</div> </div>
</div> </div>
<div *ngFor="let gb of grouboilerplates| filter:title"> <div class="content">
<mat-card class="example-card"> <div fxLayout="row wrap">
<a routerLink="/groupboilerplates/{{gb.id}}/boilerplates"> <div fxFlex="20%" *ngFor="let gb of grouboilerplates| filter:title">
<mat-card class="example-card" routerLink="/groupboilerplates/{{gb.id}}/boilerplates">
<mat-card-header> <mat-card-header>
<div mat-card-avatar class="example-header-image"></div> <div mat-card-avatar class="example-header-image"></div>
<mat-card-title>Project {{gb.title_bgroup}}</mat-card-title> <mat-card-title>{{gb.title_bgroup}}</mat-card-title>
<mat-card-subtitle></mat-card-subtitle> <mat-card-subtitle></mat-card-subtitle>
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<p> <p>
Project Description {{gb.description}}
</p> </p>
</mat-card-content> </mat-card-content>
</a>
<mat-card-actions> <mat-card-actions>
<button class="btn btn-info" mat-button>EDIT</button> <button class="btn btn-info" mat-button>EDIT</button>
<button class="btn btn-warning" (click)="deleteGroupBoilerplate(gb)" mat-button>DELETE</button> <button class="btn btn-warning" (click)="deleteGroupBoilerplate(gb)" mat-button>DELETE</button>
</mat-card-actions> </mat-card-actions>
</mat-card> </mat-card>
</div> </div>
</div>
</div>
.example-card { .example-card {
max-width: auto; width: 350px;
height: 250px;
margin-right: 5px;
} }
.mat-card-content{
height: 100px;
}
.example-header-image { .example-header-image {
background-size: cover; background-size: cover;
......
...@@ -11,6 +11,7 @@ export class GroupboilComponent implements OnInit { ...@@ -11,6 +11,7 @@ export class GroupboilComponent implements OnInit {
grouboilerplates?: GroupBoilerplate[]; grouboilerplates?: GroupBoilerplate[];
title = ''; title = '';
constructor(private boilerplateService: BoilerplateService) { } constructor(private boilerplateService: BoilerplateService) { }
ngOnInit(): void { ngOnInit(): void {
...@@ -20,8 +21,9 @@ export class GroupboilComponent implements OnInit { ...@@ -20,8 +21,9 @@ export class GroupboilComponent implements OnInit {
retrievegroupBoilerplates(): void { retrievegroupBoilerplates(): void {
this.boilerplateService.getAllgroupboil() this.boilerplateService.getAllgroupboil()
.subscribe( .subscribe(
data => {console.log(data); data => {
this.grouboilerplates = data; this.grouboilerplates = data;
console.log(data);
}, },
error => { error => {
console.log(error); console.log(error);
......
...@@ -18,6 +18,7 @@ export class BoilerplateData { ...@@ -18,6 +18,7 @@ export class BoilerplateData {
export class GroupBoilerplate { export class GroupBoilerplate {
id?:any; id?:any;
title_bgroup?: string; title_bgroup?: string;
description?: string;
} }
export class InferenceResults { export class InferenceResults {
......
...@@ -21,7 +21,7 @@ export class BoilerplateService { ...@@ -21,7 +21,7 @@ export class BoilerplateService {
return this.http.post(baseUrlgb, data); return this.http.post(baseUrlgb, data);
} }
getAllgroupboil(): Observable<Boilerplate[]> { getAllgroupboil(): Observable<any> {
return this.http.get<[GroupBoilerplate]>(baseUrlgb); return this.http.get<[GroupBoilerplate]>(baseUrlgb);
} }
......
...@@ -74,6 +74,7 @@ def create_infer_result(instance): ...@@ -74,6 +74,7 @@ def create_infer_result(instance):
class BoilerplateGroup(models.Model): class BoilerplateGroup(models.Model):
boilerplate_owner = models.ForeignKey(User, related_name='boilerplate_group_owner', on_delete=models.CASCADE) boilerplate_owner = models.ForeignKey(User, related_name='boilerplate_group_owner', on_delete=models.CASCADE)
title_bgroup = models.CharField(max_length=30, unique=True) title_bgroup = models.CharField(max_length=30, unique=True)
description = models.CharField(max_length=500)
def save(self, **kwargs): def save(self, **kwargs):
super(BoilerplateGroup, self).save(**kwargs) super(BoilerplateGroup, self).save(**kwargs)
......
...@@ -35,4 +35,4 @@ class BoilerplateGroupSerializer(serializers.ModelSerializer): ...@@ -35,4 +35,4 @@ class BoilerplateGroupSerializer(serializers.ModelSerializer):
boilerplate_owner = serializers.ReadOnlyField(source='owner.username') boilerplate_owner = serializers.ReadOnlyField(source='owner.username')
class Meta: class Meta:
model = BoilerplateGroup model = BoilerplateGroup
fields = ('id', 'boilerplate_owner', 'title_bgroup') fields = ('id', 'boilerplate_owner', 'title_bgroup', 'description')
...@@ -76,12 +76,12 @@ class MainDetailsAPIView(RetrieveUpdateDestroyAPIView): ...@@ -76,12 +76,12 @@ class MainDetailsAPIView(RetrieveUpdateDestroyAPIView):
ev_instance =instance['verb'].rsplit(':', 1) ev_instance =instance['verb'].rsplit(':', 1)
eo_instance = instance['flow_function_interface_item_system_state_stateset'].rsplit(':', 1) eo_instance = instance['flow_function_interface_item_system_state_stateset'].rsplit(':', 1)
mn = (es_instance[len(es_instance)-1] + ' ' + instance['shall'] + ' ' + ev_instance[len(ev_instance)-1] + ' ' + eo_instance[len(eo_instance)-1]) mn = (es_instance[len(es_instance)-1] + ' ' + instance['shall'] + ' ' + ev_instance[len(ev_instance)-1] + ' ' + eo_instance[len(eo_instance)-1])
BoilerplateData.objects.filter(owner_data=instance['boilerplate_of_main'].owner, boilerplate_data_id = instance['boilerplate_of_main']).update(main_data = mn )
curmain_choices = inference.getclassofmain(instance) curmain_choices = inference.getclassofmain(instance)
#instance['main_choices'] = curmain_choices[0] #instance['main_choices'] = curmain_choices[0]
if curmain_choices[0] == 'ERROR': if curmain_choices[0] == 'ERROR':
raise APIException("Main choices not in [M1-M16]") raise APIException("Main choices not in [M1-M16]")
else: else:
BoilerplateData.objects.filter(owner_data=instance['boilerplate_of_main'].owner, boilerplate_data_id = instance['boilerplate_of_main']).update(main_data = mn )
instance = serializer.save(main_choices = curmain_choices[0]) instance = serializer.save(main_choices = curmain_choices[0])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment