Browse Source

feat:更新应用列表上移 #6035 (#6084)

pull/6093/head
trom 3 months ago committed by GitHub
parent
commit
1cc2cc6400
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 32
      frontend/src/views/app-store/index.vue

32
frontend/src/views/app-store/index.vue

@ -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>
@ -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'),
@ -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) => {

Loading…
Cancel
Save