Commit e6c217cf authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

ui fixes

parent 61c047f4
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<nav aria-label="breadcrumb"> <nav aria-label="breadcrumb">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a routerLink="../../../../">Projects</a></li> <li class="breadcrumb-item"><a routerLink="../../../../">Projects</a></li>
<li class="breadcrumb-item"><a routerLink="../../">Boilerplate List</a></li> <li class="breadcrumb-item"><a routerLink="../../">Requirement List</a></li>
<li class="breadcrumb-item" aria-current="page">Edit Requirement</li> <li class="breadcrumb-item" aria-current="page">Edit Requirement</li>
</ol> </ol>
</nav> </nav>
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
<form class="form-group form-inline "> <form class="form-group form-inline ">
<mat-checkbox class="example-full-width" <mat-checkbox class="example-full-width"
[(ngModel)]="currentboilerplate.has_prefix" [(ngModel)]="currentboilerplate.has_prefix"
(change)="this.updateBoilerplate()"
name="has_prefix" name="has_prefix"
>Prefix >Prefix
</mat-checkbox> </mat-checkbox>
...@@ -41,6 +42,7 @@ ...@@ -41,6 +42,7 @@
<mat-checkbox class="example-full-width" <mat-checkbox class="example-full-width"
[(ngModel)]="currentboilerplate.has_main" [(ngModel)]="currentboilerplate.has_main"
name="has_prefix" name="has_prefix"
[disabled]="true"
>Main >Main
</mat-checkbox> </mat-checkbox>
</form> </form>
...@@ -53,6 +55,7 @@ ...@@ -53,6 +55,7 @@
<form class="form-group form-inline "> <form class="form-group form-inline ">
<mat-checkbox class="example-full-width" <mat-checkbox class="example-full-width"
[(ngModel)]="this.currentboilerplate.has_suffix" [(ngModel)]="this.currentboilerplate.has_suffix"
(change)="this.updateBoilerplate()"
name="has_suffix" name="has_suffix"
>Suffix >Suffix
</mat-checkbox> </mat-checkbox>
...@@ -67,7 +70,7 @@ ...@@ -67,7 +70,7 @@
<input class="btn btn-success" <input class="btn btn-success"
type="button" type="button"
value=" Update Boilerplate" value=" Update Boilerplate"
(click)="updateBoilerplate()"/> (click)="updateDetailsOfBoilerplate()"/>
</div> </div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end"> <div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<input class="btn btn-warning" <input class="btn btn-warning"
......
...@@ -67,19 +67,24 @@ export class BoilerplateDetailsComponent implements OnInit { ...@@ -67,19 +67,24 @@ export class BoilerplateDetailsComponent implements OnInit {
} }
updateBoilerplate(): any { updateBoilerplate(): any {
if (this.currentboilerplate.has_prefix){this.prefchild.updatePrefix()};
if (this.currentboilerplate.has_main){this.mainchild.updateMain();};
if (this.currentboilerplate.has_suffix){this.sufchild.updateSuffix();};
this.boilerplateService.update(this.route.snapshot.params.gb, this.currentboilerplate.id, this.currentboilerplate) this.boilerplateService.update(this.route.snapshot.params.gb, this.currentboilerplate.id, this.currentboilerplate)
.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']);
if (this.currentboilerplate.has_prefix){this.prefchild.getAllPrefix(this.currentboilerplate.id)};
if (this.currentboilerplate.has_suffix){this.sufchild.getAllSuffix(this.currentboilerplate.id);};
}, },
error => { error => {
this.notifier.notify("warning",(JSON.stringify(error))); this.notifier.notify("warning",(JSON.stringify(error)));
}); });}
updateDetailsOfBoilerplate(): any {
if (this.currentboilerplate.has_prefix){this.prefchild.updatePrefix()};
if (this.currentboilerplate.has_main){this.mainchild.updateMain();};
if (this.currentboilerplate.has_suffix){this.sufchild.updateSuffix();};
this.notifier.notify("success",(JSON.stringify("Requirement " + this.currentboilerplate.title + " updated")));
} }
deleteBoilerplate(): void { deleteBoilerplate(): void {
......
<nav aria-label="breadcrumb"> <nav aria-label="breadcrumb">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a routerLink="../../">Projects</a></li> <li class="breadcrumb-item"><a routerLink="../../">Projects</a></li>
<li class="breadcrumb-item" aria-current="page">Boilerplate List</li> <li class="breadcrumb-item" aria-current="page">Requirement List</li>
</ol> </ol>
</nav> </nav>
<div class="list row"> <div class="list row">
......
...@@ -265,7 +265,7 @@ export class MainDetailsComponent implements OnInit { ...@@ -265,7 +265,7 @@ export class MainDetailsComponent implements OnInit {
this.message = response.message; this.message = response.message;
}, },
error => { error => {
this.notifier.notify("warning",(JSON.stringify(error["error"]))); this.notifier.notify("warning",("MAIN " + JSON.stringify(error["error"])));
});} });}
......
...@@ -53,9 +53,9 @@ ...@@ -53,9 +53,9 @@
[formControl]="verbsControl" [formControl]="verbsControl"
[matAutocomplete]="autoverb" [matAutocomplete]="autoverb"
> >
<mat-autocomplete autoActiveFirstOption #autoverb="matAutocomplete"> <mat-autocomplete autoActiveFirstOption #autoverb="matAutocomplete" showPanel="true" [displayWith]="displayFn">
<mat-option *ngFor="let option of verbsfilteredOptions | async" [value]="option"> <mat-option *ngFor="let option of verbsfilteredOptions | async" [value]="option">
{{option}} {{option.split(" : ").pop()}}
</mat-option> </mat-option>
</mat-autocomplete> </mat-autocomplete>
</mat-form-field> </mat-form-field>
......
...@@ -146,7 +146,7 @@ export class PrefixDetailsComponent implements OnInit { ...@@ -146,7 +146,7 @@ export class PrefixDetailsComponent implements OnInit {
this.message = response.message; this.message = response.message;
}, },
error => { error => {
this.notifier.notify("warning",(JSON.stringify(error["error"]))); this.notifier.notify("warning",("PREFIX "+JSON.stringify(error["error"])));
});} });}
} }
......
...@@ -65,6 +65,7 @@ export class SuffixDetailsComponent implements OnInit { ...@@ -65,6 +65,7 @@ export class SuffixDetailsComponent implements OnInit {
this.getAllSuffix(this.route.snapshot.params.id); this.getAllSuffix(this.route.snapshot.params.id);
} }
displayFn(option:string): string { displayFn(option:string): string {
if (option != null) { if (option != null) {
let x = option.split(" : "); let x = option.split(" : ");
...@@ -90,6 +91,7 @@ export class SuffixDetailsComponent implements OnInit { ...@@ -90,6 +91,7 @@ export class SuffixDetailsComponent implements OnInit {
for (var val of data) { for (var val of data) {
this.getSuffix(id, val.id); this.getSuffix(id, val.id);
SuffixDetailsComponent.id.push(val.id); SuffixDetailsComponent.id.push(val.id);
console.log(val.id)
} }
}, },
error => { error => {
...@@ -125,7 +127,7 @@ export class SuffixDetailsComponent implements OnInit { ...@@ -125,7 +127,7 @@ export class SuffixDetailsComponent implements OnInit {
this.message = response.message; this.message = response.message;
}, },
error => { error => {
this.notifier.notify("warning",(JSON.stringify(error["error"]))); this.notifier.notify("warning",("SUFFIX "+JSON.stringify(error["error"])));
});} });}
} }
......
...@@ -27,8 +27,7 @@ LOGICAL_EXPRESSION = ( ("",""), ...@@ -27,8 +27,7 @@ LOGICAL_EXPRESSION = ( ("",""),
("occuring functionality", "occuring functionality") ("occuring functionality", "occuring functionality")
) )
VERB_CHOICES = (("is","is"),("send","send"),("receive","receive"), VERB_CHOICES = get_verb_instances("LO#Verb")
("ingest","ingest"),("emit","emit"),("perform","perform"))
PREFIX_CHOICES = ( ("If/Unless", "If/Unless"), PREFIX_CHOICES = ( ("If/Unless", "If/Unless"),
......
...@@ -170,9 +170,11 @@ class PrefixDetailsAPIView(RetrieveUpdateDestroyAPIView): ...@@ -170,9 +170,11 @@ class PrefixDetailsAPIView(RetrieveUpdateDestroyAPIView):
def perform_update(self, serializer): def perform_update(self, serializer):
instance = serializer.validated_data instance = serializer.validated_data
#add data in thn Model BoilerplateData #add data in thn Model BoilerplateData
print(instance)
es_instance = instance['system_fun_item'].rsplit(':', 1) es_instance = instance['system_fun_item'].rsplit(':', 1)
eo_instance = instance['item_function_flow_statevalue'].rsplit(':', 1) ev_instance =instance['state_or_verb'].rsplit(':', 1)
pr = (instance['prefix'] + ' ' + es_instance[len(es_instance)-1] + ' ' + instance['state_or_verb'] + ' ' + eo_instance[len(eo_instance)-1]) ei_instance = instance['item_function_flow_statevalue'].rsplit(':', 1)
pr = (instance['prefix'] + ' ' + es_instance[len(es_instance)-1] + ' ' + ev_instance[len(ev_instance)-1] + ' ' + ei_instance[len(ei_instance)-1])
BoilerplateData.objects.filter(owner_data=instance['prefix_boilerplate'].owner, boilerplate_data_id = instance['prefix_boilerplate']).update(prefix_data = pr ) BoilerplateData.objects.filter(owner_data=instance['prefix_boilerplate'].owner, boilerplate_data_id = instance['prefix_boilerplate']).update(prefix_data = pr )
sprefix = self.simple_prefix(instance["prefix"]) sprefix = self.simple_prefix(instance["prefix"])
serializer.save(simple_prefix = sprefix) serializer.save(simple_prefix = sprefix)
......
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