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
d4a24516
Commit
d4a24516
authored
5 years ago
by
Florent Poittevin
Browse files
Options
Downloads
Patches
Plain Diff
fix: aip list preserve previously org unit retrieve
parent
eb30899c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/features/preservation/aip/components/routables/aip-list/aip-list.routable.ts
+33
-25
33 additions, 25 deletions
...on/aip/components/routables/aip-list/aip-list.routable.ts
with
33 additions
and
25 deletions
src/app/features/preservation/aip/components/routables/aip-list/aip-list.routable.ts
+
33
−
25
View file @
d4a24516
...
...
@@ -69,7 +69,7 @@ import {
styleUrls
:
[
"
../../../../../../shared/components/routables/shared-abstract-list/shared-abstract-list.routable.scss
"
],
changeDetection
:
ChangeDetectionStrategy
.
OnPush
,
})
export
class
AipListRoutable
extends
SharedAbstractListRoutable
<
AipExtended
,
PreservationAipStateModel
>
implements
OnInit
{
export
class
AipListRoutable
extends
SharedAbstractListRoutable
<
AipExtended
,
PreservationAipStateModel
>
implements
OnInit
,
OnDestroy
{
readonly
KEY_BACK_BUTTON
:
string
|
undefined
=
TRANSLATE
(
"
preservation.aip.button.back
"
);
readonly
KEY_CREATE_BUTTON
:
string
=
undefined
;
readonly
KEY_PARAM_NAME
:
keyof
AipExtended
&
string
=
undefined
;
...
...
@@ -82,28 +82,28 @@ export class AipListRoutable extends SharedAbstractListRoutable<AipExtended, Pre
listObs
:
Observable
<
AipExtended
[]
>
=
this
.
listAdaptedBS
.
asObservable
();
listOriginObs
:
Observable
<
AipExtended
[]
>
=
ResourceState
.
list
(
this
.
store
,
PreservationAipState
);
FIRST
_TAB_INDEX
:
number
=
0
;
SECOND
_TAB_INDEX
:
number
=
1
;
THIRD
_TAB_INDEX
:
number
=
2
;
All
_TAB_INDEX
:
number
=
0
;
UNIT
_TAB_INDEX
:
number
=
1
;
COLLECTION
_TAB_INDEX
:
number
=
2
;
storagion_number
:
number
|
undefined
=
undefined
;
@
Input
()
set
archivalUnit
(
value
:
number
)
{
// TODO Retrieve this info from url, this component is a routable so it should be instanciate by routing
if
(
value
===
this
.
SECOND
_TAB_INDEX
)
{
if
(
value
===
this
.
UNIT
_TAB_INDEX
)
{
this
.
getAipListWithParameter
(
true
);
}
else
if
(
value
===
this
.
THIRD
_TAB_INDEX
)
{
}
else
if
(
value
===
this
.
COLLECTION
_TAB_INDEX
)
{
this
.
getAipListWithParameter
(
false
);
}
else
{
this
.
getAipListWithParameter
(
undefined
);
}
}
constructor
(
protected
store
:
Store
,
constructor
(
protected
readonly
store
:
Store
,
protected
readonly
_route
:
ActivatedRoute
,
protected
_changeDetector
:
ChangeDetectorRef
,
private
translate
:
TranslateService
,
protected
readonly
_changeDetector
:
ChangeDetectorRef
,
private
readonly
translate
:
TranslateService
,
protected
readonly
_actions$
:
Actions
,
protected
readonly
_dialog
:
MatDialog
)
{
super
(
store
,
_changeDetector
,
_route
,
_actions$
,
_dialog
,
LocalStateEnum
.
preservation_aip
,
aipActionNameSpace
,
{
...
...
@@ -116,18 +116,6 @@ export class AipListRoutable extends SharedAbstractListRoutable<AipExtended, Pre
this
.
storagion_number
=
+
this
.
_route
.
snapshot
.
paramMap
.
get
(
AppRoutesEnum
.
paramIdWithoutPrefixParam
);
this
.
subscribe
(
this
.
listOriginObs
.
pipe
(
distinctUntilChanged
(),
filter
(
list
=>
!
isNullOrUndefined
(
list
)),
tap
(
list
=>
{
let
listOfOrgId
=
list
.
map
(
aip
=>
aip
.
info
.
organizationalUnitId
);
listOfOrgId
=
ArrayUtil
.
distinct
(
listOfOrgId
);
this
.
store
.
dispatch
(
new
PreservationAipOrgUnitAction
.
GetByListId
(
listOfOrgId
));
this
.
listAdaptedBS
.
next
(
list
);
}),
),
);
this
.
subscribe
(
this
.
_actions$
.
pipe
(
ofActionCompleted
(
PreservationAipOrgUnitAction
.
GetByListIdSuccess
),
...
...
@@ -146,7 +134,21 @@ export class AipListRoutable extends SharedAbstractListRoutable<AipExtended, Pre
});
this
.
listAdaptedBS
.
next
(
newList
);
}),
));
),
);
this
.
subscribe
(
this
.
listOriginObs
.
pipe
(
distinctUntilChanged
(),
filter
(
list
=>
!
isNullOrUndefined
(
list
)),
tap
(
list
=>
{
let
listOfOrgId
=
list
.
map
(
aip
=>
aip
.
info
.
organizationalUnitId
);
listOfOrgId
=
ArrayUtil
.
distinct
(
listOfOrgId
);
this
.
store
.
dispatch
(
new
PreservationAipOrgUnitAction
.
GetByListId
(
listOfOrgId
,
true
));
this
.
listAdaptedBS
.
next
(
list
);
}),
),
);
}
// @override
...
...
@@ -212,9 +214,11 @@ export class AipListRoutable extends SharedAbstractListRoutable<AipExtended, Pre
}
getOrganizationalUnitNameFromId
(
resId
:
string
,
listOrgUnits
:
AccessOrganizationalUnit
[]):
string
{
const
orgUnits
=
listOrgUnits
.
find
(
o
=>
o
.
resId
===
resId
);
if
(
orgUnits
)
{
return
orgUnits
.
name
;
if
(
!
isNullOrUndefined
(
listOrgUnits
))
{
const
orgUnits
=
listOrgUnits
.
find
(
o
=>
o
.
resId
===
resId
);
if
(
orgUnits
)
{
return
orgUnits
.
name
;
}
}
return
this
.
translate
.
instant
(
"
access.organizationalUnitNotFound
"
);
}
...
...
@@ -238,4 +242,8 @@ export class AipListRoutable extends SharedAbstractListRoutable<AipExtended, Pre
back
():
void
{
this
.
_store
.
dispatch
(
new
Navigate
([
RoutesEnum
.
preservationAip
]));
}
ngOnDestroy
():
void
{
super
.
ngOnDestroy
();
}
}
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