1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-02-08 01:20:07 +08:00

feat: 应用列表增加已安装提示 (#1107)

Refs https://github.com/1Panel-dev/1Panel/issues/972
This commit is contained in:
zhengkunwang223 2023-05-22 21:39:42 +08:00 committed by GitHub
parent a0a1cc410f
commit f5cd45438b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 12 deletions

View File

@ -21,8 +21,9 @@ type AppUpdateRes struct {
type AppDTO struct { type AppDTO struct {
model.App model.App
Versions []string `json:"versions"` Installed bool `json:"installed"`
Tags []model.Tag `json:"tags"` Versions []string `json:"versions"`
Tags []model.Tag `json:"tags"`
} }
type TagDTO struct { type TagDTO struct {

View File

@ -98,6 +98,8 @@ func (a AppService) PageApp(req request.AppSearch) (interface{}, error) {
continue continue
} }
appDTO.Tags = tags appDTO.Tags = tags
installs, _ := appInstallRepo.ListBy(appInstallRepo.WithAppId(a.ID))
appDTO.Installed = len(installs) > 0
} }
res.Items = appDTOs res.Items = appDTOs
res.Total = total res.Total = total

View File

@ -16,6 +16,7 @@ export namespace App {
export interface AppDTO extends App { export interface AppDTO extends App {
versions: string[]; versions: string[];
installed: boolean;
} }
export interface Tag { export interface Tag {
@ -25,7 +26,7 @@ export namespace App {
export interface AppResPage { export interface AppResPage {
total: number; total: number;
items: App.App[]; items: App.AppDTO[];
} }
export interface AppUpdateRes { export interface AppUpdateRes {

View File

@ -1124,6 +1124,7 @@ const message = {
editCompose: 'Edit compose file', editCompose: 'Edit compose file',
editComposeHelper: 'Editing the compose file may cause the software installation to fail', editComposeHelper: 'Editing the compose file may cause the software installation to fail',
composeNullErr: 'compose cannot be empty', composeNullErr: 'compose cannot be empty',
takeDown: 'TakeDown',
}, },
website: { website: {
website: 'Website', website: 'Website',

View File

@ -1117,6 +1117,8 @@ const message = {
editCompose: '编辑 compose 文件', editCompose: '编辑 compose 文件',
editComposeHelper: '编辑 compose 文件可能导致软件安装失败', editComposeHelper: '编辑 compose 文件可能导致软件安装失败',
composeNullErr: 'compose 不能为空', composeNullErr: 'compose 不能为空',
takeDown: '已废弃',
allReadyInstalled: '已安装',
}, },
website: { website: {
website: '网站', website: '网站',

View File

@ -62,6 +62,9 @@
<div class="app-content"> <div class="app-content">
<div class="app-header"> <div class="app-header">
<span class="app-title">{{ app.name }}</span> <span class="app-title">{{ app.name }}</span>
<el-text type="success" style="margin-left: 10px" v-if="app.installed">
{{ $t('app.allReadyInstalled') }}
</el-text>
<el-button <el-button
class="app-button" class="app-button"
type="primary" type="primary"
@ -85,7 +88,7 @@
</span> </span>
</el-tag> </el-tag>
<el-tag v-if="app.status === 'TakeDown'" style="margin-right: 5px"> <el-tag v-if="app.status === 'TakeDown'" style="margin-right: 5px">
<span style="color: red">已废弃</span> <span style="color: red">{{ $t('app.takeDown') }}</span>
</el-tag> </el-tag>
</div> </div>
</div> </div>
@ -113,21 +116,21 @@ import { useI18n } from 'vue-i18n';
const language = useI18n().locale.value; const language = useI18n().locale.value;
let req = reactive({ const req = reactive({
name: '', name: '',
tags: [], tags: [],
page: 1, page: 1,
pageSize: 50, pageSize: 50,
}); });
let apps = ref<App.App[]>([]); const apps = ref<App.AppDTO[]>([]);
let tags = ref<App.Tag[]>([]); const tags = ref<App.Tag[]>([]);
const colorArr = ['#005eeb', '#008B45', '#BEBEBE', '#FFF68F', '#FFFF00', '#8B0000']; const colorArr = ['#005eeb', '#008B45', '#BEBEBE', '#FFF68F', '#FFFF00', '#8B0000'];
let loading = ref(false); const loading = ref(false);
let activeTag = ref('all'); const activeTag = ref('all');
let showDetail = ref(false); const showDetail = ref(false);
let appId = ref(0); const appId = ref(0);
let canUpdate = ref(false); const canUpdate = ref(false);
const getColor = (index: number) => { const getColor = (index: number) => {
return colorArr[index]; return colorArr[index];