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-client
Commits
b634210b
Commit
b634210b
authored
Aug 22, 2019
by
François Agneray
Browse files
Move delete criteria action
parent
33a80f05
Changes
31
Hide whitespace changes
Inline
Side-by-side
src/app/search/components/criteria/criteria-by-family.component.html
View file @
b634210b
...
...
@@ -3,69 +3,69 @@
<div
*ngSwitchCase=
"'fd'"
>
<app-field
class=
"criteria"
[id]=
"attribute.id"
[operator]=
"attribute.operator"
[label]=
"attribute.form_label"
[placeholder]=
"attribute.placeholder_min"
[attributeType]=
"attribute.type"
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
>
[attributeType]=
"attribute.type"
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
(delete)=
"delete($event)"
>
</app-field>
</div>
<div
*ngSwitchCase=
"'bw'"
>
<app-between
class=
"criteria"
[id]=
"attribute.id"
[label]=
"attribute.form_label"
[placeholderMin]=
"attribute.placeholder_min"
[placeholderMax]=
"attribute.placeholder_max"
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
>
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
(delete)=
"delete($event)"
>
</app-between>
</div>
<div
*ngSwitchCase=
"'se'"
>
<app-select
class=
"criteria"
[id]=
"attribute.id"
[operator]=
"attribute.operator"
[label]=
"attribute.form_label"
[options]=
"getOptions(attribute.id)"
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
>
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
(delete)=
"delete($event)"
>
</app-select>
</div>
<div
*ngSwitchCase=
"'ms'"
>
<app-select-multiple
class=
"criteria"
[id]=
"attribute.id"
[operator]=
"attribute.operator"
[label]=
"attribute.form_label"
[options]=
"getOptions(attribute.id)"
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
>
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
(delete)=
"delete($event)"
>
</app-select-multiple>
</div>
<div
*ngSwitchCase=
"'dl'"
>
<app-datalist
class=
"criteria"
[id]=
"attribute.id"
[operator]=
"attribute.operator"
[label]=
"attribute.form_label"
[placeholder]=
"attribute.placeholder_min"
[options]=
"getOptions(attribute.id)"
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
>
[options]=
"getOptions(attribute.id)"
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
(delete)=
"delete($event)"
>
</app-datalist>
</div>
<div
*ngSwitchCase=
"'rd'"
>
<app-radio
class=
"criteria"
[id]=
"attribute.id"
[operator]=
"attribute.operator"
[label]=
"attribute.form_label"
[options]=
"getOptions(attribute.id)"
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
>
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
(delete)=
"delete($event)"
>
</app-radio>
</div>
<div
*ngSwitchCase=
"'cb'"
>
<app-checkbox
class=
"criteria"
[id]=
"attribute.id"
[operator]=
"attribute.operator"
[label]=
"attribute.form_label"
[options]=
"getOptions(attribute.id)"
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
>
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
(delete)=
"delete($event)"
>
</app-checkbox>
</div>
<div
*ngSwitchCase=
"'dt'"
>
<app-date
class=
"criteria"
[id]=
"attribute.id"
[operator]=
"attribute.operator"
[label]=
"attribute.form_label"
[placeholder]=
"attribute.placeholder_min"
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
>
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
(delete)=
"delete($event)"
>
</app-date>
</div>
<div
*ngSwitchCase=
"'bd'"
>
<app-between-date
class=
"criteria"
[id]=
"attribute.id"
[operator]=
"attribute.operator"
[label]=
"attribute.form_label"
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
>
[label]=
"attribute.form_label"
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
(delete)=
"delete($event)"
>
</app-between-date>
</div>
<div
*ngSwitchCase=
"'tm'"
>
<app-time
class=
"criteria"
[id]=
"attribute.id"
[label]=
"attribute.form_label"
[operator]=
"attribute.operator"
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
>
[operator]=
"attribute.operator"
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
(delete)=
"delete($event)"
>
</app-time>
</div>
<div
*ngSwitchCase=
"'ts'"
>
<app-datetime
class=
"criteria"
[id]=
"attribute.id"
[label]=
"attribute.form_label"
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
>
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
(delete)=
"delete($event)"
>
</app-datetime>
</div>
<div
*ngSwitchCase=
"'js'"
>
<app-json
class=
"criteria"
[id]=
"attribute.id"
[label]=
"attribute.form_label"
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
>
[criterion]=
"getCriterion(attribute.id)"
(add)=
"add($event)"
(delete)=
"delete($event)"
>
</app-json>
</div>
<div
*ngSwitchDefault
>
...
...
src/app/search/components/criteria/criteria-by-family.component.ts
View file @
b634210b
...
...
@@ -33,4 +33,8 @@ export class CriteriaByFamilyComponent {
add
(
criterion
:
Criterion
):
void
{
this
.
addCriterion
.
emit
(
criterion
);
}
delete
(
id
:
number
):
void
{
this
.
deleteCriterion
.
emit
(
id
);
}
}
src/app/search/components/criteria/criteria-tabs.component.html
View file @
b634210b
...
...
@@ -2,9 +2,12 @@
<div
class=
"border rounded my-2"
>
<p
class=
"border-bottom bg-light text-primary py-4 pl-4"
>
{{ criteriaFamilyList[0].label }}
</p>
<div
class=
"px-3"
>
<app-criteria-by-family
[criteriaFamily]=
"criteriaFamilyList[0]"
[datasetAttributeList]=
"datasetAttributeList"
[criteriaList]=
"criteriaList"
(addCriterion)=
"add($event)"
>
<app-criteria-by-family
[criteriaFamily]=
"criteriaFamilyList[0]"
[datasetAttributeList]=
"datasetAttributeList"
[criteriaList]=
"criteriaList"
(addCriterion)=
"add($event)"
(deleteCriterion)=
"delCriterion($event)"
>
</app-criteria-by-family>
</div>
</div>
...
...
@@ -22,8 +25,12 @@
<span
*ngIf=
"!ag.isOpen"
><i
class=
"fas fa-chevron-down"
></i></span>
</div>
</button>
<app-criteria-by-family
[criteriaFamily]=
"family"
[datasetAttributeList]=
"datasetAttributeList"
[criteriaList]=
"criteriaList"
(addCriterion)=
"add($event)"
>
<app-criteria-by-family
[criteriaFamily]=
"family"
[datasetAttributeList]=
"datasetAttributeList"
[criteriaList]=
"criteriaList"
(addCriterion)=
"add($event)"
(deleteCriterion)=
"delCriterion($event)"
>
</app-criteria-by-family>
</accordion-group>
</ng-container>
...
...
src/app/search/components/criteria/criteria-tabs.component.ts
View file @
b634210b
...
...
@@ -14,6 +14,7 @@ export class CriteriaTabsComponent {
@
Input
()
datasetAttributeList
:
Attribute
[];
@
Input
()
criteriaList
:
Criterion
[];
@
Output
()
addCriterion
:
EventEmitter
<
Criterion
>
=
new
EventEmitter
();
@
Output
()
deleteCriterion
:
EventEmitter
<
number
>
=
new
EventEmitter
();
getAttributeByFamily
(
idFamily
:
number
):
Attribute
[]
{
return
this
.
datasetAttributeList
...
...
@@ -23,4 +24,8 @@ export class CriteriaTabsComponent {
add
(
criterion
:
Criterion
):
void
{
this
.
addCriterion
.
emit
(
criterion
);
}
delCriterion
(
id
:
number
):
void
{
this
.
deleteCriterion
.
emit
(
id
);
}
}
src/app/search/components/criteria/search-type/between-date.component.html
View file @
b634210b
...
...
@@ -6,7 +6,11 @@
bsDaterangepicker
>
</div>
<div
class=
"col-2 text-center"
>
<button
class=
"btn btn-outline-success"
*ngIf=
"!field.disabled"
[hidden]=
"!field.value"
(click)=
"addCriterion()"
><i
class=
"fas fa-plus-circle"
></i></button>
<button
class=
"btn btn-outline-success"
*ngIf=
"!field.disabled"
[hidden]=
"!field.value"
(click)=
"addCriterion()"
>
<i
class=
"fas fa-plus fa-fw"
></i>
</button>
<button
class=
"btn btn-outline-danger"
*ngIf=
"field.disabled"
(click)=
"deleteCriterion()"
>
<i
class=
"fa fa-times fa-fw"
></i>
</button>
</div>
</div>
\ No newline at end of file
src/app/search/components/criteria/search-type/between-date.component.ts
View file @
b634210b
...
...
@@ -17,6 +17,7 @@ export class BetweenDateComponent {
this
.
getDefault
(
criterion
);
}
@
Output
()
add
:
EventEmitter
<
BetweenDateCriterion
>
=
new
EventEmitter
();
@
Output
()
delete
:
EventEmitter
<
number
>
=
new
EventEmitter
();
field
=
new
FormControl
(
''
);
...
...
@@ -27,6 +28,10 @@ export class BetweenDateComponent {
this
.
add
.
emit
(
fd
);
}
deleteCriterion
()
{
this
.
delete
.
emit
(
this
.
id
);
}
getDefault
(
criterion
:
Criterion
):
void
{
if
(
!
criterion
)
{
this
.
field
.
setValue
(
''
);
...
...
src/app/search/components/criteria/search-type/between.component.html
View file @
b634210b
...
...
@@ -10,6 +10,8 @@
</div>
<div
class=
"col-2 text-center"
>
<button
class=
"btn btn-outline-success"
*ngIf=
"!fieldMin.disabled"
[hidden]=
"!fieldMin.value && !fieldMax.value"
(click)=
"addCriterion()"
><i
class=
"fas fa-plus-circle"
></i></button>
(click)=
"addCriterion()"
><i
class=
"fas fa-plus fa-fw"
></i></button>
<button
class=
"btn btn-outline-danger"
*ngIf=
"fieldMin.disabled"
(click)=
"deleteCriterion()"
><i
class=
"fa fa-times fa-fw"
></i></button>
</div>
</div>
\ No newline at end of file
src/app/search/components/criteria/search-type/between.component.ts
View file @
b634210b
...
...
@@ -18,6 +18,7 @@ export class BetweenComponent {
this
.
getDefault
(
criterion
);
}
@
Output
()
add
:
EventEmitter
<
BetweenCriterion
>
=
new
EventEmitter
();
@
Output
()
delete
:
EventEmitter
<
number
>
=
new
EventEmitter
();
fieldMin
=
new
FormControl
(
''
);
fieldMax
=
new
FormControl
(
''
);
...
...
@@ -27,6 +28,10 @@ export class BetweenComponent {
this
.
add
.
emit
(
fd
);
}
deleteCriterion
()
{
this
.
delete
.
emit
(
this
.
id
);
}
getDefault
(
criterion
:
Criterion
):
void
{
if
(
!
criterion
)
{
this
.
fieldMin
.
setValue
(
''
);
...
...
src/app/search/components/criteria/search-type/checkbox.component.html
View file @
b634210b
...
...
@@ -7,7 +7,11 @@
</div>
</div>
<div
class=
"col-2 text-center"
>
<button
class=
"btn btn-outline-success"
*ngIf=
"!checkboxes.disabled"
[hidden]=
"!isChecked()"
(click)=
"addCriterion()"
><i
class=
"fas fa-plus-circle"
></i></button>
<button
class=
"btn btn-outline-success"
*ngIf=
"!checkboxes.disabled"
[hidden]=
"!isChecked()"
(click)=
"addCriterion()"
>
<i
class=
"fas fa-plus fa-fw"
></i>
</button>
<button
class=
"btn btn-outline-danger"
*ngIf=
"checkboxes.disabled"
(click)=
"deleteCriterion()"
>
<i
class=
"fa fa-times fa-fw"
></i>
</button>
</div>
</div>
\ No newline at end of file
src/app/search/components/criteria/search-type/checkbox.component.ts
View file @
b634210b
...
...
@@ -23,6 +23,7 @@ export class CheckboxComponent {
this
.
getDefault
(
criterion
);
}
@
Output
()
add
:
EventEmitter
<
SelectMultipleCriterion
>
=
new
EventEmitter
();
@
Output
()
delete
:
EventEmitter
<
number
>
=
new
EventEmitter
();
checkboxes
:
FormArray
;
checkboxesFormControls
:
{
value
:
string
,
control
:
FormControl
}[];
...
...
@@ -39,6 +40,10 @@ export class CheckboxComponent {
this
.
add
.
emit
(
cb
);
}
deleteCriterion
()
{
this
.
delete
.
emit
(
this
.
id
);
}
setCheckboxes
(
options
:
Option
[])
{
this
.
checkboxesFormControls
=
[];
this
.
checkboxes
=
new
FormArray
(
options
.
map
((
option
:
Option
)
=>
{
...
...
src/app/search/components/criteria/search-type/datalist.component.html
View file @
b634210b
...
...
@@ -8,7 +8,11 @@
</datalist>
</div>
<div
class=
"col-2 text-center"
>
<button
class=
"btn btn-outline-success"
*ngIf=
"!field.disabled"
[hidden]=
"!field.value"
(click)=
"addCriterion()"
><i
class=
"fas fa-plus-circle"
></i></button>
<button
class=
"btn btn-outline-success"
*ngIf=
"!field.disabled"
[hidden]=
"!field.value"
(click)=
"addCriterion()"
>
<i
class=
"fas fa-plus fa-fw"
></i>
</button>
<button
class=
"btn btn-outline-danger"
*ngIf=
"field.disabled"
(click)=
"deleteCriterion()"
>
<i
class=
"fa fa-times fa-fw"
></i>
</button>
</div>
</div>
\ No newline at end of file
src/app/search/components/criteria/search-type/datalist.component.ts
View file @
b634210b
...
...
@@ -20,6 +20,7 @@ export class DatalistComponent {
this
.
getDefault
(
criterion
);
}
@
Output
()
add
:
EventEmitter
<
FieldCriterion
>
=
new
EventEmitter
();
@
Output
()
delete
:
EventEmitter
<
number
>
=
new
EventEmitter
();
field
=
new
FormControl
(
''
);
...
...
@@ -28,6 +29,10 @@ export class DatalistComponent {
this
.
add
.
emit
(
fd
);
}
deleteCriterion
()
{
this
.
delete
.
emit
(
this
.
id
);
}
getDefault
(
criterion
:
Criterion
):
void
{
if
(
!
criterion
)
{
this
.
field
.
setValue
(
''
);
...
...
src/app/search/components/criteria/search-type/date.component.html
View file @
b634210b
...
...
@@ -5,7 +5,11 @@
[bsValue]=
"field.value"
[bsConfig]=
"{ dateInputFormat: 'YYYY-MM-DD' }"
bsDatepicker
>
</div>
<div
class=
"col-2 text-center"
>
<button
class=
"btn btn-outline-success"
*ngIf=
"!field.disabled"
[hidden]=
"!field.value"
(click)=
"addCriterion()"
><i
class=
"fas fa-plus-circle"
></i></button>
<button
class=
"btn btn-outline-success"
*ngIf=
"!field.disabled"
[hidden]=
"!field.value"
(click)=
"addCriterion()"
>
<i
class=
"fas fa-plus fa-fw"
></i>
</button>
<button
class=
"btn btn-outline-danger"
*ngIf=
"field.disabled"
(click)=
"deleteCriterion()"
>
<i
class=
"fa fa-times fa-fw"
></i>
</button>
</div>
</div>
\ No newline at end of file
src/app/search/components/criteria/search-type/date.component.ts
View file @
b634210b
...
...
@@ -18,6 +18,7 @@ export class DateComponent {
this
.
getDefault
(
criterion
);
}
@
Output
()
add
:
EventEmitter
<
FieldCriterion
>
=
new
EventEmitter
();
@
Output
()
delete
:
EventEmitter
<
number
>
=
new
EventEmitter
();
field
=
new
FormControl
(
''
);
...
...
@@ -26,6 +27,10 @@ export class DateComponent {
this
.
add
.
emit
(
fd
);
}
deleteCriterion
()
{
this
.
delete
.
emit
(
this
.
id
);
}
getDefault
(
criterion
:
Criterion
):
void
{
if
(
!
criterion
)
{
this
.
field
.
setValue
(
''
);
...
...
src/app/search/components/criteria/search-type/datetime.component.html
View file @
b634210b
<div
class=
"form-group row"
>
<label
class=
"col-3 col-form-label"
>
{{ label }}
</label>
<div
class=
"col"
>
<input
type=
"text"
placeholder=
"Pick a date..."
class=
"form-control"
[formControl]=
"date"
[bsValue]=
"date.value"
[bsConfig]=
"{ dateInputFormat: 'YYYY-MM-DD' }"
(change)=
"change()"
bsDatepicker
>
<input
type=
"text"
placeholder=
"Pick a date..."
class=
"form-control"
[formControl]=
"date"
[bsValue]=
"date.value"
[bsConfig]=
"{ dateInputFormat: 'YYYY-MM-DD' }"
(change)=
"change()"
bsDatepicker
>
</div>
<div
class=
"col"
>
<div
class=
"row"
>
...
...
@@ -21,7 +20,12 @@
</div>
</div>
<div
class=
"col-2 text-center"
>
<button
class=
"btn btn-outline-success"
*ngIf=
"!date.disabled || !hh.disabled || !mm.disabled"
[hidden]=
"!isValidFields"
(click)=
"addCriterion()"
><i
class=
"fas fa-plus-circle"
></i></button>
<button
class=
"btn btn-outline-success"
*ngIf=
"!date.disabled || !hh.disabled || !mm.disabled"
[hidden]=
"!isValidFields"
(click)=
"addCriterion()"
>
<i
class=
"fas fa-plus fa-fw"
></i>
</button>
<button
class=
"btn btn-outline-danger"
*ngIf=
"date.disabled && hh.disabled && mm.disabled"
(click)=
"deleteCriterion()"
>
<i
class=
"fa fa-times fa-fw"
></i>
</button>
</div>
</div>
\ No newline at end of file
src/app/search/components/criteria/search-type/datetime.component.ts
View file @
b634210b
...
...
@@ -18,6 +18,7 @@ export class DatetimeComponent {
this
.
getDefault
(
criterion
);
}
@
Output
()
add
:
EventEmitter
<
DatetimeCriterion
>
=
new
EventEmitter
();
@
Output
()
delete
:
EventEmitter
<
number
>
=
new
EventEmitter
();
hours
:
string
[]
=
[];
minutes
:
string
[]
=
[];
...
...
@@ -38,6 +39,10 @@ export class DatetimeComponent {
this
.
add
.
emit
(
fd
);
}
deleteCriterion
()
{
this
.
delete
.
emit
(
this
.
id
);
}
getDefault
(
criterion
:
Criterion
):
void
{
if
(
!
criterion
)
{
this
.
date
.
setValue
(
''
);
...
...
src/app/search/components/criteria/search-type/field.component.html
View file @
b634210b
...
...
@@ -5,7 +5,11 @@
autocomplete=
"off"
>
</div>
<div
class=
"col-2 text-center"
>
<button
class=
"btn btn-outline-success"
*ngIf=
"!field.disabled"
[hidden]=
"!field.value"
(click)=
"addCriterion()"
><i
class=
"fas fa-plus-circle"
></i></button>
<button
class=
"btn btn-outline-success"
*ngIf=
"!field.disabled"
[hidden]=
"!field.value"
(click)=
"addCriterion()"
>
<i
class=
"fas fa-plus fa-fw"
></i>
</button>
<button
class=
"btn btn-outline-danger"
*ngIf=
"field.disabled"
(click)=
"deleteCriterion()"
>
<i
class=
"fa fa-times fa-fw"
></i>
</button>
</div>
</div>
\ No newline at end of file
src/app/search/components/criteria/search-type/field.component.ts
View file @
b634210b
...
...
@@ -19,6 +19,7 @@ export class FieldComponent {
this
.
getDefault
(
criterion
);
}
@
Output
()
add
:
EventEmitter
<
FieldCriterion
>
=
new
EventEmitter
();
@
Output
()
delete
:
EventEmitter
<
number
>
=
new
EventEmitter
();
field
=
new
FormControl
(
''
);
...
...
@@ -27,6 +28,10 @@ export class FieldComponent {
this
.
add
.
emit
(
fd
);
}
deleteCriterion
()
{
this
.
delete
.
emit
(
this
.
id
);
}
getDefault
(
criterion
:
Criterion
):
void
{
if
(
!
criterion
)
{
this
.
field
.
setValue
(
''
);
...
...
src/app/search/components/criteria/search-type/json.component.html
View file @
b634210b
...
...
@@ -26,7 +26,10 @@
<button
class=
"btn btn-outline-success"
*ngIf=
"!jsonForm.disabled"
[hidden]=
"!jsonForm.value.path || !jsonForm.value.operator || !jsonForm.value.value"
(click)=
"addCriterion()"
>
<i
class=
"fas fa-plus-circle"
></i>
<i
class=
"fas fa-plus fa-fw"
></i>
</button>
<button
class=
"btn btn-outline-danger"
*ngIf=
"jsonForm.disabled"
(click)=
"deleteCriterion()"
>
<i
class=
"fa fa-times fa-fw"
></i>
</button>
</div>
</div>
\ No newline at end of file
src/app/search/components/criteria/search-type/json.component.ts
View file @
b634210b
...
...
@@ -16,6 +16,7 @@ export class JsonComponent {
this
.
getDefault
(
criterion
);
}
@
Output
()
add
:
EventEmitter
<
JsonCriterion
>
=
new
EventEmitter
();
@
Output
()
delete
:
EventEmitter
<
number
>
=
new
EventEmitter
();
jsonForm
=
new
FormGroup
({
path
:
new
FormControl
(),
...
...
@@ -28,6 +29,10 @@ export class JsonComponent {
this
.
add
.
emit
(
js
);
}
deleteCriterion
()
{
this
.
delete
.
emit
(
this
.
id
);
}
getDefault
(
criterion
:
Criterion
):
void
{
if
(
!
criterion
)
{
this
.
jsonForm
.
reset
();
...
...
Prev
1
2
Next
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