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 @@ ...@@ -167,7 +167,7 @@
<span div fxLayout="row" fxLayoutAlign="space-around center">{{instan.Instance}}</span> <span div fxLayout="row" fxLayoutAlign="space-around center">{{instan.Instance}}</span>
<div style="margin-bottom: 4px;"> <div style="margin-bottom: 4px;">
<button <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;" mat-mini-fab color="primary" style="margin-right: 8px;"
(click)="openInstanceDialog(instan.Instance, section.Name, item.Class, '', '', '', '')"> (click)="openInstanceDialog(instan.Instance, section.Name, item.Class, '', '', '', '')">
<mat-icon>add</mat-icon> <mat-icon>add</mat-icon>
...@@ -416,7 +416,8 @@ ...@@ -416,7 +416,8 @@
<mat-panel-title class="d-flex justify-content-between"> <mat-panel-title class="d-flex justify-content-between">
<span div fxLayout="row" fxLayoutAlign="space-around center">{{genin.Instance}}</span> <span div fxLayout="row" fxLayoutAlign="space-around center">{{genin.Instance}}</span>
<div style="margin-bottom: 4px;"> <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;" mat-mini-fab color="primary" style="margin-right: 8px;"
(click)="openInstanceDialog(genin.Instance, section.Name, '', '', '', '', '')"> (click)="openInstanceDialog(genin.Instance, section.Name, '', '', '', '', '')">
<mat-icon>add</mat-icon> <mat-icon>add</mat-icon>
......
...@@ -494,22 +494,33 @@ export class BoilerplateDetailsComponent implements OnInit { ...@@ -494,22 +494,33 @@ export class BoilerplateDetailsComponent implements OnInit {
if (this.sufchild) { this.sufchild.getflowchoices(this.route.snapshot.params.gb); } if (this.sufchild) { this.sufchild.getflowchoices(this.route.snapshot.params.gb); }
//write requirements in the ontology (invokation, contain, belongsTo) //write requirements in the ontology (invokation, contain, belongsTo)
if (isInstance) { if (isInstance) {
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( this.mainService.setsecondaryrequirement(this.route.snapshot.params.gb, section, currentInstance, result.instance, " ").subscribe(
data => { }, data => { },
error => { if (error.error.text == 'Update Instance') { } else { this.notifier.notify("warning", (JSON.stringify(error.error.detail))); } }) 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( this.mainService.setsecondaryrequirement(this.route.snapshot.params.gb, section, result.instance, result.selectedValue, " ").subscribe(
data => { }, data => { },
error => { if (error.error.text == 'Update Instance') { } else { this.notifier.notify("warning", (JSON.stringify(error.error.detail))); } }) 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))); } } 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 { ...@@ -521,7 +532,7 @@ export class BoilerplateDetailsComponent implements OnInit {
openDialog(section: any, classes: any, subclass: any, subsubclass: any, subsubsubclass: any, subsubsubsubclass: any) { openDialog(section: any, classes: any, subclass: any, subsubclass: any, subsubsubclass: any, subsubsubsubclass: any) {
const dialogRef = this.dialog.open(CourseDialogComponentComponent, { const dialogRef = this.dialog.open(CourseDialogComponentComponent, {
width: ((section == 'StateValue') ? '60%' : 'auto'), width: ((section == 'StateValue' || section == 'State' || section == 'Item') ? '60%' : 'auto'),
data: { data: {
name: section + (classes ? ' : ' + classes : '') + (subclass ? ' : ' + subclass : '') + (subsubclass ? ' : ' + subsubclass : '') + (subsubsubclass ? ' : ' + subsubsubclass : '') + (subsubsubsubclass ? ' : ' + subsubsubsubclass : ''), instance: this.currentDialog.instance, comment: this.currentDialog.comment, 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 isInstance: false, currentInstance: "", currentSection: section
......
...@@ -5,10 +5,11 @@ ...@@ -5,10 +5,11 @@
</ol> </ol>
</nav> </nav>
<div class="list row"> <div class="list row">
<div class="col-md-14"> <div class="col">
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end"> <div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<input type="text" class="form-control" placeholder="Search" (keyup)="applyFilter($event)" #input /> <input type="text" class="form-control" placeholder="Search" (keyup)="applyFilter($event)" #input />
</div> </div>
<div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end"> <div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<ul fxLayout fxLayoutGap="15px" class="navigation-items"> <ul fxLayout fxLayoutGap="15px" class="navigation-items">
<div> <div>
...@@ -24,12 +25,21 @@ ...@@ -24,12 +25,21 @@
</div> </div>
</ul> </ul>
</div> </div>
</div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end"> <div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<div> <div>
<input class="btn btn-info" [disabled]="exporting" type="button" value="Download" <input class="btn btn-info" [disabled]="exporting" type="button" value="Download"
(click)="getCurrentOntology()" /> (click)="getCurrentOntology()" />
</div> </div>
</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>
</div> </div>
......
.list { .list {
text-align: left; text-align: left;
max-width: 750px; max-width: 90%;
margin: auto; margin: auto;
} }
......
...@@ -248,6 +248,7 @@ export class BoilerplateListComponent implements OnInit { ...@@ -248,6 +248,7 @@ export class BoilerplateListComponent implements OnInit {
isAllSelected() { isAllSelected() {
const numSelected = this.selection.selected.length; const numSelected = this.selection.selected.length;
const numRows = this.newdataSource.data.length; const numRows = this.newdataSource.data.length;
//console.log(this.selection.selected[0].id);
return numSelected === numRows; return numSelected === numRows;
} }
...@@ -257,5 +258,22 @@ export class BoilerplateListComponent implements OnInit { ...@@ -257,5 +258,22 @@ export class BoilerplateListComponent implements OnInit {
this.selection.clear() : this.selection.clear() :
this.newdataSource.data.forEach(row => this.selection.select(row)); 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> <h1 mat-dialog-title>{{data.name}}</h1>
<mat-divider></mat-divider> <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; "> <div style="margin-top: 8px; ">
<mat-form-field appearance="fill"> <mat-form-field appearance="fill">
<mat-label>Instance name</mat-label> <mat-label>Instance name</mat-label>
...@@ -46,6 +48,18 @@ ...@@ -46,6 +48,18 @@
<p>The current instance will add the above requirement in the ontology :</p> <p>The current instance will add the above requirement in the ontology :</p>
<h1><u>{{data.currentInstance}} shall contain {{data.instance}}</u></h1> <h1><u>{{data.currentInstance}} shall contain {{data.instance}}</u></h1>
</div> </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-tile>
</mat-grid-list> </mat-grid-list>
</div> </div>
...@@ -77,7 +91,58 @@ ...@@ -77,7 +91,58 @@
<h1><u>{{data.instance}} belongs to </u></h1> <h1><u>{{data.instance}} belongs to </u></h1>
<mat-form-field style="width: 100%;" appearance="fill"> <mat-form-field style="width: 100%;" appearance="fill">
<mat-label>Select StateSet</mat-label> <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"> <mat-option *ngFor="let stateset of stateSet" [value]="stateset">
{{stateset}} {{stateset}}
</mat-option> </mat-option>
...@@ -86,9 +151,75 @@ ...@@ -86,9 +151,75 @@
</div> </div>
</mat-grid-tile> </mat-grid-tile>
</mat-grid-list> </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>
<div mat-dialog-actions>
<button mat-button (click)="onNoClick()">Cancel</button> <div *ngIf="data.currentSection === 'Item' && !data.isInstance">
<button mat-button [mat-dialog-close]="data" cdkFocusInitial>Add</button> <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
*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> </div>
\ No newline at end of file
import { Component, Inject, OnInit } from '@angular/core'; import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; 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 { export interface DialogData {
comment: string; comment: string;
...@@ -10,6 +10,7 @@ export interface DialogData { ...@@ -10,6 +10,7 @@ export interface DialogData {
currentInstance?: any, currentInstance?: any,
currentSection?: any, currentSection?: any,
selectedValue?: any, selectedValue?: any,
selectedValue2?: any,
} }
@Component({ @Component({
...@@ -19,6 +20,8 @@ export interface DialogData { ...@@ -19,6 +20,8 @@ export interface DialogData {
}) })
export class CourseDialogComponentComponent implements OnInit { export class CourseDialogComponentComponent implements OnInit {
stateSet = statesetfordialog; stateSet = statesetfordialog;
system = systemfordialog;
checked = false;
//selectedValue?: string; //selectedValue?: string;
......
<div fxLayoutAlign="end"> <div>
<h2 *ngIf="this.color_badge=='danger'" ><span class="badge badge-danger" > MAIN TEMPLATE : {{this.main}}</span></h2> <div *ngIf="!this.spinner">
<h2 *ngIf="this.color_badge=='success'" ><span class="badge badge-success" > MAIN TEMPLATE : {{this.main}}</span></h2> <div fxLayoutAlign="end">
</div> <h2 *ngIf="this.color_badge=='danger'"><span class="badge badge-danger"> MAIN TEMPLATE : {{this.main}}</span></h2>
<div class="form-row"> <h2 *ngIf="this.color_badge=='success'"><span class="badge badge-success"> MAIN TEMPLATE : {{this.main}}</span>
</h2>
</div>
<div class="form-row">
<div class="col"> <div class="col">
<form class="form-group form-inline" ngNativeValidate> <form class="form-group form-inline" ngNativeValidate>
<mat-form-field class="example-full-width"> <mat-form-field class="example-full-width">
<mat-label *ngIf="this.subjectsControl.value !=null">Subject : {{this.subjectsControl.value.split(':')[0]}}:{{this.subjectsControl.value.split(':')[1]}}</mat-label> <mat-label *ngIf="this.subjectsControl.value !=null">Subject :
<input type="text" placeholder="Pick one" aria-label="Subject" matInput [formControl]="subjectsControl" required {{this.subjectsControl.value.split(':')[0]}}:{{this.subjectsControl.value.split(':')[1]}}</mat-label>
[matAutocomplete]="automainsub" style="width: 100%;"> <input type="text" placeholder="Pick one" aria-label="Subject" matInput [formControl]="subjectsControl"
required [matAutocomplete]="automainsub" style="width: 100%;">
<mat-autocomplete autoActiveFirstOption #automainsub="matAutocomplete" showPanel="true" <mat-autocomplete autoActiveFirstOption #automainsub="matAutocomplete" showPanel="true"
[displayWith]="displayFn"> [displayWith]="displayFn">
<mat-option *ngFor="let option of subjectsfilteredOptions | async" [value]="option"> <mat-option *ngFor="let option of subjectsfilteredOptions | async" [value]="option">
...@@ -22,7 +26,8 @@ ...@@ -22,7 +26,8 @@
<form class="form-group form-inline" <form class="form-group form-inline"
[ngStyle]="(stateitemControlisDivVisible) ? {'visibility': 'visible'} : {'visibility': 'hidden'}"> [ngStyle]="(stateitemControlisDivVisible) ? {'visibility': 'visible'} : {'visibility': 'hidden'}">
<mat-form-field class="example-full-width"> <mat-form-field class="example-full-width">
<mat-label *ngIf="this.stateitemControl.value !=null">State or Item : {{this.stateitemControl.value.split(':')[0]}}:{{this.stateitemControl.value.split(':')[1]}} </mat-label> <mat-label *ngIf="this.stateitemControl.value !=null">State or Item :
{{this.stateitemControl.value.split(':')[0]}}:{{this.stateitemControl.value.split(':')[1]}} </mat-label>
<input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="stateitemControl" <input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="stateitemControl"
[matAutocomplete]="autostateitem"> [matAutocomplete]="autostateitem">
<mat-autocomplete autoActiveFirstOption #autostateitem="matAutocomplete" showPanel="true" <mat-autocomplete autoActiveFirstOption #autostateitem="matAutocomplete" showPanel="true"
...@@ -38,7 +43,8 @@ ...@@ -38,7 +43,8 @@
<form class="form-group form-inline" <form class="form-group form-inline"
[ngStyle]="(statevalueControlisDivVisible) ? {'visibility': 'visible'} : {'visibility': 'hidden'}"> [ngStyle]="(statevalueControlisDivVisible) ? {'visibility': 'visible'} : {'visibility': 'hidden'}">
<mat-form-field class="example-full-width"> <mat-form-field class="example-full-width">
<mat-label *ngIf="statevalueControl.value !=null">State Value : {{this.statevalueControl.value.split(':')[0]}}:{{this.statevalueControl.value.split(':')[1]}}</mat-label> <mat-label *ngIf="statevalueControl.value !=null">State Value :
{{this.statevalueControl.value.split(':')[0]}}:{{this.statevalueControl.value.split(':')[1]}}</mat-label>
<input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="statevalueControl" <input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="statevalueControl"
[matAutocomplete]="autostatevalue"> [matAutocomplete]="autostatevalue">
<mat-autocomplete autoActiveFirstOption #autostatevalue="matAutocomplete" showPanel="true" <mat-autocomplete autoActiveFirstOption #autostatevalue="matAutocomplete" showPanel="true"
...@@ -50,8 +56,8 @@ ...@@ -50,8 +56,8 @@
</mat-form-field> </mat-form-field>
</form> </form>
</div> </div>
</div> </div>
<div class="form-row"> <div class="form-row">
<div class="col" style="width: 100px;"> <div class="col" style="width: 100px;">
<form class="form-group form-inline"> <form class="form-group form-inline">
<mat-form-field class="example-full-width"> <mat-form-field class="example-full-width">
...@@ -70,10 +76,12 @@ ...@@ -70,10 +76,12 @@
<form class="form-group form-inline" <form class="form-group form-inline"
[ngStyle]="(verbControlisDivVisible) ? {'visibility': 'visible'} : {'visibility': 'hidden'}"> [ngStyle]="(verbControlisDivVisible) ? {'visibility': 'visible'} : {'visibility': 'hidden'}">
<mat-form-field class="example-full-width"> <mat-form-field class="example-full-width">
<mat-label *ngIf="verbControl.value !=null">Verb : {{this.verbControl.value.split(':')[0]}}:{{this.verbControl.value.split(':')[1]}}</mat-label> <mat-label *ngIf="verbControl.value !=null">Verb :
{{this.verbControl.value.split(':')[0]}}:{{this.verbControl.value.split(':')[1]}}</mat-label>
<input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="verbControl" required <input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="verbControl" required
[matAutocomplete]="autoverb"> [matAutocomplete]="autoverb">
<mat-autocomplete autoActiveFirstOption #autoverb="matAutocomplete" showPanel="true" [displayWith]="displayFn"> <mat-autocomplete autoActiveFirstOption #autoverb="matAutocomplete" showPanel="true"
[displayWith]="displayFn">
<mat-option *ngFor="let option of verbfilteredOptions | async" [value]="option"> <mat-option *ngFor="let option of verbfilteredOptions | async" [value]="option">
{{option.split(" : ").pop()}} {{option.split(" : ").pop()}}
</mat-option> </mat-option>
...@@ -123,15 +131,17 @@ ...@@ -123,15 +131,17 @@
</mat-form-field> </mat-form-field>
</form> </form>
</div> </div>
</div> </div>
<!-- <mat-label *ngIf=".value !=null">State or Item : {{.value.slice(0, .value.indexOf(':'))}}</mat-label> --> <!-- <mat-label *ngIf=".value !=null">State or Item : {{.value.slice(0, .value.indexOf(':'))}}</mat-label> -->
<div class="form-row"> <div class="form-row">
<div class="col"> <div class="col">
<form class="form-group form-inline"> <form class="form-group form-inline">
<mat-form-field class="example-full-width"> <mat-form-field class="example-full-width">
<mat-label *ngIf="fifuintsysstatsetControl.value !=null">Object : {{this.fifuintsysstatsetControl.value.split(':')[0]}}:{{this.fifuintsysstatsetControl.value.split(':')[1]}}</mat-label> <mat-label *ngIf="fifuintsysstatsetControl.value !=null">Object :
<input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="fifuintsysstatsetControl" {{this.fifuintsysstatsetControl.value.split(':')[0]}}:{{this.fifuintsysstatsetControl.value.split(':')[1]}}
required [matAutocomplete]="autofifuintsysstatset"> </mat-label>
<input type="text" placeholder="Pick one" aria-label="Number" matInput
[formControl]="fifuintsysstatsetControl" required [matAutocomplete]="autofifuintsysstatset">
<mat-autocomplete autoActiveFirstOption #autofifuintsysstatset="matAutocomplete" showPanel="true" <mat-autocomplete autoActiveFirstOption #autofifuintsysstatset="matAutocomplete" showPanel="true"
[displayWith]="displayFn"> [displayWith]="displayFn">
<mat-option *ngFor="let option of fifuintsysstatsetfilteredOptions | async" [value]="option"> <mat-option *ngFor="let option of fifuintsysstatsetfilteredOptions | async" [value]="option">
...@@ -145,7 +155,9 @@ ...@@ -145,7 +155,9 @@
<form class="form-group form-inline" <form class="form-group form-inline"
[ngStyle]="(stsysconsetControlisDivVisible) ? {'visibility': 'visible'} : {'visibility': 'hidden'}"> [ngStyle]="(stsysconsetControlisDivVisible) ? {'visibility': 'visible'} : {'visibility': 'hidden'}">
<mat-form-field class="example-full-width"> <mat-form-field class="example-full-width">
<mat-label *ngIf="stsysconsetControl.value !=null">StateSet or StateValue or System or Connection : {{this.stsysconsetControl.value.split(':')[0]}}:{{this.stsysconsetControl.value.split(':')[1]}}</mat-label> <mat-label *ngIf="stsysconsetControl.value !=null">StateSet or StateValue or System or Connection :
{{this.stsysconsetControl.value.split(':')[0]}}:{{this.stsysconsetControl.value.split(':')[1]}}
</mat-label>
<input placeholder="Pick one" aria-label="Number" type="text" matInput [formControl]="stsysconsetControl" <input placeholder="Pick one" aria-label="Number" type="text" matInput [formControl]="stsysconsetControl"
[matAutocomplete]="autostsysconset"> [matAutocomplete]="autostsysconset">
<mat-autocomplete autoActiveFirstOption #autostsysconset="matAutocomplete" showPanel="true" <mat-autocomplete autoActiveFirstOption #autostsysconset="matAutocomplete" showPanel="true"
...@@ -157,4 +169,9 @@ ...@@ -157,4 +169,9 @@
</mat-form-field> </mat-form-field>
</form> </form>
</div> </div>
</div>
</div>
<div *ngIf="this.spinner">
<mat-spinner style="margin: auto;"></mat-spinner>
</div>
</div> </div>
\ No newline at end of file
...@@ -9,6 +9,7 @@ import { map, startWith } from 'rxjs/operators'; ...@@ -9,6 +9,7 @@ import { map, startWith } from 'rxjs/operators';
import { NotifierService } from "angular-notifier"; import { NotifierService } from "angular-notifier";
export const statesetfordialog: string[] = []; export const statesetfordialog: string[] = [];
export const systemfordialog: string[] = [];
@Component({ @Component({
selector: 'app-main-details', selector: 'app-main-details',
...@@ -93,6 +94,7 @@ export class MainDetailsComponent implements OnInit { ...@@ -93,6 +94,7 @@ export class MainDetailsComponent implements OnInit {
message = ''; message = '';
main = ''; main = '';
color_badge = 'danger' color_badge = 'danger'
spinner = true
constructor( constructor(
private mainService: MainService, private mainService: MainService,
...@@ -246,6 +248,8 @@ export class MainDetailsComponent implements OnInit { ...@@ -246,6 +248,8 @@ export class MainDetailsComponent implements OnInit {
this.numunitControl.setValue(this.currentmain.mumerical_units); this.numunitControl.setValue(this.currentmain.mumerical_units);
this.fifuintsysstatsetControl.setValue(this.currentmain.flow_function_interface_item_system_state_stateset); this.fifuintsysstatsetControl.setValue(this.currentmain.flow_function_interface_item_system_state_stateset);
this.stsysconsetControl.setValue(this.currentmain.statevalue_system_connection_stateset); this.stsysconsetControl.setValue(this.currentmain.statevalue_system_connection_stateset);
this.spinner = false;
}, },
error => { error => {
console.log(error); console.log(error);
...@@ -304,7 +308,7 @@ export class MainDetailsComponent implements OnInit { ...@@ -304,7 +308,7 @@ export class MainDetailsComponent implements OnInit {
this.getfifuintsysstatset(JSON.parse(data[0].system_choices)); this.getfifuintsysstatset(JSON.parse(data[0].system_choices));
this.getfifuintsysstatset(JSON.parse(data[0].state_choices)); this.getfifuintsysstatset(JSON.parse(data[0].state_choices));
this.getfifuintsysstatset(JSON.parse(data[0].state_set_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 //stsysconset
this.getstsysconset(JSON.parse(data[0].state_set_choices)); this.getstsysconset(JSON.parse(data[0].state_set_choices));
this.getstsysconset(JSON.parse(data[0].system_choices)); this.getstsysconset(JSON.parse(data[0].system_choices));
...@@ -384,10 +388,13 @@ export class MainDetailsComponent implements OnInit { ...@@ -384,10 +388,13 @@ export class MainDetailsComponent implements OnInit {
} }
} }
getfordialog(strIntoObj: any): void { getfordialog(strIntoObj: any, strIntoObj2: any): void {
statesetfordialog.length = 0 statesetfordialog.length = 0
systemfordialog.length = 0
for (let x = 0; x < strIntoObj.length; x++) { for (let x = 0; x < strIntoObj.length; x++) {
statesetfordialog.push((strIntoObj[x][1])); 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): ...@@ -207,10 +207,43 @@ class AddSecondaryRequirementAPIView(APIView):
print(per_instances+(instance1),sao+"belongsTo", per_instances + stateset[len(stateset)-1].strip()) 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.add((per_instances+(instance1),sao+"belongsTo", per_instances + stateset[len(stateset)-1].strip()))
g.serialize(data.values('ontology_file')[0]['ontology_file'], format="turtle") 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') 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