mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-03-14 01:34:47 +08:00
feat: 应用重建改为响应式 (#2091)
This commit is contained in:
parent
ac0f697111
commit
8b1098fc9d
@ -694,16 +694,24 @@ func upApp(appInstall *model.AppInstall) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func rebuildApp(appInstall model.AppInstall) error {
|
func rebuildApp(appInstall model.AppInstall) error {
|
||||||
dockerComposePath := appInstall.GetComposePath()
|
appInstall.Status = constant.Rebuilding
|
||||||
out, err := compose.Down(dockerComposePath)
|
_ = appInstallRepo.Save(context.Background(), &appInstall)
|
||||||
if err != nil {
|
go func() {
|
||||||
return handleErr(appInstall, err, out)
|
dockerComposePath := appInstall.GetComposePath()
|
||||||
}
|
out, err := compose.Down(dockerComposePath)
|
||||||
out, err = compose.Up(dockerComposePath)
|
if err != nil {
|
||||||
if err != nil {
|
_ = handleErr(appInstall, err, out)
|
||||||
return handleErr(appInstall, err, out)
|
return
|
||||||
}
|
}
|
||||||
return syncById(appInstall.ID)
|
out, err = compose.Up(dockerComposePath)
|
||||||
|
if err != nil {
|
||||||
|
_ = handleErr(appInstall, err, out)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
appInstall.Status = constant.Running
|
||||||
|
_ = appInstallRepo.Save(context.Background(), &appInstall)
|
||||||
|
}()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getAppDetails(details []model.AppDetail, versions []dto.AppConfigVersion) map[string]model.AppDetail {
|
func getAppDetails(details []model.AppDetail, versions []dto.AppConfigVersion) map[string]model.AppDetail {
|
||||||
|
@ -12,6 +12,7 @@ const (
|
|||||||
Upgrading = "Upgrading"
|
Upgrading = "Upgrading"
|
||||||
UpgradeErr = "UpgradeErr"
|
UpgradeErr = "UpgradeErr"
|
||||||
PullErr = "PullErr"
|
PullErr = "PullErr"
|
||||||
|
Rebuilding = "Rebuilding"
|
||||||
|
|
||||||
ContainerPrefix = "1Panel-"
|
ContainerPrefix = "1Panel-"
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ const getType = (status: string) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadingStatus = ['installing', 'building', 'restarting', 'upgrading'];
|
const loadingStatus = ['installing', 'building', 'restarting', 'upgrading', 'rebuilding'];
|
||||||
|
|
||||||
const loadingIcon = (status: string): boolean => {
|
const loadingIcon = (status: string): boolean => {
|
||||||
return loadingStatus.indexOf(status) > -1;
|
return loadingStatus.indexOf(status) > -1;
|
||||||
|
@ -221,6 +221,7 @@ const message = {
|
|||||||
upgrading: 'Upgrading',
|
upgrading: 'Upgrading',
|
||||||
upgradeerr: 'Upgrade Error',
|
upgradeerr: 'Upgrade Error',
|
||||||
pullerr: 'Pull Image Error',
|
pullerr: 'Pull Image Error',
|
||||||
|
rebuilding: '重建中',
|
||||||
},
|
},
|
||||||
units: {
|
units: {
|
||||||
second: 'Second',
|
second: 'Second',
|
||||||
|
@ -219,6 +219,7 @@ const message = {
|
|||||||
upgrading: '升級中',
|
upgrading: '升級中',
|
||||||
upgradeerr: '升級失敗',
|
upgradeerr: '升級失敗',
|
||||||
pullerr: '鏡像拉取失敗',
|
pullerr: '鏡像拉取失敗',
|
||||||
|
rebuilding: '重建中',
|
||||||
},
|
},
|
||||||
units: {
|
units: {
|
||||||
second: '秒',
|
second: '秒',
|
||||||
|
@ -219,6 +219,7 @@ const message = {
|
|||||||
upgrading: '升级中',
|
upgrading: '升级中',
|
||||||
upgradeerr: '升级失败',
|
upgradeerr: '升级失败',
|
||||||
pullerr: '镜像拉取失败',
|
pullerr: '镜像拉取失败',
|
||||||
|
rebuilding: '重建中',
|
||||||
},
|
},
|
||||||
units: {
|
units: {
|
||||||
second: '秒',
|
second: '秒',
|
||||||
|
@ -430,7 +430,7 @@ const buttons = [
|
|||||||
openOperate(row, 'sync');
|
openOperate(row, 'sync');
|
||||||
},
|
},
|
||||||
disabled: (row: any) => {
|
disabled: (row: any) => {
|
||||||
return row.status === 'DownloadErr' || row.status === 'Upgrading';
|
return row.status === 'DownloadErr' || row.status === 'Upgrading' || row.status === 'Rebuilding';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -439,7 +439,7 @@ const buttons = [
|
|||||||
openOperate(row, 'rebuild');
|
openOperate(row, 'rebuild');
|
||||||
},
|
},
|
||||||
disabled: (row: any) => {
|
disabled: (row: any) => {
|
||||||
return row.status === 'DownloadErr' || row.status === 'Upgrading';
|
return row.status === 'DownloadErr' || row.status === 'Upgrading' || row.status === 'Rebuilding';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -448,7 +448,7 @@ const buttons = [
|
|||||||
openOperate(row, 'restart');
|
openOperate(row, 'restart');
|
||||||
},
|
},
|
||||||
disabled: (row: any) => {
|
disabled: (row: any) => {
|
||||||
return row.status === 'DownloadErr' || row.status === 'Upgrading';
|
return row.status === 'DownloadErr' || row.status === 'Upgrading' || row.status === 'Rebuilding';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -461,7 +461,8 @@ const buttons = [
|
|||||||
row.status === 'Running' ||
|
row.status === 'Running' ||
|
||||||
row.status === 'Error' ||
|
row.status === 'Error' ||
|
||||||
row.status === 'DownloadErr' ||
|
row.status === 'DownloadErr' ||
|
||||||
row.status === 'Upgrading'
|
row.status === 'Upgrading' ||
|
||||||
|
row.status === 'Rebuilding'
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -471,7 +472,12 @@ const buttons = [
|
|||||||
openOperate(row, 'stop');
|
openOperate(row, 'stop');
|
||||||
},
|
},
|
||||||
disabled: (row: any) => {
|
disabled: (row: any) => {
|
||||||
return row.status !== 'Running' || row.status === 'DownloadErr' || row.status === 'Upgrading';
|
return (
|
||||||
|
row.status !== 'Running' ||
|
||||||
|
row.status === 'DownloadErr' ||
|
||||||
|
row.status === 'Upgrading' ||
|
||||||
|
row.status === 'Rebuilding'
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -486,7 +492,7 @@ const buttons = [
|
|||||||
openParam(row);
|
openParam(row);
|
||||||
},
|
},
|
||||||
disabled: (row: any) => {
|
disabled: (row: any) => {
|
||||||
return row.status === 'DownloadErr' || row.status === 'Upgrading';
|
return row.status === 'DownloadErr' || row.status === 'Upgrading' || row.status === 'Rebuilding';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user