Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchParapheur
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchParapheur
Commits
f71800c8
Commit
f71800c8
authored
4 years ago
by
Alex ORLUC
Browse files
Options
Downloads
Patches
Plain Diff
FIX #15550 TIME 1 fix current filters + do not use jquery
parent
4382f2d1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/frontend/app/search/search.component.html
+4
-4
4 additions, 4 deletions
src/frontend/app/search/search.component.html
src/frontend/app/search/search.component.ts
+34
-18
34 additions, 18 deletions
src/frontend/app/search/search.component.ts
with
38 additions
and
22 deletions
src/frontend/app/search/search.component.html
+
4
−
4
View file @
f71800c8
...
...
@@ -36,9 +36,9 @@
<div
*ngIf=
"currentFilter.id === 'workflowStates' && currentFilter.val.length > 0"
>
<ion-chip
outline
*ngFor=
"let item of currentFilter.val"
color=
"primary"
style=
"background: white;"
[title]=
"'lang.workflowStatesSearch' | translate"
(click)=
"removeFilter(currentFilter, item)"
>
(click)=
"removeFilter(currentFilter, item
.id
)"
>
<ion-icon
name=
"options-outline"
></ion-icon>
<ion-label>
{{
getLabel(item)
| translate}}
</ion-label>
<ion-label>
{{
item.label
| translate}}
</ion-label>
<ion-icon
name=
"close-circle"
></ion-icon>
</ion-chip>
</div>
...
...
@@ -174,8 +174,8 @@
</ion-list-header>
<ion-item
*ngFor=
"let val of filter.values;let i=index;"
>
<ion-label>
{{val.label | translate}}
</ion-label>
<ion-checkbox
(
ion
Change)=
"toggleItem(filter, val,
$event.detail.checked)
"
[checked]=
"filter.val.indexOf(val.id) > -1"
slot=
"end"
[value]=
"val.id"
class=
"workflowStates"
>
<ion-checkbox
(
ngModel
Change)=
"toggleItem(filter, val,
!val.selected)"
[(ngModel)]=
"val.selected"
[checked]=
"val.selected
"
slot=
"end"
[value]=
"val.id"
class=
"workflowStates"
>
</ion-checkbox>
</ion-item>
</ng-container>
...
...
This diff is collapsed.
Click to expand it.
src/frontend/app/search/search.component.ts
+
34
−
18
View file @
f71800c8
...
...
@@ -43,19 +43,23 @@ export class SearchComponent implements OnInit {
values
:
[
{
id
:
'
PROG
'
,
label
:
'
lang.inprogress
'
label
:
'
lang.inprogress
'
,
selected
:
false
},
{
id
:
'
STOP
'
,
label
:
'
lang.interrupt
'
label
:
'
lang.interrupt
'
,
selected
:
false
},
{
id
:
'
VAL
'
,
label
:
'
lang.end
'
label
:
'
lang.end
'
,
selected
:
false
},
{
id
:
'
REF
'
,
label
:
'
lang.refused
'
label
:
'
lang.refused
'
,
selected
:
false
}
]
},
...
...
@@ -148,7 +152,7 @@ export class SearchComponent implements OnInit {
this
.
menu
.
close
(
'
right-menu
'
);
}
toggleItem
(
filter
:
any
,
item
:
any
,
state
:
boole
an
)
{
toggleItem
(
filter
:
any
,
item
:
any
,
state
:
an
y
)
{
if
(
!
state
)
{
const
index
=
filter
.
val
.
indexOf
(
item
.
id
);
filter
.
val
.
splice
(
index
,
1
);
...
...
@@ -159,11 +163,13 @@ export class SearchComponent implements OnInit {
formatDatas
()
{
const
objToSend
:
any
=
{};
const
tmpArr
=
this
.
filters
.
filter
((
filter
:
any
)
=>
(
filter
.
type
===
'
text
'
&&
filter
.
val
!==
''
)
||
(
filter
.
type
!==
'
text
'
&&
filter
.
val
.
length
>
0
));
const
tmpArr
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
filters
.
filter
((
filter
:
any
)
=>
(
filter
.
type
===
'
text
'
&&
filter
.
val
!==
''
)
||
(
filter
.
type
!==
'
text
'
&&
filter
.
val
.
length
>
0
))
))
;
tmpArr
.
forEach
((
filter
:
any
)
=>
{
if
(
filter
.
id
===
'
workflowUsers
'
)
{
objToSend
[
filter
.
id
]
=
filter
.
val
.
map
((
item
:
any
)
=>
item
.
id
);
}
else
if
(
filter
.
id
===
'
workflowStates
'
)
{
objToSend
[
filter
.
id
]
=
filter
.
values
.
filter
((
item
:
any
)
=>
item
.
selected
).
map
((
item
:
any
)
=>
item
.
id
);
}
else
{
objToSend
[
filter
.
id
]
=
filter
.
val
;
}
...
...
@@ -239,11 +245,12 @@ export class SearchComponent implements OnInit {
launchSearch
()
{
this
.
ressources
=
[];
this
.
offset
=
0
;
this
.
refreshCurrentFilter
();
return
new
Promise
((
resolve
)
=>
{
this
.
http
.
post
(
`../rest/search/documents?limit=10&offset=0`
,
this
.
formatDatas
())
.
pipe
(
tap
((
data
:
any
)
=>
{
this
.
currentFilters
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
filters
.
filter
((
item
:
any
)
=>
!
this
.
functionsService
.
empty
(
item
.
val
))));
this
.
ressources
=
this
.
formatListDatas
(
data
.
documents
);
this
.
count
=
data
.
count
;
this
.
infiniteScroll
.
disabled
=
false
;
...
...
@@ -258,6 +265,17 @@ export class SearchComponent implements OnInit {
});
}
refreshCurrentFilter
()
{
this
.
currentFilters
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
filters
.
filter
((
item
:
any
)
=>
!
this
.
functionsService
.
empty
(
item
.
val
))));
if
(
this
.
currentFilters
.
filter
((
item
:
any
)
=>
item
.
id
===
'
workflowStates
'
).
length
>
0
)
{
this
.
currentFilters
.
filter
((
item
:
any
)
=>
item
.
id
===
'
workflowStates
'
)[
0
].
val
=
this
.
currentFilters
.
filter
((
item
:
any
)
=>
item
.
id
===
'
workflowStates
'
)[
0
].
values
.
filter
((
item
:
any
)
=>
item
.
selected
);
if
(
this
.
currentFilters
.
filter
((
item
:
any
)
=>
item
.
id
===
'
workflowStates
'
)[
0
].
val
.
length
===
0
)
{
this
.
currentFilters
=
this
.
currentFilters
.
filter
((
item
:
any
)
=>
item
.
id
!==
'
workflowStates
'
);
}
}
}
loadData
(
event
:
any
)
{
if
(
this
.
count
<=
this
.
limit
)
{
event
.
target
.
complete
();
...
...
@@ -412,16 +430,19 @@ export class SearchComponent implements OnInit {
}
clearFilters
()
{
$
(
"
.workflowStates
"
).
each
(
function
()
{
$
(
this
).
prop
(
"
checked
"
,
false
);
});
for
(
let
index
=
0
;
index
<
this
.
filters
.
length
;
index
++
)
{
if
(
!
Array
.
isArray
(
this
.
filters
[
index
].
val
)
&&
this
.
filters
[
index
].
val
!==
''
)
{
this
.
filters
[
index
].
val
=
''
;
}
if
(
Array
.
isArray
(
this
.
filters
[
index
].
val
)
&&
this
.
filters
[
index
].
val
.
length
>
0
&&
(
this
.
filters
[
index
].
id
===
'
workflowUsers
'
)
)
{
if
(
Array
.
isArray
(
this
.
filters
[
index
].
val
))
{
this
.
filters
[
index
].
val
=
[];
this
.
filters
[
index
].
values
=
this
.
filters
[
index
].
values
.
map
((
item
:
any
)
=>
{
return
{
...
item
,
selected
:
false
};
});
}
}
if
(
this
.
ressources
.
length
>
0
)
{
...
...
@@ -434,15 +455,10 @@ export class SearchComponent implements OnInit {
this
.
filters
.
find
((
element
:
any
)
=>
element
.
id
===
filter
.
id
).
val
=
''
;
}
else
{
if
(
filter
.
id
===
'
workflowStates
'
)
{
$
(
"
.workflowStates
"
).
each
(
function
()
{
if
(
$
(
this
).
val
()
===
item
)
{
$
(
this
).
prop
(
"
checked
"
,
false
);
return
false
;
}
});
this
.
filters
.
find
((
element
:
any
)
=>
element
.
id
===
filter
.
id
).
values
.
filter
((
element
:
any
)
=>
element
.
id
===
item
)[
0
].
selected
=
false
;
}
else
{
const
index
=
filter
.
val
.
indexOf
(
item
);
filter
.
val
.
splice
(
index
,
1
);
this
.
filter
s
.
filter
((
element
:
any
)
=>
element
.
id
===
filter
.
id
)[
0
]
.
val
.
splice
(
index
,
1
);
}
}
this
.
launchSearch
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment