Skip to content

Commit

Permalink
new: [website] search bar in config page
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidCruciani committed Feb 9, 2024
1 parent 42996e8 commit caf3c6f
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions webiste/app/templates/modules_config.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,24 @@

{% block content %}
<div id="top"> <h1>Modules Config</h1> </div>

<small>[[modules_config.length]] modules found</small>
<hr>


<div style="width:50%; transform: translate(50%, 0);">
<div>
<input type="search" @input="onInput" id="search_modules" placeholder="Search modules" autofocus class="form-control" style="border-radius: 5px;" />
</div>
</div>
<br>

<div class="row">
<div class="row" style="margin-bottom: 100px;">
<div class="col" style="flex: 0 0 50%">
<div class="list-group">
<div v-for="module in modules_config" style="display:flex; ">
<input v-if="module.is_active || module.is_active == null" type="checkbox" style="margin-right: 5px;" checked @click="change_status(module)">
<input v-else type="checkbox" style="margin-right: 5px;" @click="change_status(module)">
<a class="list-group-item list-group-item-action" style="border-radius: 10px;" @click="display_config(module)">
<a class="list-group-item list-group-item-action" style="border-radius: 10px;" :title="module.description" @click="display_config(module)">
[[module.name]]
<i v-if="!module.config.length" style="color: brown;">No config</i>
</a>
Expand Down Expand Up @@ -60,11 +67,13 @@ <h4>[[ current_config['module_name'] ]]</h4>
setup() {
const modules_config = ref({})
const current_config = ref({})
let loc_modules = {}

async function query_modules(){
let res = await fetch("/modules_config_data")
let loc = await res.json()
modules_config.value = loc
loc_modules = modules_config.value
}
query_modules()

Expand Down Expand Up @@ -136,6 +145,18 @@ <h4>[[ current_config['module_name'] ]]</h4>
}


function onInput(e){
modules_config.value = []
if(e.target.value){
modules_config.value = loc_modules.filter((module) => {
return module.name.toLowerCase().includes(e.target.value.toLowerCase())
})
}else{
modules_config.value = loc_modules
}
}


return {
message_list,
modules_config,
Expand All @@ -144,7 +165,8 @@ <h4>[[ current_config['module_name'] ]]</h4>
close_panel,
change_config,
change_status,
check_request_on_query
check_request_on_query,
onInput
}
}
}).mount('.container')
Expand Down

0 comments on commit caf3c6f

Please sign in to comment.