add dashboard inside and outside system and fix timeout when search filter

This commit is contained in:
arifal
2025-03-06 23:33:31 +07:00
parent e0c35b8897
commit ffc08f26cc
24 changed files with 972 additions and 122 deletions

View File

@@ -28,35 +28,35 @@ class Menus {
initTableMenus() {
let tableContainer = document.getElementById("table-menus");
if (this.table) {
// If table exists, update its data instead of recreating
this.table
.updateConfig({
server: {
url: `${GlobalConfig.apiHost}/api/menus`,
credentials: "include",
headers: {
Authorization: `Bearer ${document
.querySelector('meta[name="api-token"]')
.getAttribute("content")}`,
"Content-Type": "application/json",
},
then: (data) =>
data.data.map((item) => [
item.id,
item.name,
item.url,
item.icon,
item.parent_id,
item.sort_order,
item.id,
]),
total: (data) => data.total,
},
})
.forceRender();
return;
}
// if (this.table) {
// // If table exists, update its data instead of recreating
// this.table
// .updateConfig({
// server: {
// url: `${GlobalConfig.apiHost}/api/menus`,
// credentials: "include",
// headers: {
// Authorization: `Bearer ${document
// .querySelector('meta[name="api-token"]')
// .getAttribute("content")}`,
// "Content-Type": "application/json",
// },
// then: (data) =>
// data.data.map((item) => [
// item.id,
// item.name,
// item.url,
// item.icon,
// item.parent_id,
// item.sort_order,
// item.id,
// ]),
// total: (data) => data.total,
// },
// })
// .forceRender();
// return;
// }
this.table = new Grid({
columns: [
@@ -96,6 +96,7 @@ class Menus {
server: {
url: (prev, keyword) => `${prev}?search=${keyword}`,
},
debounceTimeout: 1000,
},
server: {
url: `${GlobalConfig.apiHost}/api/menus`,