Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Maintenance - Mise à jour mensuelle Lundi 6 Février entre 7h00 et 9h00
Open sidebar
urgi-is
data-discovery
Commits
a62f50c5
Commit
a62f50c5
authored
Aug 07, 2018
by
Exbrayat Cédric
Browse files
fix: do not deactivate large aggregations with a single option
parent
b537ffe3
Changes
2
Hide whitespace changes
Inline
Side-by-side
frontend/src/app/large-aggregation/large-aggregation.component.html
View file @
a62f50c5
...
...
@@ -11,25 +11,16 @@
<small
class=
"text-muted ml-1"
>
({{ aggregation.buckets.length | number }})
</small>
</h3>
<!-- multiple values as pills and a typeahead to add them -->
<div
*ngIf=
"aggregation.buckets.length > 1; else singleValue"
>
<div
class=
"mb-2"
>
<!-- values as pills and a typeahead to add them -->
<div
class=
"mb-2"
>
<span
class=
"badge badge-pill badge-secondary mr-1"
*ngFor=
"let key of selectedKeys"
tabindex=
"0"
(keydown.backspace)=
"removeKey(key)"
>
<rare-document-count
[name]=
"key"
[count]=
"documentCountForKey(key)"
[muted]=
"false"
></rare-document-count>
<button
tabindex=
"-1"
type=
"button"
class=
"btn btn-link"
(click)=
"removeKey(key)"
>
×
</button>
</span>
</div>
<input
id=
"typeahead-basic"
type=
"text"
class=
"form-control"
[formControl]=
"criterion"
[ngbTypeahead]=
"search"
(selectItem)=
"selectKey($event)"
[resultTemplate]=
"resultTemplate"
/>
</div>
<!-- single value as a pill not removable -->
<ng-template
#singleValue
>
<span
class=
"badge badge-pill badge-light"
>
<rare-document-count
[name]=
"aggregation.buckets[0].key"
[count]=
"aggregation.buckets[0].documentCount"
[muted]=
"false"
></rare-document-count>
</span>
</ng-template>
<input
class=
"form-control"
[formControl]=
"criterion"
[ngbTypeahead]=
"search"
(selectItem)=
"selectKey($event)"
[resultTemplate]=
"resultTemplate"
/>
</div>
</div>
...
...
frontend/src/app/large-aggregation/large-aggregation.component.spec.ts
View file @
a62f50c5
...
...
@@ -122,25 +122,6 @@ describe('LargeAggregationComponent', () => {
expect
(
tester
.
pills
[
1
].
button
(
'
button
'
)).
not
.
toBeNull
();
});
it
(
'
should disable the unique criterion and display it as a pill
'
,
()
=>
{
// given an aggregation with a bucket and a unique value
const
tester
=
new
LargeAggregationComponentTester
();
const
component
=
tester
.
componentInstance
;
component
.
aggregation
=
toAggregation
(
'
coo
'
,
[
'
France
'
]);
// when displaying the component
tester
.
detectChanges
();
// then it should have no input
expect
(
tester
.
inputField
).
toBeNull
();
expect
(
tester
.
typeahead
).
toBeNull
();
// and France should be displayed a pill
expect
(
tester
.
pills
.
length
).
toBe
(
1
);
expect
(
tester
.
pills
[
0
]).
toContainText
(
'
France[10]
'
);
// but not a removable one
expect
(
tester
.
pills
[
0
].
button
(
'
button
'
)).
toBeNull
();
});
it
(
'
should find one results containing the term entered
'
,
()
=>
{
// given an aggregation with a bucket
const
component
=
new
LargeAggregationComponent
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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