Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cines Vitamui
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
You need to sign in or sign up before continuing.
Show more breadcrumbs
dad
Cines Vitamui
Commits
51b7af4c
Commit
51b7af4c
authored
2 years ago
by
Baptiste Toulemonde
Browse files
Options
Downloads
Patches
Plain Diff
fix issue
#28
parent
7f485c76
No related branches found
No related tags found
2 merge requests
!72
Ajout des fonctionnalités manquante
,
!71
Fixer les bugs de sprint 4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ui/ui-frontend/projects/pastis/src/app/user-actions/add-metadata/add-metadata.component.ts
+23
-20
23 additions, 20 deletions
...c/app/user-actions/add-metadata/add-metadata.component.ts
with
23 additions
and
20 deletions
ui/ui-frontend/projects/pastis/src/app/user-actions/add-metadata/add-metadata.component.ts
+
23
−
20
View file @
51b7af4c
...
...
@@ -42,7 +42,7 @@ import { FileService } from '../../core/services/file.service';
import
{
PopupService
}
from
'
../../core/services/popup.service
'
;
import
{
ProfileService
}
from
'
../../core/services/profile.service
'
;
import
{
SedaService
}
from
'
../../core/services/seda.service
'
;
import
{
FileNode
}
from
'
../../models/file-node
'
;
import
{
CardinalityConstants
,
FileNode
}
from
'
../../models/file-node
'
;
import
{
SedaCardinalityConstants
,
SedaData
,
SedaElementConstants
}
from
'
../../models/seda-data
'
;
import
{
PastisDialogData
}
from
'
../../shared/pastis-dialog/classes/pastis-dialog-data
'
;
import
{
PastisDialogConfirmComponent
}
from
'
../../shared/pastis-dialog/pastis-dialog-confirm/pastis-dialog-confirm.component
'
;
...
...
@@ -74,9 +74,9 @@ export class UserActionAddMetadataComponent implements OnInit {
constructor
(
public
dialogRef
:
MatDialogRef
<
PastisDialogConfirmComponent
>
,
private
fileService
:
FileService
,
private
sedaService
:
SedaService
,
private
popUpService
:
PopupService
,
private
sedaLanguageService
:
PastisPopupMetadataLanguageService
,
private
profileService
:
ProfileService
)
{
}
private
fileService
:
FileService
,
private
sedaService
:
SedaService
,
private
popUpService
:
PopupService
,
private
sedaLanguageService
:
PastisPopupMetadataLanguageService
,
private
profileService
:
ProfileService
)
{
}
ngOnInit
()
{
this
.
sedaLanguageSub
=
this
.
sedaLanguageService
.
sedaLanguage
.
subscribe
(
...
...
@@ -87,26 +87,29 @@ export class UserActionAddMetadataComponent implements OnInit {
console
.
log
(
error
);
}
);
this
.
fileService
.
nodeChange
.
subscribe
(
fileNode
=>
{
this
.
fileNode
=
fileNode
;
});
this
.
fileService
.
nodeChange
.
subscribe
(
fileNode
=>
{
this
.
fileNode
=
fileNode
;
});
this
.
sedaData
=
this
.
sedaService
.
sedaRules
[
0
];
this
.
sedaNodeFound
=
this
.
fileNode
.
sedaData
;
if
(
this
.
profileService
.
profileMode
===
'
PA
'
)
{
this
.
allowedChildren
=
this
.
sedaService
.
findSelectableElementList
(
this
.
sedaNodeFound
,
this
.
fileNode
)
.
filter
(
e
=>
e
.
Element
!==
SedaElementConstants
.
attribute
);
}
else
if
(
this
.
profileService
.
profileMode
===
'
PUA
'
)
{
if
(
this
.
fileNode
.
name
===
'
ArchiveUnit
'
)
{
.
filter
(
e
=>
e
.
Element
!==
SedaElementConstants
.
attribute
);
}
else
if
(
this
.
profileService
.
profileMode
===
'
PUA
'
)
{
if
(
this
.
fileNode
.
name
===
'
ArchiveUnit
'
)
{
if
(
this
.
fileNode
.
children
.
map
((
nodeChildren
:
FileNode
)
=>
nodeChildren
.
name
).
includes
(
'
ArchiveUnitProfile
'
))
{
this
.
allowedChildren
=
this
.
sedaNodeFound
.
Children
this
.
allowedChildren
=
this
.
sedaService
.
findSelectableElementList
(
this
.
sedaNodeFound
,
this
.
fileNode
)
.
filter
(
e
=>
e
.
Element
!==
SedaElementConstants
.
attribute
)
.
filter
(
e
=>
e
.
Name
===
'
Management
'
);
}
else
{
this
.
allowedChildren
=
this
.
sedaNodeFound
.
Children
.
filter
(
e
=>
e
.
Name
===
'
Management
'
||
e
.
Name
===
'
ArchiveUnitProfile
'
);
this
.
allowedChildren
=
this
.
sedaService
.
findSelectableElementList
(
this
.
sedaNodeFound
,
this
.
fileNode
)
.
filter
(
e
=>
e
.
Element
!==
SedaElementConstants
.
attribute
)
.
filter
(
e
=>
e
.
Name
===
'
Management
'
||
e
.
Name
===
'
ArchiveUnitProfile
'
);
}
}
else
{
this
.
allowedChildren
=
this
.
sedaNodeFound
.
Children
;
}
}
// Subscribe observer to button status and
// set the inital state of the ok button to disabled
...
...
@@ -145,13 +148,13 @@ export class UserActionAddMetadataComponent implements OnInit {
}
onAddSelectedElement
(
element
:
SedaData
)
{
this
.
addedItems
.
push
(
element
);
this
.
addedItems
.
push
(
element
);
if
(
element
.
Cardinality
!==
(
SedaCardinalityConstants
.
zeroOrMore
||
SedaCardinalityConstants
.
oreOrMore
))
{
this
.
allowedChildren
=
this
.
allowedChildren
.
filter
(
e
=>
e
!=
element
);
}
this
.
addedItems
.
length
>
0
?
this
.
atLeastOneIsSelected
=
true
:
this
.
atLeastOneIsSelected
=
false
;
this
.
upateButtonStatusAndDataToSend
();
if
(
element
.
Cardinality
!==
(
SedaCardinalityConstants
.
zeroOrMore
||
SedaCardinalityConstants
.
oreOrMore
))
{
this
.
allowedChildren
=
this
.
allowedChildren
.
filter
(
e
=>
e
!=
element
);
}
this
.
addedItems
.
length
>
0
?
this
.
atLeastOneIsSelected
=
true
:
this
.
atLeastOneIsSelected
=
false
;
this
.
upateButtonStatusAndDataToSend
();
}
upateButtonStatusAndDataToSend
()
{
...
...
@@ -174,7 +177,7 @@ export class UserActionAddMetadataComponent implements OnInit {
}
onYesClick
():
void
{
console
.
log
(
'
Clicked ok on dialog : %o
'
,
this
.
selectedSedaNode
);
console
.
log
(
'
Clicked ok on dialog : %o
'
,
this
.
selectedSedaNode
);
}
onNoClick
():
void
{
...
...
@@ -202,7 +205,7 @@ export class UserActionAddMetadataComponent implements OnInit {
}
@
Pipe
({
name
:
'
filterByName
'
})
@
Pipe
({
name
:
'
filterByName
'
})
export
class
FilterByNamePipe
implements
PipeTransform
{
transform
(
listOfElements
:
SedaData
[],
nameToFilter
:
string
,
sedaLanguage
:
boolean
):
SedaData
[]
{
if
(
!
listOfElements
)
{
return
null
;
}
...
...
@@ -213,7 +216,7 @@ export class FilterByNamePipe implements PipeTransform {
}
else
{
return
listOfElements
.
filter
(
element
=>
element
.
NameFr
!==
undefined
)
.
filter
(
element
=>
element
.
NameFr
.
toLowerCase
().
indexOf
(
nameToFilter
.
toLowerCase
())
>=
0
);
.
filter
(
element
=>
element
.
NameFr
.
toLowerCase
().
indexOf
(
nameToFilter
.
toLowerCase
())
>=
0
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment