Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DLCM-Portal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
DLCM
UI
DLCM-Portal
Commits
e83e310a
Commit
e83e310a
authored
2 years ago
by
Florent Poittevin
Committed by
Nicolas.Rod
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix: MR by creating enums
parent
e625c6b6
Branches
rodn-solidify-index-update
No related tags found
1 merge request
!515
refactor: set type and booleanClauseType when searching with facets values
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/app/enums/index.ts
+32
-0
32 additions, 0 deletions
src/app/enums/index.ts
src/app/features/home/helpers/home.helper.ts
+8
-8
8 additions, 8 deletions
src/app/features/home/helpers/home.helper.ts
src/app/models/index.ts
+12
-8
12 additions, 8 deletions
src/app/models/index.ts
with
52 additions
and
16 deletions
src/app/enums/index.ts
+
32
−
0
View file @
e83e310a
...
...
@@ -93,6 +93,38 @@ export namespace Enums {
};
}
export
namespace
SearchCondition
{
export
type
Type
=
"
MATCH
"
|
"
TERM
"
|
"
RANGE
"
|
"
QUERY
"
|
"
SIMPLE_QUERY
"
|
"
NESTED_BOOLEAN
"
;
export
const
Type
=
{
MATCH
:
"
MATCH
"
as
Type
,
TERM
:
"
TERM
"
as
Type
,
RANGE
:
"
RANGE
"
as
Type
,
QUERY
:
"
QUERY
"
as
Type
,
SIMPLE_QUERY
:
"
SIMPLE_QUERY
"
as
Type
,
NESTED_BOOLEAN
:
"
NESTED_BOOLEAN
"
as
Type
,
};
export
type
BooleanClauseType
=
"
MUST
"
|
"
FILTER
"
|
"
SHOULD
"
|
"
MUST_NOT
"
;
export
const
BooleanClauseType
=
{
MUST
:
"
MUST
"
as
BooleanClauseType
,
FILTER
:
"
FILTER
"
as
BooleanClauseType
,
SHOULD
:
"
SHOULD
"
as
BooleanClauseType
,
MUST_NOT
:
"
MUST_NOT
"
as
BooleanClauseType
,
};
}
export
namespace
Aip
{
export
type
AipContainerEnum
=
AipPartial
.
ArchiveContainerEnum
;
export
const
AipContainerEnum
=
AipPartial
.
ArchiveContainerEnum
;
...
...
This diff is collapsed.
Click to expand it.
src/app/features/home/helpers/home.helper.ts
+
8
−
8
View file @
e83e310a
...
...
@@ -27,7 +27,7 @@ import {
}
from
"
@angular/router
"
;
import
{
Enums
}
from
"
@enums
"
;
import
{
environment
}
from
"
@environments/environment
"
;
import
{
Search
Facet
}
from
"
@models
"
;
import
{
Search
Condition
}
from
"
@models
"
;
import
{
Navigate
}
from
"
@ngxs/router-plugin
"
;
import
{
Store
}
from
"
@ngxs/store
"
;
import
{
RoutesEnum
}
from
"
@shared/enums/routes.enum
"
;
...
...
@@ -123,8 +123,8 @@ export class HomeHelper {
};
}
static
getFacetsSelectedForBackend
(
facetsSelected
:
MappingObject
<
Enums
.
Facet
.
Name
,
string
[]
>
):
Search
Facet
[]
{
const
facetsSelectedForBackend
:
Search
Facet
[]
=
[];
static
getFacetsSelectedForBackend
(
facetsSelected
:
MappingObject
<
Enums
.
Facet
.
Name
,
string
[]
>
):
Search
Condition
[]
{
const
facetsSelectedForBackend
:
Search
Condition
[]
=
[];
MappingObjectUtil
.
forEach
(
facetsSelected
,
(
value
,
key
)
=>
{
if
(
isNullOrUndefined
(
value
)
||
isEmptyArray
(
value
))
{
return
;
...
...
@@ -133,9 +133,9 @@ export class HomeHelper {
// FOR OR, equal value = [ "orgUnitName1", "orgUnitName2" ]
const
facet
=
{
field
:
key
,
type
:
"
TERM
"
,
booleanClauseType
:
"
MUST
"
}
as
Search
Facet
;
type
:
Enums
.
SearchCondition
.
Type
.
TERM
,
booleanClauseType
:
Enums
.
SearchCondition
.
BooleanClauseType
.
MUST
,
}
as
Search
Condition
;
if
(
value
.
length
===
1
)
{
facet
.
value
=
value
[
0
];
}
else
{
...
...
@@ -147,9 +147,9 @@ export class HomeHelper {
value
.
forEach
(
v
=>
{
facetsSelectedForBackend
.
push
({
field
:
key
,
type
:
"
TERM
"
,
type
:
Enums
.
SearchCondition
.
Type
.
TERM
,
value
:
v
,
booleanClauseType
:
"
MUST
"
booleanClauseType
:
Enums
.
SearchCondition
.
BooleanClauseType
.
MUST
,
});
});
}
...
...
This diff is collapsed.
Click to expand it.
src/app/models/index.ts
+
12
−
8
View file @
e83e310a
...
...
@@ -371,20 +371,24 @@ export interface User extends UserPartial, BaseResource, UserInfo {
lastLoginTime
?:
string
;
}
export
interface
SearchFacet
{
field
:
string
;
value
?:
string
;
values
?:
string
[];
type
:
undefined
|
"
TERM
"
|
"
NOT_MATCH
"
;
booleanClauseType
:
undefined
|
"
MUST
"
;
}
export
interface
FacetProperty
{
name
:
string
;
defaultVisibleValues
:
number
;
labels
:
Label
[];
}
export
interface
SearchCondition
{
type
?:
Enums
.
SearchCondition
.
Type
;
booleanClauseType
?:
Enums
.
SearchCondition
.
BooleanClauseType
;
field
?:
string
;
fields
?:
string
[];
value
?:
string
;
values
?:
string
[];
upperValue
?:
string
;
lowerValue
?:
string
;
nestedConditions
?:
SearchCondition
[];
}
export
interface
Label
extends
SolidifyLabel
{
languageCode
?:
Enums
.
Language
.
LanguageEnum
;
text
?:
string
;
...
...
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