mirror of
https://github.com/langbot-app/LangBot.git
synced 2025-11-25 11:29:39 +08:00
perf: store pipeline sort method
This commit is contained in:
@@ -29,7 +29,17 @@ export default function PluginConfigPage() {
|
||||
const [sortOrderValue, setSortOrderValue] = useState<string>('DESC');
|
||||
|
||||
useEffect(() => {
|
||||
getPipelines();
|
||||
// Load sort preference from localStorage
|
||||
const savedSortBy = localStorage.getItem('pipeline_sort_by');
|
||||
const savedSortOrder = localStorage.getItem('pipeline_sort_order');
|
||||
|
||||
if (savedSortBy && savedSortOrder) {
|
||||
setSortByValue(savedSortBy);
|
||||
setSortOrderValue(savedSortOrder);
|
||||
getPipelines(savedSortBy, savedSortOrder);
|
||||
} else {
|
||||
getPipelines();
|
||||
}
|
||||
}, []);
|
||||
|
||||
function getPipelines(
|
||||
@@ -91,6 +101,11 @@ export default function PluginConfigPage() {
|
||||
const [newSortBy, newSortOrder] = value.split(',').map((s) => s.trim());
|
||||
setSortByValue(newSortBy);
|
||||
setSortOrderValue(newSortOrder);
|
||||
|
||||
// Save sort preference to localStorage
|
||||
localStorage.setItem('pipeline_sort_by', newSortBy);
|
||||
localStorage.setItem('pipeline_sort_order', newSortOrder);
|
||||
|
||||
getPipelines(newSortBy, newSortOrder);
|
||||
}
|
||||
|
||||
@@ -135,6 +150,12 @@ export default function PluginConfigPage() {
|
||||
>
|
||||
{t('pipelines.newestCreated')}
|
||||
</SelectItem>
|
||||
<SelectItem
|
||||
value="created_at,ASC"
|
||||
className="text-gray-900 dark:text-gray-100"
|
||||
>
|
||||
{t('pipelines.earliestCreated')}
|
||||
</SelectItem>
|
||||
<SelectItem
|
||||
value="updated_at,DESC"
|
||||
className="text-gray-900 dark:text-gray-100"
|
||||
|
||||
@@ -377,6 +377,7 @@ const enUS = {
|
||||
defaultBadge: 'Default',
|
||||
sortBy: 'Sort by',
|
||||
newestCreated: 'Newest Created',
|
||||
earliestCreated: 'Earliest Created',
|
||||
recentlyEdited: 'Recently Edited',
|
||||
earliestEdited: 'Earliest Edited',
|
||||
basicInfo: 'Basic',
|
||||
|
||||
@@ -379,6 +379,7 @@ const jaJP = {
|
||||
defaultBadge: 'デフォルト',
|
||||
sortBy: '並び順',
|
||||
newestCreated: '最新作成',
|
||||
earliestCreated: '最古作成',
|
||||
recentlyEdited: '最近編集',
|
||||
earliestEdited: '最古編集',
|
||||
basicInfo: '基本情報',
|
||||
|
||||
@@ -363,6 +363,7 @@ const zhHans = {
|
||||
defaultBadge: '默认',
|
||||
sortBy: '排序方式',
|
||||
newestCreated: '最新创建',
|
||||
earliestCreated: '最早创建',
|
||||
recentlyEdited: '最近编辑',
|
||||
earliestEdited: '最早编辑',
|
||||
basicInfo: '基础信息',
|
||||
|
||||
@@ -361,6 +361,7 @@ const zhHant = {
|
||||
defaultBadge: '預設',
|
||||
sortBy: '排序方式',
|
||||
newestCreated: '最新建立',
|
||||
earliestCreated: '最早建立',
|
||||
recentlyEdited: '最近編輯',
|
||||
earliestEdited: '最早編輯',
|
||||
basicInfo: '基本資訊',
|
||||
|
||||
Reference in New Issue
Block a user