Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
B
brainboost-front
Gestion
Activité
Membres
Labels
Programmation
Tickets
0
Tableaux des tickets
Jalons
Wiki
Jira
Code
Requêtes de fusion
4
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Service d'assistance
Analyse
Données d'analyse des chaînes de valeur
Contributor analytics
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
marketing confort
brainboost
brainboost-front
Validations
f029faaf
Valider
f029faaf
rédigé
il y a un mois
par
zakariaeyahya
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
add ConditionalComponent
parent
d7b3dab2
Branches
Branches contenant la validation
Étiquettes
Étiquettes contenant la validation
1 requête de fusion
!94
Resolve IA-439 "Feauture/"
Pipeline
#21213
réussi avec les étapes
in 5 minutes et 11 secondes
Modifications
1
Pipelines
1
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
src/shared/sections/ai/assistants-management/settings/ConfigHistorySection.tsx
+33
-38
33 ajouts, 38 suppressions
...i/assistants-management/settings/ConfigHistorySection.tsx
avec
33 ajouts
et
38 suppressions
src/shared/sections/ai/assistants-management/settings/ConfigHistorySection.tsx
+
33
−
38
Voir le fichier @
f029faaf
...
...
@@ -6,7 +6,7 @@ import {
faChevronLeft
,
faChevronRight
}
from
'
@fortawesome/free-solid-svg-icons
'
;
import
ConditionalComponent
from
'
src/shared/components/ConditionalComponent/ConditionalComponent
'
;
import
{
Box
,
Card
,
...
...
@@ -40,50 +40,36 @@ export default function ConfigHistorySection({ assistantId }: ConfigHistorySecti
clearConfigHistory
,
}
=
useAssistantResponseConfigStore
();
// Charger l'historique au montage du composant
useEffect
(()
=>
{
if
(
assistantId
)
{
getConfigHistory
(
assistantId
,
{
page
:
0
,
size
:
10
});
}
},
[
assistantId
,
getConfigHistory
]);
// Fonction pour formater la date
const
formatDate
=
(
dateStr
:
string
|
number
|
any
[]):
string
=>
{
const
input
:
unknown
=
dateStr
;
if
(
Array
.
isArray
(
input
))
{
const
[
y
,
m
,
d
,
h
=
0
,
min
=
0
,
s
=
0
]
=
input
as
number
[];
const
date
=
new
Date
(
y
,
m
-
1
,
d
,
h
,
min
,
s
);
return
date
.
toLocaleString
(
'
fr-FR
'
);
}
const
date
=
new
Date
(
input
as
string
|
number
);
return
Number
.
isNaN
(
date
.
getTime
())
?
'
Date invalide
'
:
date
.
toLocaleString
(
'
fr-FR
'
);
};
const
formatDate
=
(
dateStr
:
string
|
number
|
number
[]):
string
=>
{
if
(
Array
.
isArray
(
dateStr
))
{
const
[
y
,
m
,
d
,
h
=
0
,
min
=
0
,
s
=
0
]
=
dateStr
;
const
date
=
new
Date
(
y
,
m
-
1
,
d
,
h
,
min
,
s
);
return
date
.
toLocaleString
(
'
fr-FR
'
);
}
const
date
=
new
Date
(
dateStr
);
return
Number
.
isNaN
(
date
.
getTime
())
?
'
Date invalide
'
:
date
.
toLocaleString
(
'
fr-FR
'
);
};
// Fonction pour obtenir la couleur selon l'action
const
getActionColor
=
(
action
:
string
)
=>
{
const
lowerAction
=
action
.
toLowerCase
();
if
(
lowerAction
.
includes
(
'
activer
'
)
||
lowerAction
.
includes
(
'
ajouter
'
))
{
return
'
success
'
;
}
if
(
lowerAction
.
includes
(
'
désactiver
'
)
||
lowerAction
.
includes
(
'
supprimer
'
))
{
return
'
error
'
;
}
if
(
lowerAction
.
includes
(
'
modifier
'
)
||
lowerAction
.
includes
(
'
mettre à jour
'
))
{
return
'
primary
'
;
}
if
(
lowerAction
.
includes
(
'
activer
'
)
||
lowerAction
.
includes
(
'
ajouter
'
))
return
'
success
'
;
if
(
lowerAction
.
includes
(
'
désactiver
'
)
||
lowerAction
.
includes
(
'
supprimer
'
))
return
'
error
'
;
if
(
lowerAction
.
includes
(
'
modifier
'
)
||
lowerAction
.
includes
(
'
mettre à jour
'
))
return
'
primary
'
;
return
'
default
'
;
};
// Fonction pour changer de page
const
handlePageChange
=
(
newPage
:
number
)
=>
{
if
(
assistantId
)
{
getConfigHistory
(
assistantId
,
{
page
:
newPage
,
size
:
10
});
}
};
// Fonction pour vider l'historique
const
handleClearHistory
=
async
()
=>
{
if
(
window
.
confirm
(
'
Êtes-vous sûr de vouloir supprimer tout l
\'
historique ?
'
))
{
await
clearConfigHistory
(
assistantId
);
...
...
@@ -92,7 +78,7 @@ const formatDate = (dateStr: string | number | any[]): string => {
return
(
<
Card
sx
=
{
{
p
:
3
,
mb
:
4
}
}
>
{
/*
En-tête
*/
}
{
/*
Header
*/
}
<
Box
sx
=
{
{
display
:
'
flex
'
,
justifyContent
:
'
space-between
'
,
alignItems
:
'
center
'
,
mb
:
3
}
}
>
<
Box
sx
=
{
{
display
:
'
flex
'
,
alignItems
:
'
center
'
}
}
>
<
FontAwesomeIcon
...
...
@@ -116,22 +102,31 @@ const formatDate = (dateStr: string | number | any[]): string => {
</
Button
>
</
Box
>
{
/*
Contenu
*/
}
{
historyLoading
?
(
{
/*
Loading State
*/
}
<
ConditionalComponent
isValid
=
{
historyLoading
}
>
<
Box
sx
=
{
{
display
:
'
flex
'
,
justifyContent
:
'
center
'
,
p
:
4
}
}
>
<
CircularProgress
/>
</
Box
>
)
:
historyError
?
(
</
ConditionalComponent
>
{
/* Error State */
}
<
ConditionalComponent
isValid
=
{
!
historyLoading
&&
!!
historyError
}
>
<
Typography
color
=
"error"
sx
=
{
{
textAlign
:
'
center
'
,
p
:
2
}
}
>
Erreur :
{
historyError
}
</
Typography
>
)
:
configHistory
.
length
===
0
?
(
</
ConditionalComponent
>
{
/* Empty State */
}
<
ConditionalComponent
isValid
=
{
!
historyLoading
&&
!
historyError
&&
configHistory
.
length
===
0
}
>
<
Typography
sx
=
{
{
textAlign
:
'
center
'
,
p
:
4
,
color
:
'
text.secondary
'
}
}
>
Aucune modification enregistrée
</
Typography
>
)
:
(
</
ConditionalComponent
>
{
/* Content */
}
<
ConditionalComponent
isValid
=
{
!
historyLoading
&&
!
historyError
&&
configHistory
.
length
>
0
}
>
<>
{
/* Table
au
*/
}
{
/* Table */
}
<
TableContainer
component
=
{
Paper
}
variant
=
"outlined"
>
<
Table
size
=
"small"
>
<
TableHead
>
...
...
@@ -177,7 +172,7 @@ const formatDate = (dateStr: string | number | any[]): string => {
</
TableContainer
>
{
/* Pagination */
}
{
historyPagination
.
totalPages
>
1
&&
(
<
ConditionalComponent
isValid
=
{
historyPagination
?
.
totalPages
>
1
}
>
<
Box
sx
=
{
{
display
:
'
flex
'
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
mt
:
2
,
gap
:
2
}
}
>
<
IconButton
onClick
=
{
()
=>
handlePageChange
(
historyPagination
.
currentPage
-
1
)
}
...
...
@@ -199,16 +194,16 @@ const formatDate = (dateStr: string | number | any[]): string => {
<
FontAwesomeIcon
icon
=
{
faChevronRight
}
/>
</
IconButton
>
</
Box
>
)
}
</
ConditionalComponent
>
{
/* Stat
istique
s */
}
{
/* Stats */
}
<
Box
sx
=
{
{
mt
:
2
,
p
:
2
,
bgcolor
:
'
background.neutral
'
,
borderRadius
:
1
}
}
>
<
Typography
variant
=
"caption"
color
=
"text.secondary"
>
Total :
{
historyPagination
.
totalElements
}
modification(s)
</
Typography
>
</
Box
>
</>
)
}
</
ConditionalComponent
>
</
Card
>
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Aperçu
0%
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter