From 5e13a227f6e91c42fa1b0b76599242c89b7aeaff Mon Sep 17 00:00:00 2001 From: 2weiEmu Date: Mon, 15 Jun 2026 15:52:10 +0200 Subject: [PATCH] updated: some basic style elements --- pkg/dbhandling/songsapi.go | 4 ++++ public/css/index.css | 27 ++++++++++++++++++++++++++- public/index.html | 13 +++++++++---- public/js/index.js | 12 ++++++++++++ public/js/room.js | 16 ++++++++++++++++ public/rooms.html | 1 + songmanager | Bin 11701980 -> 11702364 bytes 7 files changed, 68 insertions(+), 5 deletions(-) diff --git a/pkg/dbhandling/songsapi.go b/pkg/dbhandling/songsapi.go index 4022a4b..5489e0f 100644 --- a/pkg/dbhandling/songsapi.go +++ b/pkg/dbhandling/songsapi.go @@ -233,6 +233,7 @@ func (dbw *DBWrapper) SongsRestart(w http.ResponseWriter, r *http.Request) { out, err := exec.Command("/bin/sh", "-c", "sudo docker ps -aqf ancestor=sis50binb:latest").Output() if err != nil { w.WriteHeader(http.StatusInternalServerError) + w.Write([]byte("Failed to find the id of the docker container that is running: " + err.Error())) return } @@ -240,17 +241,20 @@ func (dbw *DBWrapper) SongsRestart(w http.ResponseWriter, r *http.Request) { err = exec.Command("/bin/sh", "-c", "sudo docker stop", id).Run() if err != nil { w.WriteHeader(http.StatusInternalServerError) + w.Write([]byte("Failed to stop the docker container that is running sis50binb: " + err.Error())) return } err = exec.Command("/bin/sh", "-c", "sudo docker rm", id).Run() if err != nil { w.WriteHeader(http.StatusInternalServerError) + w.Write([]byte("Failed to delete dockere container that is running sis50binb: " + err.Error())) return } err = exec.Command("/bin/sh", "-c", "sudo", dbw.BinbLocation + "./launch.sh").Run() if err != nil { w.WriteHeader(http.StatusInternalServerError) + w.Write([]byte("Failed to launch sis50binb at the given Binblocation: " + err.Error())) return } diff --git a/public/css/index.css b/public/css/index.css index f52d6c7..2ee1b13 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -2,15 +2,34 @@ font-family: sans-serif; } +button { + padding: 5px; + border: none; + border-radius: 6px; + background-color: #bcdee0; +} + +button:hover { + background-color: #4be8f2; +} + #innerSongList, #innerSongFileList { - max-height: 50vh; overflow-y: scroll; + height: 50vh; + max-width: 50vw; + border: 1px solid grey; + border-radius: 10px; } .songElement { display: flex; margin: 10px; + max-width: 40vw; + border-radius: 5px; + box-shadow: grey 3px 3px 2px; + border: 1px solid grey; + padding: 4px; * { margin: auto 10px auto 10px; @@ -39,6 +58,12 @@ .songFileElement { display: flex; + margin: 10px; + max-width: 40vw; + border-radius: 5px; + box-shadow: grey 3px 3px 2px; + border: 1px solid grey; + padding: 4px; } .success { diff --git a/public/index.html b/public/index.html index b1ec508..224c9e1 100644 --- a/public/index.html +++ b/public/index.html @@ -18,6 +18,7 @@ In DB + Not In DB @@ -28,10 +29,14 @@ -
- -
-
+
+
+

File List

+
+ +
+
+
diff --git a/public/js/index.js b/public/js/index.js index 76825fa..f5f4da1 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -216,6 +216,7 @@ let songFilterInput = document.getElementById("songFilterInput") let songFilterName = document.getElementById("songFilterName") let songFilterArtist = document.getElementById("songFilterArtist") let songFilterInDB = document.getElementById("songFilterInDB") +let songFilterNotInDB = document.getElementById("songFilterNotInDB") /** * Get the current state of filters, with fields NameFilter, ArtistFilter, DBFilter @@ -227,6 +228,7 @@ function getFilterStates() { filterStates.NameFilter = songFilterName.value.toLowerCase() filterStates.ArtistFilter = songFilterArtist.value.toLowerCase() filterStates.DBFilter = songFilterInDB.checked + filterStates.NotDBFilter = songFilterNotInDB.checked return filterStates } @@ -235,6 +237,11 @@ function updateSongListWithFilter(_) { // get the filter states let filters = getFilterStates() + if (filters.DBFilter && filters.NotDBFilter) { + alert("Contradicting filters.") + return + } + // deep copy let filteredList = [...songList] @@ -243,6 +250,10 @@ function updateSongListWithFilter(_) { filteredList = filteredList.filter((v, _1, _2) => { return SongURLExists(v.PreviewURL)}) } + if (filters.NotDBFilter) { + filteredList = filteredList.filter((v, _1, _2) => { return !SongURLExists(v.PreviewURL)}) + } + if (filters.NameFilter != "") { filteredList = filteredList.filter((v, _1, _2) => { return v.TrackName.toLowerCase().includes(filters.NameFilter.toLowerCase()) @@ -263,6 +274,7 @@ function updateSongListWithFilter(_) { songFilterName.oninput = (event) => {updateSongListWithFilter(event)} songFilterArtist.oninput = (event) => {updateSongListWithFilter(event)} songFilterInDB.oninput = (event) => {updateSongListWithFilter(event)} +songFilterNotInDB.oninput = (event) => {updateSongListWithFilter(event)} /** * EDIT MENU FOR SONGS diff --git a/public/js/room.js b/public/js/room.js index e32b555..f73ffa4 100644 --- a/public/js/room.js +++ b/public/js/room.js @@ -1,3 +1,19 @@ +/** + * RESTART + **/ +let restartButton = document.getElementById("restartButton") + +restartButton.addEventListener("click", async (_) => { + let response = await fetch("/rebootapp") + if (response.status != 200) { + alert(await response.text()) + return + } + + alert("Rebooted the app.") +}) + + /** * ROOM CREATION **/ diff --git a/public/rooms.html b/public/rooms.html index 8191ea7..9084726 100644 --- a/public/rooms.html +++ b/public/rooms.html @@ -8,6 +8,7 @@ Home +