mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-09 07:00:48 +08:00
fix: 解决应用安装升级状态错误的问题 (#5260)
This commit is contained in:
parent
e45f43da9a
commit
bdf8ba45ac
9 changed files with 192 additions and 129 deletions
|
@ -10,7 +10,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type AppRes struct {
|
type AppRes struct {
|
||||||
Items []*AppDTO `json:"items"`
|
Items []*AppDto `json:"items"`
|
||||||
Total int64 `json:"total"`
|
Total int64 `json:"total"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,21 @@ type AppDTO struct {
|
||||||
Tags []model.Tag `json:"tags"`
|
Tags []model.Tag `json:"tags"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type AppDto struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Key string `json:"key"`
|
||||||
|
ID uint `json:"ID"`
|
||||||
|
ShortDescZh string `json:"shortDescZh"`
|
||||||
|
ShortDescEn string `json:"shortDescEn"`
|
||||||
|
Icon string `json:"icon"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Resource string `json:"resource"`
|
||||||
|
Installed bool `json:"installed"`
|
||||||
|
Versions []string `json:"versions"`
|
||||||
|
Tags []model.Tag `json:"tags"`
|
||||||
|
}
|
||||||
|
|
||||||
type TagDTO struct {
|
type TagDTO struct {
|
||||||
model.Tag
|
model.Tag
|
||||||
}
|
}
|
||||||
|
@ -72,6 +87,27 @@ type AppInstalledDTO struct {
|
||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type AppInstallDTO struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
AppID uint `json:"appID"`
|
||||||
|
AppDetailID uint `json:"appDetailID"`
|
||||||
|
Version string `json:"version"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
HttpPort int `json:"httpPort"`
|
||||||
|
HttpsPort int `json:"httpsPort"`
|
||||||
|
Path string `json:"path"`
|
||||||
|
CanUpdate bool `json:"canUpdate"`
|
||||||
|
Icon string `json:"icon"`
|
||||||
|
AppName string `json:"appName"`
|
||||||
|
Ready int `json:"ready"`
|
||||||
|
Total int `json:"total"`
|
||||||
|
AppKey string `json:"appKey"`
|
||||||
|
AppType string `json:"appType"`
|
||||||
|
AppStatus string `json:"appStatus"`
|
||||||
|
}
|
||||||
|
|
||||||
type DatabaseConn struct {
|
type DatabaseConn struct {
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
|
|
|
@ -89,14 +89,21 @@ func (a AppService) PageApp(req request.AppSearch) (interface{}, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var appDTOs []*response.AppDTO
|
var appDTOs []*response.AppDto
|
||||||
for _, ap := range apps {
|
for _, ap := range apps {
|
||||||
ap.ReadMe = ""
|
ap.ReadMe = ""
|
||||||
ap.Website = ""
|
ap.Website = ""
|
||||||
ap.Document = ""
|
ap.Document = ""
|
||||||
ap.Github = ""
|
ap.Github = ""
|
||||||
appDTO := &response.AppDTO{
|
appDTO := &response.AppDto{
|
||||||
App: ap,
|
ID: ap.ID,
|
||||||
|
Name: ap.Name,
|
||||||
|
Key: ap.Key,
|
||||||
|
Type: ap.Type,
|
||||||
|
Icon: ap.Icon,
|
||||||
|
ShortDescZh: ap.ShortDescZh,
|
||||||
|
ShortDescEn: ap.ShortDescEn,
|
||||||
|
Resource: ap.Resource,
|
||||||
}
|
}
|
||||||
appDTOs = append(appDTOs, appDTO)
|
appDTOs = append(appDTOs, appDTO)
|
||||||
appTags, err := appTagRepo.GetByAppId(ap.ID)
|
appTags, err := appTagRepo.GetByAppId(ap.ID)
|
||||||
|
@ -436,6 +443,14 @@ func (a AppService) Install(ctx context.Context, req request.AppInstallCreate) (
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
appInstall.Env = string(paramByte)
|
appInstall.Env = string(paramByte)
|
||||||
|
|
||||||
|
containerNames, err := getContainerNames(*appInstall)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(containerNames) > 0 {
|
||||||
|
appInstall.ContainerName = strings.Join(containerNames, ",")
|
||||||
|
}
|
||||||
if err = appInstallRepo.Create(ctx, appInstall); err != nil {
|
if err = appInstallRepo.Create(ctx, appInstall); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,11 +39,11 @@ type AppInstallService struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type IAppInstallService interface {
|
type IAppInstallService interface {
|
||||||
Page(req request.AppInstalledSearch) (int64, []response.AppInstalledDTO, error)
|
Page(req request.AppInstalledSearch) (int64, []response.AppInstallDTO, error)
|
||||||
CheckExist(req request.AppInstalledInfo) (*response.AppInstalledCheck, error)
|
CheckExist(req request.AppInstalledInfo) (*response.AppInstalledCheck, error)
|
||||||
LoadPort(req dto.OperationWithNameAndType) (int64, error)
|
LoadPort(req dto.OperationWithNameAndType) (int64, error)
|
||||||
LoadConnInfo(req dto.OperationWithNameAndType) (response.DatabaseConn, error)
|
LoadConnInfo(req dto.OperationWithNameAndType) (response.DatabaseConn, error)
|
||||||
SearchForWebsite(req request.AppInstalledSearch) ([]response.AppInstalledDTO, error)
|
SearchForWebsite(req request.AppInstalledSearch) ([]response.AppInstallDTO, error)
|
||||||
Operate(req request.AppInstalledOperate) error
|
Operate(req request.AppInstalledOperate) error
|
||||||
Update(req request.AppInstalledUpdate) error
|
Update(req request.AppInstalledUpdate) error
|
||||||
IgnoreUpgrade(req request.AppInstalledIgnoreUpgrade) error
|
IgnoreUpgrade(req request.AppInstalledIgnoreUpgrade) error
|
||||||
|
@ -74,7 +74,7 @@ func (a *AppInstallService) GetInstallList() ([]dto.AppInstallInfo, error) {
|
||||||
return datas, nil
|
return datas, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AppInstallService) Page(req request.AppInstalledSearch) (int64, []response.AppInstalledDTO, error) {
|
func (a *AppInstallService) Page(req request.AppInstalledSearch) (int64, []response.AppInstallDTO, error) {
|
||||||
var (
|
var (
|
||||||
opts []repo.DBOption
|
opts []repo.DBOption
|
||||||
total int64
|
total int64
|
||||||
|
@ -191,7 +191,7 @@ func (a *AppInstallService) LoadConnInfo(req dto.OperationWithNameAndType) (resp
|
||||||
return data, nil
|
return data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AppInstallService) SearchForWebsite(req request.AppInstalledSearch) ([]response.AppInstalledDTO, error) {
|
func (a *AppInstallService) SearchForWebsite(req request.AppInstalledSearch) ([]response.AppInstallDTO, error) {
|
||||||
var (
|
var (
|
||||||
installs []model.AppInstall
|
installs []model.AppInstall
|
||||||
err error
|
err error
|
||||||
|
@ -705,84 +705,27 @@ func syncAppInstallStatus(appInstall *model.AppInstall) error {
|
||||||
if appInstall.Status == constant.Installing || appInstall.Status == constant.Rebuilding || appInstall.Status == constant.Upgrading {
|
if appInstall.Status == constant.Installing || appInstall.Status == constant.Rebuilding || appInstall.Status == constant.Upgrading {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
var err error
|
|
||||||
containerNames := []string{appInstall.ContainerName}
|
|
||||||
if appInstall.ContainerName == "" {
|
|
||||||
containerNames, err = getContainerNames(*appInstall)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cli, err := docker.NewClient()
|
cli, err := docker.NewClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer cli.Close()
|
defer cli.Close()
|
||||||
|
|
||||||
var containers []types.Container
|
var (
|
||||||
|
containers []types.Container
|
||||||
|
containersMap map[string]types.Container
|
||||||
|
containerNames = strings.Split(appInstall.ContainerName, ",")
|
||||||
|
)
|
||||||
containers, err = cli.ListContainersByName(containerNames)
|
containers, err = cli.ListContainersByName(containerNames)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
var (
|
containersMap = make(map[string]types.Container)
|
||||||
runningCount int
|
|
||||||
exitedCount int
|
|
||||||
pausedCount int
|
|
||||||
exitedContainerNames []string
|
|
||||||
total = len(containerNames)
|
|
||||||
count = len(containers)
|
|
||||||
)
|
|
||||||
|
|
||||||
foundNames := make(map[string]bool)
|
|
||||||
for _, con := range containers {
|
for _, con := range containers {
|
||||||
foundNames[con.Names[0]] = true
|
containersMap[con.Names[0]] = con
|
||||||
switch con.State {
|
|
||||||
case "exited":
|
|
||||||
exitedContainerNames = append(exitedContainerNames, strings.TrimPrefix(con.Names[0], "/"))
|
|
||||||
exitedCount++
|
|
||||||
case "running":
|
|
||||||
runningCount++
|
|
||||||
case "paused":
|
|
||||||
pausedCount++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var notFoundNames []string
|
|
||||||
for _, name := range containerNames {
|
|
||||||
if !foundNames["/"+name] {
|
|
||||||
notFoundNames = append(notFoundNames, name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch {
|
|
||||||
case count == 0:
|
|
||||||
if appInstall.Status != constant.Error {
|
|
||||||
appInstall.Status = constant.SyncErr
|
|
||||||
appInstall.Message = buserr.WithName("ErrContainerNotFound", strings.Join(containerNames, ",")).Error()
|
|
||||||
}
|
|
||||||
case exitedCount == total:
|
|
||||||
appInstall.Status = constant.Stopped
|
|
||||||
case runningCount == total:
|
|
||||||
appInstall.Status = constant.Running
|
|
||||||
case pausedCount == total:
|
|
||||||
appInstall.Status = constant.Paused
|
|
||||||
default:
|
|
||||||
var msg string
|
|
||||||
if exitedCount > 0 {
|
|
||||||
msg = buserr.WithName("ErrContainerMsg", strings.Join(exitedContainerNames, ",")).Error()
|
|
||||||
}
|
|
||||||
if len(notFoundNames) > 0 {
|
|
||||||
msg += buserr.WithName("ErrContainerNotFound", strings.Join(notFoundNames, ",")).Error()
|
|
||||||
}
|
|
||||||
if msg == "" {
|
|
||||||
msg = buserr.New("ErrAppWarn").Error()
|
|
||||||
}
|
|
||||||
appInstall.Message = msg
|
|
||||||
appInstall.Status = constant.UnHealthy
|
|
||||||
}
|
}
|
||||||
|
synAppInstall(containersMap, appInstall)
|
||||||
_ = appInstallRepo.Save(context.Background(), appInstall)
|
_ = appInstallRepo.Save(context.Background(), appInstall)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -937,6 +937,12 @@ func rebuildApp(appInstall model.AppInstall) error {
|
||||||
_ = handleErr(appInstall, err, out)
|
_ = handleErr(appInstall, err, out)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
containerNames, err := getContainerNames(appInstall)
|
||||||
|
if err != nil {
|
||||||
|
_ = handleErr(appInstall, err, out)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
appInstall.ContainerName = strings.Join(containerNames, ",")
|
||||||
|
|
||||||
appInstall.Status = constant.Running
|
appInstall.Status = constant.Running
|
||||||
_ = appInstallRepo.Save(context.Background(), &appInstall)
|
_ = appInstallRepo.Save(context.Background(), &appInstall)
|
||||||
|
@ -1119,10 +1125,65 @@ func handleErr(install model.AppInstall, err error, out string) error {
|
||||||
return reErr
|
return reErr
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleInstalled(appInstallList []model.AppInstall, updated bool, sync bool) ([]response.AppInstalledDTO, error) {
|
func doNotNeedSync(installed model.AppInstall) bool {
|
||||||
|
return installed.Status == constant.Installing || installed.Status == constant.Rebuilding || installed.Status == constant.Upgrading || installed.Status == constant.Syncing
|
||||||
|
}
|
||||||
|
|
||||||
|
func synAppInstall(containers map[string]types.Container, appInstall *model.AppInstall) {
|
||||||
|
containerNames := strings.Split(appInstall.ContainerName, ",")
|
||||||
|
if len(containers) == 0 {
|
||||||
|
appInstall.Status = constant.Error
|
||||||
|
appInstall.Message = buserr.WithName("ErrContainerNotFound", strings.Join(containerNames, ",")).Error()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
notFoundNames := make([]string, 0)
|
||||||
|
exitNames := make([]string, 0)
|
||||||
|
exitedCount := 0
|
||||||
|
pausedCount := 0
|
||||||
|
runningCount := 0
|
||||||
|
total := len(containerNames)
|
||||||
|
for _, name := range containerNames {
|
||||||
|
if con, ok := containers["/"+name]; ok {
|
||||||
|
switch con.State {
|
||||||
|
case "exited":
|
||||||
|
exitedCount++
|
||||||
|
exitNames = append(exitNames, name)
|
||||||
|
case "running":
|
||||||
|
runningCount++
|
||||||
|
case "paused":
|
||||||
|
pausedCount++
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
notFoundNames = append(notFoundNames, name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch {
|
||||||
|
case exitedCount == total:
|
||||||
|
appInstall.Status = constant.Stopped
|
||||||
|
case runningCount == total:
|
||||||
|
appInstall.Status = constant.Running
|
||||||
|
case pausedCount == total:
|
||||||
|
appInstall.Status = constant.Paused
|
||||||
|
default:
|
||||||
|
var msg string
|
||||||
|
if exitedCount > 0 {
|
||||||
|
msg = buserr.WithName("ErrContainerMsg", strings.Join(exitNames, ",")).Error()
|
||||||
|
}
|
||||||
|
if len(notFoundNames) > 0 {
|
||||||
|
msg += buserr.WithName("ErrContainerNotFound", strings.Join(notFoundNames, ",")).Error()
|
||||||
|
}
|
||||||
|
if msg == "" {
|
||||||
|
msg = buserr.New("ErrAppWarn").Error()
|
||||||
|
}
|
||||||
|
appInstall.Message = msg
|
||||||
|
appInstall.Status = constant.UnHealthy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func handleInstalled(appInstallList []model.AppInstall, updated bool, sync bool) ([]response.AppInstallDTO, error) {
|
||||||
var (
|
var (
|
||||||
res []response.AppInstalledDTO
|
res []response.AppInstallDTO
|
||||||
containers []types.Container
|
containersMap map[string]types.Container
|
||||||
)
|
)
|
||||||
if sync {
|
if sync {
|
||||||
cli, err := docker.NewClient()
|
cli, err := docker.NewClient()
|
||||||
|
@ -1130,41 +1191,38 @@ func handleInstalled(appInstallList []model.AppInstall, updated bool, sync bool)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer cli.Close()
|
defer cli.Close()
|
||||||
containers, err = cli.ListAllContainers()
|
containers, err := cli.ListAllContainers()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
containersMap = make(map[string]types.Container, len(containers))
|
||||||
|
for _, contain := range containers {
|
||||||
|
containersMap[contain.Names[0]] = contain
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, installed := range appInstallList {
|
for _, installed := range appInstallList {
|
||||||
if updated && (installed.App.Type == "php" || installed.Status == constant.Installing || (installed.App.Key == constant.AppMysql && installed.Version == "5.6.51")) {
|
if updated && (installed.App.Type == "php" || installed.Status == constant.Installing || (installed.App.Key == constant.AppMysql && installed.Version == "5.6.51")) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if sync {
|
if sync && !doNotNeedSync(installed) {
|
||||||
exist := false
|
synAppInstall(containersMap, &installed)
|
||||||
for _, contain := range containers {
|
|
||||||
if contain.Names[0] == "/"+installed.ContainerName {
|
|
||||||
exist = true
|
|
||||||
switch contain.State {
|
|
||||||
case "exited":
|
|
||||||
installed.Status = constant.Stopped
|
|
||||||
case "running":
|
|
||||||
installed.Status = constant.Running
|
|
||||||
case "paused":
|
|
||||||
installed.Status = constant.Paused
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !exist {
|
|
||||||
installed.Status = constant.Error
|
|
||||||
installed.Message = buserr.WithName("ErrContainerNotFound", installed.ContainerName).Error()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
installDTO := response.AppInstalledDTO{
|
installDTO := response.AppInstallDTO{
|
||||||
AppInstall: installed,
|
ID: installed.ID,
|
||||||
Path: installed.GetPath(),
|
Name: installed.Name,
|
||||||
|
AppID: installed.AppId,
|
||||||
|
AppDetailID: installed.AppDetailId,
|
||||||
|
Version: installed.Version,
|
||||||
|
Status: installed.Status,
|
||||||
|
Message: installed.Message,
|
||||||
|
HttpPort: installed.HttpPort,
|
||||||
|
HttpsPort: installed.HttpsPort,
|
||||||
|
Icon: installed.App.Icon,
|
||||||
|
AppName: installed.App.Name,
|
||||||
|
AppKey: installed.App.Key,
|
||||||
|
AppType: installed.App.Type,
|
||||||
}
|
}
|
||||||
app, err := appRepo.GetFirst(commonRepo.WithByID(installed.AppId))
|
app, err := appRepo.GetFirst(commonRepo.WithByID(installed.AppId))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -121,6 +121,27 @@ export namespace App {
|
||||||
app: App;
|
app: App;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface AppInstallDto {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
appID: number;
|
||||||
|
appDetailID: number;
|
||||||
|
version: string;
|
||||||
|
status: string;
|
||||||
|
message: string;
|
||||||
|
httpPort: number;
|
||||||
|
httpsPort: number;
|
||||||
|
path: string;
|
||||||
|
canUpdate: boolean;
|
||||||
|
icon: string;
|
||||||
|
appName: string;
|
||||||
|
ready: number;
|
||||||
|
total: number;
|
||||||
|
appKey: string;
|
||||||
|
appType: string;
|
||||||
|
appStatus: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface AppInstalledInfo {
|
export interface AppInstalledInfo {
|
||||||
id: number;
|
id: number;
|
||||||
key: string;
|
key: string;
|
||||||
|
|
|
@ -40,7 +40,7 @@ export const ChangePort = (params: App.ChangePort) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SearchAppInstalled = (search: App.AppInstallSearch) => {
|
export const SearchAppInstalled = (search: App.AppInstallSearch) => {
|
||||||
return http.post<ResPage<App.AppInstalled>>('apps/installed/search', search);
|
return http.post<ResPage<App.AppInstallDto>>('apps/installed/search', search);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ListAppInstalled = () => {
|
export const ListAppInstalled = () => {
|
||||||
|
|
|
@ -73,7 +73,7 @@ const handleClose = () => {
|
||||||
em('close', open);
|
em('close', open);
|
||||||
};
|
};
|
||||||
|
|
||||||
const acceptParams = async (app: App.AppInstalled) => {
|
const acceptParams = async (app: App.AppInstallDto) => {
|
||||||
deleteReq.value = {
|
deleteReq.value = {
|
||||||
operate: 'delete',
|
operate: 'delete',
|
||||||
installId: 0,
|
installId: 0,
|
||||||
|
@ -83,7 +83,7 @@ const acceptParams = async (app: App.AppInstalled) => {
|
||||||
};
|
};
|
||||||
deleteInfo.value = '';
|
deleteInfo.value = '';
|
||||||
deleteReq.value.installId = app.id;
|
deleteReq.value.installId = app.id;
|
||||||
appType.value = app.app.type;
|
appType.value = app.appType;
|
||||||
deleteHelper.value = i18n.global.t('website.deleteConfirmHelper', [app.name]);
|
deleteHelper.value = i18n.global.t('website.deleteConfirmHelper', [app.name]);
|
||||||
appInstallName.value = app.name;
|
appInstallName.value = app.name;
|
||||||
open.value = true;
|
open.value = true;
|
||||||
|
|
|
@ -166,7 +166,6 @@ const acceptParams = async (props: ParamProps) => {
|
||||||
submitModel.value.installId = props.id;
|
submitModel.value.installId = props.id;
|
||||||
params.value = [];
|
params.value = [];
|
||||||
paramData.value.id = props.id;
|
paramData.value.id = props.id;
|
||||||
paramData.value.app = props.app;
|
|
||||||
paramModel.value.params = {};
|
paramModel.value.params = {};
|
||||||
edit.value = false;
|
edit.value = false;
|
||||||
await get();
|
await get();
|
||||||
|
|
|
@ -100,11 +100,11 @@
|
||||||
<el-card class="e-card">
|
<el-card class="e-card">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :xs="3" :sm="3" :md="3" :lg="4" :xl="4">
|
<el-col :xs="3" :sm="3" :md="3" :lg="4" :xl="4">
|
||||||
<div class="icon" @click.stop="openDetail(installed.app)">
|
<div class="icon" @click.stop="openDetail(installed.appKey)">
|
||||||
<el-avatar
|
<el-avatar
|
||||||
shape="square"
|
shape="square"
|
||||||
:size="66"
|
:size="66"
|
||||||
:src="'data:image/png;base64,' + installed.app.icon"
|
:src="'data:image/png;base64,' + installed.icon"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -168,7 +168,7 @@
|
||||||
plain
|
plain
|
||||||
round
|
round
|
||||||
size="small"
|
size="small"
|
||||||
@click="openUploads(installed.app.key, installed.name)"
|
@click="openUploads(installed.appKey, installed.name)"
|
||||||
v-if="mode === 'installed'"
|
v-if="mode === 'installed'"
|
||||||
>
|
>
|
||||||
{{ $t('database.loadBackup') }}
|
{{ $t('database.loadBackup') }}
|
||||||
|
@ -178,9 +178,7 @@
|
||||||
plain
|
plain
|
||||||
round
|
round
|
||||||
size="small"
|
size="small"
|
||||||
@click="
|
@click="openBackups(installed.appKey, installed.name, installed.status)"
|
||||||
openBackups(installed.app.key, installed.name, installed.status)
|
|
||||||
"
|
|
||||||
v-if="mode === 'installed'"
|
v-if="mode === 'installed'"
|
||||||
>
|
>
|
||||||
{{ $t('commons.button.backup') }}
|
{{ $t('commons.button.backup') }}
|
||||||
|
@ -203,7 +201,7 @@
|
||||||
:disabled="
|
:disabled="
|
||||||
(installed.status !== 'Running' &&
|
(installed.status !== 'Running' &&
|
||||||
installed.status !== 'UpgradeErr') ||
|
installed.status !== 'UpgradeErr') ||
|
||||||
installed.app.status === 'TakeDown'
|
installed.appStatus === 'TakeDown'
|
||||||
"
|
"
|
||||||
@click="openOperate(installed, 'upgrade')"
|
@click="openOperate(installed, 'upgrade')"
|
||||||
v-if="mode === 'upgrade'"
|
v-if="mode === 'upgrade'"
|
||||||
|
@ -414,18 +412,12 @@ const getTagValue = (key: string) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const search = () => {
|
const search = async () => {
|
||||||
loading.value = true;
|
|
||||||
searchReq.page = paginationConfig.currentPage;
|
searchReq.page = paginationConfig.currentPage;
|
||||||
searchReq.pageSize = paginationConfig.pageSize;
|
searchReq.pageSize = paginationConfig.pageSize;
|
||||||
SearchAppInstalled(searchReq)
|
const res = await SearchAppInstalled(searchReq);
|
||||||
.then((res) => {
|
data.value = res.data.items;
|
||||||
data.value = res.data.items;
|
paginationConfig.total = res.data.total;
|
||||||
paginationConfig.total = res.data.total;
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
loading.value = false;
|
|
||||||
});
|
|
||||||
GetAppTags().then((res) => {
|
GetAppTags().then((res) => {
|
||||||
tags.value = res.data;
|
tags.value = res.data;
|
||||||
});
|
});
|
||||||
|
@ -435,8 +427,8 @@ const goDashboard = async (port: any, protocol: string) => {
|
||||||
dialogPortJumpRef.value.acceptParams({ port: port, protocol: protocol });
|
dialogPortJumpRef.value.acceptParams({ port: port, protocol: protocol });
|
||||||
};
|
};
|
||||||
|
|
||||||
const openDetail = (app: App.App) => {
|
const openDetail = (appKey: string) => {
|
||||||
appDetail.value.acceptParams(app.key, 'detail');
|
appDetail.value.acceptParams(appKey, 'detail');
|
||||||
};
|
};
|
||||||
|
|
||||||
const openOperate = (row: any, op: string) => {
|
const openOperate = (row: any, op: string) => {
|
||||||
|
@ -448,7 +440,7 @@ const openOperate = (row: any, op: string) => {
|
||||||
AppInstalledDeleteCheck(row.id).then(async (res) => {
|
AppInstalledDeleteCheck(row.id).then(async (res) => {
|
||||||
const items = res.data;
|
const items = res.data;
|
||||||
if (res.data && res.data.length > 0) {
|
if (res.data && res.data.length > 0) {
|
||||||
checkRef.value.acceptParams({ items: items, key: row.app.key, installID: row.id });
|
checkRef.value.acceptParams({ items: items, key: row.appKey, installID: row.id });
|
||||||
} else {
|
} else {
|
||||||
deleteRef.value.acceptParams(row);
|
deleteRef.value.acceptParams(row);
|
||||||
}
|
}
|
||||||
|
@ -475,10 +467,7 @@ const operate = async () => {
|
||||||
}, 3000);
|
}, 3000);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
search();
|
search();
|
||||||
}, 5000);
|
}, 15000);
|
||||||
setTimeout(() => {
|
|
||||||
search();
|
|
||||||
}, 10000);
|
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
search();
|
search();
|
||||||
|
@ -596,7 +585,7 @@ const openUploads = (key: string, name: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const openParam = (row: any) => {
|
const openParam = (row: any) => {
|
||||||
appParamRef.value.acceptParams({ app: row.app, id: row.id });
|
appParamRef.value.acceptParams({ id: row.id });
|
||||||
};
|
};
|
||||||
|
|
||||||
const isAppErr = (row: any) => {
|
const isAppErr = (row: any) => {
|
||||||
|
@ -618,7 +607,9 @@ onMounted(() => {
|
||||||
mode.value = 'upgrade';
|
mode.value = 'upgrade';
|
||||||
searchReq.update = true;
|
searchReq.update = true;
|
||||||
}
|
}
|
||||||
|
loading.value = true;
|
||||||
search();
|
search();
|
||||||
|
loading.value = false;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
searchReq.sync = true;
|
searchReq.sync = true;
|
||||||
search();
|
search();
|
||||||
|
|
Loading…
Add table
Reference in a new issue