Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
Requirement Formalization Tool
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thodoris Nestoridis
Requirement Formalization Tool
Commits
4f220ffb
Commit
4f220ffb
authored
Feb 23, 2021
by
Thodoris Nestoridis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get choices in angular
parent
147a1854
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
225 additions
and
48 deletions
+225
-48
boilerplate-details.component.html
...ts/boilerplate-details/boilerplate-details.component.html
+4
-1
boilerplate-details.component.ts
...ents/boilerplate-details/boilerplate-details.component.ts
+1
-1
boilerplate-list.component.html
...mponents/boilerplate-list/boilerplate-list.component.html
+0
-40
prefix-details.component.html
...p/components/prefix-details/prefix-details.component.html
+4
-0
prefix-details.component.ts
...app/components/prefix-details/prefix-details.component.ts
+80
-2
prefix-list.component.ts
...1/src/app/components/prefix-list/prefix-list.component.ts
+29
-1
prefix.model.ts
reqtool/ReqmanAngular11/src/app/models/prefix.model.ts
+10
-0
prefix.service.ts
reqtool/ReqmanAngular11/src/app/services/prefix.service.ts
+51
-1
requirements.py
.../reqman/apps/reqtool/rest_api/serializers/requirements.py
+3
-0
urls.py
reqtool/reqman/api/reqman/apps/reqtool/rest_api/urls.py
+8
-0
requirements_views.py
.../reqman/apps/reqtool/rest_api/views/requirements_views.py
+35
-2
No files found.
reqtool/ReqmanAngular11/src/app/components/boilerplate-details/boilerplate-details.component.html
View file @
4f220ffb
...
...
@@ -57,7 +57,10 @@
</button>
<p>
{{ message }}
</p>
</div>
<!---->
<app-prefix-details></app-prefix-details>
<app-prefix-list></app-prefix-list>
<!---->
<div
*
ngIf=
"!currentboilerplate.id"
>
<br
/>
<p>
Cannot access this Boilerplate...
</p>
...
...
reqtool/ReqmanAngular11/src/app/components/boilerplate-details/boilerplate-details.component.ts
View file @
4f220ffb
...
...
@@ -32,7 +32,7 @@ export class BoilerplateDetailsComponent implements OnInit {
.
subscribe
(
data
=>
{
this
.
currentboilerplate
=
data
;
console
.
log
(
data
);
//
console.log(data);
},
error
=>
{
console
.
log
(
error
);
...
...
reqtool/ReqmanAngular11/src/app/components/boilerplate-list/boilerplate-list.component.html
View file @
4f220ffb
...
...
@@ -19,46 +19,6 @@
</div>
</div>
</div>
<!--
<div class="col-md-6">
<h4>Boilerplate List</h4>
<ul class="list-group">
<li
class="list-group-item"
*ngFor="let boilerplate of boilerplates; let i = index"
[class.active]="i == currentIndex"
(click)="setActiveBoilerplate(boilerplate, i)"
>
{{boilerplate.title }}
</li>
</ul>
</div>
<div class="col-md-6">
<div *ngIf="currentBoilerplate">
<h4>Boilerplate</h4>
<div>
<label><strong>Title:</strong></label> {{ currentBoilerplate.title }}
</div>
<div>
<label><strong>Prefix:</strong></label>
{{ currentBoilerplate.has_prefix }}
</div>
<div>
<label><strong>Main:</strong></label>
{{ currentBoilerplate.has_main }}
</div>
<div>
<label><strong>Suffix:</strong></label>
{{ currentBoilerplate.has_suffix }}
</div>
<a class="badge badge-warning" routerLink="/boilerplates/{{ currentBoilerplate.id }}">
Edit
</a>
</div>
</div>
<div>
<button class="btn btn-success" routerLink="/add-boilerplate">Add</button>
</div>-->
</div>
<table
mat-table
[
dataSource
]="
dataSource
"
class=
"mat-elevation-z8"
>
...
...
reqtool/ReqmanAngular11/src/app/components/prefix-details/prefix-details.component.html
View file @
4f220ffb
<p>
prefix-details works!
</p>
<ng-container
*
ngFor=
"let prefix of simpleprefix"
>
<ul>
<li>
{{prefix[1]}}
</li>
</ul>
\ No newline at end of file
reqtool/ReqmanAngular11/src/app/components/prefix-details/prefix-details.component.ts
View file @
4f220ffb
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Prefix
}
from
'src/app/models/prefix.model'
;
import
{
PrefixService
}
from
'src/app/services/prefix.service'
;
@
Component
({
selector
:
'app-prefix-details'
,
templateUrl
:
'./prefix-details.component.html'
,
styleUrls
:
[
'./prefix-details.component.scss'
]
})
export
class
PrefixDetailsComponent
implements
OnInit
{
constructor
()
{
}
//for the moment only one prefix can showed/updates
currentprefix
:
Prefix
=
{
prefix
:
""
,
system_fun_item
:
""
,
state_or_verb
:
""
,
item_function_flow_statevalue
:
""
,
logical_expression
:
""
,
logic_connective
:
""
,
simple_prefix
:
""
,
};
message
=
''
;
simpleprefix
=
[];
subjects
=
[];
verbs
=
[];
objects
=
[];
logic_con
=
[];
ngOnInit
():
void
{
constructor
(
private
prefixService
:
PrefixService
)
{
}
ngOnInit
():
void
{
this
.
getchoices
();
}
getPrefix
(
boilerplate
:
any
,
id
:
string
):
void
{
this
.
prefixService
.
get
(
boilerplate
,
id
)
.
subscribe
(
data
=>
{
this
.
currentprefix
=
data
;
console
.
log
(
data
);
},
error
=>
{
console
.
log
(
error
);
});
}
getchoices
():
void
{
this
.
prefixService
.
getsimpleprefix
()
.
subscribe
(
data
=>
{
this
.
simpleprefix
=
data
;
},
error
=>
{
console
.
log
(
error
);
});
this
.
prefixService
.
getlogcon
()
.
subscribe
(
data
=>
{
this
.
logic_con
=
data
;
},
error
=>
{
console
.
log
(
error
);
});
this
.
prefixService
.
getverb
()
.
subscribe
(
data
=>
{
this
.
verbs
=
data
;
},
error
=>
{
console
.
log
(
error
);
});
this
.
prefixService
.
getsubject
()
.
subscribe
(
data
=>
{
this
.
subjects
=
data
;
},
error
=>
{
console
.
log
(
error
);
});
this
.
prefixService
.
getoobject
()
.
subscribe
(
data
=>
{
this
.
objects
=
data
;
},
error
=>
{
console
.
log
(
error
);
});
}
}
reqtool/ReqmanAngular11/src/app/components/prefix-list/prefix-list.component.ts
View file @
4f220ffb
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
ActivatedRoute
,
Router
}
from
'@angular/router'
;
import
{
Prefix
}
from
'src/app/models/prefix.model'
;
import
{
PrefixService
}
from
'src/app/services/prefix.service'
;
import
{
PrefixDetailsComponent
}
from
'src/app/components/prefix-details/prefix-details.component'
;
@
Component
({
selector
:
'app-prefix-list'
,
providers
:
[
PrefixDetailsComponent
],
templateUrl
:
'./prefix-list.component.html'
,
styleUrls
:
[
'./prefix-list.component.scss'
]
})
export
class
PrefixListComponent
implements
OnInit
{
prefixs
?:
Prefix
[];
constructor
(
private
prefixService
:
PrefixService
,
private
prefixDetails
:
PrefixDetailsComponent
,
private
route
:
ActivatedRoute
,
private
router
:
Router
)
{
}
constructor
()
{
}
ngOnInit
():
void
{
this
.
getAllPrefix
(
this
.
route
.
snapshot
.
params
.
id
);
//console.log("The boilerplate", this.route.snapshot.params.id);
}
getAllPrefix
(
id
:
string
):
void
{
this
.
prefixService
.
getAll
(
id
)
.
subscribe
(
data
=>
{
this
.
prefixs
=
data
;
//console.log(data);
for
(
var
val
of
data
)
{
this
.
prefixDetails
.
getPrefix
(
id
,
val
.
id
);
}
},
error
=>
{
console
.
log
(
error
);
});
}
}
reqtool/ReqmanAngular11/src/app/models/prefix.model.ts
View file @
4f220ffb
export
class
Prefix
{
id
?:
any
;
prefix_group
?:
any
;
prefix_boilerplate
?:
any
;
prefix
?:
string
;
system_fun_item
?:
string
;
state_or_verb
?:
string
;
item_function_flow_statevalue
?:
string
;
logical_expression
?:
string
;
logic_connective
?:
string
;
simple_prefix
?:
string
;
}
reqtool/ReqmanAngular11/src/app/services/prefix.service.ts
View file @
4f220ffb
import
{
Injectable
}
from
'@angular/core'
;
import
{
HttpClient
}
from
'@angular/common/http'
;
import
{
HttpHeaders
}
from
'@angular/common/http'
;
import
{
Observable
}
from
'rxjs'
;
import
{
Prefix
}
from
'../models/prefix.model'
;
const
baseUrl
=
'http://155.207.131.19:8000/api-auth/boilerplates/'
;
const
Url
=
'/prefix/'
;
@
Injectable
({
providedIn
:
'root'
})
export
class
PrefixService
{
constructor
()
{
}
constructor
(
private
http
:
HttpClient
)
{
}
getAll
(
boilerplate
:
any
):
Observable
<
Prefix
[]
>
{
return
this
.
http
.
get
<
Prefix
[]
>
(
`
${
baseUrl
}${
boilerplate
}${
Url
}
`
);
}
get
(
boilerplate
:
any
,
id
:
any
):
Observable
<
Prefix
>
{
return
this
.
http
.
get
(
`
${
baseUrl
}${
boilerplate
}${
Url
}${
id
}
`
);
}
create
(
boilerplate
:
any
,
data
:
any
):
Observable
<
any
>
{
return
this
.
http
.
post
(
`
${
baseUrl
}${
boilerplate
}${
Url
}
`
,
data
);
}
update
(
boilerplate
:
any
,
id
:
any
,
data
:
any
):
Observable
<
any
>
{
return
this
.
http
.
put
(
`
${
baseUrl
}${
boilerplate
}${
Url
}${
id
}
/`
,
data
);
}
delete
(
boilerplate
:
any
,
id
:
any
):
Observable
<
any
>
{
return
this
.
http
.
delete
(
`
${
baseUrl
}${
boilerplate
}${
Url
}${
baseUrl
}${
id
}
`
);
}
getsimpleprefix
():
Observable
<
any
>
{
return
this
.
http
.
get
(
`http://155.207.131.19:8000/api-auth/prefix/choices/simpleprefix/`
);
}
getlogcon
():
Observable
<
any
>
{
return
this
.
http
.
get
(
`http://155.207.131.19:8000/api-auth/prefix/choices/logicalconnectivity/`
);
}
getverb
():
Observable
<
any
>
{
return
this
.
http
.
get
(
`http://155.207.131.19:8000/api-auth/prefix/choices/verbprefix/`
);
}
getsubject
():
Observable
<
any
>
{
return
this
.
http
.
get
(
`http://155.207.131.19:8000/api-auth/prefix/choices/sysfunitem/`
);
}
getoobject
():
Observable
<
any
>
{
return
this
.
http
.
get
(
`http://155.207.131.19:8000/api-auth/prefix/choices/staflowfunitem/`
);
}
//findByTitle(title: any): Observable<Prefix[]> {
// return this.http.get<Prefix[]>(`${baseUrl}title=${title}`);
//}
}
reqtool/reqman/api/reqman/apps/reqtool/rest_api/serializers/requirements.py
View file @
4f220ffb
from
rest_framework
import
serializers
from
reqman.apps.reqtool.models.requirements
import
Prefix
,
Boilerplate
class
BoilerplateSerializer
(
serializers
.
ModelSerializer
):
owner
=
serializers
.
ReadOnlyField
(
source
=
'owner.username'
)
class
Meta
:
...
...
@@ -14,3 +15,5 @@ class PrefixSerializer(serializers.ModelSerializer):
class
Meta
:
model
=
Prefix
fields
=
'__all__'
reqtool/reqman/api/reqman/apps/reqtool/rest_api/urls.py
View file @
4f220ffb
from
django.urls
import
path
,
re_path
from
django.conf.urls
import
url
from
.views
import
user_views
,
requirements_views
,
main_req_views
,
suffix_req_views
urlpatterns
=
[
...
...
@@ -21,4 +22,11 @@ urlpatterns = [
path
(
'boilerplates/<int:boilerplate>/suffix/'
,
suffix_req_views
.
SuffixListAPIView
.
as_view
(),
name
=
'api-suffix-list'
),
path
(
'boilerplates/<int:boilerplate>/suffix/<int:pk>/'
,
suffix_req_views
.
SuffixDetailsAPIView
.
as_view
(),
name
=
'api-suffix-details'
),
#PREFIX CHOICES DATA
path
(
'prefix/choices/simpleprefix/'
,
requirements_views
.
PrefixChoicesViewSet
.
as_view
(),
name
=
'simpleprefixchoices'
),
path
(
'prefix/choices/logicalconnectivity/'
,
requirements_views
.
LogConChoicesViewSet
.
as_view
(),
name
=
'logicalconnectivitychoices'
),
path
(
'prefix/choices/verbprefix/'
,
requirements_views
.
VerbChoicesViewSet
.
as_view
(),
name
=
'verbprefixchoices'
),
path
(
'prefix/choices/sysfunitem/'
,
requirements_views
.
FunItemSysChoicesViewSet
.
as_view
(),
name
=
'sysfunitem'
),
path
(
'prefix/choices/staflowfunitem/'
,
requirements_views
.
StaFlowFunItemChoicesViewSet
.
as_view
(),
name
=
'staflowfunitem'
),
]
\ No newline at end of file
reqtool/reqman/api/reqman/apps/reqtool/rest_api/views/requirements_views.py
View file @
4f220ffb
...
...
@@ -5,10 +5,14 @@ from django.http import HttpResponse, JsonResponse
from
django.views.decorators.csrf
import
csrf_exempt
from
rest_framework.parsers
import
JSONParser
from
reqman.apps.reqtool.models.requirements
import
Prefix
,
Boilerplate
from
reqman.apps.reqtool.models.requirements
import
Prefix
,
Boilerplate
,
PREFIX_CHOICES
,
LOGIC_CONNECTIVE
,
VERB_CHOICES
from
reqman.apps.reqtool.models.requirements
import
VERB_CHOICES
,
ITEM_CHOICES
,
SYSTEM_CHOICES
,
FUNCTION_CHOICES
,
STATE_CHOICES
from
reqman.apps.reqtool.models.requirements
import
ITEM_CHOICES
,
FLOW_CHOICES
,
FUNCTION_CHOICES
,
STATE_VALUE_CHOICES
from
reqman.apps.reqtool.rest_api.serializers.requirements
import
PrefixSerializer
,
BoilerplateSerializer
from
reqman.apps.permissions
import
IsOwnerOrReadOnly
from
reqman.apps.reqtool.rest_api.services
import
fuseki
from
rest_framework.response
import
Response
from
rest_framework.views
import
APIView
from
django.shortcuts
import
get_object_or_404
...
...
@@ -81,7 +85,7 @@ class PrefixListAPIView(ListAPIView):
permission_classes
=
[
permissions
.
IsAuthenticatedOrReadOnly
]
serializer_class
=
PrefixSerializer
#
queryset
=
Prefix
.
objects
.
all
()
#
queryset = Prefix.objects.all()
def
get_queryset
(
self
):
group_pk
=
self
.
kwargs
[
'boilerplate'
]
...
...
@@ -127,3 +131,32 @@ class PrefixDetailsAPIView(RetrieveUpdateDestroyAPIView):
#print("deleted")
instance
.
delete
()
class
PrefixChoicesViewSet
(
APIView
):
def
get
(
self
,
request
):
response
=
Response
(
PREFIX_CHOICES
)
return
response
class
LogConChoicesViewSet
(
APIView
):
def
get
(
self
,
request
):
response
=
Response
(
LOGIC_CONNECTIVE
)
return
response
class
VerbChoicesViewSet
(
APIView
):
def
get
(
self
,
request
):
response
=
Response
(
STATE_CHOICES
+
VERB_CHOICES
)
return
response
class
FunItemSysChoicesViewSet
(
APIView
):
def
get
(
self
,
request
):
response
=
Response
(
ITEM_CHOICES
+
SYSTEM_CHOICES
+
FUNCTION_CHOICES
)
return
response
class
StaFlowFunItemChoicesViewSet
(
APIView
):
def
get
(
self
,
request
):
response
=
Response
(
ITEM_CHOICES
+
FLOW_CHOICES
+
FUNCTION_CHOICES
+
STATE_VALUE_CHOICES
)
return
response
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment