mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-14 12:23:52 +02:00
add searchTableSize limit
This commit is contained in:
@@ -127,7 +127,7 @@
|
||||
const totalItems = computed(() => {
|
||||
const length = table.getFilteredRowModel().rows.length;
|
||||
const max = vrcxStore.maxTableSize;
|
||||
return length > max && length < max + 51 ? max : length;
|
||||
return length > max ? max : length;
|
||||
});
|
||||
|
||||
const handlePageSizeChange = (size) => {
|
||||
|
||||
@@ -225,7 +225,7 @@
|
||||
const totalItems = computed(() => {
|
||||
const length = table.getFilteredRowModel().rows.length;
|
||||
const max = vrcxStore.maxTableSize;
|
||||
return length > max && length < max + 51 ? max : length;
|
||||
return length > max ? max : length;
|
||||
});
|
||||
|
||||
const handlePageSizeChange = (size) => {
|
||||
|
||||
121
src/components/dialogs/TableLimitsDialog.vue
Normal file
121
src/components/dialogs/TableLimitsDialog.vue
Normal file
@@ -0,0 +1,121 @@
|
||||
<template>
|
||||
<Dialog v-model:open="tableLimitsDialog.visible">
|
||||
<DialogContent class="x-dialog sm:max-w-110">
|
||||
<DialogHeader>
|
||||
<DialogTitle>{{ t('prompt.change_table_size.header') }}</DialogTitle>
|
||||
<DialogDescription>{{ t('prompt.change_table_size.description') }}</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<FieldGroup class="mt-3 gap-3">
|
||||
<Field>
|
||||
<FieldLabel>{{ t('prompt.change_table_size.table_max_size') }}</FieldLabel>
|
||||
<FieldContent>
|
||||
<InputGroupField
|
||||
v-model="tableLimitsDialog.maxTableSize"
|
||||
type="text"
|
||||
inputmode="numeric"
|
||||
pattern="\\d*" />
|
||||
</FieldContent>
|
||||
<p :class="['mt-1 text-xs', maxTableSizeError ? 'text-destructive' : 'text-muted-foreground']">
|
||||
{{ maxTableSizeError || maxTableSizeHint }}
|
||||
</p>
|
||||
</Field>
|
||||
<Field>
|
||||
<FieldLabel>{{ t('prompt.change_table_size.search_limit') }}</FieldLabel>
|
||||
<FieldContent>
|
||||
<InputGroupField
|
||||
v-model="tableLimitsDialog.searchLimit"
|
||||
type="text"
|
||||
inputmode="numeric"
|
||||
pattern="\\d*" />
|
||||
</FieldContent>
|
||||
<p :class="['mt-1 text-xs', searchLimitError ? 'text-destructive' : 'text-muted-foreground']">
|
||||
{{ searchLimitError || searchLimitHint }}
|
||||
</p>
|
||||
<p class="mt-1 text-xs text-muted-foreground">
|
||||
{{ t('prompt.change_table_size.search_limit_warning') }}
|
||||
</p>
|
||||
</Field>
|
||||
</FieldGroup>
|
||||
|
||||
<DialogFooter>
|
||||
<Button variant="secondary" class="mr-2" @click="closeTableLimitsDialog">
|
||||
{{ t('prompt.change_table_size.cancel') }}
|
||||
</Button>
|
||||
<Button :disabled="isSaveDisabled" @click="saveTableLimitsDialog">
|
||||
{{ t('prompt.change_table_size.save') }}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle
|
||||
} from '@/components/ui/dialog';
|
||||
import { Field, FieldContent, FieldGroup, FieldLabel } from '@/components/ui/field';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { InputGroupField } from '@/components/ui/input-group';
|
||||
import { computed } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { useAppearanceSettingsStore } from '../../stores';
|
||||
|
||||
const appearanceSettingsStore = useAppearanceSettingsStore();
|
||||
const { tableLimitsDialog } = storeToRefs(appearanceSettingsStore);
|
||||
const {
|
||||
closeTableLimitsDialog,
|
||||
saveTableLimitsDialog,
|
||||
TABLE_MAX_SIZE_MIN,
|
||||
TABLE_MAX_SIZE_MAX,
|
||||
SEARCH_LIMIT_MIN,
|
||||
SEARCH_LIMIT_MAX
|
||||
} = appearanceSettingsStore;
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const maxTableSizeError = computed(() => {
|
||||
const n = Number(tableLimitsDialog.value.maxTableSize);
|
||||
if (!Number.isFinite(n) || n < TABLE_MAX_SIZE_MIN || n > TABLE_MAX_SIZE_MAX) {
|
||||
return t('prompt.change_table_size.table_max_size_error', {
|
||||
min: TABLE_MAX_SIZE_MIN,
|
||||
max: TABLE_MAX_SIZE_MAX
|
||||
});
|
||||
}
|
||||
return '';
|
||||
});
|
||||
|
||||
const maxTableSizeHint = computed(() =>
|
||||
t('prompt.change_table_size.table_max_size_error', {
|
||||
min: TABLE_MAX_SIZE_MIN,
|
||||
max: TABLE_MAX_SIZE_MAX
|
||||
})
|
||||
);
|
||||
|
||||
const searchLimitError = computed(() => {
|
||||
const n = Number(tableLimitsDialog.value.searchLimit);
|
||||
if (!Number.isFinite(n) || n < SEARCH_LIMIT_MIN || n > SEARCH_LIMIT_MAX) {
|
||||
return t('prompt.change_table_size.search_limit_error', {
|
||||
min: SEARCH_LIMIT_MIN,
|
||||
max: SEARCH_LIMIT_MAX
|
||||
});
|
||||
}
|
||||
return '';
|
||||
});
|
||||
|
||||
const searchLimitHint = computed(() =>
|
||||
t('prompt.change_table_size.search_limit_error', {
|
||||
min: SEARCH_LIMIT_MIN,
|
||||
max: SEARCH_LIMIT_MAX
|
||||
})
|
||||
);
|
||||
|
||||
const isSaveDisabled = computed(() => !!maxTableSizeError.value || !!searchLimitError.value);
|
||||
</script>
|
||||
@@ -288,7 +288,6 @@
|
||||
"sort_instance_users_by": "Řadit uživatele v instanci podle",
|
||||
"sort_instance_users_by_time": "času",
|
||||
"sort_instance_users_by_alphabet": "abecedně",
|
||||
"table_max_size": "Magimální velikost tabulky",
|
||||
"page_size": "Velikost stránky:"
|
||||
},
|
||||
"timedate": {
|
||||
@@ -1681,7 +1680,8 @@
|
||||
},
|
||||
"change_table_size": {
|
||||
"header": "Max Table Size",
|
||||
"description": "Limit amount of entries loaded from database to UI pages, larger table sizes will impact RAM usage and performance (default: 1000, max: 10000)",
|
||||
"description": "Limit amount of entries loaded from database to UI pages, larger table sizes will impact RAM usage and performance",
|
||||
"table_max_size": "Magimální velikost tabulky",
|
||||
"cancel": "Cancel",
|
||||
"save": "Save",
|
||||
"input_error": "Valid number is required"
|
||||
|
||||
@@ -2319,7 +2319,12 @@
|
||||
},
|
||||
"change_table_size": {
|
||||
"header": "Max Table Size",
|
||||
"description": "Limit amount of entries loaded from database to UI pages, larger table sizes will impact RAM usage and performance (default: 1000, max: 10000)",
|
||||
"description": "Limit amount of entries loaded from database to UI pages, larger table sizes will impact RAM usage and performance",
|
||||
"table_max_size": "Table Max Size",
|
||||
"table_max_size_error": "Enter a number between {min} and {max}.",
|
||||
"search_limit": "Search limit",
|
||||
"search_limit_error": "Enter a number between {min} and {max}.",
|
||||
"search_limit_warning": "Too large values can freeze the app.",
|
||||
"cancel": "Cancel",
|
||||
"save": "Save",
|
||||
"input_error": "Valid number is required"
|
||||
|
||||
@@ -382,7 +382,6 @@
|
||||
"sort_instance_users_by": "Ordenar Usuarios de Instancia por",
|
||||
"sort_instance_users_by_time": "tiempo",
|
||||
"sort_instance_users_by_alphabet": "alfabético",
|
||||
"table_max_size": "Tamaño Máximo de Tabla",
|
||||
"page_size": "Tamaño de Página:"
|
||||
},
|
||||
"timedate": {
|
||||
@@ -1798,7 +1797,8 @@
|
||||
},
|
||||
"change_table_size": {
|
||||
"header": "Tamaño Máximo de Tabla",
|
||||
"description": "Limitar la cantidad de entradas cargadas desde la base de datos a las páginas de la interfaz de usuario, tamaños de tabla más grandes impactarán el uso de RAM y el rendimiento (predeterminado: 1000, máximo: 10000)",
|
||||
"description": "Limitar la cantidad de entradas cargadas desde la base de datos a las páginas de la interfaz de usuario, tamaños de tabla más grandes impactarán el uso de RAM y el rendimiento",
|
||||
"table_max_size": "Tamaño Máximo de Tabla",
|
||||
"cancel": "Cancelar",
|
||||
"save": "Guardar",
|
||||
"input_error": "Se requiere un número válido"
|
||||
|
||||
@@ -354,7 +354,6 @@
|
||||
"sort_instance_users_by": "Trier les utilisateurs dans les instances par",
|
||||
"sort_instance_users_by_time": "temps",
|
||||
"sort_instance_users_by_alphabet": "alphabétique",
|
||||
"table_max_size": "Taille maximale du tableau",
|
||||
"page_size": "Longueur d'une page :"
|
||||
},
|
||||
"timedate": {
|
||||
@@ -1687,7 +1686,8 @@
|
||||
},
|
||||
"change_table_size": {
|
||||
"header": "Taille maximale du tableau",
|
||||
"description": "Limite le nombre d'entrées chargées depuis la base de données. Des tableaux plus grands auront un impact sur l'utilisation de la RAM et sur les performances (par défaut : 1000, max : 10000).",
|
||||
"description": "Limite le nombre d'entrées chargées depuis la base de données. Des tableaux plus grands auront un impact sur l'utilisation de la RAM et sur les performances.",
|
||||
"table_max_size": "Taille maximale du tableau",
|
||||
"cancel": "Annuler",
|
||||
"save": "Sauvegarder",
|
||||
"input_error": "Un numéro valide est nécessaire"
|
||||
|
||||
@@ -275,7 +275,6 @@
|
||||
"sort_instance_users_by": "Sort Instance Users by",
|
||||
"sort_instance_users_by_time": "idő",
|
||||
"sort_instance_users_by_alphabet": "betűrend",
|
||||
"table_max_size": "Maximális táblázatméret",
|
||||
"page_size": "Lapméret:"
|
||||
},
|
||||
"timedate": {
|
||||
@@ -1559,7 +1558,8 @@
|
||||
},
|
||||
"change_table_size": {
|
||||
"header": "Max Table Size",
|
||||
"description": "Limit amount of entries loaded from database to UI pages, larger table sizes will impact RAM usage and performance (default: 1000, max: 10000)",
|
||||
"description": "Limit amount of entries loaded from database to UI pages, larger table sizes will impact RAM usage and performance",
|
||||
"table_max_size": "Maximális táblázatméret",
|
||||
"cancel": "Mégse",
|
||||
"save": "Save",
|
||||
"input_error": "Valid number is required"
|
||||
|
||||
@@ -617,9 +617,6 @@
|
||||
"sort_instance_users_by": "インスタンス人数を並び替え:",
|
||||
"sort_instance_users_by_time": "時間順",
|
||||
"sort_instance_users_by_alphabet": "アルファベット順",
|
||||
"table_max_size": "読み込むエントリの最大数",
|
||||
"table_page_sizes": "テーブルのページごとの表示件数:",
|
||||
"table_page_sizes_error": "ページサイズは1から1000の間の数字にしてください。",
|
||||
"show_notification_icon_dot": "トレイ通知ドットを表示",
|
||||
"striped_data_table_mode": "テーブルの行に交互に色を付ける",
|
||||
"toggle_pointer_on_hover": "ホバー時にポインターを切り替え",
|
||||
@@ -2319,7 +2316,10 @@
|
||||
},
|
||||
"change_table_size": {
|
||||
"header": "テーブルの最大数",
|
||||
"description": "データベースからUIページに読み込まれるエントリの量を制限します。テーブル数が多いとRAM使用量とパフォーマンスに影響を及ぼす可能性があります。 (デフォルト:1000, 最高値: 10000)",
|
||||
"description": "データベースからUIページに読み込まれるエントリの量を制限します。テーブル数が多いとRAM使用量とパフォーマンスに影響を及ぼす可能性があります。",
|
||||
"table_max_size": "読み込むエントリの最大数",
|
||||
"table_page_sizes": "テーブルのページごとの表示件数:",
|
||||
"table_page_sizes_error": "ページサイズは1から1000の間の数字にしてください。",
|
||||
"cancel": "キャンセル",
|
||||
"save": "保存",
|
||||
"input_error": "有効な数字を入力してください。"
|
||||
|
||||
@@ -289,7 +289,6 @@
|
||||
"sort_instance_users_by": "인스턴스 유저 순서",
|
||||
"sort_instance_users_by_time": "시간순",
|
||||
"sort_instance_users_by_alphabet": "이름순",
|
||||
"table_max_size": "최대 테이블 크기",
|
||||
"page_size": "페이지 당 건수:"
|
||||
},
|
||||
"timedate": {
|
||||
@@ -1573,7 +1572,8 @@
|
||||
},
|
||||
"change_table_size": {
|
||||
"header": "최대 테이블 크기",
|
||||
"description": "테이블이 커질수록 메모리 사용량과 성능에 영향을 줍니다 (기본: 1000)",
|
||||
"description": "테이블이 커질수록 메모리 사용량과 성능에 영향을 줍니다",
|
||||
"table_max_size": "최대 테이블 크기",
|
||||
"cancel": "취소",
|
||||
"save": "저장",
|
||||
"input_error": "숫자만 입력 가능"
|
||||
|
||||
@@ -534,7 +534,6 @@
|
||||
"sort_instance_users_by": "Sortuj użytkowników instancji wg",
|
||||
"sort_instance_users_by_time": "czas",
|
||||
"sort_instance_users_by_alphabet": "alfabetycznie",
|
||||
"table_max_size": "Maks. wyników w tabeli",
|
||||
"show_notification_icon_dot": "Pokaż kropkę powiadomień w zasobniku"
|
||||
},
|
||||
"timedate": {
|
||||
@@ -2114,7 +2113,8 @@
|
||||
},
|
||||
"change_table_size": {
|
||||
"header": "Maksymalny rozmiar tabeli",
|
||||
"description": "Ogranicz liczbę wpisów wyświetlanych z bazy danych, większe tabele wpłyną na zużycie RAM (domyślnie: 1000, maks.: 10000)",
|
||||
"description": "Ogranicz liczbę wpisów wyświetlanych z bazy danych, większe tabele wpłyną na zużycie RAM",
|
||||
"table_max_size": "Maks. wyników w tabeli",
|
||||
"cancel": "Anuluj",
|
||||
"save": "Zapisz",
|
||||
"input_error": "Wymagana jest prawidłowa liczba"
|
||||
@@ -2388,4 +2388,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +275,6 @@
|
||||
"sort_instance_users_by": "Ordenar Instâncias de Usuários por",
|
||||
"sort_instance_users_by_time": "tempo",
|
||||
"sort_instance_users_by_alphabet": "alfabético",
|
||||
"table_max_size": "Tamanho Máximo da Tabela",
|
||||
"page_size": "Tamanho da Página:"
|
||||
},
|
||||
"timedate": {
|
||||
@@ -1559,7 +1558,8 @@
|
||||
},
|
||||
"change_table_size": {
|
||||
"header": "Max Table Size",
|
||||
"description": "Limitar quantidade de entradas carregadas do banco de dados para páginas da interface, tamanhos maiores de tabela terão impacto no uso e desempenho da memória RAM (padrão: 1000, max: 10000)",
|
||||
"description": "Limitar quantidade de entradas carregadas do banco de dados para páginas da interface, tamanhos maiores de tabela terão impacto no uso e desempenho da memória RAM",
|
||||
"table_max_size": "Tamanho Máximo da Tabela",
|
||||
"cancel": "Cancelar",
|
||||
"save": "Salvar",
|
||||
"input_error": "Validação do número é obrigatório"
|
||||
|
||||
@@ -431,7 +431,6 @@
|
||||
"sort_instance_users_by": "Сортировать игроков по",
|
||||
"sort_instance_users_by_time": "времени",
|
||||
"sort_instance_users_by_alphabet": "алфавиту",
|
||||
"table_max_size": "Максимальный размер таблицы",
|
||||
"page_size": "Размер страницы:"
|
||||
},
|
||||
"timedate": {
|
||||
@@ -1958,7 +1957,8 @@
|
||||
},
|
||||
"change_table_size": {
|
||||
"header": "Максимальный размер таблицы",
|
||||
"description": "Ограничение количества записей, загружаемых из базы данных в пользовательский интерфейс. Большие размеры таблиц повлияют на использование и производительность ОЗУ (по умолчанию: 1000, макс: 10000)",
|
||||
"description": "Ограничение количества записей, загружаемых из базы данных в пользовательский интерфейс. Большие размеры таблиц повлияют на использование и производительность ОЗУ",
|
||||
"table_max_size": "Максимальный размер таблицы",
|
||||
"cancel": "Отмена",
|
||||
"save": "Сохранить",
|
||||
"input_error": "Требуется корректное число"
|
||||
|
||||
@@ -387,7 +387,6 @@
|
||||
"sort_instance_users_by": "เรียงผู้ใช้ในอินสแตนซ์ตาม",
|
||||
"sort_instance_users_by_time": "เวลา",
|
||||
"sort_instance_users_by_alphabet": "ตัวอักษร",
|
||||
"table_max_size": "ขนาดตารางสูงสุด",
|
||||
"page_size": "ขนาดหน้า:"
|
||||
},
|
||||
"timedate": {
|
||||
@@ -1862,7 +1861,8 @@
|
||||
},
|
||||
"change_table_size": {
|
||||
"header": "ขนาดตารางสูงสุด",
|
||||
"description": "จำกัดจำนวนรายการที่โหลดจากฐานข้อมูลไปยังหน้า UI, ขนาดตารางที่ใหญ่ขึ้นจะส่งผลต่อการใช้ RAM และประสิทธิภาพ (ค่าเริ่มต้น: 1000, สูงสุด: 10000)",
|
||||
"description": "จำกัดจำนวนรายการที่โหลดจากฐานข้อมูลไปยังหน้า UI, ขนาดตารางที่ใหญ่ขึ้นจะส่งผลต่อการใช้ RAM และประสิทธิภาพ",
|
||||
"table_max_size": "ขนาดตารางสูงสุด",
|
||||
"cancel": "ยกเลิก",
|
||||
"save": "บันทึก",
|
||||
"input_error": "ต้องระบุตัวเลขที่ถูกต้อง"
|
||||
|
||||
@@ -275,7 +275,6 @@
|
||||
"sort_instance_users_by": "Sắp xếp người dùng trong world instance theo",
|
||||
"sort_instance_users_by_time": "Thời gian",
|
||||
"sort_instance_users_by_alphabet": "Bảng chữ cái",
|
||||
"table_max_size": "Kích thước bảng tối đa",
|
||||
"page_size": "Kích thước trang"
|
||||
},
|
||||
"timedate": {
|
||||
@@ -1559,7 +1558,8 @@
|
||||
},
|
||||
"change_table_size": {
|
||||
"header": "Kích thước bảng tối đa",
|
||||
"description": "Giới hạn số lượng thông tin trên bảng UI, bảng lớn sẽ sử dụng RAM và hiệu năng nhiều hơn (mặc định: 1000, tối đa: 10000)",
|
||||
"description": "Giới hạn số lượng thông tin trên bảng UI, bảng lớn sẽ sử dụng RAM và hiệu năng nhiều hơn",
|
||||
"table_max_size": "Kích thước bảng tối đa",
|
||||
"cancel": "Hủy",
|
||||
"save": "Lưu",
|
||||
"input_error": "Yêu cầu số hợp lệ"
|
||||
|
||||
@@ -612,9 +612,6 @@
|
||||
"sort_instance_users_by": "房间玩家排序规则",
|
||||
"sort_instance_users_by_time": "时间",
|
||||
"sort_instance_users_by_alphabet": "字母顺序",
|
||||
"table_max_size": "最大显示行数",
|
||||
"table_page_sizes": "每页显示行数",
|
||||
"table_page_sizes_error": "行数必须是 1 到 1000 之间的数字",
|
||||
"show_notification_icon_dot": "显示托盘通知",
|
||||
"striped_data_table_mode": "斑马纹表格模式",
|
||||
"toggle_pointer_on_hover": "悬停时强制显示指针",
|
||||
@@ -2307,7 +2304,10 @@
|
||||
},
|
||||
"change_table_size": {
|
||||
"header": "最大读取记录数",
|
||||
"description": "限制从数据库读取记录到界面接口的数量,较大的数据表大小可能会影响内存用量和程序性能(默认值:1000)",
|
||||
"description": "限制从数据库读取记录到界面接口的数量,较大的数据表大小可能会影响内存用量和程序性能",
|
||||
"table_max_size": "最大显示行数",
|
||||
"table_page_sizes": "每页显示行数",
|
||||
"table_page_sizes_error": "行数必须是 1 到 1000 之间的数字",
|
||||
"cancel": "取消",
|
||||
"save": "保存",
|
||||
"input_error": "请输入有效的数量"
|
||||
|
||||
@@ -570,9 +570,6 @@
|
||||
"sort_instance_users_by": "房間用戶排序依據",
|
||||
"sort_instance_users_by_time": "時間",
|
||||
"sort_instance_users_by_alphabet": "字母順序",
|
||||
"table_max_size": "表格大小",
|
||||
"table_page_sizes": "表格每頁筆數",
|
||||
"table_page_sizes_error": "每頁筆數必須是 1 到 1000 之間的數字",
|
||||
"show_notification_icon_dot": "顯示通知圖示提示點"
|
||||
},
|
||||
"timedate": {
|
||||
@@ -2163,7 +2160,10 @@
|
||||
},
|
||||
"change_table_size": {
|
||||
"header": "最大表格大小",
|
||||
"description": "限制從資料庫讀取紀錄到介面的數量,較大的資料表大小可能會影響記憶體用量和效能 (預設:1000)",
|
||||
"description": "限制從資料庫讀取紀錄到介面的數量,較大的資料表大小可能會影響記憶體用量和效能",
|
||||
"table_max_size": "表格大小",
|
||||
"table_page_sizes": "表格每頁筆數",
|
||||
"table_page_sizes_error": "每頁筆數必須是 1 到 1000 之間的數字",
|
||||
"cancel": "取消",
|
||||
"save": "儲存",
|
||||
"input_error": "請輸入有效的行數"
|
||||
|
||||
@@ -17,7 +17,8 @@ import sqliteService from './sqlite.js';
|
||||
const dbVars = {
|
||||
userId: '',
|
||||
userPrefix: '',
|
||||
maxTableSize: 1000
|
||||
maxTableSize: 500,
|
||||
searchTableSize: 5000
|
||||
};
|
||||
|
||||
const database = {
|
||||
@@ -39,6 +40,10 @@ const database = {
|
||||
dbVars.maxTableSize = limit;
|
||||
},
|
||||
|
||||
setSearchTableSize(limit) {
|
||||
dbVars.searchTableSize = limit;
|
||||
},
|
||||
|
||||
async initUserTables(userId) {
|
||||
dbVars.userId = userId;
|
||||
dbVars.userPrefix = userId.replaceAll('-', '').replaceAll('_', '');
|
||||
|
||||
@@ -87,7 +87,7 @@ const feed = {
|
||||
search,
|
||||
filters,
|
||||
vipList,
|
||||
maxEntries = dbVars.maxTableSize
|
||||
maxEntries = dbVars.searchTableSize
|
||||
) {
|
||||
if (search.startsWith('wrld_') || search.startsWith('grp_')) {
|
||||
return this.getFeedByInstanceId(search, filters, vipList);
|
||||
@@ -488,7 +488,7 @@ const feed = {
|
||||
groupName: dbRow[8]
|
||||
};
|
||||
feedDatabase.push(row);
|
||||
}, `SELECT * FROM ${dbVars.userPrefix}_feed_gps WHERE location LIKE '%${instanceId}%' ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
|
||||
}, `SELECT * FROM ${dbVars.userPrefix}_feed_gps WHERE location LIKE '%${instanceId}%' ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.searchTableSize}`);
|
||||
}
|
||||
if (online || offline) {
|
||||
let query = '';
|
||||
@@ -512,7 +512,7 @@ const feed = {
|
||||
groupName: dbRow[8]
|
||||
};
|
||||
feedDatabase.push(row);
|
||||
}, `SELECT * FROM ${dbVars.userPrefix}_feed_online_offline WHERE (location LIKE '%${instanceId}%' ${query}) ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
|
||||
}, `SELECT * FROM ${dbVars.userPrefix}_feed_online_offline WHERE (location LIKE '%${instanceId}%' ${query}) ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.searchTableSize}`);
|
||||
}
|
||||
const compareByCreatedAt = function (a, b) {
|
||||
const A = a.created_at;
|
||||
@@ -526,8 +526,11 @@ const feed = {
|
||||
return 0;
|
||||
};
|
||||
feedDatabase.sort(compareByCreatedAt);
|
||||
if (feedDatabase.length > dbVars.maxTableSize) {
|
||||
feedDatabase.splice(0, feedDatabase.length - dbVars.maxTableSize);
|
||||
if (feedDatabase.length > dbVars.searchTableSize) {
|
||||
feedDatabase.splice(
|
||||
0,
|
||||
feedDatabase.length - dbVars.searchTableSize
|
||||
);
|
||||
}
|
||||
return feedDatabase;
|
||||
}
|
||||
|
||||
@@ -572,7 +572,7 @@ const gameLog = {
|
||||
groupName: dbRow[6]
|
||||
};
|
||||
gamelogDatabase.push(row);
|
||||
}, `SELECT * FROM gamelog_location WHERE location LIKE '%${instanceId}%' ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
|
||||
}, `SELECT * FROM gamelog_location WHERE location LIKE '%${instanceId}%' ORDER BY id DESC LIMIT ${dbVars.searchTableSize}`);
|
||||
}
|
||||
if (onplayerjoined || onplayerleft) {
|
||||
var query = '';
|
||||
@@ -594,7 +594,7 @@ const gameLog = {
|
||||
time: dbRow[6]
|
||||
};
|
||||
gamelogDatabase.push(row);
|
||||
}, `SELECT * FROM gamelog_join_leave WHERE (location LIKE '%${instanceId}%' AND user_id != '${dbVars.userId}') ${query} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
|
||||
}, `SELECT * FROM gamelog_join_leave WHERE (location LIKE '%${instanceId}%' AND user_id != '${dbVars.userId}') ${query} ORDER BY id DESC LIMIT ${dbVars.searchTableSize}`);
|
||||
}
|
||||
if (portalspawn) {
|
||||
await sqliteService.execute((dbRow) => {
|
||||
@@ -609,7 +609,7 @@ const gameLog = {
|
||||
worldName: dbRow[6]
|
||||
};
|
||||
gamelogDatabase.push(row);
|
||||
}, `SELECT * FROM gamelog_portal_spawn WHERE location LIKE '%${instanceId}%' ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
|
||||
}, `SELECT * FROM gamelog_portal_spawn WHERE location LIKE '%${instanceId}%' ORDER BY id DESC LIMIT ${dbVars.searchTableSize}`);
|
||||
}
|
||||
if (videoplay) {
|
||||
await sqliteService.execute((dbRow) => {
|
||||
@@ -625,7 +625,7 @@ const gameLog = {
|
||||
userId: dbRow[7]
|
||||
};
|
||||
gamelogDatabase.push(row);
|
||||
}, `SELECT * FROM gamelog_video_play WHERE location LIKE '%${instanceId}%' ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
|
||||
}, `SELECT * FROM gamelog_video_play WHERE location LIKE '%${instanceId}%' ORDER BY id DESC LIMIT ${dbVars.searchTableSize}`);
|
||||
}
|
||||
if (resourceload_string || resourceload_image) {
|
||||
var checkString = '';
|
||||
@@ -645,7 +645,7 @@ const gameLog = {
|
||||
location: dbRow[4]
|
||||
};
|
||||
gamelogDatabase.push(row);
|
||||
}, `SELECT * FROM gamelog_resource_load WHERE location LIKE '%${instanceId}%' ${checkString} ${checkImage} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
|
||||
}, `SELECT * FROM gamelog_resource_load WHERE location LIKE '%${instanceId}%' ${checkString} ${checkImage} ORDER BY id DESC LIMIT ${dbVars.searchTableSize}`);
|
||||
}
|
||||
var compareByCreatedAt = function (a, b) {
|
||||
var A = a.created_at;
|
||||
@@ -659,7 +659,10 @@ const gameLog = {
|
||||
return 0;
|
||||
};
|
||||
gamelogDatabase.sort(compareByCreatedAt);
|
||||
gamelogDatabase.splice(0, gamelogDatabase.length - dbVars.maxTableSize);
|
||||
gamelogDatabase.splice(
|
||||
0,
|
||||
gamelogDatabase.length - dbVars.searchTableSize
|
||||
);
|
||||
return gamelogDatabase;
|
||||
},
|
||||
|
||||
@@ -882,7 +885,7 @@ const gameLog = {
|
||||
search,
|
||||
filters,
|
||||
vipList,
|
||||
maxEntries = dbVars.maxTableSize
|
||||
maxEntries = dbVars.searchTableSize
|
||||
) {
|
||||
if (search.startsWith('wrld_') || search.startsWith('grp_')) {
|
||||
return this.getGameLogByLocation(search, filters);
|
||||
|
||||
@@ -32,4 +32,23 @@ const branches = {
|
||||
// }
|
||||
};
|
||||
|
||||
export { VRChatScreenshotResolutions, VRChatCameraResolutions, branches };
|
||||
const TABLE_MAX_SIZE_MIN = 100;
|
||||
const TABLE_MAX_SIZE_MAX = 10000;
|
||||
const SEARCH_LIMIT_MIN = 1000;
|
||||
const SEARCH_LIMIT_MAX = 100000;
|
||||
const DEFAULT_MAX_TABLE_SIZE = 500;
|
||||
const DEFAULT_SEARCH_LIMIT = 10000;
|
||||
const LEGACY_MAX_TABLE_SIZE_DEFAULT = 1000;
|
||||
|
||||
export {
|
||||
VRChatScreenshotResolutions,
|
||||
VRChatCameraResolutions,
|
||||
branches,
|
||||
TABLE_MAX_SIZE_MIN,
|
||||
TABLE_MAX_SIZE_MAX,
|
||||
SEARCH_LIMIT_MIN,
|
||||
SEARCH_LIMIT_MAX,
|
||||
DEFAULT_MAX_TABLE_SIZE,
|
||||
DEFAULT_SEARCH_LIMIT,
|
||||
LEGACY_MAX_TABLE_SIZE_DEFAULT
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ref, shallowReactive, shallowRef, watch } from 'vue';
|
||||
import { ref, shallowRef, watch } from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
import { database } from '../service/database';
|
||||
@@ -149,7 +149,8 @@ export const useFeedStore = defineStore('Feed', () => {
|
||||
? await database.searchFeedDatabase(
|
||||
search,
|
||||
feedTable.value.filter,
|
||||
vipList
|
||||
vipList,
|
||||
vrcxStore.searchLimit
|
||||
)
|
||||
: await database.lookupFeedDatabase(
|
||||
feedTable.value.filter,
|
||||
|
||||
@@ -407,7 +407,8 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
rows = await database.searchGameLogDatabase(
|
||||
search,
|
||||
gameLogTable.value.filter,
|
||||
vipList
|
||||
vipList,
|
||||
vrcxStore.searchLimit
|
||||
);
|
||||
} else {
|
||||
rows = await database.lookupGameLogDatabase(
|
||||
|
||||
@@ -3,6 +3,15 @@ import { defineStore } from 'pinia';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import {
|
||||
APP_FONT_DEFAULT_KEY,
|
||||
APP_FONT_FAMILIES,
|
||||
SEARCH_LIMIT_MAX,
|
||||
SEARCH_LIMIT_MIN,
|
||||
TABLE_MAX_SIZE_MAX,
|
||||
TABLE_MAX_SIZE_MIN,
|
||||
THEME_CONFIG
|
||||
} from '../../shared/constants';
|
||||
import {
|
||||
HueToHex,
|
||||
applyAppFontFamily,
|
||||
@@ -11,18 +20,12 @@ import {
|
||||
getThemeMode,
|
||||
updateTrustColorClasses
|
||||
} from '../../shared/utils/base/ui';
|
||||
import {
|
||||
APP_FONT_DEFAULT_KEY,
|
||||
APP_FONT_FAMILIES,
|
||||
THEME_CONFIG
|
||||
} from '../../shared/constants';
|
||||
import { database } from '../../service/database';
|
||||
import { getNameColour } from '../../shared/utils';
|
||||
import { languageCodes } from '../../localization';
|
||||
import { loadLocalizedStrings } from '../../plugin';
|
||||
import { useFeedStore } from '../feed';
|
||||
import { useGameLogStore } from '../gameLog';
|
||||
import { useModalStore } from '../modal';
|
||||
import { useUiStore } from '../ui';
|
||||
import { useUserStore } from '../user';
|
||||
import { useVrStore } from '../vr';
|
||||
@@ -42,9 +45,7 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
const userStore = useUserStore();
|
||||
const router = useRouter();
|
||||
const uiStore = useUiStore();
|
||||
const modalStore = useModalStore();
|
||||
|
||||
const { t, locale } = useI18n();
|
||||
const { locale } = useI18n();
|
||||
|
||||
const MAX_TABLE_PAGE_SIZE = 1000;
|
||||
const DEFAULT_TABLE_PAGE_SIZES = [10, 15, 20, 25, 50, 100];
|
||||
@@ -106,6 +107,11 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
|
||||
const isDataTableStriped = ref(false);
|
||||
const showPointerOnHover = ref(false);
|
||||
const tableLimitsDialog = ref({
|
||||
visible: false,
|
||||
maxTableSize: 500,
|
||||
searchLimit: 5000
|
||||
});
|
||||
|
||||
const clampInt = (value, min, max) => {
|
||||
const n = parseInt(value, 10);
|
||||
@@ -864,36 +870,67 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
}
|
||||
}
|
||||
|
||||
function promptMaxTableSizeDialog() {
|
||||
modalStore
|
||||
.prompt({
|
||||
title: t('prompt.change_table_size.header'),
|
||||
description: t('prompt.change_table_size.description'),
|
||||
confirmText: t('prompt.change_table_size.save'),
|
||||
cancelText: t('prompt.change_table_size.cancel'),
|
||||
inputValue: vrcxStore.maxTableSize.toString(),
|
||||
pattern: /\d+$/,
|
||||
errorMessage: t('prompt.change_table_size.input_error')
|
||||
})
|
||||
.then(async ({ ok, value }) => {
|
||||
if (!ok) return;
|
||||
if (value) {
|
||||
// TODO
|
||||
let processedValue = Number(value);
|
||||
if (processedValue > 10000) {
|
||||
processedValue = 10000;
|
||||
}
|
||||
vrcxStore.maxTableSize = processedValue;
|
||||
await configRepository.setString(
|
||||
'VRCX_maxTableSize',
|
||||
vrcxStore.maxTableSize.toString()
|
||||
);
|
||||
database.setMaxTableSize(vrcxStore.maxTableSize);
|
||||
feedStore.feedTableLookup();
|
||||
gameLogStore.gameLogTableLookup();
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
const clampLimit = (value, min, max) => {
|
||||
const n = Number.parseInt(value, 10);
|
||||
if (!Number.isFinite(n)) {
|
||||
return null;
|
||||
}
|
||||
if (n < min || n > max) {
|
||||
return null;
|
||||
}
|
||||
return n;
|
||||
};
|
||||
|
||||
function showTableLimitsDialog() {
|
||||
tableLimitsDialog.value.maxTableSize = Number(
|
||||
vrcxStore.maxTableSize ?? 500
|
||||
);
|
||||
tableLimitsDialog.value.searchLimit = Number(
|
||||
vrcxStore.searchLimit ?? 5000
|
||||
);
|
||||
tableLimitsDialog.value.visible = true;
|
||||
}
|
||||
|
||||
function closeTableLimitsDialog() {
|
||||
tableLimitsDialog.value.visible = false;
|
||||
}
|
||||
|
||||
async function saveTableLimitsDialog() {
|
||||
const nextMaxTableSize = clampLimit(
|
||||
tableLimitsDialog.value.maxTableSize,
|
||||
TABLE_MAX_SIZE_MIN,
|
||||
TABLE_MAX_SIZE_MAX
|
||||
);
|
||||
if (nextMaxTableSize === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
const nextSearchLimit = clampLimit(
|
||||
tableLimitsDialog.value.searchLimit,
|
||||
SEARCH_LIMIT_MIN,
|
||||
SEARCH_LIMIT_MAX
|
||||
);
|
||||
if (nextSearchLimit === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
vrcxStore.maxTableSize = nextMaxTableSize;
|
||||
await configRepository.setString(
|
||||
'VRCX_maxTableSize',
|
||||
vrcxStore.maxTableSize.toString()
|
||||
);
|
||||
database.setMaxTableSize(vrcxStore.maxTableSize);
|
||||
|
||||
vrcxStore.searchLimit = nextSearchLimit;
|
||||
await configRepository.setInt(
|
||||
'VRCX_searchLimit',
|
||||
vrcxStore.searchLimit
|
||||
);
|
||||
database.setSearchTableSize(vrcxStore.searchLimit);
|
||||
|
||||
feedStore.feedTableLookup();
|
||||
gameLogStore.gameLogTableLookup();
|
||||
tableLimitsDialog.value.visible = false;
|
||||
}
|
||||
|
||||
async function tryInitUserColours() {
|
||||
@@ -952,6 +989,11 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
isNavCollapsed,
|
||||
isDataTableStriped,
|
||||
showPointerOnHover,
|
||||
tableLimitsDialog,
|
||||
TABLE_MAX_SIZE_MIN,
|
||||
TABLE_MAX_SIZE_MAX,
|
||||
SEARCH_LIMIT_MIN,
|
||||
SEARCH_LIMIT_MAX,
|
||||
|
||||
setAppLanguage,
|
||||
setDisplayVRCPlusIconsAsAvatar,
|
||||
@@ -986,7 +1028,9 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
userColourInit,
|
||||
applyUserTrustLevel,
|
||||
changeAppLanguage,
|
||||
promptMaxTableSizeDialog,
|
||||
showTableLimitsDialog,
|
||||
closeTableLimitsDialog,
|
||||
saveTableLimitsDialog,
|
||||
setNotificationIconDot,
|
||||
applyTableDensity,
|
||||
setNavCollapsed,
|
||||
|
||||
@@ -5,6 +5,14 @@ import { useI18n } from 'vue-i18n';
|
||||
|
||||
import Noty from 'noty';
|
||||
|
||||
import {
|
||||
DEFAULT_MAX_TABLE_SIZE,
|
||||
DEFAULT_SEARCH_LIMIT,
|
||||
LEGACY_MAX_TABLE_SIZE_DEFAULT,
|
||||
SEARCH_LIMIT_MAX,
|
||||
SEARCH_LIMIT_MIN,
|
||||
TABLE_MAX_SIZE_MAX
|
||||
} from '../shared/constants';
|
||||
import {
|
||||
clearPiniaActionTrail,
|
||||
getPiniaActionTrail
|
||||
@@ -74,7 +82,8 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
const isRegistryBackupDialogVisible = ref(false);
|
||||
const ipcEnabled = ref(false);
|
||||
const clearVRCXCacheFrequency = ref(172800);
|
||||
const maxTableSize = ref(1000);
|
||||
const maxTableSize = ref(DEFAULT_MAX_TABLE_SIZE);
|
||||
const searchLimit = ref(DEFAULT_SEARCH_LIMIT);
|
||||
const proxyServer = ref('');
|
||||
|
||||
async function init() {
|
||||
@@ -148,13 +157,44 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
|
||||
maxTableSize.value = await configRepository.getInt(
|
||||
'VRCX_maxTableSize',
|
||||
1000
|
||||
LEGACY_MAX_TABLE_SIZE_DEFAULT
|
||||
);
|
||||
if (maxTableSize.value > 10000) {
|
||||
maxTableSize.value = 1000;
|
||||
if (maxTableSize.value > TABLE_MAX_SIZE_MAX) {
|
||||
maxTableSize.value = TABLE_MAX_SIZE_MAX;
|
||||
}
|
||||
const maxTableSizeMigrated = await configRepository.getBool(
|
||||
'VRCX_maxTableSizeMigrated500',
|
||||
false
|
||||
);
|
||||
// Migrate old default table size (1000) to new default (500)
|
||||
if (
|
||||
maxTableSize.value === LEGACY_MAX_TABLE_SIZE_DEFAULT &&
|
||||
!maxTableSizeMigrated
|
||||
) {
|
||||
maxTableSize.value = DEFAULT_MAX_TABLE_SIZE;
|
||||
await configRepository.setInt(
|
||||
'VRCX_maxTableSize',
|
||||
maxTableSize.value
|
||||
);
|
||||
await configRepository.setBool(
|
||||
'VRCX_maxTableSizeMigrated500',
|
||||
true
|
||||
);
|
||||
}
|
||||
database.setMaxTableSize(maxTableSize.value);
|
||||
|
||||
searchLimit.value = await configRepository.getInt(
|
||||
'VRCX_searchLimit',
|
||||
DEFAULT_SEARCH_LIMIT
|
||||
);
|
||||
if (searchLimit.value < SEARCH_LIMIT_MIN) {
|
||||
searchLimit.value = SEARCH_LIMIT_MIN;
|
||||
}
|
||||
if (searchLimit.value > SEARCH_LIMIT_MAX) {
|
||||
searchLimit.value = SEARCH_LIMIT_MAX;
|
||||
}
|
||||
database.setSearchTableSize(searchLimit.value);
|
||||
|
||||
refreshCustomScript();
|
||||
}
|
||||
|
||||
@@ -787,6 +827,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
ipcEnabled,
|
||||
clearVRCXCacheFrequency,
|
||||
maxTableSize,
|
||||
searchLimit,
|
||||
clearVRCXCache,
|
||||
eventVrcxMessage,
|
||||
eventLaunchCommand,
|
||||
|
||||
@@ -208,7 +208,7 @@
|
||||
const totalItems = computed(() => {
|
||||
const length = table.getFilteredRowModel().rows.length;
|
||||
const max = vrcxStore.maxTableSize;
|
||||
return length > max && length < max + 51 ? max : length;
|
||||
return length > max ? max : length;
|
||||
});
|
||||
|
||||
const handlePageSizeChange = (size) => {
|
||||
|
||||
@@ -189,8 +189,7 @@
|
||||
|
||||
const totalItems = computed(() => {
|
||||
const length = table.getFilteredRowModel().rows.length;
|
||||
const max = vrcxStore.maxTableSize;
|
||||
return length > max && length < max + 51 ? max : length;
|
||||
return length;
|
||||
});
|
||||
|
||||
const handlePageSizeChange = (size) => {
|
||||
|
||||
@@ -190,11 +190,12 @@
|
||||
</div>
|
||||
|
||||
<div class="options-container-item">
|
||||
<Button size="sm" variant="outline" @click="promptMaxTableSizeDialog">{{
|
||||
<Button size="sm" variant="outline" @click="showTableLimitsDialog">{{
|
||||
t('view.settings.appearance.appearance.table_max_size')
|
||||
}}</Button>
|
||||
</div>
|
||||
</div>
|
||||
<TableLimitsDialog />
|
||||
<div class="options-container">
|
||||
<span class="header">{{ t('view.settings.appearance.timedate.header') }}</span>
|
||||
<div class="options-container-item">
|
||||
@@ -474,6 +475,7 @@
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import PresetColorPicker from '@/components/PresetColorPicker.vue';
|
||||
import TableLimitsDialog from '@/components/dialogs/TableLimitsDialog.vue';
|
||||
|
||||
import SimpleSwitch from '../SimpleSwitch.vue';
|
||||
|
||||
@@ -533,7 +535,7 @@
|
||||
setHideUnfriends,
|
||||
updateTrustColor,
|
||||
changeAppLanguage,
|
||||
promptMaxTableSizeDialog,
|
||||
showTableLimitsDialog,
|
||||
setNotificationIconDot,
|
||||
setTablePageSizes,
|
||||
toggleStripedDataTable,
|
||||
|
||||
Reference in New Issue
Block a user