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
anis
anis-admin
Commits
4af442d4
Commit
4af442d4
authored
Nov 17, 2020
by
Tifenn Guillas
Browse files
Add authentication as instance config parameter
parent
0b2653bd
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/app/metamodel/components/instance/form-instance.component.html
View file @
4af442d4
...
...
@@ -13,16 +13,23 @@
</div>
<hr
class=
"mt-4"
>
<h4>
Authentication:
</h4>
<div
class=
"form-check mb-2"
>
<input
class=
"form-check-input"
type=
"checkbox"
id=
"authentication"
name=
"authentication"
[ngModel]=
"getConfig('authentication', 'allowed')"
>
<label
class=
"form-check-label"
for=
"authentication"
>
User authentication available
</label>
</div>
<hr>
<h4>
Search:
</h4>
<div
class=
"form-check mb-2"
>
<input
class=
"form-check-input"
type=
"checkbox"
id=
"search"
name=
"search"
[ngModel]=
"getConfig('search')"
>
<input
class=
"form-check-input"
type=
"checkbox"
id=
"search"
name=
"search"
[ngModel]=
"getConfig('search'
, 'allowed'
)"
>
<label
class=
"form-check-label"
for=
"search"
>
Classic search allowed
</label>
</div>
<hr>
<h4>
Search multiple:
</h4>
<div
class=
"form-check mb-2"
>
<input
class=
"form-check-input"
type=
"checkbox"
id=
"search_multiple"
name=
"search_multiple"
[ngModel]=
"getConfig
S
earch
M
ultiple
(
'allowed')"
>
<input
class=
"form-check-input"
type=
"checkbox"
id=
"search_multiple"
name=
"search_multiple"
[ngModel]=
"getConfig
('s
earch
_m
ultiple
',
'allowed')"
>
<label
class=
"form-check-label"
for=
"search_multiple"
>
Search multiple allowed
</label>
</div>
<div
class=
"form-check mb-2"
>
...
...
@@ -31,14 +38,14 @@
id=
"all_datasets_selected"
name=
"all_datasets_selected"
[disabled]=
"!ngForm.form.value.search_multiple"
[ngModel]=
"getConfig
S
earch
M
ultiple
(
'all_datasets_selected')"
>
[ngModel]=
"getConfig
('s
earch
_m
ultiple
',
'all_datasets_selected')"
>
<label
class=
"form-check-label"
for=
"all_datasets_selected"
>
All datasets with cone search enabled selected by default
</label>
</div>
<hr>
<h4>
Documentation:
</h4>
<div
class=
"form-check mb-2"
>
<input
class=
"form-check-input"
type=
"checkbox"
id=
"documentation"
name=
"documentation"
[ngModel]=
"getConfig('documentation')"
>
<input
class=
"form-check-input"
type=
"checkbox"
id=
"documentation"
name=
"documentation"
[ngModel]=
"getConfig('documentation'
, 'allowed'
)"
>
<label
class=
"form-check-label"
for=
"documentation"
>
Documentation allowed
</label>
</div>
...
...
src/app/metamodel/components/instance/form-instance.component.ts
View file @
4af442d4
...
...
@@ -12,30 +12,31 @@ export class FormInstanceComponent {
@
Input
()
model
:
Instance
=
new
Instance
();
@
Output
()
submitted
:
EventEmitter
<
Instance
>
=
new
EventEmitter
();
getConfig
(
key
:
string
):
boolean
{
if
(
this
.
model
.
config
&&
this
.
model
.
config
[
key
])
{
return
this
.
model
.
config
[
key
];
}
return
false
;
}
getConfig
SearchMultiple
(
key
:
string
):
boolean
{
if
(
this
.
model
.
config
&&
this
.
model
.
config
.
search_multiple
&&
this
.
model
.
config
.
search_multiple
[
key
])
{
return
this
.
model
.
config
.
search_multiple
[
key
];
getConfig
(
prop
:
string
,
key
:
string
):
boolean
{
if
(
this
.
model
.
config
&&
this
.
model
.
config
[
prop
]
&&
this
.
model
.
config
[
prop
]
[
key
])
{
return
this
.
model
.
config
[
prop
]
[
key
];
}
return
false
;
}
emit
(
instance
:
Instance
)
{
let
instanceEmitted
:
Instance
;
(
this
.
model
.
name
)
?
instanceEmitted
=
{
name
:
this
.
model
.
name
,
...
instance
}
:
instanceEmitted
=
instance
;
(
this
.
model
.
name
)
?
instanceEmitted
=
{
name
:
this
.
model
.
name
,
...
instance
}
:
instanceEmitted
=
instance
;
instanceEmitted
.
config
=
{
search
:
this
.
ngForm
.
form
.
value
.
search
,
authentication
:
{
allowed
:
this
.
ngForm
.
form
.
value
.
authentication
},
search
:
{
allowed
:
this
.
ngForm
.
form
.
value
.
search
},
search_multiple
:
{
allowed
:
this
.
ngForm
.
form
.
value
.
search_multiple
,
all_datasets_selected
:
this
.
ngForm
.
form
.
value
.
all_datasets_selected
},
documentation
:
this
.
ngForm
.
value
.
documentation
documentation
:
{
allowed
:
this
.
ngForm
.
value
.
documentation
}
};
this
.
submitted
.
emit
(
instanceEmitted
);
}
...
...
src/app/metamodel/containers/instance/edit-instance.component.ts
View file @
4af442d4
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
Observable
}
from
'
rxjs
'
;
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
Store
}
from
'
@ngrx/store
'
;
import
{
Observable
}
from
'
rxjs
'
;
import
{
Instance
}
from
'
../../store/model
'
;
import
*
as
instanceActions
from
'
../../store/action/instance.action
'
;
...
...
src/app/metamodel/store/model/instance.model.ts
View file @
4af442d4
...
...
@@ -3,11 +3,18 @@ export class Instance {
label
:
string
;
client_url
:
string
;
config
:
{
search
:
boolean
;
authentication
:
{
allowed
:
boolean
;
};
search
:
{
allowed
:
boolean
;
};
search_multiple
:
{
allowed
:
boolean
;
all_datasets_selected
:
boolean
;
};
documentation
:
boolean
;
documentation
:
{
allowed
:
boolean
;
};
};
}
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