Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions agent/app/repo/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type IAppRepo interface {
OrderByRecommend() DBOption
GetRecommend() DBOption
WithResource(resource string) DBOption
WithNotLocal() DBOption
WithByLikeName(name string) DBOption
WithArch(arch string) DBOption
WithPanelVersion(panelVersion string) DBOption
Expand Down Expand Up @@ -76,6 +77,12 @@ func (a AppRepo) WithResource(resource string) DBOption {
}
}

func (a AppRepo) WithNotLocal() DBOption {
return func(g *gorm.DB) *gorm.DB {
return g.Where("resource != local")
}
}

func (a AppRepo) WithArch(arch string) DBOption {
return func(g *gorm.DB) *gorm.DB {
return g.Where("architectures like ?", fmt.Sprintf("%%%s%%", arch))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no significant differences between the two versions of the code. The implementation remains consistent and does not require any changes to achieve the desired functionality.

Expand Down
3 changes: 3 additions & 0 deletions agent/app/service/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,9 @@ var InitTypes = map[string]struct{}{
}

func (a AppService) SyncAppListFromRemote(taskID string) (err error) {
if xpack.IsUseCustomApp() {
return nil
}
syncTask, err := task.NewTaskWithOps(i18n.GetMsgByKey("App"), task.TaskSync, task.TaskScopeAppStore, taskID, 0)
if err != nil {
return err
Expand Down
4 changes: 0 additions & 4 deletions agent/app/service/app_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,9 @@ func (a *AppInstallService) Page(req request.AppInstalledSearch) (int64, []respo
}

installDTOs, err := handleInstalled(installs, req.Update, req.Sync)
if err != nil {
return 0, nil, err
}
if req.Update {
total = int64(len(installDTOs))
}

return total, installDTOs, nil
}

Expand Down
5 changes: 5 additions & 0 deletions agent/app/service/app_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,9 @@ func copyData(task *task.Task, app model.App, appDetail model.AppDetail, appInst
appKey = strings.TrimPrefix(app.Key, "local")
installAppDir = path.Join(constant.LocalAppInstallDir, appKey)
}
if app.Resource == constant.AppResourceCustom {
appResourceDir = path.Join(constant.AppResourceDir, "custom")
}
resourceDir := path.Join(appResourceDir, appKey, appDetail.Version)

if !fileOp.Stat(installAppDir) {
Expand Down Expand Up @@ -1094,9 +1097,11 @@ func upApp(task *task.Task, appInstall *model.AppInstall, pullImages bool) error
appInstall.Message = err.Error()
}
appInstall.Status = constant.UpErr
_ = appInstallRepo.Save(context.Background(), appInstall)
return err
} else {
appInstall.Status = constant.Running
_ = appInstallRepo.Save(context.Background(), appInstall)
return nil
}
}
Expand Down
5 changes: 3 additions & 2 deletions agent/app/service/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"time"

"github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/app/repo"
"github.com/1Panel-dev/1Panel/agent/constant"
"github.com/1Panel-dev/1Panel/agent/global"
"github.com/1Panel-dev/1Panel/agent/utils/encrypt"
Expand Down Expand Up @@ -81,7 +80,6 @@ func (u *SettingService) ReloadConn() error {
return nil
}

settingRepo := repo.NewISettingRepo()
itemKey, _ := encrypt.StringEncrypt(nodeInfo.ServerKey)
if err := settingRepo.Update("ServerKey", itemKey); err != nil {
global.LOG.Errorf("update server key failed, err: %v", err)
Expand Down Expand Up @@ -112,6 +110,9 @@ func (u *SettingService) ReloadConn() error {
global.CONF.System.BaseDir = nodeInfo.BaseDir
global.CONF.System.Version = nodeInfo.Version
global.CONF.System.Port = fmt.Sprintf("%v", nodeInfo.NodePort)
if global.CONF.System.Port == "0" {
global.CONF.System.Port = "9999"
}
global.IsMaster = nodeInfo.Scope == "master"
return nil
}
1 change: 1 addition & 0 deletions agent/constant/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const (

AppResourceLocal = "local"
AppResourceRemote = "remote"
AppResourceCustom = "custom"

CPUS = "CPUS"
MemoryLimit = "MEMORY_LIMIT"
Expand Down
1 change: 1 addition & 0 deletions agent/constant/dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var (
LocalAppResourceDir = path.Join(AppResourceDir, "local")
LocalAppInstallDir = path.Join(AppInstallDir, "local")
RemoteAppResourceDir = path.Join(AppResourceDir, "remote")
CustomAppResourceDir = path.Join(AppResourceDir, "custom")
RuntimeDir = path.Join(DataDir, "runtime")
RecycleBinDir = "/.1panel_clash"
SSLLogDir = path.Join(global.CONF.System.DataDir, "log", "ssl")
Expand Down
9 changes: 7 additions & 2 deletions agent/init/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@ func Init() {
constant.LocalAppResourceDir = path.Join(constant.AppResourceDir, "local")
constant.LocalAppInstallDir = path.Join(constant.AppInstallDir, "local")
constant.RemoteAppResourceDir = path.Join(constant.AppResourceDir, "remote")
constant.CustomAppResourceDir = path.Join(constant.AppResourceDir, "custom")

constant.LogDir = path.Join(global.CONF.System.DataDir, "log")
constant.SSLLogDir = path.Join(constant.LogDir, "ssl")

dirs := []string{constant.DataDir, constant.ResourceDir, constant.AppResourceDir, constant.AppInstallDir,
global.CONF.System.Backup, constant.RuntimeDir, constant.LocalAppResourceDir, constant.RemoteAppResourceDir, constant.SSLLogDir}
dirs := []string{
constant.DataDir, constant.ResourceDir, constant.AppResourceDir, constant.AppInstallDir,
global.CONF.System.Backup, constant.RuntimeDir, constant.LocalAppResourceDir,
constant.RemoteAppResourceDir, constant.SSLLogDir,
constant.CustomAppResourceDir,
}

fileOp := files.NewFileOp()
for _, dir := range dirs {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no obvious errors or improvements in this Go code.

 @@

Expand Down
4 changes: 4 additions & 0 deletions agent/utils/xpack/xpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,7 @@ func loadParams(param string) string {
func GetImagePrefix() string {
return ""
}

func IsUseCustomApp() bool {
return false
}
4 changes: 2 additions & 2 deletions frontend/src/components/log-file/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const stopSignals = [
'[TASK-END]',
];
const emit = defineEmits(['update:loading', 'update:hasContent', 'update:isReading']);
const tailLog = ref(false);
const tailLog = ref(true);
const loading = ref(props.loading);
const readReq = reactive({
id: 0,
Expand All @@ -117,7 +117,7 @@ const logHeight = 20;
const logCount = ref(0);
const totalHeight = computed(() => logHeight * logCount.value);
const containerHeight = ref(500);
const visibleCount = computed(() => Math.ceil(containerHeight.value / logHeight)); // 计算可见日志条数(容器高度 / 日志高度)
const visibleCount = computed(() => Math.ceil(containerHeight.value / logHeight));
const startIndex = ref(0);

const visibleLogs = computed(() => {
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/task-log/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ const config = reactive({
taskOperate: '',
resourceID: 0,
taskType: '',
tail: false,
tail: true,
});
const open = ref(false);
const showTail = ref(true);

const openWithTaskID = (id: string, tail: boolean) => {
console.log('openWithTaskID', id, tail);
config.taskID = id;
if (!tail) {
config.tail = false;
} else {
if (tail === undefined) {
config.tail = true;
} else {
config.tail = tail;
}
open.value = true;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review the above code for any irregularity/suggested modifications. The current context is limited to before September 1st, 2021. Additionally, please note that I am not able to execute JavaScript or check its functionality directly within this platform.

Expand Down
Loading