|
| 1 | +<template> |
| 2 | + <div class="d-name"> |
| 3 | + <div class="flex items-center justify-between"> |
| 4 | + <div class="min-w-50 flex items-center justify-start gap-1"> |
| 5 | + <el-button link type="info"> |
| 6 | + <el-tooltip :content="installed.name" placement="top"> |
| 7 | + <span class="name">{{ installed.name }}</span> |
| 8 | + </el-tooltip> |
| 9 | + </el-button> |
| 10 | + <span class="status"> |
| 11 | + <Status :key="installed.status" :status="installed.status"></Status> |
| 12 | + </span> |
| 13 | + <span class="msg"> |
| 14 | + <el-popover |
| 15 | + v-if="isAppErr(installed)" |
| 16 | + placement="bottom" |
| 17 | + :width="400" |
| 18 | + trigger="hover" |
| 19 | + :content="installed.message" |
| 20 | + :popper-options="options" |
| 21 | + > |
| 22 | + <template #reference> |
| 23 | + <el-button link type="danger"> |
| 24 | + <el-icon><Warning /></el-icon> |
| 25 | + </el-button> |
| 26 | + </template> |
| 27 | + <div class="app-error"> |
| 28 | + {{ installed.message }} |
| 29 | + </div> |
| 30 | + </el-popover> |
| 31 | + </span> |
| 32 | + <span class="ml-1"> |
| 33 | + <el-tooltip effect="dark" :content="$t('app.toFolder')" placement="top"> |
| 34 | + <el-button type="primary" link @click="$emit('toFolder')" icon="FolderOpened"></el-button> |
| 35 | + </el-tooltip> |
| 36 | + </span> |
| 37 | + <span class="ml-1"> |
| 38 | + <el-tooltip |
| 39 | + v-if="mode !== 'upgrade'" |
| 40 | + effect="dark" |
| 41 | + :content="$t('commons.button.log')" |
| 42 | + placement="top" |
| 43 | + > |
| 44 | + <el-button |
| 45 | + type="primary" |
| 46 | + link |
| 47 | + @click="$emit('openLog')" |
| 48 | + :disabled="installed.status === 'DownloadErr'" |
| 49 | + > |
| 50 | + <el-icon><Tickets /></el-icon> |
| 51 | + </el-button> |
| 52 | + </el-tooltip> |
| 53 | + </span> |
| 54 | + <span class="ml-1"> |
| 55 | + <el-tooltip v-if="mode !== 'upgrade'" effect="dark" :content="$t('menu.terminal')" placement="top"> |
| 56 | + <el-button |
| 57 | + type="primary" |
| 58 | + link |
| 59 | + @click="$emit('openTerminal')" |
| 60 | + :disabled="installed.status !== 'Running'" |
| 61 | + > |
| 62 | + <el-icon> |
| 63 | + <SvgIcon iconName="p-terminal2" /> |
| 64 | + </el-icon> |
| 65 | + </el-button> |
| 66 | + </el-tooltip> |
| 67 | + </span> |
| 68 | + <span class="ml-1"> |
| 69 | + <el-tooltip v-if="mode !== 'upgrade'" effect="dark" :content="$t('menu.container')" placement="top"> |
| 70 | + <el-button type="primary" link @click="$emit('toContainer')"> |
| 71 | + <el-icon> |
| 72 | + <SvgIcon iconName="p-docker" /> |
| 73 | + </el-icon> |
| 74 | + </el-button> |
| 75 | + </el-tooltip> |
| 76 | + </span> |
| 77 | + <span class="ml-1" v-if="mode === 'installed'"> |
| 78 | + <el-tooltip |
| 79 | + effect="dark" |
| 80 | + :content="$t('website.cancelFavorite')" |
| 81 | + placement="top-start" |
| 82 | + v-if="installed.favorite" |
| 83 | + > |
| 84 | + <el-button |
| 85 | + link |
| 86 | + size="large" |
| 87 | + icon="StarFilled" |
| 88 | + type="warning" |
| 89 | + @click="$emit('favoriteInstall')" |
| 90 | + ></el-button> |
| 91 | + </el-tooltip> |
| 92 | + <el-tooltip effect="dark" :content="$t('website.favorite')" placement="top-start" v-else> |
| 93 | + <el-button link icon="Star" type="info" @click="$emit('favoriteInstall')"></el-button> |
| 94 | + </el-tooltip> |
| 95 | + </span> |
| 96 | + </div> |
| 97 | + <div class="flex flex-wrap items-center justify-end gap-1"> |
| 98 | + <el-button |
| 99 | + class="h-button" |
| 100 | + plain |
| 101 | + round |
| 102 | + size="small" |
| 103 | + @click="$emit('openUploads')" |
| 104 | + v-if="mode === 'installed'" |
| 105 | + > |
| 106 | + {{ $t('database.loadBackup') }} |
| 107 | + </el-button> |
| 108 | + <el-button |
| 109 | + class="h-button" |
| 110 | + plain |
| 111 | + round |
| 112 | + size="small" |
| 113 | + @click="$emit('openBackups')" |
| 114 | + v-if="mode === 'installed'" |
| 115 | + > |
| 116 | + {{ $t('commons.button.backup') }} |
| 117 | + </el-button> |
| 118 | + <el-button |
| 119 | + class="h-button" |
| 120 | + plain |
| 121 | + round |
| 122 | + size="small" |
| 123 | + :disabled="installed.status === 'Upgrading'" |
| 124 | + @click="$emit('ignoreApp')" |
| 125 | + v-if="mode === 'upgrade'" |
| 126 | + > |
| 127 | + {{ $t('commons.button.ignore') }} |
| 128 | + </el-button> |
| 129 | + <el-button |
| 130 | + class="h-button" |
| 131 | + plain |
| 132 | + round |
| 133 | + size="small" |
| 134 | + :disabled=" |
| 135 | + (installed.status !== 'Running' && installed.status !== 'UpgradeErr') || |
| 136 | + installed.appStatus === 'TakeDown' |
| 137 | + " |
| 138 | + @click="$emit('openOperate')" |
| 139 | + v-if="mode === 'upgrade'" |
| 140 | + > |
| 141 | + {{ $t('commons.button.upgrade') }} |
| 142 | + </el-button> |
| 143 | + </div> |
| 144 | + </div> |
| 145 | + </div> |
| 146 | +</template> |
| 147 | + |
| 148 | +<script lang="ts" setup> |
| 149 | +import { App } from '@/api/interface/app'; |
| 150 | +
|
| 151 | +interface Props { |
| 152 | + installed: App.AppInstalled; |
| 153 | + mode: string; |
| 154 | +} |
| 155 | +defineProps<Props>(); |
| 156 | +
|
| 157 | +defineEmits([ |
| 158 | + 'toFolder', |
| 159 | + 'openLog', |
| 160 | + 'openTerminal', |
| 161 | + 'toContainer', |
| 162 | + 'openBackups', |
| 163 | + 'openOperate', |
| 164 | + 'ignoreApp', |
| 165 | + 'openUploads', |
| 166 | + 'favoriteInstall', |
| 167 | +]); |
| 168 | +
|
| 169 | +const options = { |
| 170 | + modifiers: [ |
| 171 | + { |
| 172 | + name: 'flip', |
| 173 | + options: { |
| 174 | + padding: 5, |
| 175 | + fallbackPlacements: ['bottom-start', 'top-start', 'right', 'left'], |
| 176 | + }, |
| 177 | + }, |
| 178 | + ], |
| 179 | +}; |
| 180 | +
|
| 181 | +const isAppErr = (row: any) => { |
| 182 | + return row.status.includes('Err') || row.status.includes('Error') || row.status.includes('UnHealthy'); |
| 183 | +}; |
| 184 | +</script> |
| 185 | +<style scoped lang="scss"> |
| 186 | +@use '@/views/app-store/index.scss'; |
| 187 | +
|
| 188 | +.svg-icon { |
| 189 | + width: 100%; |
| 190 | + height: 100%; |
| 191 | + padding: 0; |
| 192 | +} |
| 193 | +</style> |
0 commit comments