fix: resolve incorrect container filter condition when redirecting applications (#10971)

This commit is contained in:
CityFun 2025-11-17 11:44:32 +08:00 committed by GitHub
parent b9367abfb9
commit a4d77a1cc2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 13 additions and 6 deletions

View file

@ -130,6 +130,7 @@ type AppInstallDTO struct {
Container string `json:"container"` Container string `json:"container"`
IsEdit bool `json:"isEdit"` IsEdit bool `json:"isEdit"`
LinkDB bool `json:"linkDB"` LinkDB bool `json:"linkDB"`
ServiceName string `json:"serviceName"`
} }
type AppInstallInfo struct { type AppInstallInfo struct {

View file

@ -450,10 +450,11 @@ func (a AppService) Install(req request.AppInstallCreate) (appInstall *model.App
} }
index++ index++
} }
if app.Limit == 0 && appInstall.Name != serviceName && len(servicesMap) == 1 { newServiceName := strings.ToLower(appInstall.Name)
servicesMap[appInstall.Name] = servicesMap[serviceName] if app.Limit == 0 && newServiceName != serviceName && len(servicesMap) == 1 {
servicesMap[newServiceName] = servicesMap[serviceName]
delete(servicesMap, serviceName) delete(servicesMap, serviceName)
serviceName = appInstall.Name serviceName = newServiceName
} }
appInstall.ServiceName = serviceName appInstall.ServiceName = serviceName

View file

@ -1569,6 +1569,7 @@ func handleInstalled(appInstallList []model.AppInstall, updated bool, sync bool)
}, },
Favorite: installed.Favorite, Favorite: installed.Favorite,
Container: installed.ContainerName, Container: installed.ContainerName,
ServiceName: strings.ToLower(installed.ServiceName),
} }
if !updated { if !updated {
installDTO.LinkDB = hasLinkDB(installed.ID) installDTO.LinkDB = hasLinkDB(installed.ID)

View file

@ -151,6 +151,7 @@ export namespace App {
app: App; app: App;
webUI: string; webUI: string;
appKey?: string; appKey?: string;
serviceName: string;
} }
export interface AppInstalledInfo { export interface AppInstalledInfo {

View file

@ -702,7 +702,10 @@ const buttons = [
]; ];
const toContainer = async (row: App.AppInstalled) => { const toContainer = async (row: App.AppInstalled) => {
routerToNameWithQuery('ContainerItem', { filters: 'com.docker.compose.project=' + row.name, uncached: true }); routerToNameWithQuery('ContainerItem', {
filters: 'com.docker.compose.project=' + row.serviceName,
uncached: true,
});
}; };
const openBackups = (row: App.AppInstalled) => { const openBackups = (row: App.AppInstalled) => {