Browse Source

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

pull/2323/head
ssongliu 1 year ago committed by GitHub
parent
commit
6cd00a072d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      backend/app/service/app_install.go
  2. 11
      backend/utils/common/common.go
  3. 4
      frontend/src/components/app-status/index.vue

2
backend/app/service/app_install.go

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

11
backend/utils/common/common.go

@ -24,6 +24,17 @@ func CompareVersion(version1 string, version2 string) bool {
version1s := strings.Split(version1, ".")
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))
re := regexp.MustCompile("[0-9]+")
for i := 0; i < n; i++ {

4
frontend/src/components/app-status/index.vue

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

Loading…
Cancel
Save