1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 16:29:17 +08:00

fix: 优化版本排序 (#2322)

This commit is contained in:
ssongliu 2023-09-16 16:30:16 +08:00 committed by GitHub
parent 8faa3b6e51
commit 6cd00a072d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -435,7 +435,7 @@ func (a *AppInstallService) GetServices(key string) ([]response.AppService, erro
for _, db := range dbs { for _, db := range dbs {
service := response.AppService{ service := response.AppService{
Label: db.Name, Label: db.Name,
Value: strconv.Itoa(int(db.ID)), Value: db.Name,
} }
if db.AppInstallID > 0 { if db.AppInstallID > 0 {
install, err := appInstallRepo.GetFirst(commonRepo.WithByID(db.AppInstallID)) install, err := appInstallRepo.GetFirst(commonRepo.WithByID(db.AppInstallID))

View File

@ -24,6 +24,17 @@ func CompareVersion(version1 string, version2 string) bool {
version1s := strings.Split(version1, ".") version1s := strings.Split(version1, ".")
version2s := strings.Split(version2, ".") version2s := strings.Split(version2, ".")
if len(version2s) > len(version1s) {
for i := 0; i < len(version2s)-len(version1s); i++ {
version1s = append(version1s, "0")
}
}
if len(version1s) > len(version2s) {
for i := 0; i < len(version1s)-len(version2s); i++ {
version2s = append(version2s, "0")
}
}
n := min(len(version1s), len(version2s)) n := min(len(version1s), len(version2s))
re := regexp.MustCompile("[0-9]+") re := regexp.MustCompile("[0-9]+")
for i := 0; i < n; i++ { for i := 0; i < n; i++ {

View File

@ -50,7 +50,7 @@
</div> </div>
</el-card> </el-card>
</div> </div>
<div v-if="!data.isExist && !isDB"> <div v-if="!data.isExist && !isDB()">
<LayoutContent :title="getTitle(key)" :divider="true"> <LayoutContent :title="getTitle(key)" :divider="true">
<template #main> <template #main>
<div class="app-warn"> <div class="app-warn">
@ -135,7 +135,7 @@ const goRouter = async (key: string) => {
}; };
const isDB = () => { const isDB = () => {
return key.value === 'mysql' || key.value === 'mysql'; return key.value === 'mysql' || key.value === 'mariadb';
}; };
const onCheck = async () => { const onCheck = async () => {