mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-10 09:02:42 +08:00
parent
15f4c05772
commit
1cc2cc6400
1 changed files with 30 additions and 2 deletions
|
@ -1,7 +1,15 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div v-if="showButton">
|
<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>
|
</div>
|
||||||
<LayoutContent>
|
<LayoutContent>
|
||||||
<router-view></router-view>
|
<router-view></router-view>
|
||||||
|
@ -12,9 +20,13 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { SearchAppInstalled } from '@/api/modules/app';
|
import { SearchAppInstalled, SyncApp } from '@/api/modules/app';
|
||||||
import bus from './bus';
|
import bus from './bus';
|
||||||
|
import { MsgSuccess } from '@/utils/message';
|
||||||
let showButton = ref(false);
|
let showButton = ref(false);
|
||||||
|
const syncing = ref(false);
|
||||||
|
const canUpdate = ref(false);
|
||||||
|
|
||||||
const buttons = [
|
const buttons = [
|
||||||
{
|
{
|
||||||
label: i18n.global.t('app.all'),
|
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 = () => {
|
const search = () => {
|
||||||
SearchAppInstalled({ update: true, page: 1, pageSize: 100 })
|
SearchAppInstalled({ update: true, page: 1, pageSize: 100 })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
Loading…
Reference in a new issue