Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sebastian Gottschalk
bmdl-expert-modeler
Commits
71dbd296
Commit
71dbd296
authored
Nov 22, 2021
by
Alexander Philipp Nowosad
Browse files
Add show description to instance selection
parent
f34eb437
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/app/canvas/instances/instance-select-pattern-form/instance-select-pattern-form.component.html
View file @
71dbd296
...
...
@@ -11,7 +11,7 @@
>
<option
*ngFor=
"let expertModel of expertModels"
[ngValue]=
"expertModel
._id
"
[ngValue]=
"expertModel"
>
{{ expertModel.name }}
</option>
...
...
@@ -24,13 +24,26 @@
<select
id=
"instance"
formControlName=
"instance"
class=
"form-control"
>
<option
*ngFor=
"let instance of expertModel ? expertModel.getPatterns() : []"
[ngValue]=
"instance
.id
"
[ngValue]=
"instance"
>
{{ instance.name }}
</option>
</select>
</div>
</div>
<div
*ngIf=
"
(selectPatternForm.valid || showsPattern) &&
instance != null &&
instance.description
"
class=
"form-group form-row"
>
<label
class=
"col-sm-4 col-form-label"
>
Description
</label>
<div
class=
"col-sm-8"
>
{{ instance.description }}
</div>
</div>
<div
class=
"form-group form-row"
>
<div
class=
"col-sm-12"
>
<button
...
...
src/app/canvas/instances/instance-select-pattern-form/instance-select-pattern-form.component.ts
View file @
71dbd296
...
...
@@ -3,8 +3,6 @@ import {
EventEmitter
,
Input
,
OnChanges
,
OnDestroy
,
OnInit
,
Output
,
SimpleChanges
,
}
from
'
@angular/core
'
;
...
...
@@ -16,16 +14,13 @@ import {
}
from
'
@angular/forms
'
;
import
{
Instance
}
from
'
../../../canvas-meta-model/instance
'
;
import
{
ExpertModel
}
from
'
../../../canvas-meta-model/expert-model
'
;
import
{
Subscription
}
from
'
rxjs
'
;
@
Component
({
selector
:
'
app-instance-select-pattern-form
'
,
templateUrl
:
'
./instance-select-pattern-form.component.html
'
,
styleUrls
:
[
'
./instance-select-pattern-form.component.css
'
],
})
export
class
InstanceSelectPatternFormComponent
implements
OnInit
,
OnChanges
,
OnDestroy
{
export
class
InstanceSelectPatternFormComponent
implements
OnChanges
{
@
Input
()
expertModels
:
ExpertModel
[]
=
[];
@
Input
()
showsPattern
=
false
;
...
...
@@ -40,22 +35,8 @@ export class InstanceSelectPatternFormComponent
instance
:
[
null
,
Validators
.
required
],
});
expertModel
:
ExpertModel
;
private
formSubscription
:
Subscription
;
constructor
(
private
fb
:
FormBuilder
)
{}
ngOnInit
()
{
this
.
formSubscription
=
this
.
featureModelControl
.
valueChanges
.
subscribe
(
(
value
)
=>
{
this
.
expertModel
=
this
.
expertModels
.
find
(
(
expertModel
)
=>
expertModel
.
_id
===
value
);
}
);
}
ngOnChanges
(
changes
:
SimpleChanges
)
{
if
(
changes
.
showsPattern
)
{
if
(
changes
.
showsPattern
.
currentValue
)
{
...
...
@@ -66,19 +47,21 @@ export class InstanceSelectPatternFormComponent
}
}
ngOnDestroy
()
{
if
(
this
.
formSubscription
)
{
this
.
formSubscription
.
unsubscribe
();
}
}
submit
()
{
this
.
showPattern
.
emit
({
instance
:
this
.
expertModel
.
getInstance
(
this
.
instanceControl
.
value
)
,
instance
:
this
.
instance
,
featureModelId
:
this
.
expertModel
.
_id
,
});
}
get
expertModel
():
ExpertModel
|
undefined
{
return
this
.
featureModelControl
.
value
;
}
get
instance
():
Instance
|
undefined
{
return
this
.
instanceControl
.
value
;
}
get
featureModelControl
():
FormControl
{
return
this
.
selectPatternForm
.
get
(
'
featureModel
'
)
as
FormControl
;
}
...
...
Write
Preview
Supports
Markdown
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