Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
Amadeus
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
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
Afficher davantage de fils d'Ariane
bakaclub
Amadeus
Validations
2b77117a
Vérifiée
Valider
2b77117a
rédigé
4 years ago
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Can now reload kara list from DB
parent
a16eaf10
Aucune branche associée trouvée
Aucune étiquette associée trouvée
2 requêtes de fusion
!3
Dev kubat
,
!2
Base interface and system
Modifications
5
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
5 fichiers modifiés
Makefile
+5
-0
5 ajouts, 0 suppression
Makefile
common/db.js
+24
-1
24 ajouts, 1 suppression
common/db.js
instance/main.js
+19
-4
19 ajouts, 4 suppressions
instance/main.js
main.js
+48
-9
48 ajouts, 9 suppressions
main.js
package.json
+1
-1
1 ajout, 1 suppression
package.json
avec
97 ajouts
et
15 suppressions
Makefile
+
5
−
0
Voir le fichier @
2b77117a
...
...
@@ -6,3 +6,8 @@ prepare:
run
:
$(
YARN
)
start
--no-sandbox
debug
:
$(
YARN
)
test
--no-sandbox
.PHONY
:
test debug run prepare
Ce diff est replié.
Cliquez pour l'agrandir.
common/db.js
+
24
−
1
Voir le fichier @
2b77117a
...
...
@@ -58,7 +58,30 @@ class KaraDatabase {
return
new
Promise
(
resolv
=>
{
db
.
all
(
__sqlQuery
,
[
`%
${
queryString
}
%`
,
queryString
],
(
err
,
rows
)
=>
{
if
(
err
)
{
logger
.
log
(
"
error
"
,
err
);
logger
.
error
(
err
);
throw
err
;
}
rows
.
forEach
((
row
)
=>
{
__ret
.
push
(
row
);
});
resolv
(
__ret
);
});
});
};
return
__getRecords
(
this
.
m_db
);
}
/* List all the kara in the db.
* => a promize, callback with [(id: Int, string: String, cat: String, type: String)] */
all
()
{
var
__ret
=
[];
let
__sqlQuery
=
`SELECT id, string, category AS cat, (song_type || song_number) AS type
FROM kara;`
;
function
__getRecords
(
db
)
{
return
new
Promise
(
resolv
=>
{
db
.
all
(
__sqlQuery
,
[],
(
err
,
rows
)
=>
{
if
(
err
)
{
logger
.
error
(
err
);
throw
err
;
}
rows
.
forEach
((
row
)
=>
{
__ret
.
push
(
row
);
});
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
instance/main.js
+
19
−
4
Voir le fichier @
2b77117a
const
{
ipcRenderer
}
=
require
(
'
electron
'
);
const
logger
=
require
(
'
../common/logger.js
'
);
const
karaJSON
=
require
(
'
../test/dummyKara.json
'
);
const
buttonList
=
[
[
"
left
"
,
"
Reload
"
,
"
reloadDb
"
],
[
"
left
"
,
"
Play
"
,
"
commandPlay
"
],
[
"
left
"
,
"
Stop
"
,
"
commandStop
"
],
[
"
right
"
,
"
Quit LektorApp
"
,
"
closeButton
"
]
[
"
right
"
,
"
Quit LektorApp
"
,
"
closeButton
"
]
,
];
const
karaJSON
=
require
(
'
../test/dummyKara.json
'
);
window
.
onload
=
()
=>
{
createButtonList
(
buttonList
);
karaList
(
karaJSON
);
//
karaList(karaJSON);
document
.
getElementById
(
"
closeButton
"
).
addEventListener
(
'
click
'
,
()
=>
{
ipcRenderer
.
send
(
'
close-app
'
)
});
document
.
getElementById
(
"
commandPlay
"
).
addEventListener
(
'
click
'
,
()
=>
{
logger
.
debug
(
"
Command play !
"
);
ipcRenderer
.
send
(
'
cmd-play
'
,
null
);
});
document
.
getElementById
(
"
commandStop
"
).
addEventListener
(
'
click
'
,
()
=>
{
logger
.
debug
(
"
Command stop !
"
);
ipcRenderer
.
send
(
"
cmd-stop
"
,
null
);
});
document
.
getElementById
(
"
reloadDb
"
).
addEventListener
(
"
click
"
,
()
=>
{
ipcRenderer
.
send
(
"
reload-db-request
"
,
document
.
getElementById
(
"
buttonPanelListLeft
"
).
innerHTML
);
});
logger
.
debug
(
"
Window loaded
"
);
}
}
;
function
createButtonList
(
list
)
{
var
renderHtmlLeft
=
""
;
...
...
@@ -43,6 +53,11 @@ function createButtonList(list) {
document
.
getElementById
(
"
buttonPanelListLeft
"
).
innerHTML
=
renderHtmlLeft
+
renderHtmlRight
;
}
ipcRenderer
.
on
(
"
reload-db-responce
"
,
(
event
,
arg
)
=>
{
logger
.
debug
(
`Web page got reload-db`
);
document
.
getElementById
(
"
panelLeft
"
).
innerHTML
=
arg
;
});
function
karaList
(
karas
)
{
var
karaList
=
""
;
var
playingList
=
""
;
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
main.js
+
48
−
9
Voir le fichier @
2b77117a
...
...
@@ -3,19 +3,26 @@ const electron = require('electron')
const
{
app
,
BrowserWindow
}
=
require
(
'
electron
'
)
const
{
ipcMain
}
=
require
(
'
electron
'
)
const
{
fork
,
spawn
}
=
require
(
'
child_process
'
);
const
fs
=
require
(
"
fs
"
);
var
tail
=
require
(
'
tail
'
).
Tail
;
var
client
;
/* Sub process for the express server */
const
fs
=
require
(
"
fs
"
);
const
db
=
require
.
main
.
require
(
"
./common/db.js
"
);
const
lkt
=
require
.
main
.
require
(
"
./common/lkt.js
"
);
var
tail
=
require
(
'
tail
'
).
Tail
;
var
client
;
/* Sub process for the express server */
var
myDb
=
new
db
(
"
/home/kara/kara.db
"
);
/**********************
* Reinit the logfile *
**********************/
/* Reinit the logfile */
fs
.
truncate
(
logger
.
logfile
,
0
,
()
=>
{});
var
tail
=
new
tail
(
logger
.
logfile
);
tail
.
on
(
"
line
"
,
function
(
data
)
{
console
.
log
(
data
);
});
tail
.
on
(
"
line
"
,
function
(
data
)
{
console
.
log
(
data
);
});
/***************************************************************
* Creates the main window and process for the admin interface *
***************************************************************/
/* Creates the main window and process for the admin interface */
function
createInstanceWindow
()
{
const
win
=
new
BrowserWindow
({
width
:
1280
,
...
...
@@ -30,18 +37,50 @@ function createInstanceWindow () {
// win.webContents.openDevTools();
}
/******************************
* The end of the application *
******************************/
ipcMain
.
on
(
'
close-app
'
,
(
evt
,
arg
)
=>
{
app
.
quit
()
})
app
.
on
(
"
quit
"
,
()
=>
{
logger
.
info
(
"
Send SIGTERM to express process and tailler process
"
);
logger
.
info
(
"
Send SIGTERM to express process and tailler process
"
);
client
.
kill
(
"
SIGTERM
"
);
});
/*********************************
* The beggin of the application *
*********************************/
app
.
on
(
'
ready
'
,
()
=>
{
logger
.
info
(
"
Main window is ready
"
);
createInstanceWindow
();
client
=
fork
(
'
client/main.js
'
);
});
/*********************************
* Messages from the main window *
*********************************/
ipcMain
.
on
(
"
cmd-play
"
,
(
event
,
arg
)
=>
{
logger
.
debug
(
`
${
event
}
:
${
arg
}
`
);
});
ipcMain
.
on
(
"
cmd-stop
"
,
(
event
,
arg
)
=>
{
logger
.
debug
(
`
${
event
}
:
${
arg
}
`
);
});
/* Fill the pannel with the content of the DB.
* The `arg` is the HTML object of the pannel */
ipcMain
.
on
(
"
reload-db-request
"
,
(
event
,
arg
)
=>
{
logger
.
info
(
"
Reloading the left panel with all the DB
"
);
myDb
.
all
().
then
(
karas
=>
{
var
karaList
=
""
;
karas
.
forEach
(
kara
=>
{
karaList
+=
`<div class="card shadow" style="margin: 5px; border-radius: 10px; margin: 20px 0px 20px 0px;">
<div class="card-body">
${
kara
.
string
}
</div></div>`
;
});
event
.
reply
(
"
reload-db-responce
"
,
karaList
);
});
});
Ce diff est replié.
Cliquez pour l'agrandir.
package.json
+
1
−
1
Voir le fichier @
2b77117a
...
...
@@ -12,7 +12,7 @@
"license"
:
"
ISC
"
,
"scripts"
:
{
"start"
:
"electron ."
,
"test"
:
"ELECTRON_ENABLE_LOGGING=0 ELECTRON_NO_ATTACH_CONSOLE=true electron ."
"test"
:
"ELECTRON_ENABLE_LOGGING=0 ELECTRON_NO_ATTACH_CONSOLE=true electron
--trace-uncaught
."
},
"dependencies"
:
{
"
ejs
"
:
"
^3.1.5
"
,
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
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