Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ff2balex
Manage
Activity
Members
Labels
Plan
Issues
9
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Lex gaMe
ff2balex
Commits
b8e717cb
Commit
b8e717cb
authored
3 months ago
by
Lucie Bader
Browse files
Options
Downloads
Patches
Plain Diff
Pas d'identifiant des lexiques en mode prod
parent
6177ddbe
No related branches found
Branches containing commit
No related tags found
1 merge request
!8
Test final
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/context_menu/custom_context_menu.js
+22
-8
22 additions, 8 deletions
src/context_menu/custom_context_menu.js
src/sidebar/sidebar.js
+14
-6
14 additions, 6 deletions
src/sidebar/sidebar.js
with
36 additions
and
14 deletions
src/context_menu/custom_context_menu.js
+
22
−
8
View file @
b8e717cb
...
@@ -243,15 +243,27 @@ async function showPicker(event, selectedText) {
...
@@ -243,15 +243,27 @@ async function showPicker(event, selectedText) {
const
lexicons
=
await
getLexicons
(
authToken
);
const
lexicons
=
await
getLexicons
(
authToken
);
log
(
"
Lexicons récupérés :
"
,
lexicons
);
log
(
"
Lexicons récupérés :
"
,
lexicons
);
const
lexiconDescriptions
=
{};
if
(
!
Array
.
isArray
(
lexicons
)
||
lexicons
.
length
===
0
)
{
if
(
!
Array
.
isArray
(
lexicons
)
||
lexicons
.
length
===
0
)
{
picker
.
innerHTML
=
"
<p style='color:#333;'>Aucun lexique trouvé.</p>
"
;
picker
.
innerHTML
=
"
<p style='color:#333;'>Aucun lexique trouvé.</p>
"
;
}
else
{
}
else
{
for
(
const
lex
of
lexicons
)
{
for
(
const
lex
of
lexicons
)
{
const
id
=
lex
.
id
;
const
id
=
lex
.
id
;
const
name
=
lex
.
category
===
"
User
"
let
name
=
""
;
?
`Lexique personnel :
${
lex
.
user
?.
pseudo
||
"
Inconnu
"
}
(
${
lex
.
id
}
)`
if
(
lex
.
category
===
"
User
"
)
{
:
`Lexique de groupe :
${
lex
.
group
?.
name
||
"
Inconnu
"
}
(
${
lex
.
id
}
)`
;
name
=
DEBUG
?
`Lexique personnel :
${
lex
.
user
?.
pseudo
||
"
Inconnu
"
}
(
${
lex
.
id
}
)`
:
`Lexique personnel :
${
lex
.
user
?.
pseudo
||
"
Inconnu
"
}
`
;
}
else
{
name
=
DEBUG
?
`Lexique de groupe :
${
lex
.
group
?.
name
||
"
Inconnu
"
}
(
${
lex
.
id
}
)`
:
`Lexique de groupe :
${
lex
.
group
?.
name
||
"
Inconnu
"
}
`
;
}
if
(
lex
.
language
)
{
name
+=
` [
${
lex
.
language
}
]`
;
}
lexiconDescriptions
[
id
]
=
name
;
const
color
=
await
getColorForLexicon
(
id
);
const
color
=
await
getColorForLexicon
(
id
);
const
circleIcon
=
await
createColorCircle
(
color
,
28
);
const
circleIcon
=
await
createColorCircle
(
color
,
28
);
...
@@ -309,19 +321,21 @@ async function showPicker(event, selectedText) {
...
@@ -309,19 +321,21 @@ async function showPicker(event, selectedText) {
log
(
"
Réponse API :
"
,
result
);
log
(
"
Réponse API :
"
,
result
);
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
300
));
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
300
));
browser
.
runtime
.
sendMessage
({
action
:
"
refreshUI
"
});
browser
.
runtime
.
sendMessage
({
action
:
"
refreshUI
"
});
picker
.
innerHTML
=
`<p style="color: green;">✅ Mot ajouté avec succès dans :
${
lexiconsToAdd
.
join
(
"
,
"
)}
.</p>`
;
const
successMsg
=
`✅ Mot ajouté avec succès dans :
${
lexiconsToAdd
.
map
(
id
=>
lexiconDescriptions
[
id
]).
join
(
"
,
"
)}
`
;
picker
.
innerHTML
=
`<p style="color: green;">
${
successMsg
}
</p>`
;
setTimeout
(()
=>
picker
.
style
.
display
=
"
none
"
,
2000
);
setTimeout
(()
=>
picker
.
style
.
display
=
"
none
"
,
2000
);
browser
.
runtime
.
sendMessage
({
browser
.
runtime
.
sendMessage
({
action
:
"
addWordResult
"
,
action
:
"
addWordResult
"
,
lexicons
:
`✅ Mot ajouté avec succès dans :
${
lexiconsToAdd
.
join
(
"
,
"
)}
.`
lexicons
:
successMsg
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
"
❌ Erreur lors de l'ajout du mot :
"
,
error
);
console
.
error
(
"
❌ Erreur lors de l'ajout du mot :
"
,
error
);
picker
.
innerHTML
=
`<p style="color: red;">❌ Erreur :
${
error
.
message
}
</p>`
;
const
errorMsg
=
`❌ Erreur lors de l'ajout du mot :
${
error
.
message
}
`
;
picker
.
innerHTML
=
`<p style="color: red;">
${
errorMsg
}
</p>`
;
setTimeout
(()
=>
picker
.
style
.
display
=
"
none
"
,
3000
);
setTimeout
(()
=>
picker
.
style
.
display
=
"
none
"
,
3000
);
browser
.
runtime
.
sendMessage
({
browser
.
runtime
.
sendMessage
({
action
:
"
addWordResult
"
,
action
:
"
addWordResult
"
,
lexicons
:
`❌ Erreur lors de l'ajout du mot :
${
error
.
message
}
`
lexicons
:
errorMsg
});
});
}
}
});
});
...
...
This diff is collapsed.
Click to expand it.
src/sidebar/sidebar.js
+
14
−
6
View file @
b8e717cb
...
@@ -74,7 +74,7 @@ function toggleHighlightMessage(isLoggedIn) {
...
@@ -74,7 +74,7 @@ function toggleHighlightMessage(isLoggedIn) {
}
}
/**
/**
* Met à jour l'état global de la
sidebar
(bouton d'authentification, etc.)
* Met à jour l'état global de la
barre latérale
(bouton d'authentification, etc.)
*/
*/
async
function
refreshSidebarState
()
{
async
function
refreshSidebarState
()
{
log
(
"
🔄 Début de l'actualisation de la barre latérale...
"
);
log
(
"
🔄 Début de l'actualisation de la barre latérale...
"
);
...
@@ -206,14 +206,18 @@ async function fetchLexicons() {
...
@@ -206,14 +206,18 @@ async function fetchLexicons() {
lexicons
.
forEach
((
lex
)
=>
{
lexicons
.
forEach
((
lex
)
=>
{
let
lexiconName
=
""
;
let
lexiconName
=
""
;
if
(
lex
.
category
===
"
User
"
)
{
if
(
lex
.
category
===
"
User
"
)
{
lexiconName
=
`Lexique personnel :
${
lex
.
user
?.
pseudo
||
"
Inconnu
"
}
(
${
lex
.
id
}
)`
;
lexiconName
=
DEBUG
?
`Lexique personnel :
${
lex
.
user
?.
pseudo
||
"
Inconnu
"
}
(
${
lex
.
id
}
)`
:
`Lexique personnel :
${
lex
.
user
?.
pseudo
||
"
Inconnu
"
}
`
;
if
(
lex
.
language
)
{
if
(
lex
.
language
)
{
lexiconName
+=
` [
${
lex
.
language
}
]`
;
lexiconName
+=
` [
${
lex
.
language
}
]`
;
}
}
}
else
if
(
lex
.
category
===
"
Group
"
)
{
}
else
if
(
lex
.
category
===
"
Group
"
)
{
lexiconName
=
`Lexique de groupe :
${
lex
.
group
?.
name
||
"
Inconnu
"
}
(
${
lex
.
id
}
)`
;
lexiconName
=
DEBUG
?
`Lexique de groupe :
${
lex
.
group
?.
name
||
"
Inconnu
"
}
(
${
lex
.
id
}
)`
:
`Lexique de groupe :
${
lex
.
group
?.
name
||
"
Inconnu
"
}
`
}
else
{
}
else
{
lexiconName
=
`Lexique :
${
lex
.
id
}
`
;
lexiconName
=
DEBUG
?
`Lexique :
${
lex
.
id
}
`
:
"
Lexique
"
;
}
}
lexiconMap
.
set
(
lex
.
id
,
lexiconName
);
lexiconMap
.
set
(
lex
.
id
,
lexiconName
);
});
});
...
@@ -221,8 +225,12 @@ async function fetchLexicons() {
...
@@ -221,8 +225,12 @@ async function fetchLexicons() {
displayLexiconsWithCheckbox
(
lexicons
.
map
((
lex
)
=>
({
displayLexiconsWithCheckbox
(
lexicons
.
map
((
lex
)
=>
({
lexiconName
:
lexiconName
:
lex
.
category
===
"
User
"
lex
.
category
===
"
User
"
?
`Lexique personnel :
${
lex
.
user
?.
pseudo
||
"
Inconnu
"
}
(
${
lex
.
id
}
)
${(
lex
.
language
)
?
` [
${
lex
.
language
}
]`
:
""
}
`
?
DEBUG
:
`Lexique de groupe :
${
lex
.
group
?.
name
||
"
Inconnu
"
}
(
${
lex
.
id
}
)
${(
lex
.
language
)
?
` [
${
lex
.
language
}
]`
:
""
}
`
,
?
`Lexique personnel :
${
lex
.
user
?.
pseudo
||
"
Inconnu
"
}
(
${
lex
.
id
}
)
${(
lex
.
language
)
?
` [
${
lex
.
language
}
]`
:
""
}
`
:
`Lexique personnel :
${
lex
.
user
?.
pseudo
||
"
Inconnu
"
}${(
lex
.
language
)
?
` [
${
lex
.
language
}
]`
:
""
}
`
:
DEBUG
?
`Lexique de groupe :
${
lex
.
group
?.
name
||
"
Inconnu
"
}
(
${
lex
.
id
}
)
${(
lex
.
language
)
?
` [
${
lex
.
language
}
]`
:
""
}
`
:
`Lexique de groupe :
${
lex
.
group
?.
name
||
"
Inconnu
"
}${(
lex
.
language
)
?
` [
${
lex
.
language
}
]`
:
""
}
`
,
lexiconId
:
lex
.
id
,
lexiconId
:
lex
.
id
,
active
:
lex
.
active
||
false
,
active
:
lex
.
active
||
false
,
})));
})));
...
...
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