Skip to content

Commit

Permalink
feat:更新应用列表上移 #6035 (#6084)
Browse files Browse the repository at this point in the history
  • Loading branch information
see-more committed Aug 12, 2024
1 parent 15f4c05 commit 1cc2cc6
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions frontend/src/views/app-store/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
<template>
<div>
<div v-if="showButton">
<RouterButton :buttons="buttons" />
<RouterButton :buttons="buttons">
<template #route-button>
<el-badge is-dot :hidden="!canUpdate" class="pr-5">
<el-button @click="sync" type="primary" plain :disabled="syncing">
{{ $t('app.syncAppList') }}
</el-button>
</el-badge>
</template>
</RouterButton>
</div>
<LayoutContent>
<router-view></router-view>
Expand All @@ -12,9 +20,13 @@
<script lang="ts" setup>
import i18n from '@/lang';
import { onMounted, ref } from 'vue';
import { SearchAppInstalled } from '@/api/modules/app';
import { SearchAppInstalled, SyncApp } from '@/api/modules/app';
import bus from './bus';
import { MsgSuccess } from '@/utils/message';
let showButton = ref(false);
const syncing = ref(false);
const canUpdate = ref(false);
const buttons = [
{
label: i18n.global.t('app.all'),
Expand All @@ -31,6 +43,22 @@ const buttons = [
},
];
const sync = () => {
syncing.value = true;
SyncApp()
.then((res) => {
if (res.message != '') {
MsgSuccess(res.message);
} else {
MsgSuccess(i18n.global.t('app.syncStart'));
}
canUpdate.value = false;
})
.finally(() => {
syncing.value = false;
});
};
const search = () => {
SearchAppInstalled({ update: true, page: 1, pageSize: 100 })
.then((res) => {
Expand Down

0 comments on commit 1cc2cc6

Please sign in to comment.