Commit 4ef011fc authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

Complete 5 Main Auto REq - Change table -del rows

parent a250d052
......@@ -167,7 +167,7 @@
<span div fxLayout="row" fxLayoutAlign="space-around center">{{instan.Instance}}</span>
<div style="margin-bottom: 4px;">
<button
*ngIf="section.Name == 'Function' || section.Name == 'System' || section.Name == 'Item'"
*ngIf="section.Name == 'Function' || section.Name == 'System' || section.Name == 'Item' "
mat-mini-fab color="primary" style="margin-right: 8px;"
(click)="openInstanceDialog(instan.Instance, section.Name, item.Class, '', '', '', '')">
<mat-icon>add</mat-icon>
......@@ -416,7 +416,8 @@
<mat-panel-title class="d-flex justify-content-between">
<span div fxLayout="row" fxLayoutAlign="space-around center">{{genin.Instance}}</span>
<div style="margin-bottom: 4px;">
<button *ngIf="section.Name == 'Function' || section.Name == 'System' || section.Name == 'Item' "
<button
*ngIf="section.Name == 'Function' || section.Name == 'System' || section.Name == 'Item' "
mat-mini-fab color="primary" style="margin-right: 8px;"
(click)="openInstanceDialog(genin.Instance, section.Name, '', '', '', '', '')">
<mat-icon>add</mat-icon>
......
......@@ -494,22 +494,33 @@ export class BoilerplateDetailsComponent implements OnInit {
if (this.sufchild) { this.sufchild.getflowchoices(this.route.snapshot.params.gb); }
//write requirements in the ontology (invokation, contain, belongsTo)
if (isInstance) {
this.mainService.setsecondaryrequirement(this.route.snapshot.params.gb, section, currentInstance, result.instance, " ").subscribe(
data => { },
error => { if (error.error.text == 'Update Instance') { } else { this.notifier.notify("warning", (JSON.stringify(error.error.detail))); } })
if (result.selectedValue) {
this.mainService.setsecondaryrequirement(this.route.snapshot.params.gb, section, currentInstance, result.instance, result.selectedValue).subscribe(
data => { },
error => { if (error.error.text == 'Update Instance') { } else { this.notifier.notify("warning", (JSON.stringify(error.error.detail))); } })
}
else {
this.mainService.setsecondaryrequirement(this.route.snapshot.params.gb, section, currentInstance, result.instance, " ").subscribe(
data => { },
error => { if (error.error.text == 'Update Instance') { } else { this.notifier.notify("warning", (JSON.stringify(error.error.detail))); } })
}
}
if (result.selectedValue) {
if (result.selectedValue && !result.selectedValue2 && !isInstance) {
{
this.mainService.setsecondaryrequirement(this.route.snapshot.params.gb, section, result.instance, result.selectedValue, " ").subscribe(
data => { },
error => { if (error.error.text == 'Update Instance') { } else { this.notifier.notify("warning", (JSON.stringify(error.error.detail))); } })
}
}
if (result.selectedValue2) {
{
this.mainService.setsecondaryrequirement(this.route.snapshot.params.gb, section, result.instance, result.selectedValue, result.selectedValue2).subscribe(
data => { },
error => { if (error.error.text == 'Update Instance') { } else { this.notifier.notify("warning", (JSON.stringify(error.error.detail))); } })
}
}
} else { this.notifier.notify("warning", (JSON.stringify(error.error.detail))); }
});
//this.ngOnInit();
//Call to update instances
}
}
......@@ -521,7 +532,7 @@ export class BoilerplateDetailsComponent implements OnInit {
openDialog(section: any, classes: any, subclass: any, subsubclass: any, subsubsubclass: any, subsubsubsubclass: any) {
const dialogRef = this.dialog.open(CourseDialogComponentComponent, {
width: ((section == 'StateValue') ? '60%' : 'auto'),
width: ((section == 'StateValue' || section == 'State' || section == 'Item') ? '60%' : 'auto'),
data: {
name: section + (classes ? ' : ' + classes : '') + (subclass ? ' : ' + subclass : '') + (subsubclass ? ' : ' + subsubclass : '') + (subsubsubclass ? ' : ' + subsubsubclass : '') + (subsubsubsubclass ? ' : ' + subsubsubsubclass : ''), instance: this.currentDialog.instance, comment: this.currentDialog.comment,
isInstance: false, currentInstance: "", currentSection: section
......
......@@ -5,24 +5,26 @@
</ol>
</nav>
<div class="list row">
<div class="col-md-14">
<div class="col">
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<input type="text" class="form-control" placeholder="Search" (keyup)="applyFilter($event)" #input />
</div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<ul fxLayout fxLayoutGap="15px" class="navigation-items">
<div>
<input class="btn btn-success" type="button" value="Add Requirement" routerLink="add-boilerplate" />
</div>
</ul>
</div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<ul *ngFor="let inf of infer;" fxLayout fxLayoutGap="15px" class="navigation-items">
<div>
<input class="btn btn-info" [disabled]="exporting" type="button" value="Inferencing"
(click)="updateInfer(inf.id)" />
</div>
</ul>
<div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<ul fxLayout fxLayoutGap="15px" class="navigation-items">
<div>
<input class="btn btn-success" type="button" value="Add Requirement" routerLink="add-boilerplate" />
</div>
</ul>
</div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<ul *ngFor="let inf of infer;" fxLayout fxLayoutGap="15px" class="navigation-items">
<div>
<input class="btn btn-info" [disabled]="exporting" type="button" value="Inferencing"
(click)="updateInfer(inf.id)" />
</div>
</ul>
</div>
</div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<div>
......@@ -30,6 +32,14 @@
(click)="getCurrentOntology()" />
</div>
</div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end" *ngIf="this.selection.selected.length >= 1">
<div>
<button mat-mini-fab color="warn" (click)="deleteBoilerplateList()">
<mat-icon>delete</mat-icon>
</button>
</div>
</div>
</div>
</div>
......
.list {
text-align: left;
max-width: 750px;
max-width: 90%;
margin: auto;
}
......
......@@ -248,6 +248,7 @@ export class BoilerplateListComponent implements OnInit {
isAllSelected() {
const numSelected = this.selection.selected.length;
const numRows = this.newdataSource.data.length;
//console.log(this.selection.selected[0].id);
return numSelected === numRows;
}
......@@ -257,5 +258,22 @@ export class BoilerplateListComponent implements OnInit {
this.selection.clear() :
this.newdataSource.data.forEach(row => this.selection.select(row));
}
deleteBoilerplateList(): void {
if (confirm("Αre you sure you want to delete this list of Boilerplates?")) {
let num = 0;
for (let currentboilerplate of this.selection.selected) {
num++;
this.boilerplateService.delete(this.route.snapshot.params.gb, currentboilerplate.id)
.subscribe(
response => {
if (num == this.selection.selected.length) { location.reload(); }
},
error => {
this.notifier.notify("warning", (JSON.stringify(error)));
});
}
}
// location.reload();
}
}
<h1 mat-dialog-title>{{data.name}}</h1>
<mat-divider></mat-divider>
<div *ngIf="!data.isInstance && data.currentSection !== 'StateValue'" class="text-center" mat-dialog-content>
<div
*ngIf="!data.isInstance && data.currentSection !== 'StateValue' && data.currentSection !== 'State' && data.currentSection !== 'Item'"
class="text-center" mat-dialog-content>
<div style="margin-top: 8px; ">
<mat-form-field appearance="fill">
<mat-label>Instance name</mat-label>
......@@ -46,6 +48,18 @@
<p>The current instance will add the above requirement in the ontology :</p>
<h1><u>{{data.currentInstance}} shall contain {{data.instance}}</u></h1>
</div>
<div class="col" *ngIf="data.currentSection == 'Item'">
<p>The current instance will add the above requirement in the ontology :</p>
<mat-form-field style="width: 100%;" appearance="fill">
<mat-label>Select System</mat-label>
<mat-select required [(ngModel)]="data.selectedValue" name="system">
<mat-option *ngFor="let system of system" [value]="system">
{{system}}
</mat-option>
</mat-select>
</mat-form-field>
<h1><u> {{data.currentInstance}} shall be composed from {{data.instance}}</u></h1>
</div>
</mat-grid-tile>
</mat-grid-list>
</div>
......@@ -77,7 +91,58 @@
<h1><u>{{data.instance}} belongs to </u></h1>
<mat-form-field style="width: 100%;" appearance="fill">
<mat-label>Select StateSet</mat-label>
<mat-select [(ngModel)]="data.selectedValue" name="stateset">
<mat-select required [(ngModel)]="data.selectedValue" name="stateset">
<mat-option *ngFor="let stateset of stateSet" [value]="stateset">
{{stateset}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</mat-grid-tile>
</mat-grid-list>
<div mat-dialog-actions>
<button mat-button color="warn" (click)="onNoClick()">Cancel</button>
<button [disabled]="!data.selectedValue" mat-button color="primary" [mat-dialog-close]="data"
cdkFocusInitial>Add</button>
</div>
</div>
<div *ngIf="data.currentSection === 'State'">
<mat-grid-list cols="2" rowHeight="2:1">
<mat-grid-tile>
<div mat-dialog-content>
<div style="margin-top: 8px; ">
<mat-form-field appearance="fill">
<mat-label>Instance name</mat-label>
<input matInput required [(ngModel)]="data.instance">
</mat-form-field>
</div>
<div style="margin-top: 8px;">
<mat-form-field appearance="fill">
<mat-label>Instance comment</mat-label>
<textarea matInput required [(ngModel)]="data.comment"></textarea>
</mat-form-field>
</div>
</div>
<div style="margin-left: 100px;">
<mat-divider vertical style="height:250px"></mat-divider>
</div>
</mat-grid-tile>
<mat-grid-tile>
<div class="col">
<p>The current instance will add the above requirement in the ontology :</p>
<mat-form-field style="width: 100%;" appearance="fill">
<mat-label>Select System</mat-label>
<mat-select required [(ngModel)]="data.selectedValue" name="system1">
<mat-option *ngFor="let system1 of system" [value]="system1">
{{system1}}
</mat-option>
</mat-select>
</mat-form-field>
<h1><u>shall have state {{data.instance}} with values </u></h1>
<mat-form-field style="width: 100%;" appearance="fill">
<mat-label>Select StateSet</mat-label>
<mat-select required [(ngModel)]="data.selectedValue2" name="stateset">
<mat-option *ngFor="let stateset of stateSet" [value]="stateset">
{{stateset}}
</mat-option>
......@@ -86,9 +151,75 @@
</div>
</mat-grid-tile>
</mat-grid-list>
<div mat-dialog-actions>
<button mat-button color="warn" (click)="onNoClick()">Cancel</button>
<button [disabled]="!data.selectedValue || !data.selectedValue2" mat-button color="primary"
[mat-dialog-close]="data" cdkFocusInitial>Add</button>
</div>
</div>
<div *ngIf="data.currentSection === 'Item' && !data.isInstance">
<mat-grid-list cols="2" rowHeight="2:1">
<mat-grid-tile>
<div mat-dialog-content>
<div style="margin-top: 8px; ">
<mat-form-field appearance="fill">
<mat-label>Instance name</mat-label>
<input matInput required [(ngModel)]="data.instance">
</mat-form-field>
</div>
<div style="margin-top: 8px;">
<mat-form-field appearance="fill">
<mat-label>Instance comment</mat-label>
<textarea matInput required [(ngModel)]="data.comment"></textarea>
</mat-form-field>
</div>
</div>
<div style="margin-left: 100px;">
<mat-divider vertical style="height:250px"></mat-divider>
</div>
</mat-grid-tile>
<mat-grid-tile>
<div class="col">
<section class="example-section">
<mat-checkbox class="example-margin" [(ngModel)]="checked">Checked if the item can have State Values
</mat-checkbox>
</section>
<div *ngIf="checked">
<p>The current instance will add the above requirement in the ontology :</p>
<mat-form-field style="width: 100%;" appearance="fill">
<mat-label>Select System</mat-label>
<mat-select required [(ngModel)]="data.selectedValue" name="system">
<mat-option *ngFor="let system of system" [value]="system">
{{system}}
</mat-option>
</mat-select>
</mat-form-field>
<h1><u>{{data.instance}} shall take values from </u></h1>
<mat-form-field style="width: 100%;" appearance="fill">
<mat-label>Select StateSet</mat-label>
<mat-select required [(ngModel)]="data.selectedValue2" name="stateset">
<mat-option *ngFor="let stateset of stateSet" [value]="stateset">
{{stateset}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</mat-grid-tile>
</mat-grid-list>
<div mat-dialog-actions>
<button mat-button color="warn" (click)="onNoClick()">Cancel</button>
<button [disabled]="checked && (!data.selectedValue || !data.selectedValue2)" mat-button color="primary"
[mat-dialog-close]="data" cdkFocusInitial>Add</button>
</div>
</div>
<div mat-dialog-actions>
<button mat-button (click)="onNoClick()">Cancel</button>
<button mat-button [mat-dialog-close]="data" cdkFocusInitial>Add</button>
<div mat-dialog-actions
*ngIf="data.currentSection != 'StateValue' && data.currentSection !== 'State' && !(data.currentSection === 'Item' && !data.isInstance) ">
<button mat-button color="warn" (click)="onNoClick()">Cancel</button>
<button [disabled]="data.currentSection == 'Item' && data.isInstance && !data.selectedValue" mat-button
color="primary" [mat-dialog-close]="data" cdkFocusInitial>Add</button>
</div>
\ No newline at end of file
import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { statesetfordialog } from '../main-details/main-details.component';
import { statesetfordialog, systemfordialog } from '../main-details/main-details.component';
export interface DialogData {
comment: string;
......@@ -10,6 +10,7 @@ export interface DialogData {
currentInstance?: any,
currentSection?: any,
selectedValue?: any,
selectedValue2?: any,
}
@Component({
......@@ -19,6 +20,8 @@ export interface DialogData {
})
export class CourseDialogComponentComponent implements OnInit {
stateSet = statesetfordialog;
system = systemfordialog;
checked = false;
//selectedValue?: string;
......
......@@ -9,6 +9,7 @@ import { map, startWith } from 'rxjs/operators';
import { NotifierService } from "angular-notifier";
export const statesetfordialog: string[] = [];
export const systemfordialog: string[] = [];
@Component({
selector: 'app-main-details',
......@@ -93,6 +94,7 @@ export class MainDetailsComponent implements OnInit {
message = '';
main = '';
color_badge = 'danger'
spinner = true
constructor(
private mainService: MainService,
......@@ -246,6 +248,8 @@ export class MainDetailsComponent implements OnInit {
this.numunitControl.setValue(this.currentmain.mumerical_units);
this.fifuintsysstatsetControl.setValue(this.currentmain.flow_function_interface_item_system_state_stateset);
this.stsysconsetControl.setValue(this.currentmain.statevalue_system_connection_stateset);
this.spinner = false;
},
error => {
console.log(error);
......@@ -304,7 +308,7 @@ export class MainDetailsComponent implements OnInit {
this.getfifuintsysstatset(JSON.parse(data[0].system_choices));
this.getfifuintsysstatset(JSON.parse(data[0].state_choices));
this.getfifuintsysstatset(JSON.parse(data[0].state_set_choices));
this.getfordialog(JSON.parse(data[0].state_set_choices));
this.getfordialog(JSON.parse(data[0].state_set_choices), JSON.parse(data[0].system_choices));
//stsysconset
this.getstsysconset(JSON.parse(data[0].state_set_choices));
this.getstsysconset(JSON.parse(data[0].system_choices));
......@@ -384,10 +388,13 @@ export class MainDetailsComponent implements OnInit {
}
}
getfordialog(strIntoObj: any): void {
getfordialog(strIntoObj: any, strIntoObj2: any): void {
statesetfordialog.length = 0
systemfordialog.length = 0
for (let x = 0; x < strIntoObj.length; x++) {
statesetfordialog.push((strIntoObj[x][1]));
} for (let x = 0; x < strIntoObj2.length; x++) {
systemfordialog.push((strIntoObj2[x][1]));
}
}
......
......@@ -207,10 +207,43 @@ class AddSecondaryRequirementAPIView(APIView):
print(per_instances+(instance1),sao+"belongsTo", per_instances + stateset[len(stateset)-1].strip())
g.add((per_instances+(instance1),sao+"belongsTo", per_instances + stateset[len(stateset)-1].strip()))
g.serialize(data.values('ontology_file')[0]['ontology_file'], format="turtle")
if (section == 'State'):
system =instance2.rsplit(':')
stateset=instance3.rsplit(':')
g.add((per_instances + section+instance1+stateset[len(stateset)-1].strip()+system[len(system)-1].strip(), RDF.type, rdo + 'Requirement'))
g.add((per_instances + section+instance1+stateset[len(stateset)-1].strip()+system[len(system)-1].strip(), rdo + 'hasMain', per_instances+(section+instance1+stateset[len(stateset)-1].strip()+system[len(system)-1].strip()+"_M12")))
g.add((per_instances+(section+instance1+stateset[len(stateset)-1].strip()+system[len(system)-1].strip()+"_M12"), RDF.type, rbo + "M12"))
g.add((per_instances+(section+instance1+stateset[len(stateset)-1].strip()+system[len(system)-1].strip()+"_M12"), rbo+"isRelatedToState", per_instances+instance1))
g.add((per_instances+(section+instance1+stateset[len(stateset)-1].strip()+system[len(system)-1].strip()+"_M12"), rbo+"isRelatedToStateSet", per_instances+stateset[len(stateset)-1].strip()))
g.add((per_instances+(section+instance1+stateset[len(stateset)-1].strip()+system[len(system)-1].strip()+"_M12"), rbo+"isRelatedToSubject", per_instances+system[len(system)-1].strip()))
g.add((per_instances+(section+instance1+stateset[len(stateset)-1].strip()+system[len(system)-1].strip()+"_M12"), rbo+"isRelatedToAction", lo+"HaveState"))
g.serialize(data.values('ontology_file')[0]['ontology_file'], format="turtle")
if (section == 'Item'):
if( "StateSet" in instance3):
item= instance1
system =instance2.rsplit(':')[len(instance2.rsplit(':'))-1].strip()
stateset =instance3.rsplit(':')[len(instance3.rsplit(':'))-1].strip()
g.add((per_instances + section+system+item+stateset, RDF.type, rdo + 'Requirement'))
g.add((per_instances + section+system+item+stateset, rdo + 'hasMain', per_instances + section+system+item+stateset+"_M14"))
g.add((per_instances + section+system+item+stateset+"_M14", RDF.type, rbo + "M14"))
g.add((per_instances + section+system+item+stateset+"_M14", rbo+"isRelatedToSubject", per_instances + system))
g.add((per_instances + section+system+item+stateset+"_M14", rbo+"isRelatedToStateSet", per_instances + stateset))
g.add((per_instances + section+system+item+stateset+"_M14", rbo+"isRelatedToSubjectItem", per_instances + item))
g.add((per_instances + section+system+item+stateset+"_M14", rbo+"isRelatedToAction", lo+"TakeValuesFrom"))
g.serialize(data.values('ontology_file')[0]['ontology_file'], format="turtle")
else:
item= instance1
item2 =instance2
system =instance3.rsplit(':')
g.add((per_instances + section+system[len(system)-1].strip()+item+item2, RDF.type, rdo + 'Requirement'))
g.add((per_instances + section+system[len(system)-1].strip()+item+item2, rdo + 'hasMain', (per_instances + section+system[len(system)-1].strip()+item+item2+"_M15")))
g.add((per_instances + section+system[len(system)-1].strip()+item+item2+"_M15", RDF.type, rbo + "M15"))
g.add((per_instances + section+system[len(system)-1].strip()+item+item2+"_M15", rbo+"isRelatedToSubject", per_instances+system[len(system)-1].strip()))
g.add((per_instances + section+system[len(system)-1].strip()+item+item2+"_M15", rbo+"isRelatedToAction", lo+"BeComposedFrom"))
g.add((per_instances + section+system[len(system)-1].strip()+item+item2+"_M15", rbo+"isRelatedToSubjectItem", per_instances+item))
g.add((per_instances + section+system[len(system)-1].strip()+item+item2+"_M15", rbo+"isRelatedToTraversingConcept", per_instances+item2))
g.serialize(data.values('ontology_file')[0]['ontology_file'], format="turtle")
#print(section)
return HttpResponse('Update Instance')
......
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