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 {
response => {
this.notifier.notify("success",(JSON.stringify(response)));
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 => {
console.log(error);
......
......@@ -17,9 +17,20 @@
[(ngModel)]="groupboilerplate.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>
</div>
</div>
\ No newline at end of file
......@@ -13,6 +13,7 @@ export class AddGroupboilComponent implements OnInit {
groupboilerplate: GroupBoilerplate = {
title_bgroup: "",
description: "",
};
submitted = false;
private readonly notifier: NotifierService;
......@@ -26,6 +27,7 @@ export class AddGroupboilComponent implements OnInit {
saveBoilerplate(): void {
const data = {
title_bgroup: this.groupboilerplate.title_bgroup,
description: this.groupboilerplate.description,
};
this.boilerplatelService.creategroupboil(data)
......@@ -45,6 +47,7 @@ export class AddGroupboilComponent implements OnInit {
this.submitted = false;
this.groupboilerplate = {
title_bgroup: "",
description: "",
};
}
......
......@@ -68,7 +68,7 @@
value=" Update Boilerplate"
(click)="updateBoilerplate()"/>
</div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="start">
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<input class="btn btn-warning"
type="button"
value="Delete Boilerplate"
......
......@@ -75,7 +75,7 @@ export class BoilerplateDetailsComponent implements OnInit {
.subscribe(
response => {
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 => {
this.notifier.notify("warning",(JSON.stringify(error)));
......@@ -107,16 +107,6 @@ export class BoilerplateDetailsComponent implements OnInit {
console.log(error);
});
}
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 {
if (i.length>1){ return true}
......
......@@ -34,23 +34,26 @@
</div>
</div>
<div *ngFor="let gb of grouboilerplates| filter:title">
<mat-card class="example-card">
<a routerLink="/groupboilerplates/{{gb.id}}/boilerplates">
<div class="content">
<div fxLayout="row wrap">
<div fxFlex="20%" *ngFor="let gb of grouboilerplates| filter:title">
<mat-card class="example-card" routerLink="/groupboilerplates/{{gb.id}}/boilerplates">
<mat-card-header>
<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-header>
<mat-card-content>
<p>
Project Description
{{gb.description}}
</p>
</mat-card-content>
</a>
<mat-card-actions>
<button class="btn btn-info" mat-button>EDIT</button>
<button class="btn btn-warning" (click)="deleteGroupBoilerplate(gb)" mat-button>DELETE</button>
</mat-card-actions>
</mat-card>
</div>
</div>
</div>
.example-card {
max-width: auto;
width: 350px;
height: 250px;
margin-right: 5px;
}
.mat-card-content{
height: 100px;
}
.example-header-image {
background-size: cover;
......
......@@ -10,6 +10,7 @@ import { BoilerplateService } from 'src/app/services/boilerplate.service';
export class GroupboilComponent implements OnInit {
grouboilerplates?: GroupBoilerplate[];
title = '';
constructor(private boilerplateService: BoilerplateService) { }
......@@ -20,8 +21,9 @@ export class GroupboilComponent implements OnInit {
retrievegroupBoilerplates(): void {
this.boilerplateService.getAllgroupboil()
.subscribe(
data => {console.log(data);
data => {
this.grouboilerplates = data;
console.log(data);
},
error => {
console.log(error);
......
......@@ -18,6 +18,7 @@ export class BoilerplateData {
export class GroupBoilerplate {
id?:any;
title_bgroup?: string;
description?: string;
}
export class InferenceResults {
......
......@@ -21,7 +21,7 @@ export class BoilerplateService {
return this.http.post(baseUrlgb, data);
}
getAllgroupboil(): Observable<Boilerplate[]> {
getAllgroupboil(): Observable<any> {
return this.http.get<[GroupBoilerplate]>(baseUrlgb);
}
......
......@@ -74,6 +74,7 @@ def create_infer_result(instance):
class BoilerplateGroup(models.Model):
boilerplate_owner = models.ForeignKey(User, related_name='boilerplate_group_owner', on_delete=models.CASCADE)
title_bgroup = models.CharField(max_length=30, unique=True)
description = models.CharField(max_length=500)
def save(self, **kwargs):
super(BoilerplateGroup, self).save(**kwargs)
......
......@@ -35,4 +35,4 @@ class BoilerplateGroupSerializer(serializers.ModelSerializer):
boilerplate_owner = serializers.ReadOnlyField(source='owner.username')
class Meta:
model = BoilerplateGroup
fields = ('id', 'boilerplate_owner', 'title_bgroup')
fields = ('id', 'boilerplate_owner', 'title_bgroup', 'description')
......@@ -76,12 +76,12 @@ class MainDetailsAPIView(RetrieveUpdateDestroyAPIView):
ev_instance =instance['verb'].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])
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)
#instance['main_choices'] = curmain_choices[0]
if curmain_choices[0] == 'ERROR':
raise APIException("Main choices not in [M1-M16]")
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])
......
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