Skip to content

Commit 901d64d

Browse files
author
Test User
committed
feat: add pinUpdatesOnTop option to always show plugin updates at top
1 parent 29a449f commit 901d64d

5 files changed

Lines changed: 29 additions & 4 deletions

File tree

dashboard/src/i18n/locales/en-US/features/extension.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@
144144
"updated": "Last Updated",
145145
"updateStatus": "Update Status",
146146
"ascending": "Ascending",
147-
"descending": "Descending"
147+
"descending": "Descending",
148+
"pinUpdatesOnTop": "Pin Updates on Top"
148149
},
149150
"tags": {
150151
"danger": "Danger"

dashboard/src/i18n/locales/ru-RU/features/extension.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{
1+
{
22
"title": "Плагины",
33
"subtitle": "Управление и настройка расширений системы",
44
"tabs": {
@@ -143,7 +143,8 @@
143143
"updated": "Дате обновления",
144144
"updateStatus": "Статусу обновления",
145145
"ascending": "По возрастанию",
146-
"descending": "По убыванию"
146+
"descending": "По убыванию",
147+
"pinUpdatesOnTop": "Обновления сверху"
147148
},
148149
"tags": {
149150
"danger": "Опасно"

dashboard/src/i18n/locales/zh-CN/features/extension.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@
147147
"updated": "更新时间",
148148
"updateStatus": "更新状态",
149149
"ascending": "升序",
150-
"descending": "降序"
150+
"descending": "降序",
151+
"pinUpdatesOnTop": "有更新置顶"
151152
},
152153
"tags": {
153154
"danger": "危险"

dashboard/src/views/extension/InstalledPluginsTab.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,15 @@ const pinnedPlugins = computed(() => {
354354
:show-order="installedSortUsesOrder"
355355
@update:order="installedSortOrder = $event"
356356
/>
357+
<v-switch
358+
v-model="pinUpdatesOnTop"
359+
:label="tm('sort.pinUpdatesOnTop')"
360+
color="primary"
361+
density="compact"
362+
hide-details
363+
class="ml-4"
364+
style="max-width: 160px"
365+
/>
357366
</div>
358367
</div>
359368
</v-col>

dashboard/src/views/extension/useExtensionPage.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ export const useExtensionPage = () => {
188188
const installedStatusFilter = ref("all");
189189
const installedSortBy = ref("default");
190190
const installedSortOrder = ref("desc");
191+
const pinUpdatesOnTop = ref(true);
191192
const loading_ = ref(false);
192193

193194
// 分页相关
@@ -441,6 +442,17 @@ export const useExtensionPage = () => {
441442
const fallbackResult =
442443
fallbackNameCompare !== 0 ? fallbackNameCompare : left.index - right.index;
443444

445+
if (
446+
pinUpdatesOnTop.value &&
447+
installedSortBy.value !== "update_status"
448+
) {
449+
const leftHasUpdate = left.plugin?.has_update ? 1 : 0;
450+
const rightHasUpdate = right.plugin?.has_update ? 1 : 0;
451+
if (leftHasUpdate !== rightHasUpdate) {
452+
return rightHasUpdate - leftHasUpdate;
453+
}
454+
}
455+
444456
if (installedSortBy.value === "install_time") {
445457
const leftTimestamp = left.installedAtTimestamp;
446458
const rightTimestamp = right.installedAtTimestamp;
@@ -1695,6 +1707,7 @@ export const useExtensionPage = () => {
16951707
installedStatusFilter,
16961708
installedSortBy,
16971709
installedSortOrder,
1710+
pinUpdatesOnTop,
16981711
loading_,
16991712
currentPage,
17001713
marketCategoryFilter,

0 commit comments

Comments
 (0)